models

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 6 Imported by: 116

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agg

type Agg struct {
	Ticker       string  `json:"T,omitempty"`
	Close        float64 `json:"c,omitempty"`
	High         float64 `json:"h,omitempty"`
	Low          float64 `json:"l,omitempty"`
	Transactions int64   `json:"n,omitempty"`
	Open         float64 `json:"o,omitempty"`
	Timestamp    Millis  `json:"t,omitempty"`
	Volume       float64 `json:"v,omitempty"`
	VWAP         float64 `json:"vw,omitempty"`
}

Agg is an aggregation of all the activity on a specified ticker between the start and end timestamps.

type AssetClass

type AssetClass string

AssetClass is an identifier for a group of similar financial instruments.

const (
	AssetStocks  AssetClass = "stocks"
	AssetOptions AssetClass = "options"
	AssetCrypto  AssetClass = "crypto"
	AssetFx      AssetClass = "fx"
)

type BaseResponse

type BaseResponse struct {
	PaginationHooks

	// The status of this request's response.
	Status string `json:"status,omitempty"`

	// A request id assigned by the server.
	RequestID string `json:"request_id,omitempty"`

	// The total number of results for this request.
	Count int `json:"count,omitempty"`

	// A response message for successful requests.
	Message string `json:"message,omitempty"`

	// An error message for unsuccessful requests.
	ErrorMessage string `json:"error,omitempty"`
}

BaseResponse has all possible attributes that any response can use. It's intended to be embedded in a domain specific response struct.

type Branding

type Branding struct {
	LogoURL string `json:"logo_url,omitempty"`
	IconURL string `json:"icon_url,omitempty"`
}

Branding contains information related to a company's brand.

type CompanyAddress

type CompanyAddress struct {
	Address1   string `json:"address1,omitempty"`
	Address2   string `json:"address2,omitempty"` // todo: add this to the spec
	City       string `json:"city,omitempty"`
	PostalCode string `json:"postal_code,omitempty"`
	State      string `json:"state,omitempty"`
}

CompanyAddress contains information on the physical address of a company.

type Comparator

type Comparator string

Comparator is the type of comparison to make for a specific query parameter.

const (
	EQ  Comparator = "eq"
	LT  Comparator = "lt"
	LTE Comparator = "lte"
	GT  Comparator = "gt"
	GTE Comparator = "gte"
)

type Condition

type Condition struct {
	Abbreviation string      `json:"abbreviation,omitempty"`
	AssetClass   string      `json:"asset_class,omitempty"`
	DataTypes    []string    `json:"data_types,omitempty"`
	Description  string      `json:"description,omitempty"`
	Exchange     int64       `json:"exchange,omitempty"`
	ID           int64       `json:"id,omitempty"`
	Legacy       bool        `json:"legacy"`
	Name         string      `json:"name,omitempty"`
	SIPMapping   SIPMapping  `json:"sip_mapping,omitempty"`
	Type         string      `json:"type,omitempty"`
	UpdateRules  UpdateRules `json:"update_rules,omitempty"`
}

Condition contains detailed information on a specified condition.

type CryptoTrade

type CryptoTrade struct {
	Conditions []int   `json:"conditions,omitempty"`
	Exchange   int     `json:"exchange,omitempty"`
	Price      float64 `json:"price,omitempty"`
	Size       float64 `json:"size,omitempty"`
	Timestamp  Nanos   `json:"timestamp,omitempty"`
}

CryptoTrade is a trade for a crypto pair.

type DataType

type DataType string

DataType is the type of data.

const (
	DataTrade DataType = "trade"
	DataBBO   DataType = "bbo"
	DataNBBO  DataType = "nbbo"
)

type Date

type Date time.Time

Date represents a short date string of the following format: "2006-01-02".

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

type DayOptionContractSnapshot

type DayOptionContractSnapshot struct {
	Change        float64 `json:"change,omitempty"`
	ChangePercent float64 `json:"change_percent,omitempty"`
	Close         float64 `json:"close,omitempty"`
	High          float64 `json:"high,omitempty"`
	LastUpdated   Nanos   `json:"last_updated,omitempty"`
	Low           float64 `json:"low,omitempty"`
	Open          float64 `json:"open,omitempty"`
	PreviousClose float64 `json:"previous_close,omitempty"`
	Volume        float64 `json:"volume,omitempty"`
	VWAP          float64 `json:"vwap,omitempty"`
}

DayOptionContractSnapshot contains the most recent day agg for an option contract.

type DaySnapshot

type DaySnapshot struct {
	Close                 float64 `json:"c,omitempty"`
	High                  float64 `json:"h,omitempty"`
	Low                   float64 `json:"l,omitempty"`
	Open                  float64 `json:"o,omitempty"`
	Volume                float64 `json:"v,omitempty"`
	VolumeWeightedAverage float64 `json:"vw,omitempty"`
}

DaySnapshot is the most recent day agg for a ticker.

type Direction

type Direction string

Direction is the direction of the snapshot results to return.

const (
	Gainers Direction = "gainers"
	Losers  Direction = "losers"
)

type Dividend

type Dividend struct {
	CashAmount      float64 `json:"cash_amount,omitempty"`
	DeclarationDate string  `json:"declaration_date,omitempty"`
	DividendType    string  `json:"dividend_type,omitempty"`
	ExDividendDate  string  `json:"ex_dividend_date,omitempty"`
	Frequency       int64   `json:"frequency,omitempty"`
	PayDate         string  `json:"pay_date,omitempty"`
	RecordDate      string  `json:"record_date,omitempty"`
	Ticker          string  `json:"ticker,omitempty"`
}

Dividend contains detailed information on a specified stock dividend.

type DividendType

type DividendType string

DividendType is the type of dividend.

const (
	DividendCD DividendType = "CD"
	DividendLT DividendType = "LT"
	DividendSC DividendType = "SC"
	DividendST DividendType = "ST"
)

type ErrorResponse

type ErrorResponse struct {
	BaseResponse

	// An HTTP status code for unsuccessful requests.
	StatusCode int
}

ErrorResponse represents an API response with an error status code.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error returns the details of an error response.

type Exchange

type Exchange struct {
	Acronym       string `json:"acronym,omitempty"`
	AssetClass    string `json:"asset_class,omitempty"`
	ID            int64  `json:"id,omitempty"`
	Locale        string `json:"locale,omitempty"`
	MIC           string `json:"mic,omitempty"`
	Name          string `json:"name,omitempty"`
	OperatingMIC  string `json:"operating_mic,omitempty"`
	ParticipantID string `json:"participant_id,omitempty"`
	Type          string `json:"type,omitempty"`
	URL           string `json:"url,omitempty"`
}

Exchange contains detailed information on a specified stock Exchange.

type Financial added in v0.7.0

type Financial map[string]struct {
	Formula string  `json:"formula,omitempty"`
	Label   string  `json:"label,omitempty"`
	Order   int32   `json:"order,omitempty"`
	Unit    string  `json:"unit,omitempty"`
	Value   float64 `json:"value,omitempty"`
	Xpath   string  `json:"xpath,omitempty"`
}

Financial aliases nested data points of information for a stock financial.

type ForexQuote

type ForexQuote struct {
	Ask       float64 `json:"ask,omitempty"`
	Bid       float64 `json:"bid,omitempty"`
	Exchange  int     `json:"exchange,omitempty"`
	Timestamp Nanos   `json:"timestamp,omitempty"`
}

