Documentation ¶
Index ¶
- Variables
- func GetBarsAsync(symbol string, params GetBarsParams) <-chan BarItem
- func GetCryptoBarsAsync(symbol string, params GetCryptoBarsParams) <-chan CryptoBarItem
- func GetCryptoMultiBars(symbols []string, params GetCryptoBarsParams) (map[string][]CryptoBar, error)
- func GetCryptoMultiBarsAsync(symbols []string, params GetCryptoBarsParams) <-chan CryptoMultiBarItem
- func GetCryptoQuotesAsync(symbol string, params GetCryptoQuotesParams) <-chan CryptoQuoteItem
- func GetCryptoSnapshots(symbols []string, exchange string) (map[string]CryptoSnapshot, error)
- func GetCryptoTradesAsync(symbol string, params GetCryptoTradesParams) <-chan CryptoTradeItem
- func GetLatestBars(symbols []string) (map[string]Bar, error)
- func GetLatestCryptoBars(symbols []string, exchange string) (map[string]CryptoBar, error)
- func GetLatestCryptoQuotes(symbols []string, exchange string) (map[string]CryptoQuote, error)
- func GetLatestCryptoTrades(symbols []string, exchange string) (map[string]CryptoTrade, error)
- func GetLatestCryptoXBBOs(symbols []string, exchanges []string) (map[string]CryptoXBBO, error)
- func GetLatestQuotes(symbols []string) (map[string]Quote, error)
- func GetLatestTrades(symbols []string) (map[string]Trade, error)
- func GetMultiBars(symbols []string, params GetBarsParams) (map[string][]Bar, error)
- func GetMultiBarsAsync(symbols []string, params GetBarsParams) <-chan MultiBarItem
- func GetMultiQuotes(symbols []string, params GetQuotesParams) (map[string][]Quote, error)
- func GetMultiQuotesAsync(symbols []string, params GetQuotesParams) <-chan MultiQuoteItem
- func GetMultiTrades(symbols []string, params GetTradesParams) (map[string][]Trade, error)
- func GetMultiTradesAsync(symbols []string, params GetTradesParams) <-chan MultiTradeItem
- func GetQuotesAsync(symbol string, params GetQuotesParams) <-chan QuoteItem
- func GetSnapshots(symbols []string) (map[string]*Snapshot, error)
- func GetTradesAsync(symbol string, params GetTradesParams) <-chan TradeItem
- type APIError
- type Adjustment
- type Bar
- type BarItem
- type Client
- type ClientOpts
- type CryptoBar
- type CryptoBarItem
- type CryptoMultiBarItem
- type CryptoQuote
- type CryptoQuoteItem
- type CryptoSnapshot
- type CryptoSnapshots
- type CryptoTrade
- type CryptoTradeItem
- type CryptoXBBO
- type GetBarsParams
- type GetCryptoBarsParams
- type GetCryptoQuotesParams
- type GetCryptoTradesParams
- type GetNewsParams
- type GetQuotesParams
- type GetTradesParams
- type MultiBarItem
- type MultiQuoteItem
- type MultiTradeItem
- type News
- type NewsImage
- type Quote
- type QuoteItem
- type Snapshot
- type Sort
- type TimeFrame
- type TimeFrameUnit
- type Trade
- type TradeItem
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = NewClient(ClientOpts{})
DefaultClient uses options from environment variables, or the defaults.
Functions ¶
func GetBarsAsync ¶
func GetBarsAsync(symbol string, params GetBarsParams) <-chan BarItem
GetBarsAsync returns a channel that will be populated with the bars for the given symbol.
func GetCryptoBarsAsync ¶
func GetCryptoBarsAsync(symbol string, params GetCryptoBarsParams) <-chan CryptoBarItem
GetCryptoBarsAsync returns a channel that will be populated with the bars for the given crypto symbol.
func GetCryptoMultiBars ¶
func GetCryptoMultiBars(symbols []string, params GetCryptoBarsParams) (map[string][]CryptoBar, error)
GetCryptoMultiBars returns the bars for the given crypto symbols. It blocks until all the bars are collected. If you want to process the incoming bars instantly, use GetCryptoMultiBarsAsync instead!
func GetCryptoMultiBarsAsync ¶
func GetCryptoMultiBarsAsync(symbols []string, params GetCryptoBarsParams) <-chan CryptoMultiBarItem
GetCryptoMultiBarsAsync returns a channel that will be populated with the bars for the given crypto symbols.
func GetCryptoQuotesAsync ¶
func GetCryptoQuotesAsync(symbol string, params GetCryptoQuotesParams) <-chan CryptoQuoteItem
GetCryptoQuotesAsync returns a channel that will be populated with the quotes for the given crypto symbol that happened between the given start and end times, limited to the given limit.
func GetCryptoSnapshots ¶
func GetCryptoSnapshots(symbols []string, exchange string) (map[string]CryptoSnapshot, error)
GetCryptoSnapshots returns the snapshots for the given crypto symbols on the given exchange
func GetCryptoTradesAsync ¶
func GetCryptoTradesAsync(symbol string, params GetCryptoTradesParams) <-chan CryptoTradeItem
GetCryptoQuotesAsync returns a channel that will be populated with the trades for the given crypto symbol that happened between the given start and end times, limited to the given limit.
func GetLatestBars ¶
GetLatestBars returns the latest minute bars for the given symbols.
func GetLatestCryptoBars ¶
GetLatestCryptoBars returns the latest bars for the given crypto symbols on the given exchange
func GetLatestCryptoQuotes ¶
func GetLatestCryptoQuotes(symbols []string, exchange string) (map[string]CryptoQuote, error)
GetLatestCryptoQuotes returns the latest quotes for the given crypto symbols on the given exchange
func GetLatestCryptoTrades ¶
func GetLatestCryptoTrades(symbols []string, exchange string) (map[string]CryptoTrade, error)
GetLatestCryptoTrades returns the latest trades for the given crypto symbols on the given exchange
func GetLatestCryptoXBBOs ¶
func GetLatestCryptoXBBOs(symbols []string, exchanges []string) (map[string]CryptoXBBO, error)
GetLatestCryptoXBBOs returns the latest cross exchange BBOs for the given crypto symbols on the given exchanges
func GetLatestQuotes ¶
GetLatestQuotes returns the latest quotes for the given symbols.
func GetLatestTrades ¶
GetLatestTrades returns the latest trades for the given symbols.
func GetMultiBars ¶
func GetMultiBars(symbols []string, params GetBarsParams) (map[string][]Bar, error)
GetMultiBars returns the bars for the given symbols. It blocks until all the bars are collected. If you want to process the incoming bars instantly, use GetMultiBarsAsync instead!
func GetMultiBarsAsync ¶
func GetMultiBarsAsync(symbols []string, params GetBarsParams) <-chan MultiBarItem
GetMultiBarsAsync returns a channel that will be populated with the bars for the given symbols.
func GetMultiQuotes ¶
func GetMultiQuotes(symbols []string, params GetQuotesParams) (map[string][]Quote, error)
GetMultiQuotes returns the quotes for the given symbols. It blocks until all the quotes are collected. If you want to process the incoming quotes instantly, use GetMultiQuotesAsync instead!
func GetMultiQuotesAsync ¶
func GetMultiQuotesAsync(symbols []string, params GetQuotesParams) <-chan MultiQuoteItem
GetMultiQuotesAsync returns a channel that will be populated with the quotes for the given symbols.
func GetMultiTrades ¶
func GetMultiTrades(symbols []string, params GetTradesParams) (map[string][]Trade, error)
GetMultiTrades returns the trades for the given symbols. It blocks until all the trades are collected. If you want to process the incoming trades instantly, use GetMultiTradesAsync instead!
func GetMultiTradesAsync ¶
func GetMultiTradesAsync(symbols []string, params GetTradesParams) <-chan MultiTradeItem
GetMultiTradesAsync returns a channel that will be populated with the trades for the given symbols.
func GetQuotesAsync ¶
func GetQuotesAsync(symbol string, params GetQuotesParams) <-chan QuoteItem
GetQuotesAsync returns a channel that will be populated with the quotes for the given symbol that happened between the given start and end times, limited to the given limit.
func GetSnapshots ¶
GetSnapshots returns the snapshots for a multiple symbols
func GetTradesAsync ¶
func GetTradesAsync(symbol string, params GetTradesParams) <-chan TradeItem
GetTradesAsync returns a channel that will be populated with the trades for the given symbol that happened between the given start and end times, limited to the given limit.
Types ¶
type APIError ¶
APIError wraps the detailed code and message supplied by Alpaca's API for debugging purposes
type Adjustment ¶
type Adjustment string
Adjustment specifies the corporate action adjustment(s) for the bars
const ( Raw Adjustment = "raw" Split Adjustment = "split" Dividend Adjustment = "dividend" All Adjustment = "all" )
List of adjustments
type Bar ¶
type Bar struct { Timestamp time.Time `json:"t"` Open float64 `json:"o"` High float64 `json:"h"` Low float64 `json:"l"` Close float64 `json:"c"` Volume uint64 `json:"v"` TradeCount uint64 `json:"n"` VWAP float64 `json:"vw"` }
Bar is an aggregate of trades
func GetBars ¶
func GetBars(symbol string, params GetBarsParams) ([]Bar, error)
GetBars returns the bars for the given symbol. It blocks until all the bars are collected. If you want to process the incoming bars instantly, use GetBarsAsync instead!
func GetLatestBar ¶
GetLatestBar returns the latest minute bar for a given symbol.
type Client ¶
type Client interface { GetTrades(symbol string, params GetTradesParams) ([]Trade, error) GetTradesAsync(symbol string, params GetTradesParams) <-chan TradeItem GetMultiTrades(symbols []string, params GetTradesParams) (map[string][]Trade, error) GetMultiTradesAsync(symbols []string, params GetTradesParams) <-chan MultiTradeItem GetQuotes(symbol string, params GetQuotesParams) ([]Quote, error) GetQuotesAsync(symbol string, params GetQuotesParams) <-chan QuoteItem GetMultiQuotes(symbols []string, params GetQuotesParams) (map[string][]Quote, error) GetMultiQuotesAsync(symbols []string, params GetQuotesParams) <-chan MultiQuoteItem GetBars(symbol string, params GetBarsParams) ([]Bar, error) GetBarsAsync(symbol string, params GetBarsParams) <-chan BarItem GetMultiBars(symbols []string, params GetBarsParams) (map[string][]Bar, error) GetMultiBarsAsync(symbols []string, params GetBarsParams) <-chan MultiBarItem GetLatestBar(symbol string) (*Bar, error) GetLatestBars(symbols []string, feed string) (map[string]Bar, error) GetLatestTrade(symbol string) (*Trade, error) GetLatestTrades(symbols []string) (map[string]Trade, error) GetLatestQuote(symbol string) (*Quote, error) GetLatestQuotes(symbols []string) (map[string]Quote, error) GetSnapshot(symbol string) (*Snapshot, error) GetSnapshots(symbols []string) (map[string]*Snapshot, error) GetCryptoTrades(symbol string, params GetCryptoTradesParams) ([]CryptoTrade, error) GetCryptoTradesAsync(symbol string, params GetCryptoTradesParams) <-chan CryptoTradeItem GetCryptoQuotes(symbol string, params GetCryptoQuotesParams) ([]CryptoQuote, error) GetCryptoQuotesAsync(symbol string, params GetCryptoQuotesParams) <-chan CryptoQuoteItem GetCryptoBars(symbol string, params GetCryptoBarsParams) ([]CryptoBar, error) GetCryptoBarsAsync(symbol string, params GetCryptoBarsParams) <-chan CryptoBarItem GetCryptoMultiBars(symbols []string, params GetCryptoBarsParams) (map[string][]CryptoBar, error) GetCryptoMultiBarsAsync(symbols []string, params GetCryptoBarsParams) <-chan CryptoMultiBarItem GetLatestCryptoBar(symbol, exchange string) (*CryptoBar, error) GetLatestCryptoBars(symbols []string, exchange string) (map[string]CryptoBar, error) GetLatestCryptoTrade(symbol, exchange string) (*CryptoTrade, error) GetLatestCryptoTrades(symbols []string, exchange string) (map[string]CryptoTrade, error) GetLatestCryptoQuote(symbol, exchange string) (*CryptoQuote, error) GetLatestCryptoQuotes(symbols []string, exchange string) (map[string]CryptoQuote, error) GetLatestCryptoXBBO(symbol string, exchanges []string) (*CryptoXBBO, error) GetLatestCryptoXBBOs(symbols []string, exchanges []string) (map[string]CryptoXBBO, error) GetCryptoSnapshot(symbol string, exchange string) (*CryptoSnapshot, error) GetCryptoSnapshots(symbols []string, exchange string) (map[string]CryptoSnapshot, error) GetNews(params GetNewsParams) ([]News, error) }
Client is the alpaca marketdata client.
func NewClient ¶
func NewClient(opts ClientOpts) Client
NewClient creates a new marketdata client using the given opts.
type ClientOpts ¶
type ClientOpts struct { ApiKey string ApiSecret string OAuth string BaseURL string // Timeout sets the HTTP timeout for each request. // // Deprecated: use HttpClient with its Timeout set instead. // If both are set, HttpClient has precedence. Timeout time.Duration RetryLimit int RetryDelay time.Duration Feed string // HttpClient to be used for each http request. HttpClient *http.Client }
ClientOpts contains options for the alpaca marketdata client.
Currently it contains the exact same options as the trading alpaca client, but there is no guarantee that this will remain the case.
type CryptoBar ¶
type CryptoBar struct { Timestamp time.Time `json:"t"` Exchange string `json:"x"` Open float64 `json:"o"` High float64 `json:"h"` Low float64 `json:"l"` Close float64 `json:"c"` Volume float64 `json:"v"` TradeCount uint64 `json:"n"` VWAP float64 `json:"vw"` }
CryptoBar is an aggregate of crypto trades
func GetCryptoBars ¶
func GetCryptoBars(symbol string, params GetCryptoBarsParams) ([]CryptoBar, error)
GetCryptoBars returns the bars for the given crypto symbol. It blocks until all the bars are collected. If you want to process the incoming bars instantly, use GetCryptoBarsAsync instead!
func GetLatestCryptoBar ¶
GetLatestCryptoBar returns the latest bar for a given crypto symbol on the given exchange
type CryptoBarItem ¶
CryptoBarItem contains a single crypto bar or an error
type CryptoMultiBarItem ¶
CryptoMultiBarItem contains a single crypto bar for a symbol or an error
type CryptoQuote ¶
type CryptoQuote struct { Timestamp time.Time `json:"t"` Exchange string `json:"x"` BidPrice float64 `json:"bp"` BidSize float64 `json:"bs"` AskPrice float64 `json:"ap"` AskSize float64 `json:"as"` }
CryptoQuote is crypto quote
func GetCryptoQuotes ¶
func GetCryptoQuotes(symbol string, params GetCryptoQuotesParams) ([]CryptoQuote, error)
GetCryptoQuotes returns the quotes for the given crypto symbol. It blocks until all the quotes are collected. If you want to process the incoming quotes instantly, use GetCryptoQuotesAsync instead!
func GetLatestCryptoQuote ¶
func GetLatestCryptoQuote(symbol, exchange string) (*CryptoQuote, error)
GetLatestCryptoQuote returns the latest quote for a given crypto symbol on the given exchange
type CryptoQuoteItem ¶
type CryptoQuoteItem struct { Quote CryptoQuote Error error }
CryptoQuoteItem contains a single crypto quote or an error
type CryptoSnapshot ¶
type CryptoSnapshot struct { LatestTrade *CryptoTrade `json:"latestTrade"` LatestQuote *CryptoQuote `json:"latestQuote"` MinuteBar *CryptoBar `json:"minuteBar"` DailyBar *CryptoBar `json:"dailyBar"` PrevDailyBar *CryptoBar `json:"prevDailyBar"` }
CryptoSnapshot is a snapshot of a crypto symbol
func GetCryptoSnapshot ¶
func GetCryptoSnapshot(symbol string, exchange string) (*CryptoSnapshot, error)
GetCryptoSnapshot returns the snapshot for a given crypto symbol on the given exchange
type CryptoSnapshots ¶
type CryptoSnapshots struct {
Snapshots map[string]CryptoSnapshot `json:"snapshots"`
}
CryptoSnapshots is the snapshots for multiple crypto symbols
type CryptoTrade ¶
type CryptoTrade struct { Timestamp time.Time `json:"t"` Price float64 `json:"p"` Size float64 `json:"s"` Exchange string `json:"x"` ID int64 `json:"i"` // TakerSide is the side of the taker of the trade. It is either "B" (buy), "S" (sell) or "-" (unspecified) TakerSide string `json:"tks"` }
CryptoTrade is a crypto trade
func GetCryptoTrades ¶
func GetCryptoTrades(symbol string, params GetCryptoTradesParams) ([]CryptoTrade, error)
GetCryptoTrades returns the trades for the given crypto symbol. It blocks until all the trades are collected. If you want to process the incoming trades instantly, use GetCryptoTradesAsync instead!
func GetLatestCryptoTrade ¶
func GetLatestCryptoTrade(symbol, exchange string) (*CryptoTrade, error)
GetLatestCryptoTrade returns the latest trade for a given crypto symbol on the given exchange
type CryptoTradeItem ¶
type CryptoTradeItem struct { Trade CryptoTrade Error error }
type CryptoXBBO ¶
type CryptoXBBO struct { Timestamp time.Time `json:"t"` BidExchange string `json:"bx"` BidPrice float64 `json:"bp"` BidSize float64 `json:"bs"` AskExchange string `json:"ax"` AskPrice float64 `json:"ap"` AskSize float64 `json:"as"` }
CryptoXBBO is a cross exchange crypto BBO
func GetLatestCryptoXBBO ¶
func GetLatestCryptoXBBO(symbol string, exchanges []string) (*CryptoXBBO, error)
GetLatestCryptoXBBO returns the latest cross exchange BBO for a given crypto symbol on the given exchanges
type GetBarsParams ¶
type GetBarsParams struct { // TimeFrame is the aggregation size of the bars TimeFrame TimeFrame // Adjustment tells if the bars should be adjusted for corporate actions Adjustment Adjustment // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned bars. // If missing, all bars between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Feed is the source of the data: sip or iex. // If provided, it overrides the client's Feed option. Feed string // AsOf defines the date when the symbols are mapped. "-" means no mapping. AsOf string }
GetBarsParams contains optional parameters for getting bars
type GetCryptoBarsParams ¶
type GetCryptoBarsParams struct { // TimeFrame is the aggregation size of the bars TimeFrame TimeFrame // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned bars. // If missing, all bars between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Exchanges is the list of exchanges to query. If empty, the default exchanges will be used. Exchanges []string }
GetCryptoBarsParams contains optional parameters for getting crypto bars
type GetCryptoQuotesParams ¶
type GetCryptoQuotesParams struct { // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned quotes. // If missing, all quotes between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Exchanges is the list of exchanges to query. If empty, the default exchanges will be used. Exchanges []string }
GetCryptoQuotesParams contains optional parameters for getting crypto quotes
type GetCryptoTradesParams ¶
type GetCryptoTradesParams struct { // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned trades. // If missing, all trades between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Exchanges is the list of exchanges to query. If empty, the default exchanges will be used. Exchanges []string }
GetCryptoTradesParams contains optional parameters for getting crypto trades
type GetNewsParams ¶
type GetNewsParams struct { // Symbols filters the news to the related symbols. // If empty or nil, all articles will be returned. Symbols []string // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // Sort sets the sort order of the results. Sorting will be done by the UpdatedAt field. Sort Sort // IncludeContent tells the server to include the article content in the response. IncludeContent bool // ExcludeContentless tells the server to exclude articles that have no content. ExcludeContentless bool // TotalLimit is the limit of the total number of the returned news. // // If it's non-zero, NoTotalLimit must be false, otherwise an error well be returned. // If it's zero then the NoTotalLimit parameter is considered: if NoTotalLimit is true, // then all the articles in the given start-end interval are returned. // If NoTotalLimit is false, then 50 articles will be returned. // // The reason for this complication is that the default (empty GetNewsParams) would // not return all the news articles. TotalLimit int // NoTotalLimit means all news articles will be returned from the given start-end interval. // // TotalLimit must be set to 0 if NoTotalLimit is true, otherwise an error well be returned. NoTotalLimit bool // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int }
GetNewsParams contains optional parameters for getting news articles.
type GetQuotesParams ¶
type GetQuotesParams struct { // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned quotes. // If missing, all quotes between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Feed is the source of the data: sip or iex. Feed string // AsOf defines the date when the symbols are mapped. "-" means no mapping. AsOf string }
GetQuotesParams contains optional parameters for getting quotes
type GetTradesParams ¶
type GetTradesParams struct { // Start is the inclusive beginning of the interval Start time.Time // End is the inclusive end of the interval End time.Time // TotalLimit is the limit of the total number of the returned trades. // If missing, all trades between start end end will be returned. TotalLimit int // PageLimit is the pagination size. If empty, the default page size will be used. PageLimit int // Feed is the source of the data: sip or iex. Feed string // AsOf defines the date when the symbols are mapped. "-" means no mapping. AsOf string }
GetTradesParams contains optional parameters for getting trades.
type MultiBarItem ¶
MultiBarItem contains a single bar for a symbol or an error
type MultiQuoteItem ¶
MultiQuoteItem contains a single quote for a symbol or an error
type MultiTradeItem ¶
MultiTradeItem contains a single trade for a symbol or an error
type News ¶
type News struct { ID int `json:"id"` Author string `json:"author"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Headline string `json:"headline"` Summary string `json:"summary"` Content string `json:"content"` Images []NewsImage `json:"images"` URL string `json:"url"` Symbols []string `json:"symbols"` }
News is a single news article.
func GetNews ¶
func GetNews(params GetNewsParams) ([]News, error)
GetNews returns the news articles based on the given params.
type Quote ¶
type Quote struct { Timestamp time.Time `json:"t"` BidPrice float64 `json:"bp"` BidSize uint32 `json:"bs"` BidExchange string `json:"bx"` AskPrice float64 `json:"ap"` AskSize uint32 `json:"as"` AskExchange string `json:"ax"` Conditions []string `json:"c"` Tape string `json:"z"` }
Quote is a stock quote from the market
func GetLatestQuote ¶
GetLatestQuote returns the latest quote for a given symbol.
type Snapshot ¶
type Snapshot struct { LatestTrade *Trade `json:"latestTrade"` LatestQuote *Quote `json:"latestQuote"` MinuteBar *Bar `json:"minuteBar"` DailyBar *Bar `json:"dailyBar"` PrevDailyBar *Bar `json:"prevDailyBar"` }
Snapshot is a snapshot of a symbol
func GetSnapshot ¶
GetSnapshot returns the snapshot for a given symbol
type TimeFrame ¶
type TimeFrame struct { N int Unit TimeFrameUnit }
TimeFrame is the resolution of the bars
var ( OneMin TimeFrame = NewTimeFrame(1, Min) OneHour TimeFrame = NewTimeFrame(1, Hour) OneDay TimeFrame = NewTimeFrame(1, Day) OneWeek TimeFrame = NewTimeFrame(1, Week) OneMonth TimeFrame = NewTimeFrame(1, Month) )
func NewTimeFrame ¶
func NewTimeFrame(n int, unit TimeFrameUnit) TimeFrame
type TimeFrameUnit ¶
type TimeFrameUnit string
TimeFrameUnite is the base unit of the timeframe.
const ( Min TimeFrameUnit = "Min" Hour TimeFrameUnit = "Hour" Day TimeFrameUnit = "Day" Week TimeFrameUnit = "Week" Month TimeFrameUnit = "Month" )
List of timeframe units
type Trade ¶
type Trade struct { Timestamp time.Time `json:"t"` Price float64 `json:"p"` Size uint32 `json:"s"` Exchange string `json:"x"` ID int64 `json:"i"` Conditions []string `json:"c"` Tape string `json:"z"` }
Trade is a stock trade that happened on the market
func GetLatestTrade ¶
GetLatestTrade returns the latest trade for a given symbol.