marketdata

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OneMin   = NewTimeFrame(1, Min)
	OneHour  = NewTimeFrame(1, Hour)
	OneDay   = NewTimeFrame(1, Day)
	OneWeek  = NewTimeFrame(1, Week)
	OneMonth = NewTimeFrame(1, Month)
)
View Source
var DefaultClient = NewClient(ClientOpts{})

DefaultClient uses options from environment variables, or the defaults.

Functions

func GetCryptoMultiBars

func GetCryptoMultiBars(symbols []string, req GetCryptoBarsRequest) (map[string][]CryptoBar, error)

GetCryptoMultiBars returns the bars for the given crypto symbols.

func GetCryptoMultiQuotes added in v3.2.0

func GetCryptoMultiQuotes(symbols []string, req GetCryptoQuotesRequest) (map[string][]CryptoQuote, error)

GetCryptoMultiQuotes returns quotes for the given crypto symbols.

func GetCryptoMultiTrades

func GetCryptoMultiTrades(symbols []string, req GetCryptoTradesRequest) (map[string][]CryptoTrade, error)

GetCryptoMultiTrades returns trades for the given crypto symbols.

func GetCryptoSnapshots

func GetCryptoSnapshots(symbols []string, req GetCryptoSnapshotRequest) (map[string]CryptoSnapshot, error)

GetCryptoSnapshots returns the snapshots for the given crypto symbols

func GetLatestBars

func GetLatestBars(symbols []string, req GetLatestBarRequest) (map[string]Bar, error)

GetLatestBars returns the latest minute bars for the given symbols.

func GetLatestCryptoBars

func GetLatestCryptoBars(symbols []string, req GetLatestCryptoBarRequest) (map[string]CryptoBar, error)

GetLatestCryptoBars returns the latest bars for the given crypto symbols

func GetLatestCryptoQuotes

func GetLatestCryptoQuotes(symbols []string, req GetLatestCryptoQuoteRequest) (map[string]CryptoQuote, error)

GetLatestCryptoQuotes returns the latest quotes for the given crypto symbols

func GetLatestCryptoTrades

func GetLatestCryptoTrades(symbols []string, req GetLatestCryptoTradeRequest) (map[string]CryptoTrade, error)

GetLatestCryptoTrades returns the latest trades for the given crypto symbols

func GetLatestOptionQuotes added in v3.3.0

func GetLatestOptionQuotes(symbols []string, req GetLatestOptionQuoteRequest) (map[string]OptionQuote, error)

GetLatestOptionQuotes returns the latest option quotes for the given symbols

func GetLatestOptionTrades added in v3.3.0

func GetLatestOptionTrades(symbols []string, req GetLatestOptionTradeRequest) (map[string]OptionTrade, error)

GetLatestOptionTrades returns the latest option trades for the given symbols

func GetLatestQuotes

func GetLatestQuotes(symbols []string, req GetLatestQuoteRequest) (map[string]Quote, error)

GetLatestQuotes returns the latest quotes for the given symbols.

func GetLatestTrades

func GetLatestTrades(symbols []string, req GetLatestTradeRequest) (map[string]Trade, error)

GetLatestTrades returns the latest trades for the given symbols.

func GetMultiAuctions

func GetMultiAuctions(symbols []string, req GetAuctionsRequest) (map[string][]DailyAuctions, error)

GetMultiAuctions returns the auctions for the given symbols.

func GetMultiBars

func GetMultiBars(symbols []string, req GetBarsRequest) (map[string][]Bar, error)

GetMultiBars returns the bars for the given symbols.

func GetMultiOptionBars added in v3.3.0

func GetMultiOptionBars(symbols []string, req GetOptionBarsRequest) (map[string][]OptionBar, error)

GetMultiOptionBars returns bars for the given symbols.

func GetMultiQuotes

func GetMultiQuotes(symbols []string, req GetQuotesRequest) (map[string][]Quote, error)

GetMultiQuotes returns the quotes for the given symbols.

func GetMultiTrades

func GetMultiTrades(symbols []string, req GetTradesRequest) (map[string][]Trade, error)

GetMultiTrades returns the trades for the given symbols.

func GetOptionChain added in v3.3.0

func GetOptionChain(underlyingSymbol string, req GetOptionChainRequest) (map[string]OptionSnapshot, error)

GetOptionChain returns the snapshot chain for an underlying symbol (e.g. AAPL)

func GetOptionMultiTrades added in v3.3.0

func GetOptionMultiTrades(symbols []string, req GetOptionTradesRequest) (map[string][]OptionTrade, error)

GetOptionMultiTrades returns option trades for the given symbols.

func GetOptionSnapshots added in v3.3.0

func GetOptionSnapshots(symbols []string, req GetOptionSnapshotRequest) (map[string]OptionSnapshot, error)

GetOptionSnapshots returns the snapshots for multiple symbols

func GetSnapshots

func GetSnapshots(symbols []string, req GetSnapshotRequest) (map[string]*Snapshot, error)

GetSnapshots returns the snapshots for a multiple symbols

Types

type Adjustment

type Adjustment string

Adjustment specifies the corporate action adjustment(s) for the bars

const (
	Raw      Adjustment = "raw"
	Split    Adjustment = "split"
	Dividend Adjustment = "dividend"
	All      Adjustment = "all"
)

List of adjustments

type Auction

type Auction struct {
	Timestamp time.Time `json:"t"`
	Price     float64   `json:"p"`
	Size      uint32    `json:"s"`
	Exchange  string    `json:"x"`
	Condition string    `json:"c"`
}

Auction is a special trade that represents a stock auction

func (Auction) MarshalEasyJSON

func (v Auction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Auction) MarshalJSON

func (v Auction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Auction) UnmarshalEasyJSON

func (v *Auction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Auction) UnmarshalJSON

func (v *Auction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Bar

type Bar struct {
	Timestamp  time.Time `json:"t"`
	Open       float64   `json:"o"`
	High       float64   `json:"h"`
	Low        float64   `json:"l"`
	Close      float64   `json:"c"`
	Volume     uint64    `json:"v"`
	TradeCount uint64    `json:"n"`
	VWAP       float64   `json:"vw"`
}

Bar is an aggregate of trades

func GetBars

func GetBars(symbol string, req GetBarsRequest) ([]Bar, error)

GetBars returns the bars for the given symbol.

func GetLatestBar

func GetLatestBar(symbol string, req GetLatestBarRequest) (*Bar, error)

GetLatestBar returns the latest minute bar for a given symbol.

func (Bar) MarshalEasyJSON

func (v Bar) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Bar) MarshalJSON

func (v Bar) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Bar) UnmarshalEasyJSON

func (v *Bar) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Bar) UnmarshalJSON

func (v *Bar) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CashDividend added in v3.3.0

