Documentation ¶
Overview ¶
Package iex provides an API for accessing and using IEX's developer API.
Index ¶
- Constants
- type Book
- type Client
- func (c *Client) GetAllAvailableHIST() (map[string][]*HIST, error)
- func (c *Client) GetBook(symbols []string) (map[string]*Book, error)
- func (c *Client) GetDEEP(symbol string) (*DEEP, error)
- func (c *Client) GetHIST(date time.Time) ([]*HIST, error)
- func (c *Client) GetHistoricalDaily(req *HistoricalDailyRequest) ([]*Stats, error)
- func (c *Client) GetHistoricalSummary(date time.Time) (*HistoricalSummary, error)
- func (c *Client) GetIntradayStats() (*IntradayStats, error)
- func (c *Client) GetLast(symbols []string) ([]*Last, error)
- func (c *Client) GetMarkets() ([]*Market, error)
- func (c *Client) GetOperationalHaltStatus(symbols []string) (map[string]*OpHaltStatus, error)
- func (c *Client) GetRecentStats() ([]*Stats, error)
- func (c *Client) GetSecurityEvents(symbols []string) (map[string]*SecurityEventMessage, error)
- func (c *Client) GetShortSaleRestriction(symbols []string) (map[string]*SSRStatus, error)
- func (c *Client) GetSymbols() ([]*Symbol, error)
- func (c *Client) GetSystemEvents(symbols []string) (map[string]*SystemEvent, error)
- func (c *Client) GetTOPS(symbols []string) ([]*TOPS, error)
- func (c *Client) GetTradeBreaks(symbols []string, last int) (map[string][]*TradeBreak, error)
- func (c *Client) GetTrades(symbols []string, last int) (map[string][]*Trade, error)
- func (c *Client) GetTradingStatus(symbols []string) (map[string]*TradingStatusMessage, error)
- type DEEP
- type HIST
- type HistoricalDailyRequest
- type HistoricalSummary
- type IntradayStats
- type Last
- type Market
- type OpHaltStatus
- type PacketDataSource
- type PcapScanner
- type Quote
- type Record
- type Records
- type SSRStatus
- type SecurityEventMessage
- type Stats
- type Symbol
- type SystemEvent
- type TOPS
- type Time
- type Trade
- type TradeBreak
- type TradingStatusMessage
Constants ¶
const ( StartMessages = "O" StartSystemHours = "S" StartMarketHours = "R" EndMarketHours = "M" EndSystemHours = "E" EndMessages = "C" )
const ( // Trading halted across all US equity markets. TradingHalted = "H" // Trading halt released into an Order Acceptance Period // (IEX-listed securities only) TradingOrderAcceptancePeriod = "O" // Trading paused and Order Acceptance Period on IEX // (IEX-listed securities only) TradingPaused = "P" // Trading on IEX Trading = "T" )
const ( // Trading halt reasons. HaltNewsPending = "T1" IPOIssueNotYetTrading = "IPO1" IPOIssueDeferred = "IPOD" MarketCircuitBreakerLevel3 = "MCB3" ReasonNotAvailable = "NA" // Order Acceptance Period Reasons HaltNewsDisseminations = "T2" IPONewIssueOrderAcceptancePeriod = "IPO2" IPOPreLaunchPeriod = "IPO3" MarketCircuitBreakerLevel1 = "MCB1" MarketCircuitBreakerLevel2 = "MCB2" )
const ( MarketOpen = "MarketOpen" MarketClose = "MarketClose" )
const IEXTP1 = "IEXTP1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to interact with IEX's HTTP API for developers.
func (*Client) GetAllAvailableHIST ¶
GetAllAvailableHIST returns HIST data for all available dates. Returns a map of date string "20060102" -> HIST data for that date.
func (*Client) GetBook ¶
Book shows IEX’s bids and asks for given symbols.
A maximumum of 10 symbols may be requested.
func (*Client) GetDEEP ¶
DEEP is used to receive real-time depth of book quotations direct from IEX. The depth of book quotations received via DEEP provide an aggregated size of resting displayed orders at a price and side, and do not indicate the size or number of individual orders at any price level. Non-displayed orders and non-displayed portions of reserve orders are not represented in DEEP.
DEEP also provides last trade price and size information. Trades resulting from either displayed or non-displayed orders matching on IEX will be reported. Routed executions will not be reported.
func (*Client) GetHIST ¶
HIST will provide the output of IEX data products for download on a T+1 basis. Data will remain available for the trailing twelve months.
Only data for the given day will be returned.
func (*Client) GetHistoricalDaily ¶
func (c *Client) GetHistoricalDaily(req *HistoricalDailyRequest) ([]*Stats, error)
This call will return daily stats for a given month or day. Historical data is only available for prior months, starting with January 2014.
func (*Client) GetHistoricalSummary ¶
func (c *Client) GetHistoricalSummary(date time.Time) (*HistoricalSummary, error)
Historical data is only available for prior months, starting with January 2014. If date IsZero(), returns the prior month's data.
func (*Client) GetIntradayStats ¶
func (c *Client) GetIntradayStats() (*IntradayStats, error)
func (*Client) GetLast ¶
Last provides trade data for executions on IEX. It is a near real time, intraday API that provides IEX last sale price, size and time. Last is ideal for developers that need a lightweight stock quote.
Symbols may be any of the available symbols returned by GetSymbols(). If symbols is nil, then all symbols will be returned.
func (*Client) GetMarkets ¶
This endpoint returns near real time traded volume on the markets. Market data is captured by the IEX system from approximately 7:45 a.m. to 5:15 p.m. ET.
func (*Client) GetOperationalHaltStatus ¶
func (c *Client) GetOperationalHaltStatus(symbols []string) (map[string]*OpHaltStatus, error)
The Exchange may suspend trading of one or more securities on IEX for operational reasons and indicates such operational halt using the Operational halt status message.
IEX disseminates a full pre-market spin of Operational halt status messages indicating the operational halt status of all securities. In the spin, IEX will send out an Operational Halt Message with “N” (Not operationally halted on IEX) for all securities that are eligible for trading at the start of the Pre-Market Session. If a security is absent from the dissemination, firms should assume that the security is being treated as operationally halted in the IEX Trading System at the start of the Pre-Market Session.
After the pre-market spin, IEX will use the Operational halt status message to relay changes in operational halt status for an individual security.
A maximumum of 10 symbols may be requested.
func (*Client) GetRecentStats ¶
This call will return a minimum of the last five trading days up to all trading days of the current month.
func (*Client) GetSecurityEvents ¶
func (c *Client) GetSecurityEvents(symbols []string) (map[string]*SecurityEventMessage, error)
The Security event message is used to indicate events that apply to a security. A Security event message will be sent whenever such event occurs.
A maximumum of 10 symbols may be requested.
func (*Client) GetShortSaleRestriction ¶
In association with Rule 201 of Regulation SHO, the Short Sale Price Test Message is used to indicate when a short sale price test restriction is in effect for a security.
IEX disseminates a full pre-market spin of Short sale price test status messages indicating the Rule 201 status of all securities. After the pre-market spin, IEX will use the Short sale price test status message in the event of an intraday status change.
The IEX Trading System will process orders based on the latest short sale price test restriction status.
A maximumum of 10 symbols may be requested.
func (*Client) GetSymbols ¶
GetSymbols returns an array of symbols IEX supports for trading. This list is updated daily as of 7:45 a.m. ET. Symbols may be added or removed by IEX after the list was produced.
func (*Client) GetSystemEvents ¶
func (c *Client) GetSystemEvents(symbols []string) (map[string]*SystemEvent, error)
The System event message is used to indicate events that apply to the market or the data feed.
There will be a single message disseminated per channel for each System Event type within a given trading session.
A maximumum of 10 symbols may be requested.
func (*Client) GetTOPS ¶
TOPS provides IEX’s aggregated best quoted bid and offer position in near real time for all securities on IEX’s displayed limit order book. TOPS is ideal for developers needing both quote and trade data.
Symbols may be any of the available symbols returned by GetSymbols(). If symbols is nil, then all symbols will be returned.
func (*Client) GetTradeBreaks ¶
Trade break messages are sent when an execution on IEX is broken on that same trading day. Trade breaks are rare and only affect applications that rely upon IEX execution based data.
A maximum of 10 symbols may be requested. Last is the number of trades to fetch, and must be <= 500.
func (*Client) GetTrades ¶
Trade report messages are sent when an order on the IEX Order Book is executed in whole or in part. DEEP sends a Trade report message for every individual fill.
A maximum of 10 symbols may be requested. Last is the number of trades to fetch, and must be <= 500.
func (*Client) GetTradingStatus ¶
func (c *Client) GetTradingStatus(symbols []string) (map[string]*TradingStatusMessage, error)
The Trading status message is used to indicate the current trading status of a security. For IEX-listed securities, IEX acts as the primary market and has the authority to institute a trading halt or trading pause in a security due to news dissemination or regulatory reasons. For non-IEX-listed securities, IEX abides by any regulatory trading halts and trading pauses instituted by the primary or listing market, as applicable.
IEX disseminates a full pre-market spin of Trading status messages indicating the trading status of all securities. In the spin, IEX will send out a Trading status message with “T” (Trading) for all securities that are eligible for trading at the start of the Pre-Market Session. If a security is absent from the dissemination, firms should assume that the security is being treated as operationally halted in the IEX Trading System.
After the pre-market spin, IEX will use the Trading status message to relay changes in trading status for an individual security. Messages will be sent when a security is:
Halted Paused* Released into an Order Acceptance Period* Released for trading
*The paused and released into an Order Acceptance Period status will be disseminated for IEX-listed securities only. Trading pauses on non-IEX-listed securities will be treated simply as a halt.
A maximumum of 10 symbols may be requested.
type DEEP ¶
type DEEP struct { Symbol string MarketPercent float64 Volume int LastSalePrice float64 LastSaleSize int LastSaleTime Time LastUpdate Time Bids []*Quote Asks []*Quote SystemEvent *SystemEvent TradingStatus *TradingStatusMessage OpHaltStatus *OpHaltStatus SSRStatus *SSRStatus SecurityEvent *SecurityEventMessage Trades []*Trade TradeBreaks []*TradeBreak }
type HIST ¶
type HIST struct { // URL to the available data file. Link string // Date of the data contained in this file. Date string // Which data feed is contained in this file. Feed string // The feed format specification version. Version string // The protocol version of the data. Protocol string // The size, in bytes, of the data file. Size int64 `json:",string"` }
type HistoricalDailyRequest ¶
type HistoricalDailyRequest struct { // Option 1: Value needs to be in four-digit year, two-digit // month format (YYYYMM) (i.e January 2017 would be written as 201701) // // Option 2: Value needs to be in four-digit year, two-digit month, // two-digit day format (YYYYMMDD) (i.e January 21, 2017 would be // written as 20170121). Date string `url:"date,omitempty"` // Is used in place of date to retrieve last n number of trading days. // Value can only be a number up to 90. Last int `url:"last,omitempty"` }
type HistoricalSummary ¶
type HistoricalSummary struct { AverageDailyVolume float64 AverageDailyRoutedVolume float64 AverageOrderSize float64 AverageFillSize float64 Bin100Percent float64 Bin101Percent float64 Bin200Percent float64 Bin300Percent float64 Bin400Percent float64 Bin500Percent float64 Bin1000Percent float64 Bin5000Percent float64 Bin10000Percent float64 Bin10000Trades float64 Bin20000Trades float64 Bin50000Trades float64 UniqueSymbolsTraded float64 BlockPercent float64 SelfCrossPercent float64 ETFPercent float64 LargeCapPercent float64 MidCapPercent float64 SmallCapPercent float64 VenueARCXFirstWaveWeight float64 VenueBATSFirstWaveWeight float64 VenueBATYFirstWaveWeight float64 VenueEDGAFirstWaveWeight float64 VenueEDGXFirstWaveWeight float64 VenueOverallFirstWaveWeight float64 VenueXASEFirstWaveWeight float64 VenueXBOSFirstWaveWeight float64 VenueXCHIFirstWaveWeight float64 VenueXCISFirstWaveWeight float64 VenueXNGSFirstWaveWeight float64 VenueXNYSFirstWaveWeight float64 VenueXPHLFirstWaveWeight float64 VenueARCXFirstWaveRate float64 VenueBATSFirstWaveRate float64 VenueBATYFirstWaveRate float64 VenueEDGAFirstWaveRate float64 VenueEDGXFirstWaveRate float64 VenueOverallFirstWaveRate float64 VenueXASEFirstWaveRate float64 VenueXBOSFirstWaveRate float64 VenueXCHIFirstWaveRate float64 VenueXCISFirstWaveRate float64 VenueXNGSFirstWaveRate float64 VenueXNYSFirstWaveRate float64 VenueXPHLFirstWaveRate float64 }
type IntradayStats ¶
type IntradayStats struct { // Refers to single counted shares matched from executions on IEX. Volume struct { Value int LastUpdated Time } // Refers to number of symbols traded on IEX. SymbolsTraded struct { Value int LastUpdated Time } // Refers to executions received from order routed to away trading centers. RoutedVolume struct { Value int LastUpdated Time } // Refers to sum of matched volume times execution price of those trades. Notional struct { Value int LastUpdated Time } MarketShare struct { Value float64 LastUpdated Time } }
type Last ¶
type Last struct { // Refers to the stock ticker. Symbol string // Refers to last sale price of the stock on IEX. (Refer to the attribution section above.) Price float64 // Refers to last sale size of the stock on IEX. Size int // Refers to last sale time in epoch time of the stock on IEX. Time Time }
type Market ¶
type Market struct { // Refers to the Market Identifier Code (MIC). MIC string // Refers to the tape id of the venue. TapeID string // Refers to name of the venue defined by IEX. VenueName string // Refers to the amount of traded shares reported by the venue. Volume int // Refers to the amount of Tape A traded shares reported by the venue. TapeA int // Refers to the amount of Tape B traded shares reported by the venue. TapeB int // Refers to the amount of Tape C traded shares reported by the venue. TapeC int // Refers to the venue’s percentage of shares traded in the market. MarketPercent float64 // Refers to the last update time of the data. LastUpdated Time }
type OpHaltStatus ¶
type PacketDataSource ¶
type PacketDataSource interface { gopacket.PacketDataSource LinkType() layers.LinkType }
func NewPacketDataSource ¶
func NewPacketDataSource(r io.Reader) (PacketDataSource, error)
Initializes a new packet source for pcap or pcap-ng files. Looks at the first 4 bytes to determine if the given Reader is a pcap or pcap-ng format.
type PcapScanner ¶
type PcapScanner struct {
// contains filtered or unexported fields
}
PcapScanner is a high-level reader for extracting messages from the pcap dumps provided by IEX in the HIST endpoint.
func NewPcapScanner ¶
func NewPcapScanner(packetDataSource PacketDataSource) *PcapScanner
func (*PcapScanner) NextMessage ¶
func (p *PcapScanner) NextMessage() (iextp.Message, error)
Get the next Message in the pcap dump.
type Records ¶
type Records struct { // Refers to single counted shares matched from executions on IEX. Volume *Record // Refers to number of symbols traded on IEX. SymbolsTraded *Record // Refers to executions received from order routed to away trading centers. RoutedVolume *Record // Refers to sum of matched volume times execution price of those trades. Notional *Record }
type SecurityEventMessage ¶
type Stats ¶
type Stats struct { // Refers to the trading day. Date string // Refers to executions received from order routed to away trading centers. Volume int // Refers to single counted shares matched from executions on IEX. RoutedVolume int MarketShare float64 // Will be true if the trading day is a half day. IsHalfDay int // Refers to the number of lit shares traded on IEX (single-counted). LitVolume int }
type Symbol ¶
type Symbol struct { // Refers to the symbol represented in Nasdaq Integrated symbology (INET). Symbol string // Refers to the name of the company or security. Name string // Refers to the date the symbol reference data was generated. Date string // Will be true if the symbol is enabled for trading on IEX. IsEnabled bool }
type SystemEvent ¶
type TOPS ¶
type TOPS struct { // Refers to the stock ticker. Symbol string // Refers to IEX’s percentage of the market in the stock. MarketPercent float64 // Refers to amount of shares on the bid on IEX. BidSize int // Refers to the best bid price on IEX. BidPrice float64 // Refers to amount of shares on the ask on IEX. AskSize int // Refers to the best ask price on IEX. AskPrice float64 // Refers to shares traded in the stock on IEX. Volume int // Refers to last sale price of the stock on IEX. (Refer to the attribution section above.) LastSalePrice float64 // Refers to last sale size of the stock on IEX. LastSaleSize int // Refers to last sale time of the stock on IEX. LastSaleTime Time // Refers to the last update time of the data. // If the value is the zero Time, IEX has not quoted the symbol in // the trading day. LastUpdated Time }
type Time ¶
IEX timestamps are always provided in milliseconds since the Unix epoch. Time implements JSON unmarshaling into the native Go Time type.
func (*Time) MarshalJSON ¶
func (*Time) UnmarshalJSON ¶
type TradeBreak ¶
type TradingStatusMessage ¶
Directories ¶
Path | Synopsis |
---|---|
deep
Package deep implements an unmarshaler for the DEEP protocol, v1.0.
|
Package deep implements an unmarshaler for the DEEP protocol, v1.0. |
tops
Package tops implements an unmarshaler for the TOPS protocol, v1.6.
|
Package tops implements an unmarshaler for the TOPS protocol, v1.6. |
pcap2json is a small binary for extracting IEXTP messages from a pcap dump and converting them to JSON.
|
pcap2json is a small binary for extracting IEXTP messages from a pcap dump and converting them to JSON. |