Documentation
¶
Index ¶
- Constants
- func CryptoMetadataUrl(ticker []string) string
- func CryptoPriceUrl(ticker []string, queryParams *CryptoPriceParams) string
- func DailyFundamentalUrl(ticker string, queryParams *DailyFundamentalParams) string
- func EodMetadataUrl(ticker string) string
- func EodPriceUrl(ticker string, queryParams *EodPriceParams) string
- func FundamentalMetadataUrl(queryParams *FundamentalMetadataParams) string
- func IexHistoryUrl(ticker string, queryParams *IexHistoryParams) string
- func IexTopOfBookUrl(queryParams *IexTopOfBookParams) string
- func Parse[T any](rawBytes []byte, format Format) (T, error)
- func SearchUrl(query string, queryParams *SearchParams) string
- func StmtDataUrl(ticker string, queryParams *StmtDataParams) string
- func StmtDefsUrl(queryParams *StmtDefsParams) string
- func WithHttpClient(client *http.Client) func(*Client)
- func WithLogger(l *slog.Logger) func(*Client)
- func WithRateLimiter(l RateLimiter) func(*Client)
- type Client
- func (c *Client) CryptoMetadata(ctx context.Context, ticker []string) (CryptoMetadata, error)
- func (c *Client) CryptoMetadataRaw(ctx context.Context, ticker []string) ([]byte, error)
- func (c *Client) CryptoPrice(ctx context.Context, ticker []string, queryParams *CryptoPriceParams) ([]CryptoResult, error)
- func (c *Client) CryptoPriceRaw(ctx context.Context, ticker []string, queryParams *CryptoPriceParams) ([]byte, error)
- func (c *Client) DailyFundamental(ctx context.Context, ticker string, queryParams *DailyFundamentalParams) ([]DailyFundamental, error)
- func (c *Client) DailyFundamentalRaw(ctx context.Context, ticker string, queryParams *DailyFundamentalParams) ([]byte, error)
- func (c *Client) DefaultSymbolList(ctx context.Context) ([]byte, error)
- func (c *Client) EodMetadata(ctx context.Context, ticker string) (EodMetadata, error)
- func (c *Client) EodMetadataRaw(ctx context.Context, ticker string) ([]byte, error)
- func (c *Client) EodPrice(ctx context.Context, ticker string, queryParams *EodPriceParams) ([]EodPrice, error)
- func (c *Client) EodPriceRaw(ctx context.Context, ticker string, queryParams *EodPriceParams) ([]byte, error)
- func (c *Client) FilteredSymbolList(ctx context.Context, f SymbolFilterFunc) ([]SymbolItem, error)
- func (c *Client) FundamentalMetadata(ctx context.Context, queryParams *FundamentalMetadataParams) ([]FundamentalMetadata, error)
- func (c *Client) FundamentalMetadataRaw(ctx context.Context, queryParams *FundamentalMetadataParams) ([]byte, error)
- func (c *Client) IexHistory(ctx context.Context, ticker string, queryParams *IexHistoryParams) ([]IexPrice, error)
- func (c *Client) IexHistoryRaw(ctx context.Context, ticker string, queryParams *IexHistoryParams) ([]byte, error)
- func (c *Client) IexTopOfBook(ctx context.Context, queryParams *IexTopOfBookParams) ([]IexTopOfBook, error)
- func (c *Client) IexTopOfBookRaw(ctx context.Context, queryParams *IexTopOfBookParams) ([]byte, error)
- func (c *Client) Search(ctx context.Context, query string, queryParams *SearchParams) ([]SearchResult, error)
- func (c *Client) SearchRaw(ctx context.Context, query string, queryParams *SearchParams) ([]byte, error)
- func (c *Client) StmtDataFlat(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]StmtDataFlat, error)
- func (c *Client) StmtDataNested(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]StmtDataNested, error)
- func (c *Client) StmtDataRaw(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]byte, error)
- func (c *Client) StmtDefs(ctx context.Context, queryParams *StmtDefsParams) ([]StmtDef, error)
- func (c *Client) StmtDefsRaw(ctx context.Context, queryParams *StmtDefsParams) ([]byte, error)
- type CryptoMetadata
- type CryptoPriceParams
- type CryptoResult
- type DailyFundamental
- type DailyFundamentalParams
- type EodFreq
- type EodMetadata
- type EodPrice
- type EodPriceParams
- type Format
- type FundamentalMetadata
- type FundamentalMetadataParams
- type IexFreq
- type IexHistoryParams
- type IexPrice
- type IexTopOfBook
- type IexTopOfBookParams
- type PriceData
- type RateLimiter
- type SearchParams
- type SearchResult
- type Sort
- type StmtDataField
- type StmtDataFlat
- type StmtDataNested
- type StmtDataParams
- type StmtDef
- type StmtDefsParams
- type SymbolFilterFunc
- type SymbolItem
Constants ¶
const ( JSON Format = "json" CSV Format = "csv" Daily EodFreq = "daily" Weekly EodFreq = "weekly" Monthly EodFreq = "monthly" Annually EodFreq = "annually" OneMin IexFreq = "1min" FiveMin IexFreq = "5min" FifteenMin IexFreq = "15min" ThirtyMin IexFreq = "30min" OneHour IexFreq = "1hour" TwoHour IexFreq = "2hour" FourHour IexFreq = "4hour" OneDay IexFreq = "1day" DateAsc Sort = "date" DateDesc Sort = "-date" OpenAsc Sort = "open" OpenDesc Sort = "-open" HighAsc Sort = "high" HighDesc Sort = "-high" LowAsc Sort = "low" LowDesc Sort = "-low" CloseAsc Sort = "close" CloseDesc Sort = "-close" VolumeAsc Sort = "volume" VolumeDesc Sort = "-volume" AdjOpenAsc Sort = "adjOpen" AdjOpenDesc Sort = "-adjOpen" AdjHighAsc Sort = "adjHigh" AdjHighDesc Sort = "-adjHigh" AdjLowAsc Sort = "adjLow" AdjLowDesc Sort = "-adjLow" AdjCloseAsc Sort = "adjClose" AdjCloseDesc Sort = "-adjClose" AdjVolumeAsc Sort = "adjVolume" AdjVolumeDesc Sort = "-adjVolume" DivCashAsc Sort = "divCash" DivCashDesc Sort = "-divCash" SplitFactorAsc Sort = "splitFactor" SplitFactorDesc Sort = "-splitFactor" MktCapAsc Sort = "marketCap" MktCapDesc Sort = "-marketCap" EntValAsc Sort = "enterpriseVal" EntValDesc Sort = "-enterpriseVal" PERatioAsc Sort = "peRatio" PERatioDesc Sort = "-peRatio" PBRatioAsc Sort = "pbRatio" PBRatioDesc Sort = "-pbRatio" TrailPEGAsc Sort = "trailingPEG1Y" TrailPEGDesc Sort = "-trailingPEG1Y" )
Variables ¶
This section is empty.
Functions ¶
func CryptoMetadataUrl ¶
CryptoMetadataUrl returns a built url for the given ticker from the [Crypto].2.3.3 Meta Endpoint.
func CryptoPriceUrl ¶
func CryptoPriceUrl(ticker []string, queryParams *CryptoPriceParams) string
CryptoPriceUrl returns a built url for the given ticker with the provided params from the [Crypto].2.3.2 Endpoint Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func DailyFundamentalUrl ¶
func DailyFundamentalUrl(ticker string, queryParams *DailyFundamentalParams) string
DailyFundamentalUrl returns a built url for with the provided params from the [Fundamentals].2.6.4 daily Data Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func EodMetadataUrl ¶
EodMetadataUrl returns a built url for the given ticker from the [End-of-Day].2.1.3 Meta Endpoint.
func EodPriceUrl ¶
func EodPriceUrl(ticker string, queryParams *EodPriceParams) string
EodPriceUrl returns a built url for the given ticker with the provided params from the [End-of-Day].2.1.2 End-of-Day Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func FundamentalMetadataUrl ¶
func FundamentalMetadataUrl(queryParams *FundamentalMetadataParams) string
FundamentalMetadataUrl returns a built url for with the provided params from the [Fundamentals].2.6.5 MetaData Endpoint
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func IexHistoryUrl ¶
func IexHistoryUrl(ticker string, queryParams *IexHistoryParams) string
IexHistoryUrl returns a built url for the given ticker with the provided params from the [IEX].2.5.3 Historical Intraday Prices Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func IexTopOfBookUrl ¶
func IexTopOfBookUrl(queryParams *IexTopOfBookParams) string
IexTopOfBookUrl returns a built url for the given tickers from the [IEX].2.5.2 Top-of-Book & Last Price Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func Parse ¶
Parse takes in raw bytes and parses them according to the format. Valid formats are CSV or JSON (an empty string defaults to JSON).
func SearchUrl ¶
func SearchUrl(query string, queryParams *SearchParams) string
SearchUrl returns a built url for the given query from the [Utility].4.1.2 Search Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func StmtDataUrl ¶
func StmtDataUrl(ticker string, queryParams *StmtDataParams) string
StmtDataUrl returns a built url for with the provided params from the [Fundamentals].2.6.3 Statement Data Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func StmtDefsUrl ¶
func StmtDefsUrl(queryParams *StmtDefsParams) string
StmtDefsUrl returns a built url for with the provided params from the [Fundamentals].2.6.2 Definitions Data Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func WithHttpClient ¶
WithHttpClient sets the *Client's *http.Client's all requests get routed through as provided client.
func WithLogger ¶
WithLogger sets the *Client's *slog.Logger as the provided logger.
func WithRateLimiter ¶
func WithRateLimiter(l RateLimiter) func(*Client)
WithRateLimiter sets the *Client's RateLimiter as the provided limiter.
Types ¶
type Client ¶
type Client struct {
HttpClient *http.Client // default client that all tiingo requests are routed through
RateLimiter RateLimiter // rate limits request speed
Logger *slog.Logger // default logger
// contains filtered or unexported fields
}
func NewClient ¶
NewClient initializes a new Tiingo client.
Specific config options can be set by providing options funcs that will be applied to the new client. The following are already pre-defined:
- WithRateLimiter
- WithLogger
- WithHttpClient
If no options are specified, these are the default options:
- No RateLimiter
- *slog.Logger that sends all logs to io.Discard
- *http.DefaultClient
func (*Client) CryptoMetadata ¶
CryptoMetadata returns the eod metadata response data for a given ticker from the [Crypto].2.3.3 Meta Endpoint
func (*Client) CryptoMetadataRaw ¶
CryptoMetadataRaw functions the same as CryptoMetadata, except the raw response bytes are returned instead of the parsed type.
func (*Client) CryptoPrice ¶
func (c *Client) CryptoPrice(ctx context.Context, ticker []string, queryParams *CryptoPriceParams) ([]CryptoResult, error)
CryptoPrice returns the daily close price response data for a given ticker with the provided params from the [Crypto].2.3.2 Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) CryptoPriceRaw ¶
func (c *Client) CryptoPriceRaw(ctx context.Context, ticker []string, queryParams *CryptoPriceParams) ([]byte, error)
CryptoPriceRaw functions the same as EodPrice, except the raw response bytes are returned instead of the parsed type.
func (*Client) DailyFundamental ¶
func (c *Client) DailyFundamental(ctx context.Context, ticker string, queryParams *DailyFundamentalParams) ([]DailyFundamental, error)
DailyFundamental returns the daily fundamental response data for the given ticker with the provided params from the [Fundamentals].2.6.4 daily Data Endpoint.
Any zero value arguments will be left off the query string & whatever Tiingo's default for an empty query string will be returned.
func (*Client) DailyFundamentalRaw ¶
func (c *Client) DailyFundamentalRaw(ctx context.Context, ticker string, queryParams *DailyFundamentalParams) ([]byte, error)
DailyFundamentalRaw functions the same as DailyFundamental, except the raw response bytes are returned instead of the parsed type.
func (*Client) DefaultSymbolList ¶
DefaultSymbolList returns the full list of SymbolRespItem's from the [End-of-Day].2.1.3.supported_tickers.zip Endpoint
Note: This returns the raw zipped csv bytes from the endpoint, you must unzip before unmarshalling the csv bytes (or pass the raw bytes into FilteredSymbolList or ParseSymbolListCSV).
func (*Client) EodMetadata ¶
EodMetadata returns the eod metadata response data for a given ticker from the [End-of-Day].2.1.3 Meta Endpoint
func (*Client) EodMetadataRaw ¶
EodMetadataRaw functions the same as EodMetadata, except the raw response bytes are returned instead of the parsed type.
func (*Client) EodPrice ¶
func (c *Client) EodPrice(ctx context.Context, ticker string, queryParams *EodPriceParams) ([]EodPrice, error)
EodPrice returns the daily price response data for a given ticker with the provided params from the [End-of-Day].2.1.2 End-of-Day Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) EodPriceRaw ¶
func (c *Client) EodPriceRaw(ctx context.Context, ticker string, queryParams *EodPriceParams) ([]byte, error)
EodPriceRaw functions the same as EodPrice, except the raw response bytes are returned instead of the parsed type.
func (*Client) FilteredSymbolList ¶
func (c *Client) FilteredSymbolList(ctx context.Context, f SymbolFilterFunc) ([]SymbolItem, error)
FilteredSymbolList returns a filtered list of SymbolRespItem's from the [End-of-Day].2.1.3.supported_tickers.zip Endpoint
func (*Client) FundamentalMetadata ¶
func (c *Client) FundamentalMetadata(ctx context.Context, queryParams *FundamentalMetadataParams) ([]FundamentalMetadata, error)
FundamentalMetadata returns the daily fundamental metadata for the given ticker(s) with the provided params from the [Fundamentals].2.6.5 MetaData Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) FundamentalMetadataRaw ¶
func (c *Client) FundamentalMetadataRaw(ctx context.Context, queryParams *FundamentalMetadataParams) ([]byte, error)
FundamentalMetadataRaw functions the same as FundamentalMetadata, except the raw response bytes are returned instead of the parsed type.
func (*Client) IexHistory ¶
func (c *Client) IexHistory(ctx context.Context, ticker string, queryParams *IexHistoryParams) ([]IexPrice, error)
IexHistory returns the intraday price response data for a given ticker with the provided params from the [IEX].2.5.3 Historical Intraday Prices Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) IexHistoryRaw ¶
func (c *Client) IexHistoryRaw(ctx context.Context, ticker string, queryParams *IexHistoryParams) ([]byte, error)
IexHistoryRaw functions the same as IexHistory, except the raw response bytes are returned instead of the parsed type.
func (*Client) IexTopOfBook ¶
func (c *Client) IexTopOfBook(ctx context.Context, queryParams *IexTopOfBookParams) ([]IexTopOfBook, error)
IexTopOfBook returns the last price item for the specified tickers from the [IEX].2.5.2 Top-of-Book & Last Price Endpoints.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) IexTopOfBookRaw ¶
func (c *Client) IexTopOfBookRaw(ctx context.Context, queryParams *IexTopOfBookParams) ([]byte, error)
IexTopOfBookRaw functions the same as IexTopOfBook, except the raw response bytes are returned instead of the parsed type.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, query string, queryParams *SearchParams) ([]SearchResult, error)
Search returns the search result response for a given query from the [Utility].4.1.2 Search Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) SearchRaw ¶
func (c *Client) SearchRaw(ctx context.Context, query string, queryParams *SearchParams) ([]byte, error)
SearchRaw functions the same as Search, except the raw response bytes are returned instead of the parsed type.
func (*Client) StmtDataFlat ¶
func (c *Client) StmtDataFlat(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]StmtDataFlat, error)
StmtDataFlat returns the statement values response data for the given ticker with the provided params from the [Fundamentals].2.6.3 Statement Data Endpoint.
A CSV response format must be used to get the flat data structure, if the provided StmtDataParams.RespFormat is not CSV, it will be changed to that.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) StmtDataNested ¶
func (c *Client) StmtDataNested(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]StmtDataNested, error)
StmtDataNested returns the statement values response data for the given ticker with the provided params from the [Fundamentals].2.6.3 Statement Data Endpoint.
A JSON response format must be used to get the nested data structure, if the provided StmtDataParams.RespFormat is not JSON, it will be changed to that.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) StmtDataRaw ¶
func (c *Client) StmtDataRaw(ctx context.Context, ticker string, queryParams *StmtDataParams) ([]byte, error)
StmtDataRaw functions the same as StmtDataFlat and StmtDataNested, except the raw response bytes are returned instead of the parsed type.
func (*Client) StmtDefs ¶
StmtDefs returns the statement definition response data with the provided params from the [Fundamentals].2.6.2 Definitions Data Endpoint.
If queryParams is non-nil, any non-zero struct values will be applied to the url. Zero value items will be left out and Tiingo defaults will be used. A nil queryParams results in all Tiingo defaults.
func (*Client) StmtDefsRaw ¶
StmtDefsRaw functions the same as StmtDefs, except the raw response bytes are returned instead of the parsed type.
type CryptoMetadata ¶
type CryptoMetadata struct {
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
BaseCurrency string `json:"baseCurrency,omitempty" csv:"baseCurrency,omitempty"`
QuoteCurrency string `json:"quoteCurrency,omitempty" csv:"quoteCurrency,omitempty"`
Name string `json:"name,omitempty" csv:"name,omitempty"`
Description string `json:"description,omitempty" csv:"description,omitempty"`
}
CryptoMetadata corresponds to the [Crypto].2.3.3 Meta Endpoint
type CryptoPriceParams ¶
type CryptoPriceParams struct {
Exchanges []string
StartDate time.Time
EndDate time.Time
ResampleFreq IexFreq
}
CrytoPriceParams represents the query parameters for the [Crypto].2.3.2 Endpoint
type CryptoResult ¶
type CryptoResult struct {
Ticker string `json:"ticker,omitempty"`
BaseCurrency string `json:"baseCurrency,omitempty"`
QuoteCurrency string `json:"quoteCurrency,omitempty"`
PriceData []PriceData `json:"priceData,omitempty"`
}
CryptoResults corresponds to the [Crypto].2.3.2 Crypto Endpoint
type DailyFundamental ¶
type DailyFundamental struct {
Date time.Time `json:"date,omitempty" csv:"date,omitempty"`
MarketCap float64 `json:"marketCap,omitempty" csv:"marketCap,omitempty"`
EnterpriseValue float64 `json:"enterpriseVal,omitempty" csv:"enterpriseVal,omitempty"`
PriceToEarningsRatio float64 `json:"peRatio,omitempty" csv:"peRatio,omitempty"`
PriceToBookRatio float64 `json:"pbRatio,omitempty" csv:"pbRatio,omitempty"`
TrailingYearPEG float64 `json:"trailingPEG1Y,omitempty" csv:"trailingPEG1Y,omitempty"`
}
DailyFundamental corresponds to the [Fundamentals].2.6.4 Daily Data Endpoint
func (*DailyFundamental) UnmarshalCSVWithFields ¶
func (d *DailyFundamental) UnmarshalCSVWithFields(key, value string) error
type DailyFundamentalParams ¶
type EodFreq ¶
type EodFreq = string
EodFreq is the eod price frequency requested. Possible predefined constants are:
- Daily
- Weekly
- Monthly
- Annually
type EodMetadata ¶
type EodMetadata struct {
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
Name string `json:"name,omitempty" csv:"name,omitempty"`
ExchangeCode string `json:"exchangeCode,omitempty" csv:"exchangeCode,omitempty"`
Description string `json:"description,omitempty" csv:"description,omitempty"`
StartDate time.Time `json:"startDate,omitempty" csv:"startDate,omitempty"`
EndDate time.Time `json:"endDate,omitempty" csv:"endDate,omitempty"`
}
EodMetadata corresponds to the [End-of-Day].2.1.3 Meta Endpoint
func (*EodMetadata) UnmarshalCSVWithFields ¶
func (e *EodMetadata) UnmarshalCSVWithFields(key, value string) error
func (*EodMetadata) UnmarshalJSON ¶
func (e *EodMetadata) UnmarshalJSON(bytes []byte) error
type EodPrice ¶
type EodPrice struct {
Date time.Time `json:"date,omitempty" csv:"date"`
Open float64 `json:"open,omitempty" csv:"open"`
High float64 `json:"high,omitempty" csv:"high"`
Low float64 `json:"low,omitempty" csv:"low"`
Close float64 `json:"close,omitempty" csv:"close"`
Volume int64 `json:"volume,omitempty" csv:"volume"`
AdjOpen float64 `json:"adjOpen,omitempty" csv:"adjOpen"`
AdjHigh float64 `json:"adjHigh,omitempty" csv:"adjHigh"`
AdjLow float64 `json:"adjLow,omitempty" csv:"adjLow"`
AdjClose float64 `json:"adjClose,omitempty" csv:"adjClose"`
AdjVolume int64 `json:"adjVolume,omitempty" csv:"adjVolume"`
DivCash float64 `json:"divCash,omitempty" csv:"divCash"`
SplitFactor float64 `json:"splitFactor,omitempty" csv:"splitFactor"`
}
EodPrice corresponds to the [End-of-Day].2.1.2 End-of-Day Endpoint
func (*EodPrice) UnmarshalCSVWithFields ¶
type EodPriceParams ¶
type EodPriceParams struct {
StartDate time.Time
EndDate time.Time
ResampleFreq EodFreq
Sort Sort
RespFormat Format
Columns []string
}
EodPriceParams represents the query parameters for the [End-of-Day].2.1.2 End-of-Day Endpoint
type Format ¶
type Format = string
Format is the respFormat the response is sent in. Possible predefined constants are:
- CSV
- JSON
type FundamentalMetadata ¶
type FundamentalMetadata struct {
PermaTicker string `json:"permaTicker,omitempty" csv:"permaTicker,omitempty"`
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
Name string `json:"name,omitempty" csv:"name,omitempty"`
IsActive bool `json:"isActive,omitempty" csv:"isActive,omitempty"`
IsADR bool `json:"isADR,omitempty" csv:"isADR,omitempty"`
Sector string `json:"sector,omitempty" csv:"sector,omitempty"`
Industry string `json:"industry,omitempty" csv:"industry,omitempty"`
SicCode int32 `json:"sicCode,omitempty" csv:"sicCode,omitempty"`
SicSector string `json:"sicSector,omitempty" csv:"sicSector,omitempty"`
SicIndustry string `json:"sicIndustry,omitempty" csv:"sicIndustry,omitempty"`
ReportingCurrency string `json:"reportingCurrency,omitempty" csv:"reportingCurrency,omitempty"`
Location string `json:"location,omitempty" csv:"location,omitempty"`
CompanyWebsite string `json:"companyWebsite,omitempty" csv:"companyWebsite,omitempty"`
SecFilingWebsite string `json:"secFilingWebsite,omitempty" csv:"secFilingWebsite,omitempty"`
StatementLastUpdated time.Time `json:"statementLastUpdated,omitempty" csv:"statementLastUpdated,omitempty"`
DailyLastUpdated time.Time `json:"dailyLastUpdated,omitempty" csv:"dailyLastUpdated,omitempty"`
DataProviderPermaTicker string `json:"dataProviderPermaTicker,omitempty" csv:"dataProviderPermaTicker,omitempty"`
}
FundamentalMetadata corresponds to the [Fundamentals].2.6.5 Meta Data Endpoint
func (*FundamentalMetadata) UnmarshalCSVWithFields ¶
func (f *FundamentalMetadata) UnmarshalCSVWithFields(key, value string) error
type IexFreq ¶
type IexFreq = string
IexFreq is the IexHistory price frequency requested. Possible predefined constants are:
- OneMin
- FiveMin
- FifteenMin
- ThirtyMin
- OneHour
- TwoHour
- FourHour
type IexHistoryParams ¶
type IexPrice ¶
type IexPrice struct {
Date time.Time `json:"date,omitempty" csv:"date,omitempty"`
Open float64 `json:"open,omitempty" csv:"open,omitempty"`
High float64 `json:"high,omitempty" csv:"high,omitempty"`
Low float64 `json:"low,omitempty" csv:"low,omitempty"`
Close float64 `json:"close,omitempty" csv:"close,omitempty"`
Volume int64 `json:"volume,omitempty" csv:"volume,omitempty"`
}
IexPrice corresponds to the [IEX].2.5.3 Historical Intraday Prices Endpoint
func (*IexPrice) UnmarshalCSVWithFields ¶
type IexTopOfBook ¶
type IexTopOfBook struct {
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty" csv:"timestamp,omitempty"`
QuoteTimestamp time.Time `json:"quoteTimestamp,omitempty" csv:"quoteTimestamp,omitempty"`
LastSaleTimestamp time.Time `json:"lastSaleTimestamp,omitempty" csv:"lastSaleTimestamp,omitempty"`
Last float64 `json:"last,omitempty" csv:"last,omitempty"`
LastSize int32 `json:"lastSize,omitempty" csv:"lastSize,omitempty"`
TngoLast float64 `json:"tngoLast,omitempty" csv:"tngoLast,omitempty"`
PrevClose float64 `json:"prevClose,omitempty" csv:"prevClose,omitempty"`
Open float64 `json:"open,omitempty" csv:"open,omitempty"`
High float64 `json:"high,omitempty" csv:"high,omitempty"`
Low float64 `json:"low,omitempty" csv:"low,omitempty"`
Mid float64 `json:"mid,omitempty" csv:"mid,omitempty"`
Volume int64 `json:"volume,omitempty" csv:"volume,omitempty"`
BidSize float64 `json:"bidSize,omitempty" csv:"bidSize,omitempty"`
BidPrice float64 `json:"bidPrice,omitempty" csv:"bidPrice,omitempty"`
AskSize float64 `json:"askSize,omitempty" csv:"askSize,omitempty"`
AskPrice float64 `json:"askPrice,omitempty" csv:"askPrice,omitempty"`
}
IexTopOfBook corresponds to the [IEX].2.5.2 Top-of-Book and Last Price Endpoints
func (*IexTopOfBook) UnmarshalCSVWithFields ¶
func (i *IexTopOfBook) UnmarshalCSVWithFields(key, value string) error
func (*IexTopOfBook) UnmarshalJSON ¶
func (i *IexTopOfBook) UnmarshalJSON(bytes []byte) error
type IexTopOfBookParams ¶
IexTopOfBookParams represents the query parameters for the [IEX].2.5.2 Top-of-Book & Last Price Endpoints
type PriceData ¶
type PriceData struct {
Date time.Time `json:"date,omitempty"`
Open float64 `json:"open,omitempty"`
High float64 `json:"high,omitempty"`
Low float64 `json:"low,omitempty"`
Close float64 `json:"close,omitempty"`
TradesDone float64 `json:"tradesDone,omitempty"`
Volume float64 `json:"volume,omitempty"`
VolumeNotional float64 `json:"volumeNotional,omitempty"`
}
PriceData corresponds to the [Crypto].2.3.2 priceData Response
type RateLimiter ¶
RateLimiter rate limits requests. It takes in a context, that if canceled, will stop the current waiting and return an error. If the context is not canceled, and the limiting time is reached, the returned error should be nil.
NOTE: this most seamlessly integrates with a rate.Limiter.
type SearchParams ¶
type SearchResult ¶
type SearchResult struct {
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
Name string `json:"name,omitempty" csv:"name,omitempty"`
AssetType string `json:"assetType,omitempty" csv:"assetType,omitempty"`
IsActive bool `json:"isActive,omitempty" csv:"isActive,omitempty"`
PermaTicker string `json:"permaTicker,omitempty" csv:"permaTicker,omitempty"`
OpenFIGIComposite string `json:"openFIGIComposite,omitempty" csv:"openFIGIComposite,omitempty"`
CountryCode string `json:"countryCode" csv:"countryCode"`
}
SearchResult corresponds to [Utility].4.1.2 Search Endpoint
type Sort ¶
type Sort = string
Sort defines the sorting order of the response data. Possible predefined constants are:
- DateAsc
- DateDesc
- OpenAsc
- OpenDesc
- HighAsc
- HighDesc
- LowAsc
- LowDesc
- CloseAsc
- CloseDesc
- VolumeAsc
- VolumeDesc
- AdjOpenAsc
- AdjOpenDesc
- AdjHighAsc
- AdjHighDesc
- AdjLowAsc
- AdjLowDesc
- AdjCloseAsc
- AdjCloseDesc
- AdjVolumeAsc
- AdjVolumeDesc
- DivCashAsc
- DivCashDesc
- SplitFactorAsc
- SplitFactorDesc
- MktCapAsc
- MktCapDesc
- EntValAsc
- EntValDesc
- PERatioAsc
- PERatioDesc
- PBRatioAsc
- PBRatioDesc
- TrailPEGAsc
- TrailPEGDesc
type StmtDataField ¶
type StmtDataField struct {
DataCode string `json:"dataCode,omitempty"`
Value float64 `json:"value,omitempty"`
}
StmtDataField corresponds to the [Fundamentals].2.6.3 Statement Data Endpoint statement data fields
type StmtDataFlat ¶
type StmtDataFlat struct {
Date time.Time `json:"date" csv:"date"`
Year int `json:"year" csv:"year"`
Quarter int `json:"quarter" csv:"quarter"`
StatementType string `json:"statementType" csv:"statementType"`
DataCode string `json:"dataCode" csv:"dataCode"`
Value float64 `json:"value" csv:"value"`
}
StmtDataFlat corresponds to the [Fundamentals].2.6.3 Statement Data Endpoint when a csv respFormat is requested
func (*StmtDataFlat) UnmarshalCSVWithFields ¶
func (s *StmtDataFlat) UnmarshalCSVWithFields(key, value string) error
type StmtDataNested ¶
type StmtDataNested struct {
Date time.Time `json:"date,omitempty"`
Year int32 `json:"year,omitempty"`
Quarter int32 `json:"quarter,omitempty"`
StatementData struct {
BalanceSheet []StmtDataField
IncomeStatement []StmtDataField
CashFlow []StmtDataField
Overview []StmtDataField
}
}
StmtDataNested corresponds to the [Fundamentals].2.6.3 Statement Data Endpoint when a json respFormat is requested
func (*StmtDataNested) UnmarshalJSON ¶
func (s *StmtDataNested) UnmarshalJSON(bytes []byte) error
type StmtDataParams ¶
type StmtDef ¶
type StmtDef struct {
DataCode string `json:"dataCode,omitempty" csv:"dataCode,omitempty"`
Name string `json:"name,omitempty" csv:"name,omitempty"`
Description string `json:"description,omitempty" csv:"description,omitempty"`
StatementType string `json:"statementType,omitempty" csv:"statementType,omitempty"`
Units string `json:"units,omitempty" csv:"units,omitempty"`
}
StmtDef corresponds to the [Fundamentals].2.6.2 Definitions Data Endpoint
type StmtDefsParams ¶
type SymbolFilterFunc ¶
type SymbolFilterFunc func(asset SymbolItem) bool
SymbolFilterFunc is a function that takes in a SymbolRespItem and returns a boolean for if that ticker item should be added to the overall ticker list. A value of nil will return every SymbolRespItem from the list.
Example: Only include NYSE & NASDAQ stocks that have a startDate & endDate date
func(asset SymbolRespItem) bool {
if asset.Exchange != "NYSE" && asset.Exchange != "NASDAQ" {
return false
}
if asset.AssetType != "stock" {
return false
}
if asset.StartDate.IsZero() || asset.EndDate.IsZero() {
return false
}
return true
}
type SymbolItem ¶
type SymbolItem struct {
Ticker string `json:"ticker,omitempty" csv:"ticker,omitempty"`
Exchange string `json:"exchange,omitempty" csv:"exchange,omitempty"`
AssetType string `json:"assetType,omitempty" csv:"assetType,omitempty"`
PriceCurrency string `json:"priceCurrency,omitempty" csv:"priceCurrency,omitempty"`
StartDate time.Time `json:"startDate,omitempty" csv:"startDate,omitempty"`
EndDate time.Time `json:"EndDate,omitempty" csv:"EndDate,omitempty"`
}
SymbolItem corresponds to [End-of-Day].2.1.3.supported_tickers.zip
func ParseSymbolListCSV ¶
func ParseSymbolListCSV(rawData []byte) ([]SymbolItem, error)
ParseSymbolListCSV accepts the raw zipped csv bytes returned from the End-of-Day].2.1.3.supported_tickers.zip Endpoint and parses them into a list of the individual SymbolItem
func (*SymbolItem) UnmarshalCSVWithFields ¶
func (s *SymbolItem) UnmarshalCSVWithFields(key, value string) error