Versions in this module Expand all Collapse all v1 v1.2.0 Mar 30, 2026 Changes in this version + const StrategyExponential + const StrategyLinear + var ErrAlreadyConnected = errors.New("already connected") + var ErrAlreadySubscribed = errors.New("already subscribed to ticker") + var ErrNotConnected = errors.New("websocket not connected") + func ParseMessage(rawMsg []byte) (interface{}, error) + type CryptoPrice struct + BaseCurrency string + Close float64 + Date Time + Exchange string + High float64 + Low float64 + Open float64 + QuoteCurrency string + Ticker string + TradesDone int + Volume float64 + VolumeNotional float64 + type CryptoPricesOptions struct + ConsolidatedBaseCurrency bool + ConvertCurrency string + EndDate string + Exchanges string + ResampleFreq string + StartDate string + Tickers string + type CryptoQuote struct + AskPrice float64 + AskSize float64 + BidPrice float64 + BidSize float64 + Date time.Time + Exchange string + MidPrice float64 + Ticker string + UpdateType string + func ParseCryptoQuote(data []interface{}) (*CryptoQuote, error) + type CryptoTrade struct + Date time.Time + Exchange string + LastPrice float64 + LastSize float64 + Ticker string + UpdateType string + func ParseCryptoTrade(data []interface{}) (*CryptoTrade, error) + type EndOfDayPricesOptions struct + Columns string + EndDate string + Format string + ResampleFreq string + Sort string + StartDate string + type EndpointType string + const EndpointTypeCrypto + const EndpointTypeForex + const EndpointTypeIEX + type ForexPricesOptions struct + EndDate string + ResampleFreq string + StartDate string + type ForexQuote struct + AskPrice float64 + AskSize float64 + BidPrice float64 + BidSize float64 + Date time.Time + MidPrice float64 + Ticker string + UpdateType string + func ParseForexQuote(data []interface{}) (*ForexQuote, error) + type FundamentalsDailyOptions struct + EndDate string + Format string + StartDate string + type FundamentalsStatement struct + DataCode map[string]float64 + Date Time + Quarter int + StatementType string + Ticker string + Year int + type FundamentalsStatementsOptions struct + AsReported bool + EndDate string + Format string + StartDate string + type IEXPrice struct + AskPrice float64 + AskSize float64 + BidPrice float64 + BidSize float64 + High float64 + Last float64 + LastSaleTimestamp Time + LastSize float64 + Low float64 + Mid float64 + Open float64 + PrevClose float64 + QuoteTimestamp Time + Ticker string + Timestamp Time + Volume float64 + type IEXQuote struct + AfterHours int32 + AskPrice *float64 + AskSize *int32 + BidPrice *float64 + BidSize *int32 + Date time.Time + Halted int32 + IntermarketSweep *int32 + LastPrice *float64 + LastSize *int32 + MidPrice *float64 + NMSRule611 *int32 + Nanoseconds int64 + Oddlot *int32 + Ticker string + UpdateType string + func ParseIEXQuote(data []interface{}) (*IEXQuote, error) + type IEXRealTimePricesOptions struct + AfterHours bool + Columns string + ForceFill bool + IncludeRawExchangeData bool + ResampleFreq string + Tickers string + type IEXTrade struct + AfterHours int32 + AskPrice *float64 + AskSize *int32 + BidPrice *float64 + BidSize *int32 + Date time.Time + Halted int32 + IntermarketSweep int32 + LastPrice *float64 + LastSize *int32 + MidPrice *float64 + NMSRule611 int32 + Nanoseconds int64 + Oddlot int32 + Ticker string + UpdateType string + func ParseIEXTrade(data []interface{}) (*IEXTrade, error) + type IEXWebSocketData struct + AskPrice float64 + AskSize float64 + BidPrice float64 + BidSize float64 + Last float64 + LastSize float64 + Ticker string + Timestamp Time + TngoLast float64 + type NewsFeedOptions struct + EndDate string + Limit int + Offset int + SortBy string + Sources string + StartDate string + Tags string + Tickers string + type NewsItem struct + CrawlDate Time + Description string + ID int64 + PublishedDate Time + Source string + Tags []string + Tickers []string + Title string + URL string + type Option func(*WebsocketClient) + func WithLivenessCheck(interval time.Duration) Option + func WithLivenessTimeout(timeout time.Duration) Option + func WithThresholdLevel(level int) Option + type PriceData struct + AdjClose float64 + AdjHigh float64 + AdjLow float64 + AdjOpen float64 + AdjVolume float64 + Close float64 + Date Time + DivCash float64 + High float64 + Low float64 + Open float64 + SplitFactor float64 + Volume float64 + type RawMessage struct + Data []interface{} + MessageType string + Service string + type Response struct + Code int + Message string + type RestClient struct + func NewRestClient(ctx context.Context, apiKey string, options ...RestOption) (*RestClient, error) + func (c *RestClient) GetCryptoPrices(ctx context.Context, opts *CryptoPricesOptions) ([]*CryptoPrice, error) + func (c *RestClient) GetEndOfDayPrices(ctx context.Context, ticker string, opts *EndOfDayPricesOptions) ([]*PriceData, error) + func (c *RestClient) GetForexPrices(ctx context.Context, ticker string, opts *ForexPricesOptions) ([]*PriceData, error) + func (c *RestClient) GetFundamentalsDaily(ctx context.Context, ticker string, opts *FundamentalsDailyOptions) ([]*FundamentalsStatement, error) + func (c *RestClient) GetFundamentalsStatements(ctx context.Context, ticker string, opts *FundamentalsStatementsOptions) ([]*FundamentalsStatement, error) + func (c *RestClient) GetIEXRealTimePrices(ctx context.Context, opts *IEXRealTimePricesOptions) ([]*IEXPrice, error) + func (c *RestClient) GetNewsFeed(ctx context.Context, opts *NewsFeedOptions) ([]*NewsItem, error) + func (c *RestClient) GetTickerMetadata(ctx context.Context, ticker string) (*TickerMetadata, error) + func (c *RestClient) Search(ctx context.Context, opts *SearchOptions) ([]*SearchResult, error) + type RestConfig struct + BaseURL string + HTTPClient *http.Client + RequestsPerSec int + RetryDelay time.Duration + RetryMax uint32 + RetryPolicy func(resp *http.Response, err error) error + RetryStrategy backoffpolicy.Strategy + Timeout time.Duration + type RestOption func(*RestConfig) + func WithBaseURL(baseURL string) RestOption + func WithHTTPClient(client *http.Client) RestOption + func WithRequestsPerSecond(rps int) RestOption + func WithRetryDelay(delay time.Duration) RestOption + func WithRetryMax(max uint32) RestOption + func WithRetryPolicy(policy func(resp *http.Response, err error) error) RestOption + func WithStrategy(strategy backoffpolicy.Strategy) RestOption + func WithTimeout(timeout time.Duration) RestOption + type SearchOptions struct + Limit int + Query string + type SearchResult struct + AssetType string + Exchange string + Name string + PermaTicker string + Ticker string + type SubscribeRequest struct + Authorization string + EventData map[string]interface{} + EventName string + type SubscriptionConfirmation struct + SubscriptionID int + ThresholdLevel string + Tickers []string + type TickerMetadata struct + Description string + EndDate Time + ExchangeCode string + Name string + StartDate Time + Ticker string + type Time time.Time + func (t *Time) UnmarshalJSON(b []byte) error + type WebSocketMessage struct + Data json.RawMessage + MessageType string + Response *Response + Service string + type WebsocketClient struct + func NewWebsocketClient(apiKey string, endpointType EndpointType, options ...Option) *WebsocketClient + func (c *WebsocketClient) Close() error + func (c *WebsocketClient) Connect(ctx context.Context, onError func(error)) error + func (c *WebsocketClient) Subscribe(ticker string, handler func(message []byte, err error)) error + func (c *WebsocketClient) SubscribeCryptoEndpointWithHandlers(ticker string, cryptoQuoteHandler func(msg *CryptoQuote, err error), ...) error + func (c *WebsocketClient) SubscribeForexEndpointWithHandler(ticker string, forexQuoteHandler func(msg *ForexQuote, err error)) error + func (c *WebsocketClient) SubscribeIEXEndpointWithHandlers(ticker string, iexQuoteHandler func(msg *IEXQuote, err error), ...) error + func (c *WebsocketClient) Unsubscribe(ticker string) error + type WebsocketConfig struct + LivenessCheck time.Duration + LivenessTimeout time.Duration + ThresholdLevel int v1.1.0 Feb 3, 2026 v1.0.0 Jan 26, 2026