ForexQuote is a BBO for a forex currency pair.

type Frequency

type Frequency int64

Frequency is the number of times a dividend is paid out over the course of one year.

const (
	OneTime    Frequency = 0
	Annually   Frequency = 1
	BiAnnually Frequency = 2
	Quarterly  Frequency = 4
	Monthly    Frequency = 12
)

type FullBookSnapshot added in v0.9.0

type FullBookSnapshot struct {
	AskCount float64          `json:"askCount,omitempty"`
	Asks     []OrderBookQuote `json:"asks,omitempty"`
	BidCount float64          `json:"bidCount,omitempty"`
	Bids     []OrderBookQuote `json:"bids,omitempty"`
	Spread   float64          `json:"spread,omitempty"`
	Ticker   string           `json:"ticker,omitempty"`
	Updated  Nanos            `json:"updated,omitempty"`
}

FullBookSnapshot is the level 2 book of a single crypto ticker.

type GetAggsParams

type GetAggsParams struct {
	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`

	// The size of the timespan multiplier.
	Multiplier int `validate:"required" path:"multiplier"`

	// The size of the time window.
	Timespan Timespan `validate:"required" path:"timespan"`

	// The start of the aggregate time window.
	From Millis `validate:"required" path:"from"`

	// The end of the aggregate time window.
	To Millis `validate:"required" path:"to"`

	// Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get
	// results that are NOT adjusted for splits.
	Adjusted *bool `query:"adjusted"`

	// Order the results by timestamp. asc will return results in ascending order (oldest at the top), desc will return
	// results in descending order (newest at the top).
	Order *Order `query:"sort"`

	// Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 5000. Read
	// more about how limit is used to calculate aggregate results in our article on Aggregate Data API Improvements:
	// https://polygon.io/blog/aggs-api-updates/.
	Limit *int `query:"limit"`
}

GetAggsParams is the set of parameters for the GetAggs method.

func (GetAggsParams) WithAdjusted

func (p GetAggsParams) WithAdjusted(q bool) *GetAggsParams

func (GetAggsParams) WithLimit

func (p GetAggsParams) WithLimit(q int) *GetAggsParams

func (GetAggsParams) WithOrder

func (p GetAggsParams) WithOrder(q Order) *GetAggsParams

type GetAggsResponse

type GetAggsResponse struct {
	BaseResponse
	Ticker       string `json:"ticker,omitempty"`
	QueryCount   int    `json:"queryCount,omitempty"`
	ResultsCount int    `json:"resultsCount,omitempty"`
	Adjusted     bool   `json:"adjusted"`
	Results      []Agg  `json:"results,omitempty"`
}

GetAggsResponse is the response returned by the GetAggs method.

type GetAllTickersSnapshotParams

type GetAllTickersSnapshotParams struct {
	// The locale of the market.
	Locale MarketLocale `validate:"required" path:"locale"`

	// The type of market to query.
	MarketType MarketType `validate:"required" path:"marketType"`

	// A comma separated list of tickers to get snapshots for.
	Tickers *string `query:"tickers"`
}

GetAllTickersSnapshotParams is the set of parameters for the GetAllTickersSnapshot method.

func (GetAllTickersSnapshotParams) WithTickers

type GetAllTickersSnapshotResponse

type GetAllTickersSnapshotResponse struct {
	BaseResponse
	Tickers []TickerSnapshot `json:"tickers,omitempty"`
}

GetAllTickersSnapshotResponse is the response returned by the GetAllTickersSnapshot method.

type GetCryptoFullBookSnapshotParams

type GetCryptoFullBookSnapshotParams struct {
	Ticker string `validate:"required" path:"ticker"`
}

GetCryptoFullBookSnapshotParams is the set of parameters for the GetCryptoFullBookSnapshot method.

type GetCryptoFullBookSnapshotResponse

type GetCryptoFullBookSnapshotResponse struct {
	BaseResponse
	Data FullBookSnapshot `json:"data,omitempty"`
}

GetCryptoFullBookSnapshotResponse is the response returned by the GetCryptoFullBookSnapshot method.

type GetDailyOpenCloseAggParams

type GetDailyOpenCloseAggParams struct {
	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`

	// The date of the requested open/close in the format YYYY-MM-DD.
	Date Date `validate:"required" path:"date"`

	// Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get
	// results that are NOT adjusted for splits.
	Adjusted *bool `query:"adjusted"`
}

GetDailyOpenCloseAggParams is the set of parameters for the GetDailyOpenCloseAgg method.

func (GetDailyOpenCloseAggParams) WithAdjusted

type GetDailyOpenCloseAggResponse

type GetDailyOpenCloseAggResponse struct {
	BaseResponse
	Symbol     string  `json:"symbol,omitempty"`
	From       string  `json:"from,omitempty"`
	Open       float64 `json:"open,omitempty"`
	High       float64 `json:"high,omitempty"`
	Low        float64 `json:"low,omitempty"`
	Close      float64 `json:"close,omitempty"`
	Volume     float64 `json:"volume,omitempty"`
	AfterHours float64 `json:"afterHours,omitempty"`
	PreMarket  float64 `json:"preMarket,omitempty"`
}

GetDailyOpenCloseAggResponse is the response for the GetDailyOpenCloseAgg method.

type GetExchangesParams

type GetExchangesParams struct {
	// Filter by asset class.
	AssetClass *AssetClass `query:"asset_class,omitempty"`

	// Filter by locale.
	Locale *MarketLocale `query:"locale,omitempty"`
}

GetExchangesParams is the set of parameters for the GetExchanges method.

func (GetExchangesParams) WithAssetClass

func (p GetExchangesParams) WithAssetClass(q AssetClass) *GetExchangesParams

func (GetExchangesParams) WithLocale

type GetExchangesResponse

type GetExchangesResponse struct {
	BaseResponse
	Results []Exchange `json:"results,omitempty"`
}

GetExchangesResponse is the response returned by the GetExchanges method.

type GetGainersLosersSnapshotParams

type GetGainersLosersSnapshotParams struct {
	// The locale of the market.
	Locale MarketLocale `validate:"required" path:"locale"`

	// The type of market to query.
	MarketType MarketType `validate:"required" path:"marketType"`

	// The direction of the snapshot results to return.
	Direction Direction `validate:"required" path:"direction"`
}

GetGainersLosersSnapshotParams is the set of parameters for the GetGainersLosersSnapshot method.

type GetGainersLosersSnapshotResponse

type GetGainersLosersSnapshotResponse struct {
	BaseResponse
	Tickers []TickerSnapshot `json:"tickers,omitempty"`
}

GetGainersLosersSnapshotResponse is the response returned by the GetGainersLosersSnapshot method.

type GetGroupedDailyAggsParams

type GetGroupedDailyAggsParams struct {
	// The locale of the market.
	Locale MarketLocale `validate:"required" path:"locale"`

	// The type of market to query.
	MarketType MarketType `validate:"required" path:"marketType"`

	// The beginning date for the aggregate window.
	Date Date `validate:"required" path:"date"`

	// Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get
	// results that are NOT adjusted for splits.
	Adjusted *bool `query:"adjusted"`
}

GetGroupedDailyAggsParams is the set of parameters for the GetGroupedDailyAggs method.

func (GetGroupedDailyAggsParams) WithAdjusted

type GetGroupedDailyAggsResponse