type CashDividend struct {
	Symbol         string      `json:"symbol"`
	Rate           float64     `json:"rate"`
	Foreign        bool        `json:"foreign"`
	Special        bool        `json:"special"`
	ProcessDate    civil.Date  `json:"process_date"`
	ExDate         civil.Date  `json:"ex_date"`
	RecordDate     *civil.Date `json:"record_date,omitempty"`
	PayableDate    *civil.Date `json:"payable_date,omitempty"`
	DueBillOffDate *civil.Date `json:"due_bill_off_date,omitempty"`
	DueBillOnDate  *civil.Date `json:"due_bill_on_date,omitempty"`
}

func (CashDividend) MarshalEasyJSON added in v3.3.0

func (v CashDividend) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CashDividend) MarshalJSON added in v3.3.0

func (v CashDividend) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CashDividend) UnmarshalEasyJSON added in v3.3.0

func (v *CashDividend) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CashDividend) UnmarshalJSON added in v3.3.0

func (v *CashDividend) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CashMerger added in v3.3.0

type CashMerger struct {
	AcquirerSymbol *string     `json:"acquirer_symbol,omitempty"`
	AcquireeSymbol string      `json:"acquiree_symbol"`
	Rate           float64     `json:"rate"`
	ProcessDate    civil.Date  `json:"process_date"`
	EffectiveDate  civil.Date  `json:"effective_date"`
	PayableDate    *civil.Date `json:"payable_date,omitempty"`
}

func (CashMerger) MarshalEasyJSON added in v3.3.0

func (v CashMerger) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CashMerger) MarshalJSON added in v3.3.0

func (v CashMerger) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CashMerger) UnmarshalEasyJSON added in v3.3.0

func (v *CashMerger) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CashMerger) UnmarshalJSON added in v3.3.0

func (v *CashMerger) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the alpaca marketdata Client.

func NewClient

func NewClient(opts ClientOpts) *Client

NewClient creates a new marketdata client using the given opts.

func (*Client) GetAuctions

func (c *Client) GetAuctions(symbol string, req GetAuctionsRequest) ([]DailyAuctions, error)

GetAuctions returns the auctions for the given symbol.

func (*Client) GetBars

func (c *Client) GetBars(symbol string, req GetBarsRequest) ([]Bar, error)

GetBars returns a slice of bars for the given symbol.

func (*Client) GetCorporateActions added in v3.3.0

func (c *Client) GetCorporateActions(req GetCorporateActionsRequest) (CorporateActions, error)

GetCorporateActions returns the corporate actions based on the given req.

func (*Client) GetCryptoBars

func (c *Client) GetCryptoBars(symbol string, req GetCryptoBarsRequest) ([]CryptoBar, error)

GetCryptoBars returns a slice of bars for the given crypto symbol.

func (*Client) GetCryptoMultiBars

func (c *Client) GetCryptoMultiBars(symbols []string, req GetCryptoBarsRequest) (map[string][]CryptoBar, error)

GetCryptoMultiBars returns bars for the given crypto symbols.

func (*Client) GetCryptoMultiQuotes added in v3.2.0

func (c *Client) GetCryptoMultiQuotes(symbols []string, req GetCryptoQuotesRequest) (map[string][]CryptoQuote, error)

GetMultiQuotes returns quotes for the given crypto symbols.

func (*Client) GetCryptoMultiTrades

func (c *Client) GetCryptoMultiTrades(symbols []string, req GetCryptoTradesRequest) (map[string][]CryptoTrade, error)

GetMultiTrades returns trades for the given crypto symbols.

func (*Client) GetCryptoQuotes added in v3.2.0

func (c *Client) GetCryptoQuotes(symbol string, req GetCryptoQuotesRequest) ([]CryptoQuote, error)

GetCryptoQuotes returns the trades for the given crypto symbol.

func (*Client) GetCryptoSnapshot

func (c *Client) GetCryptoSnapshot(symbol string, req GetCryptoSnapshotRequest) (*CryptoSnapshot, error)

GetCryptoSnapshot returns the snapshot for a given crypto symbol

func (*Client) GetCryptoSnapshots

func (c *Client) GetCryptoSnapshots(symbols []string, req GetCryptoSnapshotRequest) (map[string]CryptoSnapshot, error)

GetCryptoSnapshots returns the snapshots for the given crypto symbols

func (*Client) GetCryptoTrades

func (c *Client) GetCryptoTrades(symbol string, req GetCryptoTradesRequest) ([]CryptoTrade, error)

GetCryptoTrades returns the trades for the given crypto symbol.

func (*Client) GetLatestBar

func (c *Client) GetLatestBar(symbol string, req GetLatestBarRequest) (*Bar, error)

GetLatestBar returns the latest minute bar for a given symbol

func (*Client) GetLatestBars

func (c *Client) GetLatestBars(symbols []string, req GetLatestBarRequest) (map[string]Bar, error)

GetLatestBars returns the latest minute bars for the given symbols

func (*Client) GetLatestCryptoBar

func (c *Client) GetLatestCryptoBar(symbol string, req GetLatestCryptoBarRequest) (*CryptoBar, error)

GetLatestCryptoBar returns the latest bar for a given crypto symbol

func (*Client) GetLatestCryptoBars

func (c *Client) GetLatestCryptoBars(symbols []string, req GetLatestCryptoBarRequest) (map[string]CryptoBar, error)

GetLatestCryptoBars returns the latest bars for the given crypto symbols

func (*Client) GetLatestCryptoQuote

func (c *Client) GetLatestCryptoQuote(symbol string, req GetLatestCryptoQuoteRequest) (*CryptoQuote, error)

GetLatestCryptoQuote returns the latest quote for a given crypto symbol

func (*Client) GetLatestCryptoQuotes

func (c *Client) GetLatestCryptoQuotes(symbols []string, req GetLatestCryptoQuoteRequest) (map[string]CryptoQuote, error)

GetLatestCryptoQuotes returns the latest quotes for the given crypto symbols

func (*Client) GetLatestCryptoTrade

func (c *Client) GetLatestCryptoTrade(symbol string, req GetLatestCryptoTradeRequest) (*CryptoTrade, error)

GetLatestCryptoTrade returns the latest trade for a given crypto symbol

func (*Client) GetLatestCryptoTrades

func (c *Client) GetLatestCryptoTrades(symbols []string, req GetLatestCryptoTradeRequest) (map[string]CryptoTrade, error)

GetLatestCryptoTrades returns the latest trades for the given crypto symbols

func (*Client) GetLatestOptionQuote added in v3.3.0

func (c *Client) GetLatestOptionQuote(symbol string, req GetLatestOptionQuoteRequest) (*OptionQuote, error)

GetLatestOptionQuote returns the latest option quote for a given symbol

func (*Client) GetLatestOptionQuotes added in v3.3.0

func (c *Client) GetLatestOptionQuotes(symbols []string, req GetLatestOptionQuoteRequest) (map[string]OptionQuote, error)

GetLatestOptionQuotes returns the latest option quotes for the given symbols

func (*Client) GetLatestOptionTrade added in v3.3.0

func (c *Client) GetLatestOptionTrade(symbol string, req GetLatestOptionTradeRequest) (*OptionTrade, error)

