models

package
v1.16.7 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is the set of recognized actions used in control messages.

const (
	Auth        Action = "auth"
	Subscribe   Action = "subscribe"
	Unsubscribe Action = "unsubscribe"
)

type ControlMessage

type ControlMessage struct {
	EventType
	Status  string `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
	Action  Action `json:"action,omitempty"`
	Params  string `json:"params,omitempty"`
}

ControlMessage is a message to signal status and control events to and from the server.

type CryptoQuote

type CryptoQuote struct {
	// The event type.
	EventType

	// The crypto pair.
	Pair string `json:"pair,omitempty"`

	// The bid price.
	BidPrice float64 `json:"bp,omitempty"`

	// The bid size.
	BidSize float64 `json:"bs,omitempty"`

	// The ask price.
	AskPrice float64 `json:"ap,omitempty"`

	// The ask size.
	AskSize float64 `json:"as,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The crypto exchange ID.
	ExchangeID int32 `json:"x,omitempty"`

	// The timestamp that the tick was received by Polygon.
	ReceivedTimestamp int64 `json:"r,omitempty"`
}

CryptoQuote is a quote for a crypto pair.

type CryptoTrade

type CryptoTrade struct {
	// The event type.
	EventType

	// The crypto pair.
	Pair string `json:"pair,omitempty"`

	// The crypto exchange ID.
	Exchange int32 `json:"x,omitempty"`

	// The ID of the trade (optional).
	ID string `json:"i,omitempty"`

	// The price.
	Price float64 `json:"p,omitempty"`

	// The size.
	Size float64 `json:"s,omitempty"`

	// The conditions. 0 (or empty array): empty 1: sellside 2: buyside
	Conditions []int32 `json:"c,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The timestamp that the tick was received by Polygon.
	ReceivedTimestamp int64 `json:"r,omitempty"`
}

CryptoTrade is a trade for a crypto pair.

type CurrencyAgg

type CurrencyAgg struct {
	// The event type.
	EventType

	// The currency pair.
	Pair string `json:"pair,omitempty"`

	// The open price for this aggregate window.
	Open float64 `json:"o,omitempty"`

	// The close price for this aggregate window.
	Close float64 `json:"c,omitempty"`

	// The high price for this aggregate window.
	High float64 `json:"h,omitempty"`

	// The low price for this aggregate window.
	Low float64 `json:"l,omitempty"`

	// The volume of trades during this aggregate window.
	Volume float64 `json:"v,omitempty"`

	// The volume weighted average price.
	VWAP float64 `json:"vw,omitempty"`

	// The start time for this aggregate window in Unix Milliseconds.
	StartTimestamp int64 `json:"s,omitempty"`

	// The end time for this aggregate window in Unix Milliseconds.
	EndTimestamp int64 `json:"e,omitempty"`

	// The average trade size for this aggregate window.
	AVGTradeSize int32 `json:"z,omitempty"`
}

CurrencyAgg is an aggregate for either forex currency pairs or crypto pairs.

type EquityAgg

type EquityAgg struct {
	// The event type.
	EventType

	// The ticker symbol for the given stock.
	Symbol string `json:"sym,omitempty"`

	// The tick volume.
	Volume float64 `json:"v,omitempty"`

	// Today's accumulated volume.
	AccumulatedVolume float64 `json:"av,omitempty"`

	// Today's official opening price.
	OfficialOpenPrice float64 `json:"op,omitempty"`

	// The tick's volume weighted average price.
	VWAP float64 `json:"vw,omitempty"`

	// The opening tick price for this aggregate window.
	Open float64 `json:"o,omitempty"`

	// The closing tick price for this aggregate window.
	Close float64 `json:"c,omitempty"`

	// The highest tick price for this aggregate window.
	High float64 `json:"h,omitempty"`

	// The lowest tick price for this aggregate window.
	Low float64 `json:"l,omitempty"`

	// Today's volume weighted average price.
	AggregateVWAP float64 `json:"a,omitempty"`

	// The average trade size for this aggregate window.
	AverageSize float64 `json:"z,omitempty"`

	// The timestamp of the starting tick for this aggregate window in Unix Milliseconds.
	StartTimestamp int64 `json:"s,omitempty"`

	// The timestamp of the ending tick for this aggregate window in Unix Milliseconds.
	EndTimestamp int64 `json:"e,omitempty"`

	// Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
	OTC bool `json:"otc,omitempty"`
}

EquityAgg is an aggregate for either stock tickers or option contracts.

type EquityQuote

type EquityQuote struct {
	// The event type.
	EventType

	// The ticker symbol for the given stock.
	Symbol string `json:"sym,omitempty"`

	// The bid exchange ID.
	BidExchangeID int32 `json:"bx,omitempty"`

	// The bid price.
	BidPrice float64 `json:"bp,omitempty"`

	// The bid size. This represents the number of round lot orders at the given bid price. The normal round lot size is
	// 100 shares. A bid size of 2 means there are 200 shares for purchase at the given bid price.
	BidSize int32 `json:"bs,omitempty"`

	// The ask exchange ID.
	AskExchangeID int32 `json:"ax,omitempty"`

	// The ask price.
	AskPrice float64 `json:"ap,omitempty"`

	// The ask size. This represents the number of round lot orders at the given ask price. The normal round lot size is
	// 100 shares. An ask size of 2 means there are 200 shares available to purchase at the given ask price.
	AskSize int32 `json:"as,omitempty"`

	// The condition.
	Condition int32 `json:"c,omitempty"`

	// The indicators. For more information, see our glossary: https://polygon.io/glossary/us/stocks/conditions-indicators.
	Indicators []int32 `json:"i,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The tape. (1 = NYSE, 2 = AMEX, 3 = Nasdaq).
	Tape int32 `json:"z,omitempty"`

	// The sequence number represents the sequence in which message events happened. These are increasing and unique per
	// ticker symbol, but will not always be sequential (e.g., 1, 2, 6, 9, 10, 11).
	SequenceNumber int64 `json:"q,omitempty"`
}