type GetGroupedDailyAggsResponse struct {
	BaseResponse
	Ticker       string `json:"ticker,omitempty"`
	QueryCount   int    `json:"queryCount,omitempty"`
	ResultsCount int    `json:"resultsCount,omitempty"`
	Adjusted     bool   `json:"adjusted"`
	Results      []Agg  `json:"results,omitempty"`
}

GetGroupedDailyAggsResponse is the response returned by the GetGroupedDailyAggs method.

type GetLastCryptoTradeParams

type GetLastCryptoTradeParams struct {
	// The "from" symbol of the pair.
	From string `validate:"required" path:"from"`

	// The "to" symbol of the pair.
	To string `validate:"required" path:"to"`
}

GetLastCryptoTradeParams is the set of parameters for the GetLastCryptoTrade method.

type GetLastCryptoTradeResponse

type GetLastCryptoTradeResponse struct {
	BaseResponse
	Symbol string      `json:"symbol,omitempty"`
	Last   CryptoTrade `json:"last,omitempty"`
}

GetLastCryptoTradeResponse is the response returned by the GetLastCryptoTrade method.

type GetLastForexQuoteParams

type GetLastForexQuoteParams struct {
	// The "from" symbol of the pair.
	From string `validate:"required" path:"from"`

	// The "to" symbol of the pair.
	To string `validate:"required" path:"to"`
}

GetLastForexQuoteParams is the set of parameters for the GetLastForexQuote method.

type GetLastForexQuoteResponse

type GetLastForexQuoteResponse struct {
	BaseResponse
	Symbol string     `json:"symbol,omitempty"`
	Last   ForexQuote `json:"last,omitempty"`
}

GetLastForexQuoteResponse is the response returned by the GetLastForexQuote method.

type GetLastQuoteParams

type GetLastQuoteParams struct {
	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`
}

GetLastQuoteParams is the set of parameters for the GetLastQuote method.

type GetLastQuoteResponse

type GetLastQuoteResponse struct {
	BaseResponse
	Results LastQuote `json:"results,omitempty"`
}

GetLastQuoteResponse is the response returned by the GetLastQuote method.

type GetLastTradeParams

type GetLastTradeParams struct {
	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`
}

GetLastTradeParams is the set of parameters for GetLastTrade method.

type GetLastTradeResponse

type GetLastTradeResponse struct {
	BaseResponse
	Results LastTrade `json:"results,omitempty"`
}

GetLastTradeResponse is the response returned by the GetLastTradeResponse method.

type GetMarketHolidaysResponse

type GetMarketHolidaysResponse []MarketHoliday

GetMarketHolidaysResponse is the response returned by the GetMarketHolidays method.

type GetMarketStatusResponse

type GetMarketStatusResponse struct {
	AfterHours bool              `json:"afterHours"`
	Currencies map[string]string `json:"currencies,omitempty"`
	EarlyHours bool              `json:"earlyHours"`
	Exchanges  map[string]string `json:"exchanges,omitempty"`
	Market     string            `json:"market,omitempty"`
	ServerTime Time              `json:"serverTime,omitempty"`
}

GetMarketStatusResponse is the response returned by the GetMarketStatus method.

type GetOptionContractSnapshotParams

type GetOptionContractSnapshotParams struct {
	UnderlyingAsset string `validate:"required" path:"underlyingAsset"`
	OptionContract  string `validate:"required" path:"optionContract"`
}

GetOptionContractSnapshotParams is the set of parameters for the GetOptionContractSnapshot method.

type GetOptionContractSnapshotResponse

type GetOptionContractSnapshotResponse struct {
	BaseResponse
	Results OptionContractSnapshot `json:"results,omitempty"`
}

GetOptionContractSnapshotResponse is the response returned by the GetOptionContractSnapshot method.

type GetPreviousCloseAggParams

type GetPreviousCloseAggParams struct {
	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`

	// Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get
	// results that are NOT adjusted for splits.
	Adjusted *bool `query:"adjusted"`
}

GetPreviousCloseAggParams is the set of parameters for the GetPreviousCloseAgg method.

func (GetPreviousCloseAggParams) WithAdjusted

type GetPreviousCloseAggResponse

type GetPreviousCloseAggResponse struct {
	BaseResponse
	Ticker       string `json:"ticker,omitempty"`
	QueryCount   int    `json:"queryCount,omitempty"`
	ResultsCount int    `json:"resultsCount,omitempty"`
	Adjusted     bool   `json:"adjusted"`
	Results      []Agg  `json:"results,omitempty"`
}

GetPreviousCloseAggResponse is the response returned by the GetPreviousCloseAgg method.

type GetRealTimeCurrencyConversionParams added in v0.5.0

type GetRealTimeCurrencyConversionParams struct {
	From string `validate:"required" path:"from"`
	To   string `validate:"required" path:"to"`
}

GetRealTimeCurrencyConversionParams is the set of parameters for the GetRealTimeCurrencyConversion method.

type GetRealTimeCurrencyConversionResponse added in v0.5.0

type GetRealTimeCurrencyConversionResponse struct {
	BaseResponse
	InitialAmount float64    `json:"initialAmount,omitempty"`
	Converted     float64    `json:"converted,omitempty"`
	From          string     `json:"from,omitempty"`
	To            string     `json:"to,omitempty"`
	LastQuote     ForexQuote `json:"last,omitempty"`
}

GetRealTimeCurrencyConversionResponse is the response returned by the GetRealTimeCurrencyConversion method.

type GetTickerDetailsParams

type GetTickerDetailsParams struct {
	// The ticker symbol of the asset.
	Ticker string `validate:"required" path:"ticker"`

	// Specify a point in time to get information about the ticker available on that date. When retrieving information
	// from SEC filings, we compare this date with the period of report date on the SEC filing.
	//
	// For example, consider an SEC filing submitted by AAPL on 2019-07-31, with a period of report date ending on
	// 2019-06-29. That means that the filing was submitted on 2019-07-31, but the filing was created based on
	// information from 2019-06-29. If you were to query for AAPL details on 2019-06-29, the ticker details would
	// include information from the SEC filing.
	//
	// Defaults to the most recent available date.
	Date *Date `query:"date"`
}

GetTickerDetailsParams is the set of parameters for the GetTickerDetails method.

func (GetTickerDetailsParams) WithDate

type GetTickerDetailsResponse

type GetTickerDetailsResponse struct {
	BaseResponse

	// Ticker with details.
	Results Ticker `json:"results,omitempty"`
}

GetTickerDetailsResponse is the response returned by the GetTickerDetails method.

type GetTickerSnapshotParams

type GetTickerSnapshotParams struct {
	// The locale of the market.
	Locale MarketLocale `validate:"required" path:"locale"`

	// The type of market to query.
	MarketType MarketType `validate:"required" path:"marketType"`

	// The ticker symbol of the stock/equity.
	Ticker string `validate:"required" path:"ticker"`
}

GetTickerSnapshotParams is the set of parameters for the GetTickerSnapshot method.

type GetTickerSnapshotResponse

type GetTickerSnapshotResponse struct {
	BaseResponse
	Snapshot TickerSnapshot `json:"ticker,omitempty"`
}

GetTickerSnapshotResponse is the response returned by the GetTickerSnapshot method.

type GetTickerTypesParams

type GetTickerTypesParams struct {
	// Filter by asset class.
	AssetClass *AssetClass `query:"asset_class"`

	// Filter by locale.
	Locale *MarketLocale `query:"locale"`
}

GetTickerTypesParams is the set of parameters for the GetTickerTypes method.

func (GetTickerTypesParams) WithAssetClass

func (GetTickerTypesParams) WithLocale

type GetTickerTypesResponse

type GetTickerTypesResponse struct {
	BaseResponse

	// Ticker type results.
	Results []TickerType `json:"results,omitempty"`
}

GetTickerTypesResponse is the response returned by the GetTickerTypes method.

type Greeks

type Greeks struct {
	Delta float64 `json:"delta,omitempty"`
	Gamma float64 `json:"gamma,omitempty"`
	Theta float64 `json:"theta,omitempty"`
	Vega  float64 `json:"vega,omitempty"`
}

Greeks contains the delta, gamma, vega, and theta of an option contract.

type LastQuote

type LastQuote struct {
	Ticker               string  `json:"T,omitempty"`
	TrfTimestamp         Nanos   `json:"f,omitempty"`
	SequenceNumber       Nanos   `json:"q,omitempty"`
	SipTimestamp         Nanos   `json:"t,omitempty"`
	ParticipantTimestamp Nanos   `json:"y,omitempty"`
	AskPrice             float64 `json:"P,omitempty"`
	AskSize              float64 `json:"S,omitempty"`
	AskExchange          int     `json:"X,omitempty"`
	Conditions           []int32 `json:"c,omitempty"`
	Indicators           []int32 `json:"i,omitempty"`
	BidPrice             float64 `json:"p,omitempty"`
	BidSize              float64 `json:"s,omitempty"`
	BidExchange          int     `json:"x,omitempty"`
	Tape                 int32   `json:"z,omitempty"`
}

LastQuote is the most recent NBBO for a ticker symbol.

type LastQuoteOptionContractSnapshot

type LastQuoteOptionContractSnapshot struct {
	Ask         float64 `json:"ask,omitempty"`
	AskSize     float64 `json:"ask_size,omitempty"`
	Bid         float64 `json:"bid,omitempty"`
	BidSize     float64 `json:"bid_size,omitempty"`
	LastUpdated Nanos   `json:"last_updated,omitempty"`
	Midpoint    float64 `json:"midpoint,omitempty"`
	Timeframe   string  `json:"timeframe,omitempty"`
}

LastQuoteOptionContractSnapshot contains the most recent quote of an option contract.

type LastQuoteSnapshot

type LastQuoteSnapshot struct {
	AskPrice  float64 `json:"P,omitempty"`
	BidPrice  float64 `json:"p,omitempty"`
	AskSize   float64 `json:"S,omitempty"`
	BidSize   float64 `json:"s,omitempty"`
	Timestamp Nanos   `json:"t,omitempty"`
}

LastQuoteSnapshot is the most recent quote for a ticker.

type LastTrade

type LastTrade struct {
	Ticker               string  `json:"T,omitempty"`
	TRFTimestamp         Nanos   `json:"f,omitempty"`
	SequenceNumber       int64   `json:"q,omitempty"`
	Timestamp            Nanos   `json:"t,omitempty"`
	ParticipantTimestamp Nanos   `json:"y,omitempty"`
	Conditions           []int32 `json:"c,omitempty"`
	Correction           uint32  `json:"e,omitempty"`
	ID                   string  `json:"i,omitempty"`
	Price                float64 `json:"p,omitempty"`
	TRF                  int32   `json:"r,omitempty"`
	Size                 uint32  `json:"s,omitempty"`
	Exchange             int32   `json:"x,omitempty"`
	Tape                 int32   `json:"z,omitempty"`
}

LastTrade is the most recent trade for a specified ticker.

type LastTradeSnapshot

type LastTradeSnapshot struct {
	Conditions []int   `json:"c,omitempty"`
	TradeID    string  `json:"i,omitempty"`
	Price      float64 `json:"p,omitempty"`
	Size       int     `json:"s,omitempty"`
	Timestamp  Nanos   `json:"t,omitempty"`
	ExchangeID int     `json:"x,omitempty"`
}

LastQuoteSnapshot is the most recent trade for a ticker.

type ListConditionsParams

type ListConditionsParams struct {
	// Filter for conditions within a given asset class.
	AssetClass *AssetClass `query:"asset_class,omitempty"`

	// Filter by data type.
	DataType *DataType `query:"data_type,omitempty"`

	// Filter for conditions with a given ID.
	ID *int64 `query:"id,omitempty"`

	// Filter by SIP. If the condition contains a mapping for that SIP, the condition will be returned.
	SIP *SIP `query:"sip,omitempty"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 1000.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListConditionsParams is the set of parameters for the ListConditions method.

func (ListConditionsParams) WithAssetClass

func (ListConditionsParams) WithDataType

func (ListConditionsParams) WithID

func (ListConditionsParams) WithLimit

func (ListConditionsParams) WithOrder

func (ListConditionsParams) WithSIP

func (ListConditionsParams) WithSort

type ListConditionsResponse

type ListConditionsResponse struct {
	BaseResponse
	Results []Condition `json:"results,omitempty"`
}

ListConditionsResponse is the response returned by the ListConditions method.

type ListDividendsParams

type ListDividendsParams struct {
	// Return the dividends that contain this ticker.
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	// Query by ex-dividend date with the format YYYY-MM-DD.
	ExDividendDateEQ  *Date `query:"ex_dividend_date"`
	ExDividendDateLT  *Date `query:"ex_dividend_date.lt"`
	ExDividendDateLTE *Date `query:"ex_dividend_date.lte"`
	ExDividendDateGT  *Date `query:"ex_dividend_date.gt"`
	ExDividendDateGTE *Date `query:"ex_dividend_date.gte"`

	// Query by record date with the format YYYY-MM-DD.
	RecordDateEQ  *Date `query:"record_date"`
	RecordDateLT  *Date `query:"record_date.lt"`
	RecordDateLTE *Date `query:"record_date.lte"`
	RecordDateGT  *Date `query:"record_date.gt"`
	RecordDateGTE *Date `query:"record_date.gte"`

	// Query by declaration date with the format YYYY-MM-DD.
	DeclarationDateEQ  *Date `query:"declaration_date"`
	DeclarationDateLT  *Date `query:"declaration_date.lt"`
	DeclarationDateLTE *Date `query:"declaration_date.lte"`
	DeclarationDateGT  *Date `query:"declaration_date.gt"`
	DeclarationDateGTE *Date `query:"declaration_date.gte"`

	// Query by pay date with the format YYYY-MM-DD.
	PayDateEQ  *Date `query:"pay_date"`
	PayDateLT  *Date `query:"pay_date.lt"`
	PayDateLTE *Date `query:"pay_date.lte"`
	PayDateGT  *Date `query:"pay_date.gt"`
	PayDateGTE *Date `query:"pay_date.gte"`

	// Query by the number of times per year the dividend is paid out. Possible values are 0 (one-time), 1 (annually), 2
	// (bi-annually), 4 (quarterly), and 12 (monthly).
	Frequency *Frequency `query:"frequency"`

	// Query by the cash amount of the dividend.
	CashAmountEQ  *float64 `query:"cash_amount"`
	CashAmountLT  *float64 `query:"cash_amount.lt"`
	CashAmountLTE *float64 `query:"cash_amount.lte"`
	CashAmountGT  *float64 `query:"cash_amount.gt"`
	CashAmountGTE *float64 `query:"cash_amount.gte"`

	// Query by the type of dividend. Dividends that have been paid and/or are expected to be paid on consistent
	// schedules are denoted as CD. Special Cash dividends that have been paid that are infrequent or unusual, and/or
	// can not be expected to occur in the future are denoted as SC.
	DividendType *DividendType `query:"dividend_type"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 1000.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListDividendsParams is the set of parameters for the ListDividends method.

func (ListDividendsParams) WithCashAmount

func (ListDividendsParams) WithDeclarationDate

func (p ListDividendsParams) WithDeclarationDate(c Comparator, q Date) *ListDividendsParams

func (ListDividendsParams) WithDividendType

func (p ListDividendsParams) WithDividendType(q DividendType) *ListDividendsParams

func (ListDividendsParams) WithExDividendDate

func (p ListDividendsParams) WithExDividendDate(c Comparator, q Date) *ListDividendsParams

func (ListDividendsParams) WithFrequency

func (ListDividendsParams) WithLimit

func (ListDividendsParams) WithOrder

func (ListDividendsParams) WithSort

func (ListDividendsParams) WithTicker

type ListDividendsResponse

type ListDividendsResponse struct {
	BaseResponse
	Results []Dividend `json:"results,omitempty"`
}

ListDividendsResponse is the response returned by the ListDividends method.

type ListQuotesParams

type ListQuotesParams struct {
	// The ticker symbol to get quotes for.
	Ticker string `validate:"required" path:"ticker"`

	// Query by timestamp. Either a date with the format YYYY-MM-DD or a nanosecond timestamp.
	TimestampEQ  *Nanos `query:"timestamp"`
	TimestampLT  *Nanos `query:"timestamp.lt"`
	TimestampLTE *Nanos `query:"timestamp.lte"`
	TimestampGT  *Nanos `query:"timestamp.gt"`
	TimestampGTE *Nanos `query:"timestamp.gte"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 50000.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListQuotesParams is the set of parameters for the ListQuotes method.

func (ListQuotesParams) WithLimit

func (p ListQuotesParams) WithLimit(q int) *ListQuotesParams

func (ListQuotesParams) WithOrder

func (p ListQuotesParams) WithOrder(q Order) *ListQuotesParams

func (ListQuotesParams) WithSort

func (p ListQuotesParams) WithSort(q Sort) *ListQuotesParams

func (ListQuotesParams) WithTimestamp

func (p ListQuotesParams) WithTimestamp(c Comparator, q Nanos) *ListQuotesParams

type ListQuotesResponse

type ListQuotesResponse struct {
	BaseResponse
	Results []Quote `json:"results,omitempty"`
}

ListQuotesResponse is the response returned by the ListQuotes method.

type ListSplitsParams

type ListSplitsParams struct {
	// Return the stock splits that contain this ticker.
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	// Query by execution date with the format YYYY-MM-DD.
	ExecutionDateEQ  *Date `query:"execution_date"`
	ExecutionDateLT  *Date `query:"execution_date.lt"`
	ExecutionDateLTE *Date `query:"execution_date.lte"`
	ExecutionDateGT  *Date `query:"execution_date.gt"`
	ExecutionDateGTE *Date `query:"execution_date.gte"`

	// Query for reverse stock splits. A split ratio where split_from is greater than split_to represents a reverse
	// split. By default this filter is not used.
	ReverseSplit *bool `query:"reverse_split"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 1000.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListSplitsParams is the set of parameters for the ListSplits method.

func (ListSplitsParams) WithExecutionDate

func (p ListSplitsParams) WithExecutionDate(c Comparator, q Date) *ListSplitsParams

func (ListSplitsParams) WithLimit

func (p ListSplitsParams) WithLimit(q int) *ListSplitsParams

func (ListSplitsParams) WithOrder

func (p ListSplitsParams) WithOrder(q Order) *ListSplitsParams

func (ListSplitsParams) WithReverseSplit

func (p ListSplitsParams) WithReverseSplit(q bool) *ListSplitsParams

func (ListSplitsParams) WithSort

func (p ListSplitsParams) WithSort(q Sort) *ListSplitsParams

func (ListSplitsParams) WithTicker

func (p ListSplitsParams) WithTicker(c Comparator, q string) *ListSplitsParams

type ListSplitsResponse

type ListSplitsResponse struct {
	BaseResponse
	Results []Split `json:"results,omitempty"`
}

ListSplitsResponse is the response returned by the ListSplits method.

type ListStockFinancialsParams added in v0.7.0

type ListStockFinancialsParams struct {
	// Query by company ticker.
	Ticker *string `query:"ticker"`

	// Query by central index key Number (CIK: https://www.sec.gov/edgar/searchedgar/cik.htm).
	CIK *string `query:"cik"`

	// Query by company name.
	CompanyNameFull   *string `query:"company_name"`
	CompanyNameSearch *string `query:"company_name.search"`

	// Query by standard industrial classification (SIC:
	// https://www.sec.gov/corpfin/division-of-corporation-finance-standard-industrial-classification-sic-code-list).
	SIC *string `query:"sic"`

	// Query by the date when the filing with financials data was filed in YYYY-MM-DD format.
	//
	// Best used when querying over date ranges to find financials based on filings that happen in a time period.
	//
	// Examples:
	//
	// To get financials based on filings that have happened after January 1, 2009 use the query param
	// filing_date.gte=2009-01-01.
	//
	// To get financials based on filings that happened in the year 2009 use the query params
	// filing_date.gte=2009-01-01&filing_date.lt=2010-01-01.
	FilingDateEQ  *Date `query:"filing_dividend_date"`
	FilingDateLT  *Date `query:"filing_dividend_date.lt"`
	FilingDateLTE *Date `query:"filing_dividend_date.lte"`
	FilingDateGT  *Date `query:"filing_dividend_date.gt"`
	FilingDateGTE *Date `query:"filing_dividend_date.gte"`

	// The period of report for the filing with financials data in YYYY-MM-DD format.
	PeriodOfReportDateEQ  *Date `query:"period_of_report_date"`
	PeriodOfReportDateLT  *Date `query:"period_of_report_date.lt"`
	PeriodOfReportDateLTE *Date `query:"period_of_report_date.lte"`
	PeriodOfReportDateGT  *Date `query:"period_of_report_date.gt"`
	PeriodOfReportDateGTE *Date `query:"period_of_report_date.gte"`

	// Query by timeframe. Annual financials originate from 10-K filings, and quarterly financials originate from 10-Q
	// filings. Note: Most companies do not file quarterly reports for Q4 and instead include those financials in their
	// annual report, so some companies my not return quarterly financials for Q4.
	Timeframe *Timeframe `query:"timeframe"`

	// Whether or not to include the xpath and formula attributes for each financial data point. See the xpath and
	// formula response attributes for more info. False by default.
	IncludeSources *bool `query:"include_sources"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 1 and max is 100.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListStockFinancialsParams is the set of parameters for the ListFinancials method.

func (ListStockFinancialsParams) WithCIK added in v0.7.0

func (ListStockFinancialsParams) WithCompanyName added in v0.7.0

func (ListStockFinancialsParams) WithFilingDate added in v0.7.0

func (ListStockFinancialsParams) WithIncludeSources added in v0.7.0

func (p ListStockFinancialsParams) WithIncludeSources(q bool) *ListStockFinancialsParams

func (ListStockFinancialsParams) WithLimit added in v0.7.0

func (ListStockFinancialsParams) WithOrder added in v0.7.0

func (ListStockFinancialsParams) WithPeriodOfReportDate added in v0.7.0

func (p ListStockFinancialsParams) WithPeriodOfReportDate(c Comparator, q Date) *ListStockFinancialsParams

func (ListStockFinancialsParams) WithSIC added in v0.7.0

func (ListStockFinancialsParams) WithSort added in v0.7.0

func (ListStockFinancialsParams) WithTicker added in v0.7.0

func (ListStockFinancialsParams) WithTimeframe added in v0.7.0

type ListStockFinancialsResponse added in v0.7.0

type ListStockFinancialsResponse struct {
	BaseResponse
	Results []StockFinancial `json:"results,omitempty"`
}

ListStockFinancialsResponse is the response returned by the ListFinancials method.

type ListTickerNewsParams added in v0.4.0

type ListTickerNewsParams struct {
	// Return results that contain this ticker.
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	// Return results published on, before, or after this date.
	PublishedUtcEQ  *Millis `query:"published_utc"`
	PublishedUtcLT  *Millis `query:"published_utc.lt"`
	PublishedUtcLTE *Millis `query:"published_utc.lte"`
	PublishedUtcGT  *Millis `query:"published_utc.gt"`
	PublishedUtcGTE *Millis `query:"published_utc.gte"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 1000.
	Limit *int `query:"limit"`
}

ListTickerNewsParams is the set of parameters for the ListTickerNews method.

func (ListTickerNewsParams) WithLimit added in v0.4.0

func (ListTickerNewsParams) WithOrder added in v0.4.0

func (ListTickerNewsParams) WithPublishedUTC added in v0.4.0

func (p ListTickerNewsParams) WithPublishedUTC(c Comparator, q Millis) *ListTickerNewsParams

func (ListTickerNewsParams) WithSort added in v0.4.0

func (ListTickerNewsParams) WithTicker added in v0.4.0

type ListTickerNewsResponse added in v0.4.0

type ListTickerNewsResponse struct {
	BaseResponse

	// Ticker news results.
	Results []TickerNews `json:"results,omitempty"`
}

ListTickerNewsResponse is the response returned by the ListTickerNews method.

type ListTickersParams

type ListTickersParams struct {
	// Specify a ticker symbol. Defaults to empty string which queries all tickers.
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	// Specify the type of the tickers. Find the types that we support via our Ticker Types API. Defaults to empty
	// string which queries all types.
	Type *string `query:"type"`

	// Filter by market type. By default all markets are included.
	Market *AssetClass `query:"market"`

	// Specify the primary exchange of the asset in the ISO code format. Find more information about the ISO codes at
	// the ISO org website. Defaults to empty string which queries all exchanges.
	Exchange *int `query:"exchange"`

	// Specify the CUSIP code of the asset you want to search for. Find more information about CUSIP codes at their
	// website. Defaults to empty string which queries all CUSIPs.
	//
	// Note: Although you can query by CUSIP, due to legal reasons we do not return the CUSIP in the response.
	CUSIP *int `query:"cusip"`

	// Specify the CIK of the asset you want to search for. Find more information about CIK codes at their website.
	// Defaults to empty string which queries all CIKs.
	CIK *int `query:"cik"`

	// Specify a point in time to retrieve tickers available on that date. Defaults to the most recent available date.
	Date *Date `query:"date"`

	// Specify if the tickers returned should be actively traded on the queried date. Default is true.
	Active *bool `query:"active"`

	// Search for terms within the ticker and/or company name.
	Search *string `query:"search"`

	// The field to sort the results on. Default is ticker. If the search query parameter is present, sort is ignored
	// and results are ordered by relevance.
	Sort *Sort `query:"sort"`

	// The order to sort the results on. Default is asc (ascending).
	Order *Order `query:"order"`

	// Limit the size of the response, default is 100 and max is 1000.
	Limit *int `query:"limit"`
}

ListTickersParams is the set of parameters for the ListTickers method.

func (ListTickersParams) WithActive

func (p ListTickersParams) WithActive(q bool) *ListTickersParams

func (ListTickersParams) WithCIK

func (p ListTickersParams) WithCIK(q int) *ListTickersParams

func (ListTickersParams) WithCUSIP

func (p ListTickersParams) WithCUSIP(q int) *ListTickersParams

func (ListTickersParams) WithDate

func (p ListTickersParams) WithDate(q Date) *ListTickersParams

func (ListTickersParams) WithExchange

func (p ListTickersParams) WithExchange(q int) *ListTickersParams

func (ListTickersParams) WithLimit

func (p ListTickersParams) WithLimit(q int) *ListTickersParams

func (ListTickersParams) WithMarket

func (ListTickersParams) WithOrder

func (p ListTickersParams) WithOrder(q Order) *ListTickersParams

func (ListTickersParams) WithSearch

func (p ListTickersParams) WithSearch(q string) *ListTickersParams

func (ListTickersParams) WithSort

func (p ListTickersParams) WithSort(q Sort) *ListTickersParams

func (ListTickersParams) WithTicker

func (ListTickersParams) WithType

type ListTickersResponse

type ListTickersResponse struct {
	BaseResponse

	// An array of tickers that match your query. Note: Although you can query by CUSIP, due to legal reasons we do not
	// return the CUSIP in the response.
	Results []Ticker `json:"results,omitempty"`
}

ListTickersResponse is the response returned by the ListTickers method.

type ListTradesParams

type ListTradesParams struct {
	// The ticker symbol to get trades for.
	Ticker string `validate:"required" path:"ticker"`

	// Query by trade timestamp. Either a date with the format YYYY-MM-DD or a nanosecond timestamp.
	TimestampEQ  *Nanos `query:"timestamp"`
	TimestampLT  *Nanos `query:"timestamp.lt"`
	TimestampLTE *Nanos `query:"timestamp.lte"`
	TimestampGT  *Nanos `query:"timestamp.gt"`
	TimestampGTE *Nanos `query:"timestamp.gte"`

	// Order results based on the sort field.
	Order *Order `query:"order"`

	// Limit the number of results returned, default is 10 and max is 50000.
	Limit *int `query:"limit"`

	// Sort field used for ordering.
	Sort *Sort `query:"sort"`
}

ListTradesParams is the set of parameters for the ListTrades method.

func (ListTradesParams) WithLimit

func (p ListTradesParams) WithLimit(q int) *ListTradesParams

func (ListTradesParams) WithOrder

func (p ListTradesParams) WithOrder(q Order) *ListTradesParams

func (ListTradesParams) WithSort

func (p ListTradesParams) WithSort(q Sort) *ListTradesParams

func (ListTradesParams) WithTimestamp

func (p ListTradesParams) WithTimestamp(c Comparator, q Nanos) *ListTradesParams

type ListTradesResponse

type ListTradesResponse struct {
	BaseResponse
	Results []Trade `json:"results,omitempty"`
}

ListTradesResponse is the response returned by the ListTrades method.

type MarketHoliday

type MarketHoliday struct {
	Exchange string `json:"exchange,omitempty"`
	Name     string `json:"name,omitempty"`
	Date     Date   `json:"date,omitempty"`
	Status   string `json:"status,omitempty"`
	Open     Time   `json:"open,omitempty"`
	Close    Time   `json:"close,omitempty"`
}

MarketHoliday represents a market holiday for a specific exchange.

type MarketLocale

type MarketLocale string

Locale is the market location.

const (
	US     MarketLocale = "us"
	Global MarketLocale = "global"
)

type MarketType

type MarketType string

MarketType is the type of market.

const (
	Stocks MarketType = "stocks"
	Forex  MarketType = "forex"
	Crypto MarketType = "crypto"
)

type Millis

type Millis time.Time

Millis represents a Unix time in milliseconds since January 1, 1970 UTC.

func (*Millis) MarshalJSON

func (m *Millis) MarshalJSON() ([]byte, error)

func (*Millis) UnmarshalJSON

func (m *Millis) UnmarshalJSON(data []byte) error

type MinuteSnapshot

type MinuteSnapshot struct {
	AccumulatedVolume     int     `json:"av,omitempty"`
	Close                 float64 `json:"c,omitempty"`
	High                  float64 `json:"h,omitempty"`
	Low                   float64 `json:"l,omitempty"`
	Open                  float64 `json:"o,omitempty"`
	Volume                float64 `json:"v,omitempty"`
	VolumeWeightedAverage float64 `json:"vw,omitempty"`
}

DaySnapshot is the most recent minute agg for a ticker.

type NameComparator added in v0.7.0

type NameComparator string

NameComparator is the type of comparison to make for the company_name query parameter in Stock Financials.

const (
	Full   NameComparator = "full"
	Search NameComparator = "search"
)

type Nanos

type Nanos time.Time

Nanos represents a Unix time in nanoseconds since January 1, 1970 UTC.

func (*Nanos) MarshalJSON

func (n *Nanos) MarshalJSON() ([]byte, error)

func (*Nanos) UnmarshalJSON

func (n *Nanos) UnmarshalJSON(data []byte) error

type OptionContractSnapshot

type OptionContractSnapshot struct {
	BreakEvenPrice    float64                         `json:"break_even_price,omitempty"`
	Day               DayOptionContractSnapshot       `json:"day,omitempty"`
	Details           OptionDetails                   `json:"details,omitempty"`
	Greeks            Greeks                          `json:"greeks,omitempty"`
	ImpliedVolatility float64                         `json:"implied_volatility,omitempty"`
	LastQuote         LastQuoteOptionContractSnapshot `json:"last_quote,omitempty"`
	OpenInterest      float64                         `json:"open_interest,omitempty"`
	UnderlyingAsset   UnderlyingAsset                 `json:"underlying_asset,omitempty"`
}

OptionContractSnapshot is a collection of data for an option contract ticker including the current day aggregate and the most recent quote.

type OptionDetails

type OptionDetails struct {
	ContractType      string  `json:"contract_type,omitempty"`
	ExerciseStyle     string  `json:"exercise_style,omitempty"`
	ExpirationDate    Date    `json:"expiration_date,omitempty"`
	SharesPerContract float64 `json:"shares_per_contract,omitempty"`
	StrikePrice       float64 `json:"strike_price,omitempty"`
	Ticker            string  `json:"ticker,omitempty"`
}

OptionDetails contains more detailed information about an option contract.

type Order

type Order string

Order the results. asc will return results in ascending order (oldest at the top), desc will return results in descending order (newest at the top).

const (
	Asc  Order = "asc"
	Desc Order = "desc"
)

type OrderBookQuote

type OrderBookQuote struct {
	Price            float64            `json:"p,omitempty"`
	ExchangeToShares map[string]float64 `json:"x,omitempty"`
}

OrderBookQuote contains quote information for a crypto ticker.

type PaginationHooks

type PaginationHooks struct {
	// If present, this value can be used to fetch the next page of data.
	NextURL string `json:"next_url,omitempty"`
}

PaginationHooks are links to next and/or previous pages. Embed this struct into an API response if the endpoint supports pagination.

func (PaginationHooks) NextPage added in v0.2.0

func (p PaginationHooks) NextPage() string

type Publisher added in v0.4.0

type Publisher struct {
	FaviconURL  string `json:"favicon_url,omitempty"`
	HomepageURL string `json:"homepage_url,omitempty"`
	LogoURL     string `json:"logo_url,omitempty"`
	Name        string `json:"name,omitempty"`
}

Publisher contains information on a new article publisher.

type Quote

type Quote struct {
	AskExchange          int     `json:"ask_exchange,omitempty"`
	AskPrice             float64 `json:"ask_price,omitempty"`
	AskSize              float64 `json:"ask_size,omitempty"`
	BidExchange          int     `json:"bid_exchange,omitempty"`
	BidPrice             float64 `json:"bid_price,omitempty"`
	BidSize              float64 `json:"bid_size,omitempty"`
	Conditions           []int32 `json:"conditions,omitempty"`
	Indicators           []int32 `json:"indicators,omitempty"`
	ParticipantTimestamp Nanos   `json:"participant_timestamp,omitempty"`
	SequenceNumber       Nanos   `json:"sequence_number,omitempty"`
	SipTimestamp         Nanos   `json:"sip_timestamp,omitempty"`
	Tape                 int32   `json:"tape,omitempty"`
	TrfTimestamp         Nanos   `json:"trf_timestamp,omitempty"`
}

Quote is an NBBO for a ticker symbol in a given time range.

type RequestOption

type RequestOption func(o *RequestOptions)

RequestOption changes the configuration of RequestOptions.

func APIKey

func APIKey(id string) RequestOption

APIKey sets an APIKey as an option.

func Header(key, value string) RequestOption

Header sets a header as an option.

func QueryParam

func QueryParam(key, value string) RequestOption

QueryParam sets a query param as an option.

type RequestOptions

type RequestOptions struct {
	// APIKey to pass with the request
	APIKey *string

	// Headers to apply to the request
	Headers http.Header

	// Query params to apply to the request
	QueryParams url.Values
}

RequestOptions are used to configure client calls.

type SIP

type SIP string

SIP is the type of Securies Information Processor.

const (
	CTA  SIP = "CTA"
	UTP  SIP = "UTP"
	OPRA SIP = "OPRA"
)

type SIPMapping added in v0.9.0

type SIPMapping struct {
	CTA  string `json:"CTA,omitempty"`
	OPRA string `json:"OPRA,omitempty"`
	UTP  string `json:"UTP,omitempty"`
}

SIPMapping maps a condition to symbols for each SIP.

type Sort

type Sort string

Sort is a query param type that specifies how the results should be sorted.

const (
	TickerSymbol       Sort = "ticker"
	Name               Sort = "name"
	Market             Sort = "market"
	Locale             Sort = "locale"
	PrimaryExchange    Sort = "primary_exchange"
	Type               Sort = "type"
	CurrencySymbol     Sort = "currency_symbol"
	CurrencyName       Sort = "currency_name"
	BaseCurrencySymbol Sort = "base_currency_symbol"
	BaseCurrencyName   Sort = "base_currency_name"
	CIK                Sort = "cik"
	CompositeFIGI      Sort = "composite_figi"
	ShareClassFIGI     Sort = "share_class_figi"
	PublishedUTC       Sort = "published_utc"
	LastUpdatedUTC     Sort = "last_updated_utc"
	DelistedUTC        Sort = "delisted_utc"
	Timestamp          Sort = "timestamp"
)

type Split

type Split struct {
	ExecutionDate string `json:"execution_date,omitempty"`
	SplitFrom     int64  `json:"split_from,omitempty"`
	SplitTo       int64  `json:"split_to,omitempty"`
	Ticker        string `json:"ticker,omitempty"`
}

Split contains detailed information on a specified stock split.

type StockFinancial added in v0.7.0

type StockFinancial struct {
	CIK                 string               `json:"cik,omitempty"`
	CompanyName         string               `json:"company_name,omitempty"`
	EndDate             string               `json:"end_date,omitempty"`
	FilingDate          string               `json:"filing_date,omitempty"`
	Financials          map[string]Financial `json:"financials,omitempty"`
	FiscalPeriod        string               `json:"fiscal_period,omitempty"`
	FiscalYear          string               `json:"fiscal_year,omitempty"`
	SourceFilingFileUrl string               `json:"source_filing_file_url,omitempty"`
	SourceFilingUrl     string               `json:"source_filing_url,omitempty"`
	StartDate           string               `json:"start_date,omitempty"`
}

StockFinancial contains detailed information on a specified stock financial.

type Ticker

type Ticker struct {
	Active                      bool           `json:"active"`
	Address                     CompanyAddress `json:"address,omitempty"`
	Branding                    Branding       `json:"branding,omitempty"`
	CIK                         string         `json:"cik,omitempty"`
	CompositeFIGI               string         `json:"composite_figi,omitempty"`
	CurrencyName                string         `json:"currency_name,omitempty"`
	DelistedUTC                 Time           `json:"delisted_utc,omitempty"`
	Description                 string         `json:"description,omitempty"`
	HomepageURL                 string         `json:"homepage_url,omitempty"`
	LastUpdatedUTC              Time           `json:"last_updated_utc,omitempty"`
	ListDate                    Date           `json:"list_date,omitempty"`
	Locale                      string         `json:"locale,omitempty"`
	Market                      string         `json:"market,omitempty"`
	MarketCap                   float64        `json:"market_cap,omitempty"`
	Name                        string         `json:"name,omitempty"`
	PhoneNumber                 string         `json:"phone_number,omitempty"`
	PrimaryExchange             string         `json:"primary_exchange,omitempty"`
	ShareClassFIGI              string         `json:"share_class_figi,omitempty"`
	ShareClassSharesOutstanding int64          `json:"share_class_shares_outstanding,omitempty"`
	SICCode                     string         `json:"sic_code,omitempty"`
	SICDescription              string         `json:"sic_description,omitempty"`
	Ticker                      string         `json:"ticker,omitempty"`
	TickerRoot                  string         `json:"ticker_root,omitempty"`
	TickerSuffix                string         `json:"ticker_suffix,omitempty"`
	TotalEmployees              int32          `json:"total_employees,omitempty"`
	Type                        string         `json:"type,omitempty"`
	WeightedSharesOutstanding   int64          `json:"weighted_shares_outstanding,omitempty"`
}

Ticker contains detailed information on a specified ticker symbol.

type TickerNews added in v0.4.0

type TickerNews struct {
	AMPURL       string    `json:"amp_url,omitempty"`
	ArticleURL   string    `json:"article_url,omitempty"`
	Author       string    `json:"author,omitempty"`
	Description  string    `json:"description,omitempty"`
	ID           string    `json:"id,omitempty"`
	ImageURL     string    `json:"image_url,omitempty"`
	Keywords     []string  `json:"keywords,omitempty"`
	PublishedUTC Time      `json:"published_utc,omitempty"`
	Publisher    Publisher `json:"publisher,omitempty"`
	Tickers      []string  `json:"tickers,omitempty"`
	Title        string    `json:"title,omitempty"`
}

TickerNews contains information on a ticker news article.

type TickerSnapshot

type TickerSnapshot struct {
	Day              DaySnapshot       `json:"day,omitempty"`
	LastQuote        LastQuoteSnapshot `json:"lastQuote,omitempty"`
	LastTrade        LastTradeSnapshot `json:"lastTrade,omitempty"`
	Minute           MinuteSnapshot    `json:"min,omitempty"`
	PrevDay          DaySnapshot       `json:"prevDay,omitempty"`
	Ticker           string            `json:"ticker,omitempty"`
	TodaysChange     float64           `json:"todaysChange,omitempty"`
	TodaysChangePerc float64           `json:"todaysChangePerc,omitempty"`
	Updated          Nanos             `json:"updated,omitempty"`
}

TickerSnapshot is a collection of data for a ticker including the current minute, day, and previous day's aggregate, as well as the last trade and quote.

type TickerType

type TickerType struct {
	AssetClass  string `json:"asset_class,omitempty"`
	Code        string `json:"code,omitempty"`
	Description string `json:"description,omitempty"`
	Locale      string `json:"locale,omitempty"`
}

TickerType represents a type of ticker with a code that the API understands.

type Time

type Time time.Time

Time represents a long date string of the following format: "2006-01-02T15:04:05.000Z".

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type Timeframe added in v0.7.0

type Timeframe string

TimeFrame is the type of time frame query parameter for stock financials.

const (
	TFAnnual    Timeframe = "annual"
	TFQuarterly Timeframe = "quarterly"
)

type Timespan added in v0.9.0

type Timespan string

Timespan is the size of the time window.

const (
	Minute  Timespan = "minute"
	Hour    Timespan = "hour"
	Day     Timespan = "day"
	Week    Timespan = "week"
	Month   Timespan = "month"
	Quarter Timespan = "quarter"
	Year    Timespan = "year"
)

type Trade

type Trade struct {
	Conditions           []int32 `json:"conditions,omitempty"`
	Correction           int     `json:"correction,omitempty"`
	Exchange             int     `json:"exchange,omitempty"`
	ID                   string  `json:"id,omitempty"`
	ParticipantTimestamp Nanos   `json:"participant_timestamp,omitempty"`
	Price                float64 `json:"price,omitempty"`
	SequenceNumber       int64   `json:"sequence_number,omitempty"`
	SipTimestamp         Nanos   `json:"sip_timestamp,omitempty"`
	Size                 float64 `json:"size,omitempty"`
	Tape                 int32   `json:"tape,omitempty"`
	TrfID                int     `json:"trf_id,omitempty"`
	TrfTimestamp         Nanos   `json:"trf_timestamp,omitempty"`
}

Trade contains trade data for a specified ticker symbol.

type UnderlyingAsset

type UnderlyingAsset struct {
	ChangeToBreakEven float64 `json:"change_to_break_even,omitempty"`
	LastUpdated       int64   `json:"last_updated,omitempty"`
	Price             float64 `json:"price,omitempty"`
	Ticker            string  `json:"ticker,omitempty"`
	Timeframe         string  `json:"timeframe,omitempty"`
}

UnderlyingAsset contains information on the underlying stock for this options contract.

type UpdateRules added in v0.9.0

type UpdateRules struct {
	Consolidated struct {
		UpdatesHighLow   bool `json:"updates_high_low,omitempty"`
		UpdatesOpenClose bool `json:"updates_open_close,omitempty"`
		UpdatesVolume    bool `json:"updates_volume,omitempty"`
	} `json:"consolidated,omitempty"`
	MarketCenter struct {
		UpdatesHighLow   bool `json:"updates_high_low,omitempty"`
		UpdatesOpenClose bool `json:"updates_open_close,omitempty"`
		UpdatesVolume    bool `json:"updates_volume,omitempty"`
	} `json:"market_center,omitempty"`
}

UpdateRules is a list of aggregation rules.

Jump to

Keyboard shortcuts

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