GetLatestOptionTrade returns the latest option trade for a given symbol

func (*Client) GetLatestOptionTrades added in v3.3.0

func (c *Client) GetLatestOptionTrades(symbols []string, req GetLatestOptionTradeRequest) (map[string]OptionTrade, error)

GetLatestOptionTrades returns the latest option trades for the given symbols

func (*Client) GetLatestQuote

func (c *Client) GetLatestQuote(symbol string, req GetLatestQuoteRequest) (*Quote, error)

GetLatestQuote returns the latest quote for a given symbol

func (*Client) GetLatestQuotes

func (c *Client) GetLatestQuotes(symbols []string, req GetLatestQuoteRequest) (map[string]Quote, error)

GetLatestQuotes returns the latest quotes for the given symbols

func (*Client) GetLatestTrade

func (c *Client) GetLatestTrade(symbol string, req GetLatestTradeRequest) (*Trade, error)

GetLatestTrade returns the latest trade for a given symbol

func (*Client) GetLatestTrades

func (c *Client) GetLatestTrades(symbols []string, req GetLatestTradeRequest) (map[string]Trade, error)

GetLatestTrades returns the latest trades for the given symbols

func (*Client) GetMultiAuctions

func (c *Client) GetMultiAuctions(
	symbols []string, req GetAuctionsRequest,
) (map[string][]DailyAuctions, error)

GetMultiAuctions returns auctions for the given symbols.

func (*Client) GetMultiBars

func (c *Client) GetMultiBars(symbols []string, req GetBarsRequest) (map[string][]Bar, error)

GetMultiBars returns bars for the given symbols.

func (*Client) GetMultiOptionBars added in v3.3.0

func (c *Client) GetMultiOptionBars(symbols []string, req GetOptionBarsRequest) (map[string][]OptionBar, error)

GetMultiOptionBars returns bars for the given symbols.

func (*Client) GetMultiQuotes

func (c *Client) GetMultiQuotes(symbols []string, req GetQuotesRequest) (map[string][]Quote, error)

GetMultiQuotes returns quotes for the given symbols.

func (*Client) GetMultiTrades

func (c *Client) GetMultiTrades(symbols []string, req GetTradesRequest) (map[string][]Trade, error)

GetMultiTrades returns trades for the given symbols.

func (*Client) GetNews

func (c *Client) GetNews(req GetNewsRequest) ([]News, error)

GetNews returns the news articles based on the given req.

func (*Client) GetOptionBars added in v3.3.0

func (c *Client) GetOptionBars(symbol string, req GetOptionBarsRequest) ([]OptionBar, error)

GetOptionBars returns a slice of bars for the given symbol.

func (*Client) GetOptionChain added in v3.3.0

func (c *Client) GetOptionChain(underlyingSymbol string, req GetOptionChainRequest) (map[string]OptionSnapshot, error)

GetOptionChain returns the snapshot chain for an underlying symbol (e.g. AAPL)

func (*Client) GetOptionMultiTrades added in v3.3.0

func (c *Client) GetOptionMultiTrades(symbols []string, req GetOptionTradesRequest) (map[string][]OptionTrade, error)

GetOptionMultiTrades returns option trades for the given symbols.

func (*Client) GetOptionSnapshot added in v3.3.0

func (c *Client) GetOptionSnapshot(symbol string, req GetOptionSnapshotRequest) (*OptionSnapshot, error)

GetOptionSnapshot returns the snapshot for a given symbol

func (*Client) GetOptionSnapshots added in v3.3.0

func (c *Client) GetOptionSnapshots(symbols []string, req GetOptionSnapshotRequest) (map[string]OptionSnapshot, error)

GetOptionSnapshots returns the snapshots for multiple symbols

func (*Client) GetOptionTrades added in v3.3.0

func (c *Client) GetOptionTrades(symbol string, req GetOptionTradesRequest) ([]OptionTrade, error)

GetOptionTrades returns the option trades for the given symbol.

func (*Client) GetQuotes

func (c *Client) GetQuotes(symbol string, req GetQuotesRequest) ([]Quote, error)

GetQuotes returns the quotes for the given symbol.

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(symbol string, req GetSnapshotRequest) (*Snapshot, error)

GetSnapshot returns the snapshot for a given symbol

func (*Client) GetSnapshots

func (c *Client) GetSnapshots(symbols []string, req GetSnapshotRequest) (map[string]*Snapshot, error)

GetSnapshots returns the snapshots for multiple symbol

func (*Client) GetTrades

func (c *Client) GetTrades(symbol string, req GetTradesRequest) ([]Trade, error)

GetTrades returns the trades for the given symbol.

type ClientOpts

type ClientOpts struct {
	APIKey     string
	APISecret  string
	OAuth      string
	BaseURL    string
	RetryLimit int
	RetryDelay time.Duration
	// Feed is the default feed to be used by all requests. Can be overridden per request.
	Feed Feed
	// CryptoFeed is the default crypto feed to be used by all requests. Can be overridden per request.
	CryptoFeed CryptoFeed
	// Currency is the default currency to be used by all requests. Can be overridden per request.
	// For the latest endpoints this is the only way to set this parameter.
	Currency string
	// HTTPClient to be used for each http request.
	HTTPClient *http.Client
	// Host used to set the http request's host
	RequestHost string
}

ClientOpts contains options for the alpaca marketdata client.

Currently it contains the exact same options as the trading alpaca client, but there is no guarantee that this will remain the case.

type CorporateActions added in v3.3.0

type CorporateActions struct {
	ReverseSplits       []ReverseSplit       `json:"reverse_splits,omitempty"`
	ForwardSplits       []ForwardSplit       `json:"forward_splits,omitempty"`
	UnitSplits          []UnitSplit          `json:"unit_splits,omitempty"`
	CashDividends       []CashDividend       `json:"cash_dividends,omitempty"`
	CashMergers         []CashMerger         `json:"cash_mergers,omitempty"`
	StockMergers        []StockMerger        `json:"stock_mergers,omitempty"`
	StockAndCashMergers []StockAndCashMerger `json:"stock_and_cash_mergers,omitempty"`
	StockDividends      []StockDividend      `json:"stock_dividends,omitempty"`
	Redemptions         []Redemption         `json:"redemptions,omitempty"`
	SpinOffs            []SpinOff            `json:"spin_offs,omitempty"`
	NameChanges         []NameChange         `json:"name_changes,omitempty"`
	WorthlessRemovals   []WorthlessRemoval   `json:"worthless_removals,omitempty"`
	RightsDistributions []RightsDistribution `json:"rights_distributions,omitempty"`
}

CorporateActions contains corporate actions grouped by type

func GetCorporateActions added in v3.3.0

func GetCorporateActions(req GetCorporateActionsRequest) (CorporateActions, error)

GetCorporateActions returns the corporate actions based on the given req.

func (CorporateActions) MarshalEasyJSON added in v3.3.0