EquityQuote is a quote for either stock tickers or option contracts.

type EquityTrade

type EquityTrade struct {
	// The event type.
	EventType

	// The ticker symbol for the given stock.
	Symbol string `json:"sym,omitempty"`

	// The exchange ID.
	Exchange int32 `json:"x,omitempty"`

	// The trade ID.
	ID string `json:"i,omitempty"`

	// The tape. (1 = NYSE, 2 = AMEX, 3 = Nasdaq).
	Tape int32 `json:"z,omitempty"`

	// The price.
	Price float64 `json:"p,omitempty"`

	// The trade size.
	Size int64 `json:"s,omitempty"`

	// The trade conditions.
	Conditions []int32 `json:"c,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The sequence number represents the sequence in which message events happened. These are increasing and unique per
	// ticker symbol, but will not always be sequential (e.g., 1, 2, 6, 9, 10, 11).
	SequenceNumber int64 `json:"q,omitempty"`

	// The ID for the Trade Reporting Facility where the trade took place.
	TradeReportingFacilityID int64 `json:"trfi,omitempty"`

	// The TRF (Trade Reporting Facility) Timestamp in Unix MS.
	// This is the timestamp of when the trade reporting facility received this trade.
	TradeReportingFacilityTimestamp int64 `json:"trft,omitempty"`
}

EquityTrade is trade data for either stock tickers or option contracts.

type EventType

type EventType struct {
	EventType string `json:"ev,omitempty"`
}

EventType is the type of message received. It should be present in every message sent by the server.

type FairMarketValue added in v1.15.0

type FairMarketValue struct {
	// The event type.
	EventType

	// The value.
	FMV float64 `json:"fmv"`

	// The ticker symbol for the given security.
	Ticker string `json:"sym"`

	// The Timestamp in nanoseconds.
	Timestamp int64 `json:"t,omitempty"`
}

type ForexQuote

type ForexQuote struct {
	// The event type.
	EventType

	// The current pair.
	Pair string `json:"p,omitempty"`

	// The exchange ID.
	ExchangeID int32 `json:"x,omitempty"`

	// The ask price.
	AskPrice float64 `json:"a,omitempty"`

	// The bid price.
	BidPrice float64 `json:"b,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`
}

ForexQuote is a quote for a forex currency pair.

type Imbalance

type Imbalance struct {
	// The event type.
	EventType

	// The ticker symbol for the given stock.
	Symbol string `json:"T,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The time that the auction is planned to take place in the format (hour x 100) + minutes in Eastern Standard Time,
	// for example 930 would be 9:30 am EST, and 1600 would be 4:00 pm EST.
	AuctionTime int32 `json:"at,omitempty"`

	// The auction type. O - Early Opening Auction (non-NYSE only) M - Core Opening Auction H - Reopening Auction (Halt
	// Resume) C - Closing Auction P - Extreme Closing Imbalance (NYSE only) R - Regulatory Closing Imbalance (NYSE
	// only)
	AuctionType string `json:"a,omitempty"`

	// The symbol sequence.
	SymbolSequence int32 `json:"i,omitempty"`

	// The exchange ID.
	ExchangeID int32 `json:"x,omitempty"`

	// The imbalance quantity.
	ImbalanceQuantity int32 `json:"o,omitempty"`

	// The paired quantity.
	PairedQuantity int32 `json:"p,omitempty"`

	// The book clearing price.
	BookClearingPrice float64 `json:"b,omitempty"`
}

Imbalance is an imbalance event for a given stock ticker symbol.

type IndexValue added in v1.11.0

type IndexValue struct {
	// The event type.
	EventType

	// The value.
	Value float64 `json:"val"`

	// The ticker symbol for the given index.
	Ticker string `json:"T"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`
}

IndexValue is value data for either indices.

type LaunchpadValue added in v1.13.0

type LaunchpadValue struct {
	// The event type.
	EventType

	// The value.
	Value float64 `json:"val"`

	// The ticker symbol for the given security.
	Ticker string `json:"sym"`

	// The Timestamp in nanoseconds.
	Timestamp int64 `json:"t,omitempty"`
}

type Level2Book

type Level2Book struct {
	// The event type.
	EventType

	// The crypto pair.
	Pair string `json:"pair,omitempty"`

	// An array of bid prices with a maximum depth of 100.
	BidPrices [][]float64 `json:"b,omitempty"`

	// An array of ask prices with a maximum depth of 100.
	AskPrices [][]float64 `json:"a,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The crypto exchange ID.
	ExchangeID int32 `json:"x,omitempty"`

	// The timestamp that the tick was received by Polygon.
	ReceivedTimestamp int64 `json:"r,omitempty"`
}

Level2Book is level 2 book data for a given crypto pair.

type LimitUpLimitDown

type LimitUpLimitDown struct {
	// The event type.
	EventType

	// The ticker symbol for the given stock.
	Symbol string `json:"T,omitempty"`

	// The high price.
	HighPrice float64 `json:"h,omitempty"`

	// The low price.
	LowPrice float64 `json:"l,omitempty"`

	// The Indicators.
	Indicators []int32 `json:"i,omitempty"`

	// The tape. (1 = NYSE, 2 = AMEX, 3 = Nasdaq).
	Tape int32 `json:"z,omitempty"`

	// The Timestamp in Unix MS.
	Timestamp int64 `json:"t,omitempty"`

	// The sequence number represents the sequence in which message events happened. These are increasing and unique per ticker symbol, but will not always be sequential (e.g., 1, 2, 6, 9, 10, 11).
	SequenceNumber int64 `json:"q,omitempty"`
}

LimitUpLimitDown is a LULD event for a given stock ticker symbol.

Jump to

Keyboard shortcuts

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