models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 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"`
	Volume            float64 `json:"v,omitempty"`
	VWAP              float64 `json:"vw,omitempty"`
	AggregateVWAP     float64 `json:"a,omitempty"`
	Open              float64 `json:"o,omitempty"`
	Close             float64 `json:"c,omitempty"`
	High              float64 `json:"h,omitempty"`
	Low               float64 `json:"l,omitempty"`
	Timestamp         *Millis `json:"t,omitempty"`
	Transactions      int64   `json:"n,omitempty"`
	Market            string  `json:"m,omitempty"`
	Exchange          int32   `json:"x,omitempty"`
	Locale            string  `json:"g,omitempty"`
	OfficialOpenPrice float64 `json:"op,omitempty"`
	AverageSize       float64 `json:"z,omitempty"`
	AccumulatedVolume float64 `json:"av,omitempty"`
	StartTimestamp    *Millis `json:"s,omitempty"`
	EndTimestamp      *Millis `json:"e,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 {
	Status       string `json:"status,omitempty"`
	RequestID    string `json:"request_id,omitempty"`
	Count        int    `json:"count,omitempty"`
	Message      string `json:"message,omitempty"`
	ErrorMessage string `json:"error,omitempty"`

	PaginationHooks
}

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"`
	AccentColor string `json:"accent_color,omitempty"`
	LightColor  string `json:"light_color,omitempty"`
	DarkColor   string `json:"dark_color,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"`
	City       string `json:"city,omitempty"`
	State      string `json:"state,omitempty"`
	Country    string `json:"country,omitempty"`
	PostalCode string `json:"postal_code,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   map[string]string          `json:"sip_mapping,omitempty"`
	Type         string                     `json:"type,omitempty"`
	UpdateRules  map[string]map[string]bool `json:"update_rules,omitempty"`
}

Condition contains detailed information on a specified condition.

type CryptoTrade

type CryptoTrade struct {
	Price      float64 `json:"price,omitempty"`
	Size       float64 `json:"size,omitempty"`
	Exchange   int     `json:"exchange,omitempty"`
	Conditions []int   `json:"conditions,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"`
}

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"`
}

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 {
	StatusCode int
	BaseResponse
}

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 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 GetAggsParams

type GetAggsParams struct {
	Ticker     string     `validate:"required" path:"ticker"`
	Multiplier int        `validate:"required" path:"multiplier"`
	Resolution Resolution `validate:"required" path:"resolution"`
	From       Millis     `validate:"required" path:"from"`
	To         Millis     `validate:"required" path:"to"`

	Order    *Order `query:"sort"`
	Limit    *int   `query:"limit"`
	Adjusted *bool  `query:"adjusted"`
	Explain  *bool  `query:"explain"`
}

GetAggsParams is the set of parameters for the GetAggs method.

func (GetAggsParams) WithAdjusted

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

func (GetAggsParams) WithExplain

func (p GetAggsParams) WithExplain(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 {
	Locale     MarketLocale `validate:"required" path:"locale"`
	MarketType MarketType   `validate:"required" path:"marketType"`

	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 SnapshotTickerFullBook `json:"data,omitempty"`
}

GetCryptoFullBookSnapshotResponse is the response returned by the GetCryptoFullBookSnapshot method.

type GetDailyOpenCloseAggParams

type GetDailyOpenCloseAggParams struct {
	Ticker string `validate:"required" path:"ticker"`
	Date   Date   `validate:"required" path:"date"`

	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 {
	AssetClass *AssetClass   `query:"asset_class,omitempty"`
	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 {
	Locale     MarketLocale `validate:"required" path:"locale"`
	MarketType MarketType   `validate:"required" path:"marketType"`
	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 {
	Locale     MarketLocale `validate:"required" path:"locale"`
	MarketType MarketType   `validate:"required" path:"marketType"`
	Date       Date         `validate:"required" path:"date"`

	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 {
	From string `validate:"required" path:"from"`
	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 {
	From string `validate:"required" path:"from"`
	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 {
	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 {
	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 {
	Ticker string `validate:"required" path:"ticker"`

	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 GetTickerDetailsParams

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

	Date *Date `query:"date"`
}

GetTickerDetailsParams is the set of parameters for the GetTickerDetails method.

func (GetTickerDetailsParams) WithDate

type GetTickerDetailsResponse

type GetTickerDetailsResponse struct {
	BaseResponse
	Results Ticker `json:"results,omitempty"`
}

GetTickerDetailsResponse is the response returned by the GetTickerDetails method.

type GetTickerSnapshotParams

type GetTickerSnapshotParams struct {
	Locale     MarketLocale `validate:"required" path:"locale"`
	MarketType MarketType   `validate:"required" path:"marketType"`
	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 {
	AssetClass *AssetClass   `query:"asset_class"`
	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
	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"`
}

type LastQuote

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

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"`
}

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"`
}

type ListConditionsParams

type ListConditionsParams struct {
	AssetClass *AssetClass `query:"asset_class,omitempty"`
	DataType   *DataType   `query:"data_type,omitempty"`
	ID         *int64      `query:"id,omitempty"`
	SIP        *SIP        `query:"sip,omitempty"`

	Sort  *Sort  `query:"sort"`
	Order *Order `query:"order"`
	Limit *int   `query:"limit"`
}

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 {
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	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"`

	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"`

	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"`

	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"`

	Frequency *Frequency `query:"frequency"`

	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"`

	DividendType *DividendType `query:"dividend_type"`

	Sort  *Sort  `query:"sort"`
	Order *Order `query:"order"`
	Limit *int   `query:"limit"`
}

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 {
	Ticker string `validate:"required" path:"ticker"`

	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 *Order `query:"order"`
	Limit *int   `query:"limit"`
	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 {
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	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"`

	ReverseSplit *bool `query:"reverse_split"`

	Sort  *Sort  `query:"sort"`
	Order *Order `query:"order"`
	Limit *int   `query:"limit"`
}

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 ListTickersParams

type ListTickersParams struct {
	TickerEQ  *string `query:"ticker"`
	TickerLT  *string `query:"ticker.lt"`
	TickerLTE *string `query:"ticker.lte"`
	TickerGT  *string `query:"ticker.gt"`
	TickerGTE *string `query:"ticker.gte"`

	Type     *string     `query:"type"`
	Market   *AssetClass `query:"market"`
	Exchange *int        `query:"exchange"`
	CUSIP    *int        `query:"cusip"`
	CIK      *int        `query:"cik"`
	Date     *Date       `query:"date"`
	Active   *bool       `query:"active"`

	Sort  *Sort  `query:"sort"`
	Order *Order `query:"order"`
	Limit *int   `query:"limit"`

	PageMarker *string `query:"page_marker"`
	Search     *string `query:"search"`
}

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) WithPageMarker

func (p ListTickersParams) WithPageMarker(q string) *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
	Results []Ticker `json:"results,omitempty"`
}

ListTickersResponse is the response returned by the ListTickers method.

type ListTradesParams

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

	TimestampEQ  *Nanos `query:"timestamp"`
	TimestampLT  *Nanos `query:"timestamp.lt"`
	TimestampLTE *Nanos `query:"timestamp.lte"`
	TimestampGT  *Nanos `query:"timestamp.gt"`
	TimestampGTE *Nanos `query:"timestamp.gte"`

	Sort  *Sort  `query:"sort"`
	Order *Order `query:"order"`
	Limit *int   `query:"limit"`
}

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"`
}

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"`
}

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"`
}

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"`
}

type PaginationHooks

type PaginationHooks struct {
	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 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 Resolution

type Resolution string

Resolution is the size of the time window.

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

type SIP

type SIP string

SIP is the type of Securies Information Processor.

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

type SnapshotTickerFullBook

type SnapshotTickerFullBook 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"`
}

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"
	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 Ticker

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

Ticker contains detailed information on a specified ticker symbol.

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 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"`
}

Jump to

Keyboard shortcuts

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