func (v CorporateActions) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CorporateActions) MarshalJSON added in v3.3.0

func (v CorporateActions) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CorporateActions) UnmarshalEasyJSON added in v3.3.0

func (v *CorporateActions) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CorporateActions) UnmarshalJSON added in v3.3.0

func (v *CorporateActions) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CryptoBar

type CryptoBar struct {
	Timestamp  time.Time `json:"t"`
	Open       float64   `json:"o"`
	High       float64   `json:"h"`
	Low        float64   `json:"l"`
	Close      float64   `json:"c"`
	Volume     float64   `json:"v"`
	TradeCount uint64    `json:"n"`
	VWAP       float64   `json:"vw"`
}

CryptoBar is an aggregate of crypto trades

func GetCryptoBars

func GetCryptoBars(symbol string, req GetCryptoBarsRequest) ([]CryptoBar, error)

GetCryptoBars returns the bars for the given crypto symbol.

func GetLatestCryptoBar

func GetLatestCryptoBar(symbol string, req GetLatestCryptoBarRequest) (*CryptoBar, error)

GetLatestCryptoBar returns the latest bar for a given crypto symbol

func (CryptoBar) MarshalEasyJSON

func (v CryptoBar) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CryptoBar) MarshalJSON

func (v CryptoBar) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CryptoBar) UnmarshalEasyJSON

func (v *CryptoBar) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CryptoBar) UnmarshalJSON

func (v *CryptoBar) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CryptoFeed

type CryptoFeed = string

CryptoFeed defines the source feed of crypto data.

const (
	// US is the crypto feed for the United States.
	US CryptoFeed = "us"
)

type CryptoQuote

type CryptoQuote struct {
	Timestamp time.Time `json:"t"`
	BidPrice  float64   `json:"bp"`
	BidSize   float64   `json:"bs"`
	AskPrice  float64   `json:"ap"`
	AskSize   float64   `json:"as"`
}

CryptoQuote is crypto quote

func GetCryptoQuotes added in v3.2.0

func GetCryptoQuotes(symbol string, req GetCryptoQuotesRequest) ([]CryptoQuote, error)

GetCryptoQuotes returns the quotes for the given crypto symbol.

func GetLatestCryptoQuote

func GetLatestCryptoQuote(symbol string, req GetLatestCryptoQuoteRequest) (*CryptoQuote, error)

GetLatestCryptoQuote returns the latest quote for a given crypto symbol

func (CryptoQuote) MarshalEasyJSON

func (v CryptoQuote) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CryptoQuote) MarshalJSON

func (v CryptoQuote) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CryptoQuote) UnmarshalEasyJSON

func (v *CryptoQuote) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CryptoQuote) UnmarshalJSON

func (v *CryptoQuote) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CryptoSnapshot

type CryptoSnapshot struct {
	LatestTrade  *CryptoTrade `json:"latestTrade"`
	LatestQuote  *CryptoQuote `json:"latestQuote"`
	MinuteBar    *CryptoBar   `json:"minuteBar"`
	DailyBar     *CryptoBar   `json:"dailyBar"`
	PrevDailyBar *CryptoBar   `json:"prevDailyBar"`
}

CryptoSnapshot is a snapshot of a crypto symbol

func GetCryptoSnapshot

func GetCryptoSnapshot(symbol string, req GetCryptoSnapshotRequest) (*CryptoSnapshot, error)

GetCryptoSnapshot returns the snapshot for a given crypto symbol

func (CryptoSnapshot) MarshalEasyJSON

func (v CryptoSnapshot) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CryptoSnapshot) MarshalJSON

func (v CryptoSnapshot) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CryptoSnapshot) UnmarshalEasyJSON

func (v *CryptoSnapshot) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CryptoSnapshot) UnmarshalJSON

func (v *CryptoSnapshot) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CryptoSnapshots

type CryptoSnapshots struct {
	Snapshots map[string]CryptoSnapshot `json:"snapshots"`
}

CryptoSnapshots is the snapshots for multiple crypto symbols

func (CryptoSnapshots) MarshalEasyJSON

func (v CryptoSnapshots) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CryptoSnapshots) MarshalJSON

func (v CryptoSnapshots) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CryptoSnapshots) UnmarshalEasyJSON

func (v *CryptoSnapshots) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CryptoSnapshots) UnmarshalJSON

func (v *CryptoSnapshots) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CryptoTrade

type CryptoTrade struct {
	Timestamp time.Time `json:"t"`
	Price     float64   `json:"p"`
	Size      float64   `json:"s"`
	ID        int64     `json:"i"`
	TakerSide TakerSide `json:"tks"`
}

CryptoTrade is a crypto trade

func GetCryptoTrades

func GetCryptoTrades(symbol string, req GetCryptoTradesRequest) ([]CryptoTrade, error)

GetCryptoTrades returns the trades for the given crypto symbol.

func GetLatestCryptoTrade

func GetLatestCryptoTrade(symbol string, req GetLatestCryptoTradeRequest) (*CryptoTrade, error)

GetLatestCryptoTrade returns the latest trade for a given crypto symbol

func (CryptoTrade) MarshalEasyJSON

func (v CryptoTrade) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CryptoTrade) MarshalJSON

func (v CryptoTrade) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CryptoTrade) UnmarshalEasyJSON

func (v *CryptoTrade) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CryptoTrade) UnmarshalJSON

func (v *CryptoTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DailyAuctions

type DailyAuctions struct {
	Date    civil.Date `json:"d"`
	Opening []Auction  `json:"o"`
	Closing []Auction  `json:"c"`
}

DailyAuctions contains all the opening and closing auctions for a symbol in a single day

func GetAuctions

func GetAuctions(symbol string, req GetAuctionsRequest) ([]DailyAuctions, error)

GetAuctions returns the auctions for the given symbol.

func (DailyAuctions) MarshalEasyJSON

func (v DailyAuctions) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DailyAuctions) MarshalJSON

func (v DailyAuctions) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DailyAuctions) UnmarshalEasyJSON

func (v *DailyAuctions) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DailyAuctions) UnmarshalJSON

func (v *DailyAuctions) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Feed

type Feed = string

Feed defines the source feed of stock data.

const (
	// SIP includes all US exchanges.
	SIP Feed = "sip"
	// IEX only includes the Investors Exchange.
	IEX Feed = "iex"
	// OTC includes Over-the-Counter exchanges
	OTC Feed = "otc"
)
const (
	OPRA       Feed = "opra"
	Indicative Feed = "indicative"
)

type ForwardSplit added in v3.3.0

type ForwardSplit struct {
	Symbol                string      `json:"symbol"`
	NewRate               float64     `json:"new_rate"`
	OldRate               float64     `json:"old_rate"`
	ProcessDate           civil.Date  `json:"process_date"`
	ExDate                civil.Date  `json:"ex_date"`
	RecordDate            *civil.Date `json:"record_date,omitempty"`
	PayableDate           *civil.Date `json:"payable_date,omitempty"`
	DueBillRedemptionDate *civil.Date `json:"due_bill_redemption_date,omitempty"`
}

