api

package
v4.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateToMinute

type AggregateToMinute struct {

	// symbol
	Symbol string `json:"T"`
	// volume (shares)
	Volume uint64 `json:"v"`

	// VWAP (Volume Weighted Average Price)
	VWAP float64 `json:"vw"`
	// open price of the bar
	Open float64 `json:"o"`
	// close price of the bar
	Close float64 `json:"c"`
	// high price of the bar
	High float64 `json:"h"`
	// low price of the bar
	Low float64 `json:"l"`
	// average price of the bar
	Average float64 `json:"a"`
	// epoch time at the beginning of the window in milliseconds
	EpochMillis int64 `json:"s"`
	// epoch time at the ending of the window in milliseconds
	EndTime int64 `json:"e"`
	// contains filtered or unexported fields
}

AggregateToMinute is a minute aggregate

type AlpacaAggregateToMinute

type AlpacaAggregateToMinute struct {
	Data AggregateToMinute `json:"data"`
}

AlpacaAggregateToMinute is the message from Alpaca that contains the minute aggregate

type AlpacaMessage

type AlpacaMessage struct {
	Data Message `json:"data"`
}

type AlpacaQuote

type AlpacaQuote struct {
	Data Quote `json:"data"`
}

AlpacaQuote is the message from Alpaca that contains the quote

type AlpacaTrade

type AlpacaTrade struct {
	Data Trade `json:"data"`
}

AlpacaTrade is the message from Alpaca that contains the trade

type AlpacaWebSocket

type AlpacaWebSocket struct {
	// contains filtered or unexported fields
}

func NewAlpacaWebSocket

func NewAlpacaWebSocket(config config.Config, oChan chan<- interface{}) *AlpacaWebSocket

type Message

type Message struct {
	EventType enums.Prefix `json:"ev"`
}

type Quote

type Quote struct {

	// symbol
	Symbol string `json:"T"`
	// exchange code for bid quote
	BidExchange int `json:"x"`
	// bid price
	BidPrice float64 `json:"p"`
	// bid size
	BidSize int `json:"s"`
	// exchange code for ask quote
	AskExchange int `json:"X"`
	// ask price
	AskPrice float64 `json:"P"`
	// ask size
	AskSize int `json:"S"`
	// condition flags.
	// NOTE: always has len = 1
	Conditions []int `json:"c"`
	// epoch timestamp in nanoseconds
	Timestamp int64 `json:"t"`
	// contains filtered or unexported fields
}

Quote is a quote

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func NewSubscription

func NewSubscription(config config.Config) (s *Subscription)

NewSubscription creates and initializes a Subscription that is ready to use.

func (*Subscription) Start

func (s *Subscription) Start(handler func(msg []byte))

Start establishes a websocket connection and starts processing messages using handler. Subsequent calls are no-ops.

type Trade

type Trade struct {

	// symbol
	Symbol string `json:"T"`

	// exchange code where the trade occurred
	Exchange int `json:"x"`
	// trade price
	Price float64 `json:"p"`
	// trade size (shares)
	Size int `json:"s"`
	// epoch timestamp in nanoseconds
	Timestamp int64 `json:"t"`
	// condition flags
	Conditions []int `json:"c"`
	// tape ID
	TapeID int `json:"z"`
	// contains filtered or unexported fields
}

Trade is a trade

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL