Documentation ¶
Index ¶
- func GetTickerCurrentPrice(ctx context.Context, apiKey, ticker string) (float64, error)
- func GetTickerYesterdaysClose(ctx context.Context, apiKey, ticker string) (float64, error)
- type APIResponse
- type Aggregate
- type AggsResponse
- type Client
- func (c *Client) AddTickerToUpdates(tickers []string) error
- func (c *Client) GetTickerTodayAggs(ctx context.Context, t time.Time, ticker string, rangeSize int) (results []*models.Agg, err error)
- func (c *Client) ListenForTickerUpdates(ctx context.Context, tickers []string) error
- func (c *Client) LoadTickerData(ctx context.Context, tickerSymbol string) (*models.Ticker, error)
- type Company
- type CompanyDetails
- type LastTrade
- type Trade
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTickerCurrentPrice ¶
func GetTickerYesterdaysClose ¶
GetTickerYesterdaysClose is the previous days close price. Takes into account weekends, holidays. This should always return a price for a ticker if it has ever traded previously.
Types ¶
type APIResponse ¶
type Aggregate ¶
type Aggregate struct { Ticker string `json:"T"` Timestamp int64 `json:"t"` Volume float64 `json:"v"` Close float64 `json:"c"` Open float64 `json:"o"` High float64 `json:"h"` Low float64 `json:"l"` }
Aggregate is a rollup of trades for a specified time window.
type AggsResponse ¶
type AggsResponse struct { APIResponse Results []*Aggregate `json:"results"` }
AggsResponse contains multiple Aggregates in the results block.
type Client ¶
type Client struct { APIKey string PriceUpdates chan *models.PriceUpdate // contains filtered or unexported fields }
func (*Client) AddTickerToUpdates ¶
AddTickerToUpdates sends a subscribe message to the given tickers.
func (*Client) GetTickerTodayAggs ¶
func (*Client) ListenForTickerUpdates ¶
ListenForTickerUpdates listens for trades on the given tickers. This will get propogated via the client.PriceUpdates channel.
type Company ¶
type Company struct { CompanyName string `json:"name"` }
Company is the meta data about a company.
type CompanyDetails ¶
type CompanyDetails struct { APIResponse Results Company `json:"results"` }
CompanyDetails returns the meta data about this company.
type LastTrade ¶
type LastTrade struct { APIResponse Results Trade `json:"results"` }
LastTrade is the last trade that has occurred for this ticker.