func (ForwardSplit) MarshalEasyJSON added in v3.3.0

func (v ForwardSplit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ForwardSplit) MarshalJSON added in v3.3.0

func (v ForwardSplit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ForwardSplit) UnmarshalEasyJSON added in v3.3.0

func (v *ForwardSplit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ForwardSplit) UnmarshalJSON added in v3.3.0

func (v *ForwardSplit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type GetAuctionsRequest

type GetAuctionsRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned auctions.
	// If missing, all auctions between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// AsOf defines the date when the symbols are mapped. "-" means no mapping.
	AsOf string
	// Currency is the currency of the displayed prices
	Currency string
	// Sort is the sort direction of the data
	Sort Sort
}

GetAuctionsRequest contains optional parameters for getting auctions

type GetBarsRequest

type GetBarsRequest struct {
	// TimeFrame is the aggregation size of the bars
	TimeFrame TimeFrame
	// Adjustment tells if the bars should be adjusted for corporate actions
	Adjustment Adjustment
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned bars.
	// If missing, all bars between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Feed is the source of the data: sip or iex.
	// If provided, it overrides the client's Feed option.
	Feed Feed
	// AsOf defines the date when the symbols are mapped. "-" means no mapping.
	AsOf string
	// Currency is the currency of the displayed prices
	Currency string
	// Sort is the sort direction of the data
	Sort Sort
}

GetBarsRequest contains optional parameters for getting bars

type GetCorporateActionsRequest added in v3.3.0

type GetCorporateActionsRequest struct {
	// Symbols is the list of company symbols
	Symbols []string
	// Types is the list of corporate actions types. Available types:
	//
	// The following types are supported:
	//  - reverse_split
	//  - forward_split
	//  - unit_split
	//  - cash_dividend
	//  - stock_dividend
	//  - spin_off
	//  - cash_merger
	//  - stock_merger
	//  - stock_and_cash_merger
	//  - redemption
	//  - name_change
	//  - worthless_removal
	//  - rights_distribution
	Types []string
	// Start is the inclusive beginning of the interval
	Start civil.Date
	// End is the inclusive end of the interval
	End civil.Date
	// TotalLimit is the limit of the total number of the returned trades.
	// If missing, all trades between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Sort is the sort direction of the data
	Sort Sort
}

GetCorporateActionsRequest contains optional parameters for getting corporate actions.

type GetCryptoBarsRequest

type GetCryptoBarsRequest struct {
	// TimeFrame is the aggregation size of the bars
	TimeFrame TimeFrame
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned bars.
	// If missing, all bars between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// CryptoFeed is the crypto feed. Default is "us".
	CryptoFeed CryptoFeed
	// Sort is the sort direction of the data
	Sort Sort
}

GetCryptoBarsRequest contains optional parameters for getting crypto bars

type GetCryptoQuotesRequest added in v3.2.0

type GetCryptoQuotesRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned quotes.
	// If missing, all quotes between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// CryptoFeed is the crypto feed. Default is "us".
	CryptoFeed CryptoFeed
	// Sort is the sort direction of the data
	Sort Sort
}

GetCryptoQuotesRequest contains optional parameters for getting crypto quotes

type GetCryptoSnapshotRequest

type GetCryptoSnapshotRequest struct {
	CryptoFeed CryptoFeed
}

type GetCryptoTradesRequest

type GetCryptoTradesRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned trades.
	// If missing, all trades between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// CryptoFeed is the crypto feed. Default is "us".
	CryptoFeed CryptoFeed
	// Sort is the sort direction of the data
	Sort Sort
}

GetCryptoTradesRequest contains optional parameters for getting crypto trades

type GetLatestBarRequest

type GetLatestBarRequest struct {
	Feed     Feed
	Currency string
}

type GetLatestCryptoBarRequest

type GetLatestCryptoBarRequest struct {
	CryptoFeed CryptoFeed
}

type GetLatestCryptoQuoteRequest

type GetLatestCryptoQuoteRequest struct {
	CryptoFeed CryptoFeed
}

type GetLatestCryptoTradeRequest

type GetLatestCryptoTradeRequest struct {
	CryptoFeed CryptoFeed
}

type GetLatestOptionQuoteRequest added in v3.3.0

type GetLatestOptionQuoteRequest struct {
	Feed OptionFeed
}

type GetLatestOptionTradeRequest added in v3.3.0

type GetLatestOptionTradeRequest struct {
	Feed OptionFeed
}

type GetLatestQuoteRequest

type GetLatestQuoteRequest struct {
	Feed     Feed
	Currency string
}

type GetLatestTradeRequest

type GetLatestTradeRequest struct {
	Feed     Feed
	Currency string
}

type GetNewsRequest

type GetNewsRequest struct {
	// Symbols filters the news to the related symbols.
	// If empty or nil, all articles will be returned.
	Symbols []string
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// Sort sets the sort order of the results. Sorting will be done by the UpdatedAt field.
	Sort Sort
	// IncludeContent tells the server to include the article content in the response.
	IncludeContent bool
	// ExcludeContentless tells the server to exclude articles that have no content.
	ExcludeContentless bool
	// TotalLimit is the limit of the total number of the returned news.
	//
	// If it's non-zero, NoTotalLimit must be false, otherwise an error well be returned.
	// If it's zero then the NoTotalLimit parameter is considered: if NoTotalLimit is true,
	// then all the articles in the given start-end interval are returned.
	// If NoTotalLimit is false, then 50 articles will be returned.
	//
	// The reason for this complication is that the default (empty GetNewsRequest) would
	// not return all the news articles.
	TotalLimit int
	// NoTotalLimit means all news articles will be returned from the given start-end interval.
	//
	// TotalLimit must be set to 0 if NoTotalLimit is true, otherwise an error well be returned.
	NoTotalLimit bool
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
}

GetNewsRequest contains optional parameters for getting news articles.

type GetOptionBarsRequest added in v3.3.0

type GetOptionBarsRequest struct {
	// TimeFrame is the aggregation size of the bars
	TimeFrame TimeFrame
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned bars.
	// If missing, all bars between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Sort is the sort direction of the data
	Sort Sort
}

GetOptionBarsRequest contains optional parameters for getting bars

type GetOptionChainRequest added in v3.4.0

type GetOptionChainRequest struct {
	// Feed is the source of the data: opra or indicative.
	Feed OptionFeed
	// TotalLimit is the limit of the total number of the returned snapshots.
	// If missing, all snapshots will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Type filters contracts by the type (call or put).
	Type OptionType
	// StrikePriceGte filters contracts with strike price greater than or equal to the specified value.
	StrikePriceGte float64
	// StrikePriceLte filters contracts with strike price less than or equal to the specified value.
	StrikePriceLte float64
	// ExpirationDate filters contracts by the exact expiration date
	ExpirationDate civil.Date
	// ExpirationDateGte filters contracts with expiration date greater than or equal to the specified date.
	ExpirationDateGte civil.Date
	// ExpirationDateLte filters contracts with expiration date less than or equal to the specified date.
	ExpirationDateLte civil.Date
	// RootSymbol filters contracts by the root symbol (e.g. AAPL1)
	RootSymbol string
}

type GetOptionSnapshotRequest added in v3.3.0

type GetOptionSnapshotRequest struct {
	// Feed is the source of the data: opra or indicative.
	Feed OptionFeed
	// TotalLimit is the limit of the total number of the returned snapshots.
	// If missing, all snapshots will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
}

type GetOptionTradesRequest added in v3.3.0

type GetOptionTradesRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned trades.
	// If missing, all trades between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Sort is the sort direction of the data
	Sort Sort
}

GetOptionTradesRequest contains optional parameters for getting option trades.

type GetQuotesRequest

type GetQuotesRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned quotes.
	// If missing, all quotes between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Feed is the source of the data: sip or iex.
	Feed Feed
	// AsOf defines the date when the symbols are mapped. "-" means no mapping.
	AsOf string
	// Currency is the currency of the displayed prices
	Currency string
	// Sort is the sort direction of the data
	Sort Sort
}

GetQuotesRequest contains optional parameters for getting quotes

type GetSnapshotRequest

type GetSnapshotRequest struct {
	Feed     Feed
	Currency string
}

type GetTradesRequest

type GetTradesRequest struct {
	// Start is the inclusive beginning of the interval
	Start time.Time
	// End is the inclusive end of the interval
	End time.Time
	// TotalLimit is the limit of the total number of the returned trades.
	// If missing, all trades between start end end will be returned.
	TotalLimit int
	// PageLimit is the pagination size. If empty, the default page size will be used.
	PageLimit int
	// Feed is the source of the data: sip or iex.
	Feed Feed
	// AsOf defines the date when the symbols are mapped. "-" means no mapping.
	AsOf string
	// Currency is the currency of the displayed prices
	Currency string
	// Sort is the sort direction of the data
	Sort Sort
}

GetTradesRequest contains optional parameters for getting trades.

type NameChange added in v3.3.0

type NameChange struct {
	NewSymbol   string     `json:"new_symbol"`
	OldSymbol   string     `json:"old_symbol"`
	ProcessDate civil.Date `json:"process_date"`
}

func (NameChange) MarshalEasyJSON added in v3.3.0

func (v NameChange) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (NameChange) MarshalJSON added in v3.3.0

func (v NameChange) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*NameChange) UnmarshalEasyJSON added in v3.3.0

func (v *NameChange) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*NameChange) UnmarshalJSON added in v3.3.0

func (v *NameChange) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type News

type News struct {
	ID        int         `json:"id"`
	Author    string      `json:"author"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
	Headline  string      `json:"headline"`
	Summary   string      `json:"summary"`
	Content   string      `json:"content"`
	Images    []NewsImage `json:"images"`
	URL       string      `json:"url"`
	Symbols   []string    `json:"symbols"`
}

News is a single news article.

func GetNews

func GetNews(req GetNewsRequest) ([]News, error)

GetNews returns the news articles based on the given req.

func (News) MarshalEasyJSON

func (v News) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (News) MarshalJSON

func (v News) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*News) UnmarshalEasyJSON

func (v *News) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*News) UnmarshalJSON

func (v *News) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type NewsImage

type NewsImage struct {
	Size string `json:"size"`
	URL  string `json:"url"`
}

NewsImage is a single image for a news article.

func (NewsImage) MarshalEasyJSON

func (v NewsImage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (NewsImage) MarshalJSON

func (v NewsImage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*NewsImage) UnmarshalEasyJSON

func (v *NewsImage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*NewsImage) UnmarshalJSON

func (v *NewsImage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionBar added in v3.3.0

type OptionBar struct {
	Timestamp  time.Time `json:"t"`
	Open       float64   `json:"o"`
	High       float64   `json:"h"`
	Low        float64   `json:"l"`
	Close      float64   `json:"c"`
	Volume     uint64    `json:"v"`
	TradeCount uint64    `json:"n"`
	VWAP       float64   `json:"vw"`
}

OptionBar is an aggregate of option trades

func GetOptionBars added in v3.3.0

func GetOptionBars(symbol string, req GetOptionBarsRequest) ([]OptionBar, error)

GetOptionBars returns a slice of bars for the given symbol.

func (OptionBar) MarshalEasyJSON added in v3.3.0

func (v OptionBar) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OptionBar) MarshalJSON added in v3.3.0

func (v OptionBar) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OptionBar) UnmarshalEasyJSON added in v3.3.0

func (v *OptionBar) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OptionBar) UnmarshalJSON added in v3.3.0

func (v *OptionBar) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionFeed added in v3.3.0

type OptionFeed = string

OptionFeed defines the source feed of option data.

type OptionGreeks added in v3.4.0

type OptionGreeks struct {
	Delta float64 `json:"delta"`
	Gamma float64 `json:"gamma"`
	Rho   float64 `json:"rho"`
	Theta float64 `json:"theta"`
	Vega  float64 `json:"vega"`
}

func (OptionGreeks) MarshalEasyJSON added in v3.4.0

func (v OptionGreeks) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OptionGreeks) MarshalJSON added in v3.4.0

func (v OptionGreeks) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OptionGreeks) UnmarshalEasyJSON added in v3.4.0

func (v *OptionGreeks) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OptionGreeks) UnmarshalJSON added in v3.4.0

func (v *OptionGreeks) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionQuote added in v3.3.0

type OptionQuote struct {
	Timestamp   time.Time `json:"t"`
	BidPrice    float64   `json:"bp"`
	BidSize     uint32    `json:"bs"`
	BidExchange string    `json:"bx"`
	AskPrice    float64   `json:"ap"`
	AskSize     uint32    `json:"as"`
	AskExchange string    `json:"ax"`
	Condition   string    `json:"c"`
}

OptionQuote is an option NBBO (National Best Bid and Offer)

func GetLatestOptionQuote added in v3.3.0

func GetLatestOptionQuote(symbol string, req GetLatestOptionQuoteRequest) (*OptionQuote, error)

GetLatestOptionQuote returns the latest option quote for a given symbol

func (OptionQuote) MarshalEasyJSON added in v3.3.0

func (v OptionQuote) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OptionQuote) MarshalJSON added in v3.3.0

func (v OptionQuote) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OptionQuote) UnmarshalEasyJSON added in v3.3.0

func (v *OptionQuote) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OptionQuote) UnmarshalJSON added in v3.3.0

func (v *OptionQuote) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionSnapshot added in v3.3.0

type OptionSnapshot struct {
	LatestTrade       *OptionTrade  `json:"latestTrade"`
	LatestQuote       *OptionQuote  `json:"latestQuote"`
	ImpliedVolatility float64       `json:"impliedVolatility,omitempty`
	Greeks            *OptionGreeks `json:"greeks,omitempty`
}

func GetOptionSnapshot added in v3.3.0

func GetOptionSnapshot(symbol string, req GetOptionSnapshotRequest) (*OptionSnapshot, error)

GetOptionSnapshot returns the snapshot for a given symbol

func (OptionSnapshot) MarshalEasyJSON added in v3.3.0

func (v OptionSnapshot) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OptionSnapshot) MarshalJSON added in v3.3.0

func (v OptionSnapshot) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OptionSnapshot) UnmarshalEasyJSON added in v3.3.0

func (v *OptionSnapshot) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OptionSnapshot) UnmarshalJSON added in v3.3.0

func (v *OptionSnapshot) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionTrade added in v3.3.0

type OptionTrade struct {
	Timestamp time.Time `json:"t"`
	Price     float64   `json:"p"`
	Size      uint32    `json:"s"`
	Exchange  string    `json:"x"`
	Condition string    `json:"c"`
}

OptionTrade is an option trade that happened on the market

func GetLatestOptionTrade added in v3.3.0

func GetLatestOptionTrade(symbol string, req GetLatestOptionTradeRequest) (*OptionTrade, error)

GetLatestOptionTrade returns the latest option trade for a given symbol

func GetOptionTrades added in v3.3.0

func GetOptionTrades(symbol string, req GetOptionTradesRequest) ([]OptionTrade, error)

GetOptionTrades returns the option trades for the given symbol.

func (OptionTrade) MarshalEasyJSON added in v3.3.0

func (v OptionTrade) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OptionTrade) MarshalJSON added in v3.3.0

func (v OptionTrade) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OptionTrade) UnmarshalEasyJSON added in v3.3.0

func (v *OptionTrade) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OptionTrade) UnmarshalJSON added in v3.3.0

func (v *OptionTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OptionType added in v3.4.0

type OptionType = string
const (
	Call OptionType = "call"
	Put  OptionType = "put"
)

type Quote

type Quote struct {
	Timestamp   time.Time `json:"t"`
	BidPrice    float64   `json:"bp"`
	BidSize     uint32    `json:"bs"`
	BidExchange string    `json:"bx"`
	AskPrice    float64   `json:"ap"`
	AskSize     uint32    `json:"as"`
	AskExchange string    `json:"ax"`
	Conditions  []string  `json:"c"`
	Tape        string    `json:"z"`
}

Quote is a stock quote from the market

func GetLatestQuote

func GetLatestQuote(symbol string, req GetLatestQuoteRequest) (*Quote, error)

GetLatestQuote returns the latest quote for a given symbol.

func GetQuotes

func GetQuotes(symbol string, req GetQuotesRequest) ([]Quote, error)

GetQuotes returns the quotes for the given symbol.

func (Quote) MarshalEasyJSON

func (v Quote) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Quote) MarshalJSON

func (v Quote) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Quote) UnmarshalEasyJSON

func (v *Quote) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Quote) UnmarshalJSON

func (v *Quote) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Redemption added in v3.3.0

type Redemption struct {
	Symbol      string      `json:"symbol"`
	Rate        float64     `json:"rate"`
	PayableDate *civil.Date `json:"payable_date,omitempty"`
	ProcessDate civil.Date  `json:"process_date"`
}

func (Redemption) MarshalEasyJSON added in v3.3.0

func (v Redemption) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Redemption) MarshalJSON added in v3.3.0

func (v Redemption) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Redemption) UnmarshalEasyJSON added in v3.3.0

func (v *Redemption) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Redemption) UnmarshalJSON added in v3.3.0

func (v *Redemption) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ReverseSplit added in v3.3.0

type ReverseSplit struct {
	Symbol      string      `json:"symbol"`
	NewRate     float64     `json:"new_rate"`
	OldRate     float64     `json:"old_rate"`
	ProcessDate civil.Date  `json:"process_date"`
	ExDate      civil.Date  `json:"ex_date"`
	RecordDate  *civil.Date `json:"record_date,omitempty"`
	PayableDate *civil.Date `json:"payable_date,omitempty"`
}

func (ReverseSplit) MarshalEasyJSON added in v3.3.0

func (v ReverseSplit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ReverseSplit) MarshalJSON added in v3.3.0

func (v ReverseSplit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ReverseSplit) UnmarshalEasyJSON added in v3.3.0

func (v *ReverseSplit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ReverseSplit) UnmarshalJSON added in v3.3.0

func (v *ReverseSplit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RightsDistribution added in v3.4.0

type RightsDistribution struct {
	SourceSymbol   string      `json:"source_symbol"`
	NewSymbol      string      `json:"new_symbol"`
	Rate           float64     `json:"rate"`
	ProcessDate    civil.Date  `json:"process_date"`
	ExDate         civil.Date  `json:"ex_date"`
	PayableDate    civil.Date  `json:"payable_date,omitempty"`
	RecordDate     *civil.Date `json:"record_date,omitempty"`
	ExpirationDate *civil.Date `json:"expiration_date,omitempty"`
}

func (RightsDistribution) MarshalEasyJSON added in v3.4.0

func (v RightsDistribution) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RightsDistribution) MarshalJSON added in v3.4.0

func (v RightsDistribution) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RightsDistribution) UnmarshalEasyJSON added in v3.4.0

func (v *RightsDistribution) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RightsDistribution) UnmarshalJSON added in v3.4.0

func (v *RightsDistribution) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Snapshot

type Snapshot struct {
	LatestTrade  *Trade `json:"latestTrade"`
	LatestQuote  *Quote `json:"latestQuote"`
	MinuteBar    *Bar   `json:"minuteBar"`
	DailyBar     *Bar   `json:"dailyBar"`
	PrevDailyBar *Bar   `json:"prevDailyBar"`
}

Snapshot is a snapshot of a symbol

func GetSnapshot

func GetSnapshot(symbol string, req GetSnapshotRequest) (*Snapshot, error)

GetSnapshot returns the snapshot for a given symbol

func (Snapshot) MarshalEasyJSON

func (v Snapshot) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Snapshot) MarshalJSON

func (v Snapshot) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Snapshot) UnmarshalEasyJSON

func (v *Snapshot) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Snapshot) UnmarshalJSON

func (v *Snapshot) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Sort

type Sort string

Sort represents the sort order of the results

var (
	// SortDesc means the results will be sorted in a descending order
	SortDesc Sort = "desc"
	// SortAsc means the results will be sorted in an ascending order
	SortAsc Sort = "asc"
)

List of sort values

type SpinOff added in v3.3.0

type SpinOff struct {
	SourceSymbol          string      `json:"source_symbol"`
	SourceRate            float64     `json:"source_rate"`
	NewSymbol             string      `json:"new_symbol"`
	NewRate               float64     `json:"new_rate"`
	ProcessDate           civil.Date  `json:"process_date"`
	ExDate                civil.Date  `json:"ex_date"`
	PayableDate           *civil.Date `json:"payable_date,omitempty"`
	RecordDate            *civil.Date `json:"record_date,omitempty"`
	DueBillRedemptionDate *civil.Date `json:"due_bill_redemption_date,omitempty"`
}

func (SpinOff) MarshalEasyJSON added in v3.3.0

func (v SpinOff) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpinOff) MarshalJSON added in v3.3.0

func (v SpinOff) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpinOff) UnmarshalEasyJSON added in v3.3.0

func (v *SpinOff) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpinOff) UnmarshalJSON added in v3.3.0

func (v *SpinOff) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StockAndCashMerger added in v3.3.0

type StockAndCashMerger struct {
	AcquirerSymbol string      `json:"acquirer_symbol"`
	AcquirerRate   float64     `json:"acquirer_rate"`
	AcquireeSymbol string      `json:"acquiree_symbol"`
	AcquireeRate   float64     `json:"acquiree_rate"`
	CashRate       float64     `json:"cash_rate"`
	ProcessDate    civil.Date  `json:"process_date"`
	EffectiveDate  civil.Date  `json:"effective_date"`
	PayableDate    *civil.Date `json:"payable_date,omitempty"`
}

func (StockAndCashMerger) MarshalEasyJSON added in v3.3.0

func (v StockAndCashMerger) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StockAndCashMerger) MarshalJSON added in v3.3.0

func (v StockAndCashMerger) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StockAndCashMerger) UnmarshalEasyJSON added in v3.3.0

func (v *StockAndCashMerger) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StockAndCashMerger) UnmarshalJSON added in v3.3.0

func (v *StockAndCashMerger) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StockDividend added in v3.3.0

type StockDividend struct {
	Symbol      string      `json:"symbol"`
	Rate        float64     `json:"rate"`
	ProcessDate civil.Date  `json:"process_date"`
	ExDate      civil.Date  `json:"ex_date"`
	RecordDate  *civil.Date `json:"record_date,omitempty"`
	PayableDate *civil.Date `json:"payable_date,omitempty"`
}

func (StockDividend) MarshalEasyJSON added in v3.3.0

func (v StockDividend) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StockDividend) MarshalJSON added in v3.3.0

func (v StockDividend) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StockDividend) UnmarshalEasyJSON added in v3.3.0

func (v *StockDividend) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StockDividend) UnmarshalJSON added in v3.3.0

func (v *StockDividend) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StockMerger added in v3.3.0

type StockMerger struct {
	AcquirerSymbol string      `json:"acquirer_symbol"`
	AcquirerRate   float64     `json:"acquirer_rate"`
	AcquireeSymbol string      `json:"acquiree_symbol"`
	AcquireeRate   float64     `json:"acquiree_rate"`
	ProcessDate    civil.Date  `json:"process_date"`
	EffectiveDate  civil.Date  `json:"effective_date"`
	PayableDate    *civil.Date `json:"payable_date,omitempty"`
}

func (StockMerger) MarshalEasyJSON added in v3.3.0

func (v StockMerger) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StockMerger) MarshalJSON added in v3.3.0

func (v StockMerger) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StockMerger) UnmarshalEasyJSON added in v3.3.0

func (v *StockMerger) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StockMerger) UnmarshalJSON added in v3.3.0

func (v *StockMerger) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TakerSide

type TakerSide = string

TakerSide is the taker's side: one of B, S or -. B is buy, S is sell and - is unknown.

const (
	TakerSideBuy     TakerSide = "B"
	TakerSideSell    TakerSide = "S"
	TakerSideUnknown TakerSide = "-"
)

type TimeFrame

type TimeFrame struct {
	N    int
	Unit TimeFrameUnit
}

TimeFrame is the resolution of the bars

func NewTimeFrame

func NewTimeFrame(n int, unit TimeFrameUnit) TimeFrame

func (TimeFrame) MarshalEasyJSON

func (v TimeFrame) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TimeFrame) MarshalJSON

func (v TimeFrame) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (TimeFrame) String

func (tf TimeFrame) String() string

func (*TimeFrame) UnmarshalEasyJSON

func (v *TimeFrame) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TimeFrame) UnmarshalJSON

func (v *TimeFrame) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TimeFrameUnit

type TimeFrameUnit string

TimeFrameUnite is the base unit of the timeframe.

const (
	Min   TimeFrameUnit = "Min"
	Hour  TimeFrameUnit = "Hour"
	Day   TimeFrameUnit = "Day"
	Week  TimeFrameUnit = "Week"
	Month TimeFrameUnit = "Month"
)

List of timeframe units

type Trade

type Trade struct {
	Timestamp  time.Time `json:"t"`
	Price      float64   `json:"p"`
	Size       uint32    `json:"s"`
	Exchange   string    `json:"x"`
	ID         int64     `json:"i"`
	Conditions []string  `json:"c"`
	Tape       string    `json:"z"`
	Update     string    `json:"u"`
}

Trade is a stock trade that happened on the market

func GetLatestTrade

func GetLatestTrade(symbol string, req GetLatestTradeRequest) (*Trade, error)

GetLatestTrade returns the latest trade for a given symbol.

func GetTrades

func GetTrades(symbol string, req GetTradesRequest) ([]Trade, error)

GetTrades returns the trades for the given symbol.

func (Trade) MarshalEasyJSON

func (v Trade) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Trade) MarshalJSON

func (v Trade) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Trade) UnmarshalEasyJSON

func (v *Trade) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Trade) UnmarshalJSON

func (v *Trade) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UnitSplit added in v3.3.0

type UnitSplit struct {
	NewSymbol       string      `json:"new_symbol"`
	NewRate         float64     `json:"new_rate"`
	OldSymbol       string      `json:"old_symbol"`
	OldRate         float64     `json:"old_rate"`
	AlternateSymbol string      `json:"alternate_symbol"`
	AlternateRate   float64     `json:"alternate_rate"`
	ProcessDate     civil.Date  `json:"process_date"`
	EffectiveDate   civil.Date  `json:"effective_date"`
	PayableDate     *civil.Date `json:"payable_date,omitempty"`
}

func (UnitSplit) MarshalEasyJSON added in v3.3.0

func (v UnitSplit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UnitSplit) MarshalJSON added in v3.3.0

func (v UnitSplit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UnitSplit) UnmarshalEasyJSON added in v3.3.0

func (v *UnitSplit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UnitSplit) UnmarshalJSON added in v3.3.0

func (v *UnitSplit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WorthlessRemoval added in v3.3.0

type WorthlessRemoval struct {
	Symbol      string     `json:"symbol"`
	ProcessDate civil.Date `json:"process_date"`
}

func (WorthlessRemoval) MarshalEasyJSON added in v3.3.0

func (v WorthlessRemoval) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WorthlessRemoval) MarshalJSON added in v3.3.0

func (v WorthlessRemoval) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WorthlessRemoval) UnmarshalEasyJSON added in v3.3.0

func (v *WorthlessRemoval) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WorthlessRemoval) UnmarshalJSON added in v3.3.0

func (v *WorthlessRemoval) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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