data

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package data provides the Webull Market Data API client.

A Client is constructed from the public client:

cl, err := client.New(
	client.WithAppKey(key),
	client.WithAppSecret(secret),
	client.WithSandbox(),
)
if err != nil {
	return err
}
market := data.New(cl)

The individual endpoints are grouped by area: instruments in instrument.go, fundamentals in fundamentals.go, futures static data in futures.go, and snapshot, tick, quotes, bars, footprint, NOII, screener, watchlist, options, and news in their own files.

Numeric values are returned as strings to preserve precision, and timestamps are strings in the format documented by the Webull API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalystRating

type AnalystRating struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// Category is the instrument's market.
	Category StockCategory `json:"category"`
	// Number is the total number of analysts, as a string.
	Number string `json:"number"`
	// UnderPerform is the number of under-perform ratings, as a string.
	UnderPerform string `json:"under_perform"`
	// Buy is the number of buy ratings, as a string.
	Buy string `json:"buy"`
	// Sell is the number of sell ratings, as a string.
	Sell string `json:"sell"`
	// StrongBuy is the number of strong-buy ratings, as a string.
	StrongBuy string `json:"strong_buy"`
	// Hold is the number of hold (neutral) ratings, as a string.
	Hold string `json:"hold"`
	// EffectiveStartDate is when the figures became effective.
	EffectiveStartDate string `json:"effective_start_date"`
}

AnalystRating holds analyst rating counts for a security.

type AnalystTargetPrice

type AnalystTargetPrice struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// Category is the instrument's market.
	Category StockCategory `json:"category"`
	// Mean is the average target price, as a decimal string.
	Mean string `json:"mean"`
	// Low is the lowest target price, as a decimal string.
	Low string `json:"low"`
	// High is the highest target price, as a decimal string.
	High string `json:"high"`
	// Median is the median target price, as a decimal string.
	Median string `json:"median"`
	// Currency is the target-price currency, for example "USD".
	Currency string `json:"currency"`
	// EffectiveStartDate is when the figures became effective.
	EffectiveStartDate string `json:"effective_start_date"`
}

AnalystTargetPrice holds analyst target-price statistics for a security.

type Bar

type Bar struct {
	// Time is the bar time, as returned by the server. The batch endpoint
	// documents an ISO-8601 string.
	Time string `json:"time"`
	// Open is the open price, as a decimal string.
	Open string `json:"open"`
	// Close is the close price, as a decimal string.
	Close string `json:"close"`
	// High is the high price, as a decimal string.
	High string `json:"high"`
	// Low is the low price, as a decimal string.
	Low string `json:"low"`
	// Volume is the volume, as a decimal string.
	Volume string `json:"volume"`
	// TradingSession is the session the bar belongs to, when supplied.
	TradingSession TradingSession `json:"trading_sessions,omitempty"`
}

Bar is a single OHLCV candlestick. Trading sessions use the shared TradingSession type.

type BarQuery

type BarQuery struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string
	// Category is the market to query. Required.
	Category StockCategory
	// Interval is the bar granularity. Required.
	Interval BarTimespan
	// Count is the number of bars to return. Zero means the server default
	// (200); the documented maximum is 1200 (1650 for M1).
	Count int
	// RealTimeRequired requests the latest market data when true. When nil the
	// server default (true) applies.
	RealTimeRequired *bool
	// TradingSessions restricts the result to the given trading sessions.
	TradingSessions []TradingSession
}

BarQuery parameterizes Client.GetBars. Symbol, Category and Interval are required.

type BarTimespan

type BarTimespan string

BarTimespan is the time granularity of a bar. It is the "timespan" body field of the batch bars endpoint.

const (
	// BarTimespanS5 is a 5-second bar.
	BarTimespanS5 BarTimespan = "S5"
	// BarTimespanS15 is a 15-second bar.
	BarTimespanS15 BarTimespan = "S15"
	// BarTimespanM1 is a 1-minute bar.
	BarTimespanM1 BarTimespan = "M1"
	// BarTimespanM5 is a 5-minute bar.
	BarTimespanM5 BarTimespan = "M5"
	// BarTimespanM15 is a 15-minute bar.
	BarTimespanM15 BarTimespan = "M15"
	// BarTimespanM30 is a 30-minute bar.
	BarTimespanM30 BarTimespan = "M30"
	// BarTimespanM60 is a 60-minute bar.
	BarTimespanM60 BarTimespan = "M60"
	// BarTimespanM120 is a 120-minute bar.
	BarTimespanM120 BarTimespan = "M120"
	// BarTimespanM240 is a 240-minute bar.
	BarTimespanM240 BarTimespan = "M240"
	// BarTimespanDay is a daily bar.
	BarTimespanDay BarTimespan = "D"
	// BarTimespanWeek is a weekly bar.
	BarTimespanWeek BarTimespan = "W"
	// BarTimespanMonth is a monthly bar.
	BarTimespanMonth BarTimespan = "M"
	// BarTimespanYear is a yearly bar.
	BarTimespanYear BarTimespan = "Y"
)

Bar time granularities accepted by the bars endpoints.

type BatchBarQuery

type BatchBarQuery struct {
	// Symbols is the list of security symbols to query, at most 100.
	Symbols []string
	// Category is the market to query. Required.
	Category StockCategory
	// Timespan is the bar granularity. Required. The batch endpoint documents
	// this parameter as "timespan".
	Timespan BarTimespan
	// Count is the number of bars to return per symbol. Zero means the server
	// default (200); the documented maximum is 1200 (1650 for M1).
	Count int
	// RealTimeRequired requests the latest market data when true. When nil the
	// server default (true) applies.
	RealTimeRequired *bool
	// TradingSessions restricts the result to the given trading sessions.
	TradingSessions []TradingSession
	// StartTime restricts the result to bars at or after this Unix timestamp in
	// milliseconds. Zero means unbounded.
	StartTime int64
	// EndTime restricts the result to bars at or before this Unix timestamp in
	// milliseconds. Zero means unbounded.
	EndTime int64
}

BatchBarQuery parameterizes Client.GetBatchBars. Symbols, Category and Timespan are required.

type BatchBarSymbol

type BatchBarSymbol struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Result is the list of bars for Symbol.
	Result []Bar `json:"result"`
}

BatchBarSymbol groups the bars returned for one symbol.

type BatchBars

type BatchBars struct {
	// Result groups the bars by symbol.
	Result []BatchBarSymbol `json:"result"`
}

BatchBars is the batch historical-bars response.

type BoolOrSuccess added in v0.9.1

type BoolOrSuccess struct {
	Success bool
}

func (*BoolOrSuccess) UnmarshalJSON added in v0.9.1

func (b *BoolOrSuccess) UnmarshalJSON(data []byte) error

type CapitalFlowEntry added in v0.4.0

type CapitalFlowEntry struct {
	Date      string `json:"date"`
	LargeIn   string `json:"large_in"`
	LargeOut  string `json:"large_out"`
	MediumIn  string `json:"medium_in"`
	MediumOut string `json:"medium_out"`
	SmallIn   string `json:"small_in"`
	SmallOut  string `json:"small_out"`
}

CapitalFlowEntry describes one trading day's capital flow breakdown.

type Client

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

Client exposes the Webull Market Data HTTP API. It is a thin, typed layer on top of client.Client: every request goes through the public client so that signing, transport, and error handling are shared with the rest of the SDK.

A Client is safe for concurrent use and does not own the underlying client.Client; callers close that client themselves.

func New

func New(c *client.Client) *Client

New returns a market-data client bound to c. The underlying client is owned by the caller and is not closed by Client.Close.

func (*Client) AddWatchlistInstruments

func (c *Client) AddWatchlistInstruments(ctx context.Context, params WatchlistInstrumentsParam) (*SuccessResponse, error)

AddWatchlistInstruments adds instruments to a watchlist.

Reference: https://developer.webull.hk/apis/docs/reference/add-watchlist-instruments.md

func (*Client) Close

func (c *Client) Close() error

Close releases resources held by the client. The underlying client.Client is owned by the caller and is not closed here.

func (*Client) Core

func (c *Client) Core() *client.Client

Core returns the underlying public client.

func (*Client) CreateWatchlist

func (c *Client) CreateWatchlist(ctx context.Context, params CreateWatchlistParams) (*CreateWatchlistResult, error)

CreateWatchlist creates a new watchlist and returns its identifier.

Reference: https://developer.webull.hk/apis/docs/reference/create-watchlist.md

func (*Client) DSSubscribe added in v0.7.0

func (c *Client) DSSubscribe(ctx context.Context, req DSSubscribeRequest) error

DSSubscribe subscribes to real-time streaming data for the given symbols via the Display Solution endpoint.

func (*Client) DSUnsubscribe added in v0.7.0

func (c *Client) DSUnsubscribe(ctx context.Context, req DSUnsubscribeRequest) error

DSUnsubscribe unsubscribes from real-time streaming data for the given symbols via the Display Solution endpoint.

func (*Client) DeleteWatchlist

func (c *Client) DeleteWatchlist(ctx context.Context, watchlistID string) (*SuccessResponse, error)

DeleteWatchlist deletes the watchlist identified by watchlistID.

Reference: https://developer.webull.hk/apis/docs/reference/delete-watchlist.md

func (*Client) DisplayService added in v0.5.0

func (c *Client) DisplayService() *display.Service

DisplayService returns the display.Service for Display Solution API calls. It is created lazily on first use using the same app credentials as the underlying client.Client. Tests may replace it with Client.SetDisplaySvcForTesting.

func (*Client) GetAnalystRating

func (c *Client) GetAnalystRating(ctx context.Context, symbol string, category StockCategory) (*AnalystRating, error)

GetAnalystRating retrieves aggregate analyst rating counts for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/get-analyst-rating.md

func (*Client) GetAnalystTargetPrice

func (c *Client) GetAnalystTargetPrice(ctx context.Context, symbol string, category StockCategory) (*AnalystTargetPrice, error)

GetAnalystTargetPrice retrieves aggregate analyst target-price data for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/get-analyst-target-price.md

func (*Client) GetBalanceSheet added in v0.4.0

func (c *Client) GetBalanceSheet(ctx context.Context, symbol string, category StockCategory) ([]FinancialsItem, error)

GetBalanceSheet retrieves the balance sheet for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/balance-sheet.md

func (*Client) GetBars

func (c *Client) GetBars(ctx context.Context, q BarQuery) (*StockBars, error)

GetBars retrieves historical bars for a single symbol.

The historical single-symbol endpoint GET /market-data/stocks/bars/get is retired: both the official Webull Python SDK (MarketData.get_history_bar) and the live sandbox report it as no longer available. GetBars therefore issues a one-symbol batch request against POST /market-data/stocks/bars/list and unwraps the single result.

Reference: https://developer.webull.hk/apis/docs/reference/historical-bars.md

func (*Client) GetBatchBars

func (c *Client) GetBatchBars(ctx context.Context, q BatchBarQuery) (*BatchBars, error)

GetBatchBars retrieves historical bars for multiple symbols in one request.

Reference: https://developer.webull.hk/apis/docs/reference/historical-bars.md

func (*Client) GetCapitalFlow added in v0.4.0

func (c *Client) GetCapitalFlow(ctx context.Context, symbol string, category StockCategory, count int) ([]CapitalFlowEntry, error)

GetCapitalFlow retrieves the capital flow breakdown for symbol over the most recent count trading days (default 5, maximum 5). Results are sorted in ascending chronological order.

Reference: https://developer.webull.hk/apis/docs/reference/capital-flow.md

func (*Client) GetCashFlow added in v0.4.0

func (c *Client) GetCashFlow(ctx context.Context, symbol string, category StockCategory) ([]FinancialsItem, error)

GetCashFlow retrieves the cash flow statement for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/cash-flow-statement.md

func (*Client) GetCompanyProfile

func (c *Client) GetCompanyProfile(ctx context.Context, symbol string, category StockCategory) (*CompanyProfile, error)

GetCompanyProfile retrieves the profile of the company behind symbol. The Webull documentation currently supports US stocks only, so category should normally be StockCategoryUS.

Reference: https://developer.webull.hk/apis/docs/reference/get-company-profile.md

func (*Client) GetCorporateActions added in v0.5.0

func (c *Client) GetCorporateActions(ctx context.Context, q CorporateActionQuery) ([]CorporateAction, string, error)

GetCorporateActions retrieves corporate action events for one or more symbols using the Display Solution API.

category is required and must be one of: "US_STOCK", "HK_STOCK", "CN_STOCK".

Reference: https://developer.webull.hk/apis/docs/reference/market-display-solution-data-api/corp-action-using-get

func (*Client) GetCorporateActionsByMarket added in v0.5.0

func (c *Client) GetCorporateActionsByMarket(ctx context.Context, q CorporateActionQuery) ([]CorporateAction, string, error)

GetCorporateActionsByMarket retrieves corporate action events for all securities in a market using the Display Solution API.

Currently only "US" market is supported.

Reference: https://developer.webull.hk/apis/docs/reference/market-display-solution-data-api/corp-market-using-get

func (*Client) GetCryptoBars added in v0.5.0

func (c *Client) GetCryptoBars(ctx context.Context, q CryptoBarsQuery) ([]CryptoSymbolBars, error)

GetCryptoBars retrieves historical bars for one or more crypto symbols.

func (*Client) GetCryptoInstruments added in v1.1.0

func (c *Client) GetCryptoInstruments(ctx context.Context, q CryptoInstrumentQuery) (*CryptoInstrumentsResult, error)

GetCryptoInstruments retrieves crypto instrument profiles.

func (*Client) GetCryptoSnapshot added in v0.5.0

func (c *Client) GetCryptoSnapshot(ctx context.Context, q CryptoSnapshotQuery) ([]CryptoSnapshot, error)

GetCryptoSnapshot retrieves real-time snapshots for one or more crypto symbols.

func (*Client) GetDSAnalystRating added in v0.7.0

func (c *Client) GetDSAnalystRating(ctx context.Context, symbol string) (*AnalystRating, error)

GetDSAnalystRating retrieves aggregate analyst rating counts for symbol via the Display Solution endpoint.

func (*Client) GetDSAnalystTargetPrice added in v0.7.0

func (c *Client) GetDSAnalystTargetPrice(ctx context.Context, symbol string) (*AnalystTargetPrice, error)

GetDSAnalystTargetPrice retrieves aggregate analyst target-price data for symbol via the Display Solution endpoint.

func (*Client) GetDSCompanyProfile added in v0.7.0

func (c *Client) GetDSCompanyProfile(ctx context.Context, symbol string) (*CompanyProfile, error)

GetDSCompanyProfile retrieves the company profile for symbol via the Display Solution endpoint.

func (*Client) GetDSLatestNews added in v0.7.0

func (c *Client) GetDSLatestNews(ctx context.Context) ([]DSNewsSummaryItem, error)

GetDSLatestNews retrieves the latest news headlines via the Display Solution endpoint.

func (*Client) GetDSMarketNews added in v0.7.0

func (c *Client) GetDSMarketNews(ctx context.Context, category string) ([]DSNewsSummaryItem, error)

GetDSMarketNews retrieves market-wide news for the given category via the Display Solution endpoint.

func (*Client) GetDSNewsSummary added in v0.7.0

func (c *Client) GetDSNewsSummary(ctx context.Context, symbols []string) ([]DSNewsSummaryItem, error)

GetDSNewsSummary retrieves news summaries for the given symbols via the Display Solution endpoint.

func (*Client) GetDSSymbolNews added in v0.7.0

func (c *Client) GetDSSymbolNews(ctx context.Context, symbol string) ([]DSNewsSummaryItem, error)

GetDSSymbolNews retrieves news for a specific symbol via the Display Solution endpoint.

func (*Client) GetDisplayBars added in v0.7.0

func (c *Client) GetDisplayBars(ctx context.Context, q BatchBarQuery) (*BatchBars, error)

GetDisplayBars retrieves historical bars for multiple symbols via Display Solution. The request is sent as a POST with a JSON body.

func (*Client) GetDisplayBarsSingle added in v0.7.0

func (c *Client) GetDisplayBarsSingle(ctx context.Context, q BarQuery) (*StockBars, error)

GetDisplayBarsSingle retrieves historical bars for a single symbol via Display Solution. This is a GET request against the single-symbol bars path.

func (*Client) GetDisplayDepth added in v0.7.0

func (c *Client) GetDisplayDepth(ctx context.Context, q DepthQuery) (*Quote, error)

GetDisplayDepth retrieves the latest bid/ask order-book depth via Display Solution.

func (*Client) GetDisplayGainersLosers added in v0.7.0

func (c *Client) GetDisplayGainersLosers(ctx context.Context, q GainersLosersQuery) ([]ScreenerStock, error)

GetDisplayGainersLosers retrieves gainers/losers via Display Solution.

func (*Client) GetDisplaySnapshot added in v0.7.0

func (c *Client) GetDisplaySnapshot(ctx context.Context, q SnapshotQuery) ([]Snapshot, error)

GetDisplaySnapshot retrieves real-time market snapshots via Display Solution.

func (*Client) GetDisplayTick added in v0.7.0

func (c *Client) GetDisplayTick(ctx context.Context, q TickQuery) (*StockTicks, error)

GetDisplayTick retrieves tick-by-tick trade data via Display Solution.

func (*Client) GetDisplayTopActive added in v0.7.0

func (c *Client) GetDisplayTopActive(ctx context.Context, q MostActiveQuery) ([]ScreenerStock, error)

GetDisplayTopActive retrieves top active stocks via Display Solution.

func (*Client) GetDividendCalendar added in v0.4.0

func (c *Client) GetDividendCalendar(ctx context.Context, symbol string, category StockCategory) ([]DividendCalendarEntry, error)

GetDividendCalendar retrieves the dividend calendar for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/dividend-calendar.md

func (*Client) GetEarningsCalendar added in v0.4.0

func (c *Client) GetEarningsCalendar(ctx context.Context, symbol string, category StockCategory) ([]EarningsCalendarEntry, error)

GetEarningsCalendar retrieves the earnings calendar for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/earnings-calendar.md

func (*Client) GetEventBars added in v0.7.0

func (c *Client) GetEventBars(ctx context.Context, q EventBarsQuery) ([]EventBar, error)

GetEventBars retrieves historical bars for one or more event contract symbols.

func (*Client) GetEventContractCategories added in v0.7.0

func (c *Client) GetEventContractCategories(ctx context.Context) ([]EventContractCategory, error)

GetEventContractCategories retrieves the list of event contract categories.

Reference: https://developer.webull.com/apis/docs/reference/event-categories-list.md

func (*Client) GetEventContractEvents added in v0.7.0

func (c *Client) GetEventContractEvents(ctx context.Context, q EventContractEventsQuery) ([]EventContractEvent, error)

GetEventContractEvents retrieves events within a series, optionally filtered by symbols and status.

Reference: https://developer.webull.com/apis/docs/reference/event-categories-list.md

func (*Client) GetEventContractEventsList added in v1.1.0

func (c *Client) GetEventContractEventsList(ctx context.Context, q EventListQuery) (*EventListPage, error)

GetEventContractEventsList lists event-contract events.

func (*Client) GetEventContractMarkets added in v0.7.0

func (c *Client) GetEventContractMarkets(ctx context.Context, q EventContractMarketsQuery) ([]EventContractMarket, error)

GetEventContractMarkets retrieves tradable event contract markets, optionally filtered by series, event, symbols, and expiration date.

Reference: https://developer.webull.com/apis/docs/reference/event-categories-list.md

func (*Client) GetEventContractMilestones added in v1.1.0

func (c *Client) GetEventContractMilestones(ctx context.Context, q MilestoneQuery) (*MilestonePage, error)

GetEventContractMilestones lists event-contract milestones.

func (*Client) GetEventContractSeries added in v0.7.0

func (c *Client) GetEventContractSeries(ctx context.Context, q EventContractSeriesQuery) ([]EventContractSeries, error)

GetEventContractSeries retrieves event contract series, optionally filtered by category and symbols.

Reference: https://developer.webull.com/apis/docs/reference/event-categories-list.md

func (*Client) GetEventContractSeriesList added in v1.1.0

func (c *Client) GetEventContractSeriesList(ctx context.Context, q EventSeriesListQuery) (*EventSeriesListPage, error)

GetEventContractSeriesList lists event-contract series.

func (*Client) GetEventContractSportsFilters added in v1.1.0

func (c *Client) GetEventContractSportsFilters(ctx context.Context, tag string) ([]EventSportsFilter, error)

GetEventContractSportsFilters lists the sports filters.

func (*Client) GetEventContractTags added in v1.1.0

func (c *Client) GetEventContractTags(ctx context.Context) ([]EventContractTag, error)

GetEventContractTags lists the tags per event-contract category.

func (*Client) GetEventDepth added in v0.7.0

func (c *Client) GetEventDepth(ctx context.Context, q EventDepthQuery) (*EventDepth, error)

GetEventDepth retrieves the bid/ask order-book depth for a single event contract symbol.

func (*Client) GetEventGameStats added in v1.1.0

func (c *Client) GetEventGameStats(ctx context.Context, milestoneID, category string) (*EventGameStats, error)

GetEventGameStats retrieves game statistics for a milestone.

func (*Client) GetEventLiveData added in v1.1.0

func (c *Client) GetEventLiveData(ctx context.Context, milestoneID, category string) (*EventLiveData, error)

GetEventLiveData retrieves live data for a milestone.

func (*Client) GetEventMarketBars added in v1.1.0

func (c *Client) GetEventMarketBars(ctx context.Context, q EventMarketBarsQuery) ([]EventMarketBar, error)

GetEventMarketBars retrieves bars for event-contract market symbols.

func (*Client) GetEventMarketBarsByEvent added in v1.1.0

func (c *Client) GetEventMarketBarsByEvent(ctx context.Context, q EventMarketBarsByEventQuery) ([]EventMarketBar, error)

GetEventMarketBarsByEvent retrieves bars for an event symbol.

func (*Client) GetEventMarketDepth added in v1.1.0

func (c *Client) GetEventMarketDepth(ctx context.Context, symbol, category string, depth int) (*EventMarketDepth, error)

GetEventMarketDepth retrieves the depth of an event-contract market.

func (*Client) GetEventMarketSnapshot added in v1.1.0

func (c *Client) GetEventMarketSnapshot(ctx context.Context, symbol, category string) (*EventMarketSnapshot, error)

GetEventMarketSnapshot retrieves the snapshot of an event-contract market.

func (*Client) GetEventSnapshot added in v0.7.0

func (c *Client) GetEventSnapshot(ctx context.Context, q EventSnapshotQuery) ([]EventSnapshot, error)

GetEventSnapshot retrieves real-time market snapshots for one or more event contract symbols.

func (*Client) GetEventTick added in v0.7.0

func (c *Client) GetEventTick(ctx context.Context, q EventTickQuery) ([]EventTick, error)

GetEventTick retrieves tick-by-tick trade data for a single event contract symbol.

func (*Client) GetFilings added in v0.4.0

func (c *Client) GetFilings(ctx context.Context, symbol string, category StockCategory) (*FilingsResponse, error)

GetFilings retrieves SEC filings for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/filings.md

func (*Client) GetFinancialAlert added in v0.4.0

func (c *Client) GetFinancialAlert(ctx context.Context, symbol string, category StockCategory) (*FinancialAlert, error)

GetFinancialAlert retrieves upcoming earnings-release alert for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/financial-alert.md

func (*Client) GetFinancialIndicators added in v0.4.0

func (c *Client) GetFinancialIndicators(ctx context.Context, symbol string, category StockCategory) (*FinancialIndicator, error)

GetFinancialIndicators retrieves financial indicators for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/financial-indicators.md

func (*Client) GetFootprint

func (c *Client) GetFootprint(ctx context.Context, q FootprintQuery) ([]StockFootprint, error)

GetFootprint retrieves footprint (order-flow) bars for one or more US stocks. Symbols, Category and Timespan are required.

Reference: https://developer.webull.hk/apis/docs/reference/footprint.md

func (*Client) GetForecastEPS added in v0.4.0

func (c *Client) GetForecastEPS(ctx context.Context, symbol string, category StockCategory) ([]ForecastEPSEntry, error)

GetForecastEPS retrieves forecast EPS data for symbol for the most recent 5 quarters.

Reference: https://developer.webull.hk/apis/docs/reference/forecast-eps.md

func (*Client) GetFundAllocation added in v1.1.0

func (c *Client) GetFundAllocation(ctx context.Context, symbol string, category StockCategory) ([]FundAllocation, error)

GetFundAllocation retrieves the asset allocation history of a fund.

func (*Client) GetFundDividends added in v0.5.0

func (c *Client) GetFundDividends(ctx context.Context, q FundDividendsQuery) ([]FundDividend, error)

GetFundDividends retrieves dividend history for a fund or ETF.

func (*Client) GetFundFiles added in v1.1.0

func (c *Client) GetFundFiles(ctx context.Context, symbol string, category StockCategory) ([]FundFile, error)

GetFundFiles retrieves the documents of a fund.

func (*Client) GetFundHoldings added in v1.1.0

func (c *Client) GetFundHoldings(ctx context.Context, symbol string, category StockCategory) ([]FundHolding, error)

GetFundHoldings retrieves the top holdings of a fund.

func (*Client) GetFundInfo added in v0.5.0

func (c *Client) GetFundInfo(ctx context.Context, q FundInfoQuery) (*FundInfo, error)

GetFundInfo retrieves basic information for a fund or ETF.

func (*Client) GetFundList added in v0.5.0

func (c *Client) GetFundList(ctx context.Context, q FundListQuery) ([]FundListItem, error)

GetFundList retrieves a list of funds or ETFs by market and category.

func (*Client) GetFundNav added in v0.5.0

func (c *Client) GetFundNav(ctx context.Context, q FundNavQuery) ([]FundNav, error)

GetFundNav retrieves NAV history for a fund or ETF.

func (*Client) GetFundPerformance added in v1.1.0

func (c *Client) GetFundPerformance(ctx context.Context, symbol string, category StockCategory) (*FundPerformance, error)

GetFundPerformance retrieves the performance returns of a fund.

func (*Client) GetFundRating added in v1.1.0

func (c *Client) GetFundRating(ctx context.Context, symbol string, category StockCategory) ([]FundRating, error)

GetFundRating retrieves the rating history of a fund.

func (*Client) GetFundSplits added in v1.1.0

func (c *Client) GetFundSplits(ctx context.Context, symbol string, category StockCategory) ([]FundSplit, error)

GetFundSplits retrieves the split history of a fund.

func (*Client) GetFuturesBars added in v0.7.0

func (c *Client) GetFuturesBars(ctx context.Context, q FuturesBarsQuery) (*BatchBars, error)

GetFuturesBars retrieves historical bars for one or more futures contracts.

func (*Client) GetFuturesDepth added in v0.7.0

func (c *Client) GetFuturesDepth(ctx context.Context, q FuturesDepthQuery) (*Quote, error)

GetFuturesDepth retrieves the latest bid/ask order-book depth for a single futures contract.

func (*Client) GetFuturesFootprint added in v0.7.0

func (c *Client) GetFuturesFootprint(ctx context.Context, q FuturesFootprintQuery) ([]StockFootprint, error)

GetFuturesFootprint retrieves footprint (order-flow) bars for one or more futures contracts.

func (*Client) GetFuturesInstruments

func (c *Client) GetFuturesInstruments(ctx context.Context, q FuturesInstrumentQuery) ([]FuturesInstrument, error)

GetFuturesInstruments retrieves static detail for one or more futures contracts. Category is required, and at least one of Symbols or Code must be provided.

Reference: https://developer.webull.hk/apis/docs/reference/futures-instrument-list.md

func (*Client) GetFuturesProductClasses

func (c *Client) GetFuturesProductClasses(ctx context.Context, category FuturesCategory) ([]FuturesProductClass, error)

GetFuturesProductClasses retrieves the futures product classification groups for category.

Reference: https://developer.webull.hk/apis/docs/reference/futures-products-class.md

func (*Client) GetFuturesProductCodes

func (c *Client) GetFuturesProductCodes(ctx context.Context, q FuturesProductCodeQuery) ([]FuturesProduct, error)

GetFuturesProductCodes retrieves the futures products and their product codes for q.Category.

Reference: https://developer.webull.hk/apis/docs/reference/futures-products.md

func (*Client) GetFuturesSnapshot added in v0.7.0

func (c *Client) GetFuturesSnapshot(ctx context.Context, q FuturesSnapshotQuery) ([]Snapshot, error)

GetFuturesSnapshot retrieves real-time market snapshots for one or more futures contracts.

func (*Client) GetFuturesTick added in v0.7.0

func (c *Client) GetFuturesTick(ctx context.Context, q FuturesTickQuery) (*StockTicks, error)

GetFuturesTick retrieves tick-by-tick trade data for a single futures contract.

func (*Client) GetHighDividendRank added in v0.7.0

func (c *Client) GetHighDividendRank(ctx context.Context, q HighDividendQuery) ([]ScreenerStock, error)

GetHighDividendRank retrieves US stocks ranked by dividend yield.

Reference: https://developer.webull.hk/apis/docs/reference/get-high-dividend-ranks.md

func (*Client) GetIncomeStatement added in v0.4.0

func (c *Client) GetIncomeStatement(ctx context.Context, symbol string, category StockCategory) ([]FinancialsItem, error)

GetIncomeStatement retrieves the income statement for symbol.

Reference: https://developer.webull.hk/apis/docs/reference/income-statement.md

func (*Client) GetIndustryComparison added in v0.4.0

func (c *Client) GetIndustryComparison(ctx context.Context, symbol string, category StockCategory, sortBy string) (*IndustryComparison, error)

GetIndustryComparison retrieves peer comparison data for the industry that symbol belongs to. sortBy defaults to EPS_TTM.

Reference: https://developer.webull.hk/apis/docs/reference/industry-comparison.md

func (*Client) GetLogos added in v0.5.0

func (c *Client) GetLogos(ctx context.Context, q LogoQuery) ([]Logo, error)

GetLogos retrieves logo image URLs for the specified securities.

Reference: https://developer.webull.hk/apis/docs/reference/market-display-solution-data-api/batch-logo-using-post

func (*Client) GetMarketSectorDetail added in v0.7.0

func (c *Client) GetMarketSectorDetail(ctx context.Context, q MarketSectorDetailQuery) ([]ScreenerStock, error)

GetMarketSectorDetail retrieves the constituent stocks of a single market sector, with optional sorting.

Reference: https://developer.webull.hk/apis/docs/reference/get-market-sector-detail.md

func (*Client) GetMarketSectors added in v0.7.0

func (c *Client) GetMarketSectors(ctx context.Context) ([]MarketSector, error)

GetMarketSectors retrieves the list of market sectors with their aggregate statistics and constituent stocks.

Reference: https://developer.webull.hk/apis/docs/reference/get-market-sectors.md

func (*Client) GetMostActive

func (c *Client) GetMostActive(ctx context.Context, q MostActiveQuery) ([]ScreenerStock, error)

GetMostActive retrieves the most actively traded US stocks, ranked by the metric selected with MostActiveQuery.RankType.

The Webull reference URL get-most-active.md does not exist; the endpoint is documented as "List Top Actives" (operationId getTopActive).

Reference: https://developer.webull.hk/apis/docs/reference/get-top-active.md

func (*Client) GetNOIIBars

func (c *Client) GetNOIIBars(ctx context.Context, q NOIIQuery) ([]NOIIBar, error)

GetNOIIBars retrieves Net Order Imbalance Indicator (NOII) bars for the opening or closing auction of a US stock. Only a single symbol is supported.

Reference: https://developer.webull.hk/apis/docs/reference/get-noii-bars.md

func (*Client) GetNOIISnapshot

func (c *Client) GetNOIISnapshot(ctx context.Context, q NOIIQuery) (*NOIISnapshot, error)

GetNOIISnapshot retrieves the latest Net Order Imbalance Indicator (NOII) snapshot for the opening or closing auction of a US stock. Only a single symbol is supported.

Reference: https://developer.webull.hk/apis/docs/reference/get-noii-snapshot.md

func (*Client) GetNewsSummary

func (c *Client) GetNewsSummary(ctx context.Context, params NewsSummaryParam) (*NewsSummaryStream, error)

GetNewsSummary opens a news-summary stream for the requested symbols. The caller must close the returned stream. A non-2xx response is returned as a typed error instead of a stream.

Reference: https://developer.webull.hk/apis/docs/reference/news-summary.md

func (*Client) GetOptionBars

func (c *Client) GetOptionBars(ctx context.Context, q OptionBarsQuery) ([]OptionSymbolBars, error)

GetOptionBars retrieves historical bars for one or more option contracts.

Reference: https://developer.webull.hk/apis/docs/reference/option-historical-bars.md

func (*Client) GetOptionContracts added in v1.0.2

func (c *Client) GetOptionContracts(ctx context.Context, q OptionContractsQuery) (*OptionContractsResult, error)

GetOptionContracts lists the option contracts available for an underlying symbol, optionally narrowed by expiration, option type, and strike range.

Reference: https://developer.webull.hk/apis/docs/reference/instrument returns 404.

func (*Client) GetOptionSnapshot

func (c *Client) GetOptionSnapshot(ctx context.Context, q OptionSnapshotQuery) ([]OptionSnapshot, error)

GetOptionSnapshot retrieves real-time snapshots for up to 20 option contracts.

Reference: https://developer.webull.hk/apis/docs/reference/option-snapshot.md

func (*Client) GetOptionTick

func (c *Client) GetOptionTick(ctx context.Context, q OptionTickQuery) (*OptionTickResult, error)

GetOptionTick retrieves tick-by-tick trade data for one option contract.

Reference: https://developer.webull.hk/apis/docs/reference/option-tick.md

func (*Client) GetQuotes

func (c *Client) GetQuotes(ctx context.Context, q DepthQuery) (*Quote, error)

GetQuotes retrieves the latest bid/ask order-book depth for a single symbol.

Reference: https://developer.webull.hk/apis/docs/reference/quotes.md

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(ctx context.Context, q SnapshotQuery) ([]Snapshot, error)

GetSnapshot retrieves real-time market snapshots for one or more symbols.

Reference: https://developer.webull.hk/apis/docs/reference/snapshot.md

func (*Client) GetStockInstruments

func (c *Client) GetStockInstruments(ctx context.Context, q StockInstrumentQuery) ([]StockInstrument, error)

GetStockInstruments retrieves profile information for one or more stock instruments. When q.Symbols is empty it returns the instruments of q.Category page by page; when set, it returns the requested symbols directly.

Reference: https://developer.webull.hk/apis/docs/reference/instrument-list.md

func (*Client) GetStockProfilesV3 added in v0.5.0

func (c *Client) GetStockProfilesV3(ctx context.Context, q StockProfilesV3Query) (*StockProfilesV3Result, error)

GetStockProfilesV3 retrieves profile information for one or more stock instruments using the Display Solution (v3) endpoint. Unlike the v2 endpoint (Client.GetStockInstruments), this uses POST and returns a paginated {data, pagination_key} envelope.

Reference: https://developer.webull.hk/apis/docs/reference/market-display-solution-data-api/list-using-get

func (*Client) GetTick

func (c *Client) GetTick(ctx context.Context, q TickQuery) (*StockTicks, error)

GetTick retrieves tick-by-tick trade data for a single symbol.

Reference: https://developer.webull.hk/apis/docs/reference/tick.md

func (*Client) GetTopGainersLosers

func (c *Client) GetTopGainersLosers(ctx context.Context, q GainersLosersQuery) ([]ScreenerStock, error)

GetTopGainersLosers retrieves the top gaining or losing US stocks for a ranking window. Pass SortDirectionAsc to rank losers.

Reference: https://developer.webull.hk/apis/docs/reference/get-gainers-losers.md

func (*Client) GetWatchlistInstruments

func (c *Client) GetWatchlistInstruments(ctx context.Context, watchlistID string) (*WatchlistInstruments, error)

GetWatchlistInstruments retrieves the instruments held in watchlistID.

Reference: https://developer.webull.hk/apis/docs/reference/get-watchlist-instruments.md

func (*Client) GetWatchlists

func (c *Client) GetWatchlists(ctx context.Context) ([]Watchlist, error)

GetWatchlists retrieves the authenticated user's watchlists.

Reference: https://developer.webull.hk/apis/docs/reference/get-watchlist.md

func (*Client) GetWeek52HighLow added in v0.7.0

func (c *Client) GetWeek52HighLow(ctx context.Context, q Week52HighLowQuery) ([]ScreenerStock, error)

GetWeek52HighLow retrieves US stocks based on their 52-week high/low performance.

Reference: https://developer.webull.hk/apis/docs/reference/get-week52-high-low.md

func (*Client) RemoveWatchlistInstruments

func (c *Client) RemoveWatchlistInstruments(ctx context.Context, params WatchlistInstrumentsParam) (*SuccessResponse, error)

RemoveWatchlistInstruments removes instruments from a watchlist.

Reference: https://developer.webull.hk/apis/docs/reference/remove-watchlist-instruments.md

func (*Client) SetDisplaySvcForTesting added in v0.6.0

func (c *Client) SetDisplaySvcForTesting(svc *display.Service)

SetDisplaySvcForTesting is for unit tests only (package data only).

func (*Client) UpdateWatchlist

func (c *Client) UpdateWatchlist(ctx context.Context, params UpdateWatchlistParams) (*SuccessResponse, error)

UpdateWatchlist renames a watchlist and/or changes its sort order.

Reference: https://developer.webull.hk/apis/docs/reference/update-watchlist.md

func (*Client) UpdateWatchlistInstruments

func (c *Client) UpdateWatchlistInstruments(ctx context.Context, params WatchlistInstrumentsParam) (*SuccessResponse, error)

UpdateWatchlistInstruments changes the sort order of instruments in a watchlist.

Reference: https://developer.webull.hk/apis/docs/reference/update-watchlist-instruments.md

type CompanyProfile

type CompanyProfile struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// Category is the instrument's market.
	Category StockCategory `json:"category"`
	// CompanyName is the registered company name.
	CompanyName string `json:"company_name"`
	// EstablishDate is the date of incorporation (YYYY-MM-DD).
	EstablishDate string `json:"establish_date"`
	// ExhibitionCode is the market where the company is listed.
	ExhibitionCode string `json:"exhibition_code"`
	// Profile is the free-text business description.
	Profile string `json:"profile"`
	// Employees is the number of employees, as a string.
	Employees string `json:"employees"`
	// Address is the headquarters address.
	Address string `json:"address"`
	// CEO is the name of the chief executive officer.
	CEO string `json:"ceo"`
	// Industries lists the company's industries.
	Industries []string `json:"industries"`
}

CompanyProfile describes a company's static profile.

type CorporateAction added in v0.5.0

type CorporateAction struct {
	InstrumentID int64  `json:"instrument_id"`
	Symbol       string `json:"symbol"`
	ExchangeCode string `json:"exchange_code"`
	EventType    string `json:"event_type"`
	EventAction  string `json:"event_action"`
	EventID      int64  `json:"event_id"`
	Source       string `json:"source"`
	RatioOld     string `json:"ratio_old"`
	RatioNew     string `json:"ratio_new"`
	EventDate    string `json:"event_date"`
	UpdateTime   string `json:"update_time"`
	CreateTime   string `json:"create_time"`
}

CorporateAction represents a corporate action event such as a dividend or stock split.

Reference: https://developer.webull.hk/apis/docs/reference/market-display-solution-data-api/corp-action-using-get

type CorporateActionQuery added in v0.5.0

type CorporateActionQuery struct {
	Symbols       []string
	Market        string
	StartDate     string
	EndDate       string
	EventTypes    []string
	PageSize      int
	PaginationKey string
}

CorporateActionQuery parameterizes Client.GetCorporateActions.

type CreateWatchlistParams

type CreateWatchlistParams struct {
	// Name is the watchlist name. Required.
	Name string `json:"name"`
	// Sort is the display ordering number. Zero means unset.
	Sort int32 `json:"sort,omitempty"`
}

CreateWatchlistParams parameterizes Client.CreateWatchlist. Name is required; a zero Sort lets the server choose the next display order.

type CreateWatchlistResult

type CreateWatchlistResult struct {
	// WatchlistID is the identifier assigned to the new watchlist.
	WatchlistID string `json:"watchlist_id"`
}

CreateWatchlistResult is returned by Client.CreateWatchlist.

type CryptoBar added in v0.5.0

type CryptoBar struct {
	Time   string `json:"time"`
	Open   string `json:"open"`
	Close  string `json:"close"`
	High   string `json:"high"`
	Low    string `json:"low"`
	Volume string `json:"volume"`
}

CryptoBar is a single crypto price bar.

type CryptoBarsQuery added in v0.5.0

type CryptoBarsQuery struct {
	// Symbols is the list of crypto symbols to query. Required.
	Symbols []string
	// Category is the crypto market category. Required.
	Category string
	// Timespan is the bar granularity. Required.
	Timespan BarTimespan
	// Count is the number of bars to return. Zero means the server default.
	Count int
	// RealTimeRequired asks the server to include the latest in-progress bar.
	RealTimeRequired bool
}

CryptoBarsQuery parameterizes Client.GetCryptoBars.

type CryptoInstrument added in v1.1.0

type CryptoInstrument struct {
	Symbol       string `json:"symbol"`
	Name         string `json:"name"`
	Category     string `json:"category"`
	Currency     string `json:"currency"`
	Status       string `json:"status"`
	InstrumentID string `json:"instrument_id"`
}

CryptoInstrument is the profile of one crypto instrument.

type CryptoInstrumentQuery added in v1.1.0

type CryptoInstrumentQuery struct {
	// Category is the crypto market category. Required.
	Category string
	// Symbols optionally restricts the result to specific symbols.
	Symbols []string
	// Status optionally filters by instrument status.
	Status string
	// PaginationKey continues from a previous page. Empty means unset.
	PaginationKey string
}

CryptoInstrumentQuery parameterizes Client.GetCryptoInstruments.

type CryptoInstrumentsResult added in v1.1.0

type CryptoInstrumentsResult struct {
	Instruments   []CryptoInstrument
	PaginationKey string
}

CryptoInstrumentsResult is the result of Client.GetCryptoInstruments.

type CryptoSnapshot added in v0.5.0

type CryptoSnapshot struct {
	InstrumentID  string `json:"instrument_id"`
	Symbol        string `json:"symbol"`
	PreClose      string `json:"pre_close"`
	LastTradeTime int64  `json:"last_trade_time"`
	Price         string `json:"price"`
	Open          string `json:"open"`
	High          string `json:"high"`
	Low           string `json:"low"`
	Change        string `json:"change"`
	ChangeRatio   string `json:"change_ratio"`
	QuoteTime     string `json:"quote_time"`
	Bid           string `json:"bid"`
	BidSize       string `json:"bid_size"`
	Ask           string `json:"ask"`
	AskSize       string `json:"ask_size"`
}

CryptoSnapshot is the real-time market snapshot of one crypto symbol.

type CryptoSnapshotQuery added in v0.5.0

type CryptoSnapshotQuery struct {
	// Symbols is the list of crypto symbols to query. Required.
	Symbols []string
	// Category is the crypto market category. Required.
	Category string
}

CryptoSnapshotQuery parameterizes Client.GetCryptoSnapshot.

type CryptoSymbolBars added in v1.1.0

type CryptoSymbolBars struct {
	Symbol       string      `json:"symbol"`
	InstrumentID string      `json:"instrument_id"`
	Result       []CryptoBar `json:"result"`
}

CryptoSymbolBars is the historical bars of one crypto symbol.

type DSNewsSummaryItem added in v0.7.0

type DSNewsSummaryItem struct {
	Title    string `json:"title"`
	Content  string `json:"content"`
	Source   string `json:"source"`
	URL      string `json:"url"`
	PubTime  string `json:"pub_time"`
	Symbol   string `json:"symbol"`
	Category string `json:"category"`
}

DSNewsSummaryItem is a single news item returned by the Display Solution news endpoints.

type DSSubscribeRequest added in v0.7.0

type DSSubscribeRequest struct {
	Symbols []string `json:"symbols"`
}

DSSubscribeRequest is the request body for Client.DSSubscribe.

type DSUnsubscribeRequest added in v0.7.0

type DSUnsubscribeRequest struct {
	Symbols []string `json:"symbols"`
}

DSUnsubscribeRequest is the request body for Client.DSUnsubscribe.

type DepthLevel added in v0.7.0

type DepthLevel struct {
	// Price is the level price, as a decimal string.
	Price string `json:"price"`
	// Size is the aggregate quantity at the level, as a decimal string.
	Size string `json:"size"`
}

DepthLevel is a single price level in the event-contract order book.

type DepthQuery

type DepthQuery struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string
	// Category is the market to query. Required.
	Category StockCategory
	// Depth is the number of order-book levels to return: 1 for L1, 10 for the
	// default L2 depth. Zero means the server default.
	Depth int
	// OvernightRequired includes overnight trading data when true.
	OvernightRequired bool
}

DepthQuery parameterizes Client.GetQuotes. Symbol and Category are required.

type DividendCalendarEntry added in v0.4.0

type DividendCalendarEntry struct {
	Symbol      string `json:"symbol"`
	Market      string `json:"market"`
	Currency    string `json:"currency"`
	Amount      string `json:"amount"`
	DivType     string `json:"div_type"`
	DeclareDate string `json:"declare_date"`
	ExDivDate   string `json:"ex_div_date"`
	RecordDate  string `json:"record_date"`
	PayDate     string `json:"pay_date"`
}

DividendCalendarEntry is one dividend event.

type EarningsCalendarEntry added in v0.4.0

type EarningsCalendarEntry struct {
	FiscalYear          int    `json:"fiscal_year"`
	FiscalPeriod        int    `json:"fiscal_period"`
	Currency            string `json:"currency"`
	ExpectedPublishDate string `json:"expected_publish_date"`
	EPSActual           string `json:"eps_actual"`
	EPSEst              string `json:"eps_est"`
	RevActual           string `json:"rev_actual"`
	RevEst              string `json:"rev_est"`
}

EarningsCalendarEntry is one earnings announcement.

type EventBar added in v0.7.0

type EventBar struct {
	// Symbol is the event-contract symbol.
	Symbol string `json:"symbol"`
	// Open is the open price, as a decimal string.
	Open string `json:"open"`
	// High is the high price, as a decimal string.
	High string `json:"high"`
	// Low is the low price, as a decimal string.
	Low string `json:"low"`
	// Close is the close price, as a decimal string.
	Close string `json:"close"`
	// Volume is the volume, as a decimal string.
	Volume string `json:"volume"`
	// Timestamp is the bar time, as a string.
	Timestamp string `json:"timestamp"`
	// Timespan is the bar granularity.
	Timespan BarTimespan `json:"timespan"`
}

EventBar is a candlestick bar for an event contract.

type EventBarsQuery added in v0.7.0

type EventBarsQuery struct {
	// Symbols is the list of event-contract symbols to query.
	Symbols []string
	// Category is the market to query. Required.
	Category string
	// Timespan is the bar granularity. Required.
	Timespan BarTimespan
	// Count is the number of bars to return per symbol. Zero means the server
	// default.
	Count int
	// RealTimeRequired requests the latest market data when true. When nil the
	// server default applies.
	RealTimeRequired *bool
}

EventBarsQuery parameterizes Client.GetEventBars. Symbols, Category and Timespan are required.

type EventContractCategory added in v0.7.0

type EventContractCategory struct {
	Category string `json:"category"`
	Name     string `json:"name"`
}

EventContractCategory represents an event contract category.

type EventContractEvent added in v0.7.0

type EventContractEvent struct {
	EventSymbol  string `json:"event_symbol"`
	SeriesSymbol string `json:"series_symbol"`
	Name         string `json:"name"`
	Status       string `json:"status"`
}

EventContractEvent represents a single event within a series.

type EventContractEventsQuery added in v0.7.0

type EventContractEventsQuery struct {
	SeriesSymbol string
	Symbols      []string
	Status       string
}

EventContractEventsQuery parameterizes Client.GetEventContractEvents.

type EventContractMarket added in v0.7.0

type EventContractMarket struct {
	Symbol         string `json:"symbol"`
	EventSymbol    string `json:"event_symbol"`
	SeriesSymbol   string `json:"series_symbol"`
	Status         string `json:"status"`
	StrikePrice    string `json:"strike_price,omitempty"`
	ExpirationDate string `json:"expiration_date,omitempty"`
}

EventContractMarket represents a tradable event contract instrument.

type EventContractMarketsQuery added in v0.7.0

type EventContractMarketsQuery struct {
	SeriesSymbol        string
	EventSymbol         string
	Symbols             []string
	ExpirationDateAfter string
	PaginationKey       string
}

EventContractMarketsQuery parameterizes Client.GetEventContractMarkets.

type EventContractSeries added in v0.7.0

type EventContractSeries struct {
	SeriesSymbol string `json:"series_symbol"`
	Category     string `json:"category"`
	Name         string `json:"name"`
	Status       string `json:"status"`
}

EventContractSeries represents a series of related events.

type EventContractSeriesQuery added in v0.7.0

type EventContractSeriesQuery struct {
	Category      string
	Symbols       []string
	PaginationKey string
}

EventContractSeriesQuery parameterizes Client.GetEventContractSeries.

type EventContractTag added in v1.1.0

type EventContractTag struct {
	Tags         []string `json:"tags"`
	CategoryID   int      `json:"category_id"`
	CategoryName string   `json:"category_name"`
	CategoryCode string   `json:"category_code"`
}

EventContractTag groups the tags available for a category.

type EventDepth added in v0.7.0

type EventDepth struct {
	// Symbol is the event-contract symbol.
	Symbol string `json:"symbol"`
	// Timestamp is the depth time, as a string.
	Timestamp string `json:"timestamp"`
	// YesBids is the bid side of the book, best (highest) price first.
	YesBids []DepthLevel `json:"yes_bids"`
	// YesAsks is the ask side of the book, best (lowest) price first.
	YesAsks []DepthLevel `json:"yes_asks"`
}

EventDepth is the order book for an event contract.

type EventDepthQuery added in v0.7.0

type EventDepthQuery struct {
	// Symbol is the event-contract symbol.
	Symbol string
	// Category is the market to query. Required.
	Category string
	// Depth is the number of order-book levels to return.
	Depth int
}

EventDepthQuery parameterizes Client.GetEventDepth. Symbol, Category and Depth are required.

type EventGameStats added in v1.1.0

type EventGameStats struct {
	MilestoneID string           `json:"milestone_id"`
	Periods     []map[string]any `json:"periods"`
}

EventGameStats is the game statistics for an event-contract milestone.

type EventListPage added in v1.1.0

type EventListPage struct {
	Data          []map[string]any `json:"data"`
	PaginationKey string           `json:"pagination_key"`
}

EventListPage is a paginated list of event items.

type EventListQuery added in v1.1.0

type EventListQuery struct {
	SeriesSymbol  string
	Status        string
	PaginationKey string
}

EventListQuery parameterizes Client.GetEventContractEventsList.

type EventLiveData added in v1.1.0

type EventLiveData struct {
	Type          string         `json:"type"`
	MilestoneID   string         `json:"milestone_id"`
	Status        string         `json:"status"`
	Winner        string         `json:"winner"`
	LastPlay      map[string]any `json:"last_play"`
	LastUpdatedTS int64          `json:"last_updated_ts"`
	Details       map[string]any `json:"details"`
}

EventLiveData is the live state of an event-contract milestone.

type EventMarketBar added in v1.1.0

type EventMarketBar struct {
	EndPeriodTime string `json:"end_period_time"`
	Volume        string `json:"volume"`
	Open          string `json:"open"`
	High          string `json:"high"`
	Low           string `json:"low"`
	Close         string `json:"close"`
}

EventMarketBar is a single event-contract market bar.

type EventMarketBarsByEventQuery added in v1.1.0

type EventMarketBarsByEventQuery struct {
	EventSymbol string
	Category    string
	StartTime   int64
	EndTime     int64
	Count       int
	Timespan    string
}

EventMarketBarsByEventQuery parameterizes Client.GetEventMarketBarsByEvent.

type EventMarketBarsQuery added in v1.1.0

type EventMarketBarsQuery struct {
	Symbols   []string
	Category  string
	StartTime int64
	EndTime   int64
	Count     int
	Timespan  string
}

EventMarketBarsQuery parameterizes Client.GetEventMarketBars.

type EventMarketDepth added in v1.1.0

type EventMarketDepth struct {
	Symbol       string           `json:"symbol"`
	InstrumentID string           `json:"instrument_id"`
	YesAsks      []map[string]any `json:"yes_asks"`
	YesBids      []map[string]any `json:"yes_bids"`
	NoAsks       []map[string]any `json:"no_asks"`
	NoBids       []map[string]any `json:"no_bids"`
}

EventMarketDepth is the order-book depth of an event-contract market.

type EventMarketSnapshot added in v1.1.0

type EventMarketSnapshot struct {
	Symbol        string `json:"symbol"`
	InstrumentID  string `json:"instrument_id"`
	EventSymbol   string `json:"event_symbol"`
	YesSubTitle   string `json:"yes_sub_title"`
	NoSubTitle    string `json:"no_sub_title"`
	Status        string `json:"status"`
	YesBid        string `json:"yes_bid"`
	YesAsk        string `json:"yes_ask"`
	NoBid         string `json:"no_bid"`
	NoAsk         string `json:"no_ask"`
	Price         string `json:"price"`
	Volume        string `json:"volume"`
	OpenInterest  string `json:"open_interest"`
	LastTradeTime string `json:"last_trade_time"`
}

EventMarketSnapshot is the market snapshot of an event-contract market.

type EventSeriesListPage added in v1.1.0

type EventSeriesListPage struct {
	Data          []map[string]any `json:"data"`
	PaginationKey string           `json:"pagination_key"`
}

EventSeriesListPage is a paginated list of event series.

type EventSeriesListQuery added in v1.1.0

type EventSeriesListQuery struct {
	Category      string
	Tags          string
	Symbols       []string
	PaginationKey string
}

EventSeriesListQuery parameterizes Client.GetEventContractSeriesList.

type EventSnapshot added in v0.7.0

type EventSnapshot struct {
	// Symbol is the event-contract symbol.
	Symbol string `json:"symbol"`
	// LastPrice is the last traded price, as a decimal string.
	LastPrice string `json:"last_price"`
	// YesBid is the best bid price for the yes side, as a decimal string.
	YesBid string `json:"yes_bid"`
	// YesAsk is the best ask price for the yes side, as a decimal string.
	YesAsk string `json:"yes_ask"`
	// Volume is the traded volume, as a decimal string.
	Volume string `json:"volume"`
	// OpenInterest is the open interest, as a decimal string.
	OpenInterest string `json:"open_interest"`
	// Timestamp is the snapshot time, as a string.
	Timestamp string `json:"timestamp"`
	// Extra holds additional fields not mapped to the struct.
	Extra map[string]string `json:"-"`
}

EventSnapshot is a real-time snapshot for an event contract.

type EventSnapshotQuery added in v0.7.0

type EventSnapshotQuery struct {
	// Symbols is the list of event-contract symbols to query, at most 100.
	Symbols []string
	// Category is the market to query. Required.
	Category string
}

EventSnapshotQuery parameterizes Client.GetEventSnapshot. Symbols and Category are required.

type EventSportsFilter added in v1.1.0

type EventSportsFilter struct {
	Tag          string   `json:"tag"`
	Competitions []string `json:"competitions"`
	Scopes       []string `json:"scopes"`
}

EventSportsFilter is a sports filter for event contracts.

type EventTick added in v0.7.0

type EventTick struct {
	// Symbol is the event-contract symbol.
	Symbol string `json:"symbol"`
	// YesPrice is the yes-side trade price, as a decimal string.
	YesPrice string `json:"yes_price"`
	// NoPrice is the no-side trade price, as a decimal string.
	NoPrice string `json:"no_price"`
	// Side is the aggressor side.
	Side string `json:"side"`
	// Volume is the executed trade volume, as a decimal string.
	Volume string `json:"volume"`
	// TradeID is the unique trade identifier.
	TradeID string `json:"trade_id"`
	// Timestamp is the trade time, as a string.
	Timestamp string `json:"timestamp"`
}

EventTick is a tick trade for an event contract.

type EventTickQuery added in v0.7.0

type EventTickQuery struct {
	// Symbol is the event-contract symbol.
	Symbol string
	// Category is the market to query. Required.
	Category string
	// Count is the number of ticks to return.
	Count int
}

EventTickQuery parameterizes Client.GetEventTick. Symbol, Category and Count are required.

type FilingEntry added in v0.4.0

type FilingEntry struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	PublishDate string `json:"publish_date"`
}

FilingEntry is one SEC filing.

type FilingsResponse added in v0.4.0

type FilingsResponse struct {
	Symbol   string        `json:"symbol"`
	Category string        `json:"category"`
	Filings  []FilingEntry `json:"filings"`
}

FilingsResponse wraps the filings list.

type FinancialAlert added in v0.4.0

type FinancialAlert struct {
	Symbol             string `json:"symbol"`
	Category           string `json:"category"`
	ExpectedReportDate string `json:"expected_report_date"`
	EstimatedEPS       string `json:"estimated_eps"`
	LastYearEPS        string `json:"last_year_eps"`
}

FinancialAlert holds upcoming earnings-release alert information.

type FinancialIndicator added in v0.4.0

type FinancialIndicator struct {
	ROA       string `json:"roa"`
	ROE       string `json:"roe"`
	EPS       string `json:"eps"`
	NetMargin string `json:"net_margin"`
	DebtRatio string `json:"debt_ratio"`
}

FinancialIndicator holds key financial ratios and metrics.

type FinancialsItem added in v0.4.0

type FinancialsItem map[string]any

FinancialsItem is one period's financial data entry. Field names are preserved from the API response. Values are any because the API returns a mix of strings and numbers (e.g. integer fiscal periods).

type FootprintBar

type FootprintBar struct {
	// Time is the bar timestamp, for example
	// "2025-09-30T05:47:00.000+0000".
	Time string `json:"time"`
	// TradingSession is the session the bar belongs to.
	TradingSession TradingSession `json:"trading_session"`
	// Total is the sum of buy and sell volume, as a decimal string.
	Total string `json:"total"`
	// Delta is buy volume minus sell volume, as a decimal string.
	Delta string `json:"delta"`
	// BuyTotal is the buy-initiated volume, as a decimal string.
	BuyTotal string `json:"buy_total"`
	// SellTotal is the sell-initiated volume, as a decimal string.
	SellTotal string `json:"sell_total"`
	// BuyDetail maps price levels to buy volume at that price; both the price
	// and the volume are decimal strings.
	BuyDetail map[string]string `json:"buy_detail"`
	// SellDetail maps price levels to sell volume at that price; both the price
	// and the volume are decimal strings.
	SellDetail map[string]string `json:"sell_detail"`
}

FootprintBar is a single footprint bar: aggregated buy and sell volume with a per-price breakdown.

type FootprintQuery

type FootprintQuery struct {
	// Symbols are the security symbols to query, at most 20 per request.
	// Required.
	Symbols []string
	// Category is the security type. Required, and only [StockCategoryUS] is
	// supported.
	Category StockCategory
	// Timespan is the bar granularity. Required.
	Timespan FootprintTimespan
	// Count is the number of bars to return, between 1 and 1200. Zero means
	// the server default of 200.
	Count int
	// RealTimeRequired reports whether bars that are not yet finalized should
	// be included. It only applies to minute timespans.
	RealTimeRequired bool
	// TradingSessions restricts the result to one trading session. Empty means
	// all sessions. The endpoint does not accept [TradingSessionOvernight].
	TradingSessions TradingSession
}

FootprintQuery parameterizes Client.GetFootprint. Symbols, Category and Timespan are required; the remaining fields are optional.

type FootprintTimespan

type FootprintTimespan string

FootprintTimespan is the bar granularity of a footprint request.

const (
	// FootprintTimespanS5 is a five-second bar.
	FootprintTimespanS5 FootprintTimespan = "S5"
	// FootprintTimespanS15 is a fifteen-second bar.
	FootprintTimespanS15 FootprintTimespan = "S15"
	// FootprintTimespanM1 is a one-minute bar.
	FootprintTimespanM1 FootprintTimespan = "M1"
	// FootprintTimespanM5 is a five-minute bar.
	FootprintTimespanM5 FootprintTimespan = "M5"
	// FootprintTimespanM30 is a thirty-minute bar.
	FootprintTimespanM30 FootprintTimespan = "M30"
)

Footprint granularities accepted by the footprint endpoint. Only these values are supported; the endpoint does not accept arbitrary intervals.

type ForecastEPSEntry added in v0.4.0

type ForecastEPSEntry struct {
	FiscalYear   int    `json:"fiscal_year"`
	FiscalPeriod int    `json:"fiscal_period"`
	Actual       string `json:"actual"`
	Est          string `json:"est"`
	Reported     bool   `json:"reported"`
}

ForecastEPSEntry is one quarter's EPS forecast data.

type FundAllocation added in v1.1.0

type FundAllocation struct {
	Date        string         `json:"date"`
	Aum         string         `json:"aum"`
	Cash        map[string]any `json:"cash"`
	Bond        map[string]any `json:"bond"`
	Stock       map[string]any `json:"stock"`
	Preferred   map[string]any `json:"preferred"`
	Convertible map[string]any `json:"convertible"`
	Other       map[string]any `json:"other"`
}

FundAllocation is one fund asset-allocation record. The asset-class fields are returned as decoded objects because their schema is not fixed.

type FundDividend added in v0.5.0

type FundDividend struct {
	Symbol     string            `json:"symbol"`
	Name       string            `json:"name"`
	Currency   string            `json:"currency"`
	Exchange   string            `json:"exchange"`
	Amount     string            `json:"amount"`
	ExDate     string            `json:"ex_date"`
	PayDate    string            `json:"pay_date"`
	RecordDate string            `json:"record_date"`
	Frequency  string            `json:"frequency"`
	Extra      map[string]string `json:"-"`
}

FundDividend represents a fund or ETF dividend event.

type FundDividendsQuery added in v0.5.0

type FundDividendsQuery struct {
	Symbol    string
	StartDate string
	EndDate   string
	PageSize  int
}

FundDividendsQuery parameterizes Client.GetFundDividends.

type FundFile added in v1.1.0

type FundFile struct {
	PublishDate string `json:"publish_date"`
	URL         string `json:"url"`
	Type        int    `json:"type"`
	FileName    string `json:"file_name"`
}

FundFile is one fund document.

type FundHolding added in v1.1.0

type FundHolding struct {
	TargetSymbol    string `json:"target_symbol"`
	StockName       string `json:"stock_name"`
	ShareHeldPct    string `json:"share_held_pct"`
	ShareHeldChgPct string `json:"share_held_chg_pct"`
	MaturityDate    string `json:"maturity_date"`
	UpdateTime      string `json:"update_time"`
}

FundHolding is one fund holding.

type FundInfo added in v0.5.0

type FundInfo struct {
	Symbol        string            `json:"symbol"`
	Name          string            `json:"name"`
	Currency      string            `json:"currency"`
	Exchange      string            `json:"exchange"`
	Aum           string            `json:"aum"`
	ExpenseRatio  string            `json:"expense_ratio"`
	DividendYield string            `json:"dividend_yield"`
	InceptionDate string            `json:"inception_date"`
	FundType      string            `json:"fund_type"`
	Category      string            `json:"category"`
	Extra         map[string]string `json:"-"`
}

FundInfo represents basic information for a fund or ETF.

type FundInfoQuery added in v0.5.0

type FundInfoQuery struct {
	Symbol string
}

FundInfoQuery parameterizes Client.GetFundInfo.

type FundListItem added in v0.5.0

type FundListItem struct {
	Symbol        string            `json:"symbol"`
	Name          string            `json:"name"`
	Currency      string            `json:"currency"`
	Exchange      string            `json:"exchange"`
	FundType      string            `json:"fund_type"`
	Category      string            `json:"category"`
	DividendYield string            `json:"dividend_yield"`
	Extra         map[string]string `json:"-"`
}

FundListItem represents a fund or ETF in a list response.

type FundListQuery added in v0.5.0

type FundListQuery struct {
	Market   string
	Category string
	Exchange string
	PageSize int
}

FundListQuery parameterizes Client.GetFundList.

type FundNav added in v0.5.0

type FundNav struct {
	Symbol         string            `json:"symbol"`
	Name           string            `json:"name"`
	Currency       string            `json:"currency"`
	Exchange       string            `json:"exchange"`
	Nav            string            `json:"nav"`
	NavDate        string            `json:"nav_date"`
	PrevNav        string            `json:"prev_nav"`
	NavChange      string            `json:"nav_change"`
	NavChangeRatio string            `json:"nav_change_ratio"`
	Extra          map[string]string `json:"-"`
}

FundNav represents fund NAV (Net Asset Value) history data.

type FundNavQuery added in v0.5.0

type FundNavQuery struct {
	Symbol    string
	StartDate string
	EndDate   string
	PageSize  int
}

FundNavQuery parameterizes Client.GetFundNav.

type FundPerformance added in v1.1.0

type FundPerformance struct {
	Currency  string `json:"currency"`
	EndDate   string `json:"end_date"`
	Return1M  string `json:"return_1m"`
	Return3M  string `json:"return_3m"`
	Return6M  string `json:"return_6m"`
	Return1Y  string `json:"return_1y"`
	Return3Y  string `json:"return_3y"`
	Return5Y  string `json:"return_5y"`
	Return10Y string `json:"return_10y"`
	ReturnSI  string `json:"return_si"`
}

FundPerformance is the performance-return history of a fund.

type FundRating added in v1.1.0

type FundRating struct {
	RatingDate    string `json:"rating_date"`
	RatingAgency  string `json:"rating_agency"`
	RatingCycle   string `json:"rating_cycle"`
	RatingResults int    `json:"rating_results"`
}

FundRating is one fund rating record.

type FundSplit added in v1.1.0

type FundSplit struct {
	SplitDate  string  `json:"split_date"`
	SplitType  string  `json:"split_type"`
	SplitRatio string  `json:"split_ratio"`
	From       float64 `json:"from"`
	To         float64 `json:"to"`
}

FundSplit is one fund split record.

type FuturesBarsQuery added in v0.7.0

type FuturesBarsQuery struct {
	// Symbols is the list of futures contract symbols to query.
	Symbols []string
	// Category is the futures market category. Defaults to US_FUTURES if empty.
	Category FuturesCategory
	// Interval is the bar granularity. Required.
	Interval BarTimespan
	// Count is the number of bars to return per symbol. Zero means the server
	// default (200); the documented maximum is 1200 (1650 for M1).
	Count int
}

FuturesBarsQuery parameterizes Client.GetFuturesBars. Symbols and Interval are required.

type FuturesCategory

type FuturesCategory string

FuturesCategory identifies the futures market to query.

const (
	// FuturesCategoryUS identifies United States futures.
	FuturesCategoryUS FuturesCategory = "US_FUTURES"
	// FuturesCategoryHK identifies Hong Kong futures.
	FuturesCategoryHK FuturesCategory = "HK_FUTURES"
	// FuturesCategoryCN identifies China futures.
	FuturesCategoryCN FuturesCategory = "CN_FUTURES"
)

Futures market categories.

type FuturesContractType

type FuturesContractType string

FuturesContractType distinguishes regular month contracts from continuous main contracts.

const (
	// FuturesContractTypeMonthly is a regular delivery-month contract.
	FuturesContractTypeMonthly FuturesContractType = "MONTHLY"
	// FuturesContractTypeMain is a main/continuous contract.
	FuturesContractTypeMain FuturesContractType = "MAIN"
)

Futures contract types.

type FuturesDepthQuery added in v0.7.0

type FuturesDepthQuery struct {
	// Symbol is the futures contract symbol, for example "ESZ5".
	Symbol string
	// Category is the futures market category. Defaults to US_FUTURES if empty.
	Category FuturesCategory
	// Depth is the number of order-book levels to return: 1 for L1, 10 for the
	// default L2 depth. Zero means the server default.
	Depth int
}

FuturesDepthQuery parameterizes Client.GetFuturesDepth. Symbol is required.

type FuturesFootprintQuery added in v0.7.0

type FuturesFootprintQuery struct {
	// Symbols are the futures contract symbols to query, at most 20 per request.
	Symbols []string
	// Category is the futures market category. Defaults to US_FUTURES if empty.
	Category FuturesCategory
	// Timespan is the bar granularity. Required.
	Timespan FootprintTimespan
	// Count is the number of bars to return, between 1 and 1200. Zero means
	// the server default of 200.
	Count int
}

FuturesFootprintQuery parameterizes Client.GetFuturesFootprint. Symbols and Timespan are required.

type FuturesInstrument

type FuturesInstrument struct {
	// Symbol is the contract symbol used in trading and market data, for
	// example "ESZ5" or the continuous "ESmain".
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the contract. For a main or
	// continuous contract this identifies the main contract itself.
	InstrumentID string `json:"instrument_id"`
	// ExchangeCode is the exchange code, for example "XCME".
	ExchangeCode string `json:"exchange_code"`
	// Code is the product code, for example "ES".
	Code string `json:"code"`
	// Name is the display name of the contract.
	Name string `json:"name"`
	// ProductClassID identifies the product class, for example 2.
	ProductClassID int32 `json:"product_class_id"`
	// ProductClassName is the product class name, for example "Equities".
	ProductClassName string `json:"product_class_name"`
	// Status is the tradable status.
	Status InstrumentStatus `json:"status"`
	// Currency is the trading currency, for example "USD".
	Currency string `json:"currency"`
	// ContractMonth is the delivery month in yyyyMM form, for example "202512".
	ContractMonth string `json:"contract_month"`
	// SettlementDate is the final settlement date (YYYY-MM-DD).
	SettlementDate string `json:"settlement_date"`
	// Size is the contract multiplier, as a decimal string.
	Size string `json:"size"`
	// Unit describes the pricing unit and quantity. The API returns this as
	// either a string (e.g., "1-index points") or a bare number.
	Unit StringOrNumber `json:"unit"`
	// MinTick is the minimum price increment, as a decimal string.
	MinTick string `json:"min_tick"`
	// FirstNoticeDate is the first notice date (YYYY-MM-DD), when applicable.
	FirstNoticeDate string `json:"first_notice_date"`
	// LastNoticeDate is the last notice date (YYYY-MM-DD), when applicable.
	LastNoticeDate string `json:"last_notice_date"`
	// FirstTradingDate is the first tradable date (YYYY-MM-DD).
	FirstTradingDate string `json:"first_trading_date"`
	// LastTradingDate is the final trading date (YYYY-MM-DD).
	LastTradingDate string `json:"last_trading_date"`
	// ContractType distinguishes monthly from main/continuous contracts.
	ContractType FuturesContractType `json:"contract_type"`
	// Settlement is the settlement method.
	Settlement FuturesSettlement `json:"settlement"`
}

FuturesInstrument is the static profile of a single futures contract.

type FuturesInstrumentQuery

type FuturesInstrumentQuery struct {
	// Category is the futures market to query. Required.
	Category FuturesCategory
	// Symbols restricts the result to the named trading symbols (for example
	// "ESZ5" or "NQZ5"), at most 100 per query.
	Symbols []string
	// Code restricts the result to a product code (for example "ES"). Either
	// Symbols or Code must be set.
	Code string
	// Status filters by tradable status.
	Status InstrumentStatus
}

FuturesInstrumentQuery parameterizes Client.GetFuturesInstruments. Category is required, and at least one of Symbols or Code must be provided.

type FuturesProduct

type FuturesProduct struct {
	// Name is the display name, for example "E-Mini S&P 500".
	Name string `json:"name"`
	// Code is the product code, for example "ES".
	Code string `json:"code"`
	// ProductClassID identifies the product class.
	ProductClassID int32 `json:"product_class_id"`
	// ProductClassName is the product class name, for example "Equities".
	ProductClassName string `json:"product_class_name"`
	// ExchangeCode is the exchange code, for example "XCME".
	ExchangeCode string `json:"exchange_code"`
}

FuturesProduct is a futures underlying product and its code.

type FuturesProductClass

type FuturesProductClass struct {
	// ProductClassID is the product class identifier.
	ProductClassID int32 `json:"product_class_id"`
	// ProductClassName is the product class name, for example "Equities".
	ProductClassName string `json:"product_class_name"`
}

FuturesProductClass is a futures product classification group.

type FuturesProductCodeQuery

type FuturesProductCodeQuery struct {
	// Category is the futures market to query. Required.
	Category FuturesCategory
	// ProductClassID optionally restricts the result to one product class.
	// Zero means no filter.
	ProductClassID int32
}

FuturesProductCodeQuery parameterizes Client.GetFuturesProductCodes. Category is required.

type FuturesSettlement

type FuturesSettlement string

FuturesSettlement is the settlement method of a futures contract.

const (
	// FuturesSettlementCash settles in cash.
	FuturesSettlementCash FuturesSettlement = "Cash"
	// FuturesSettlementPhysical settles by physical delivery.
	FuturesSettlementPhysical FuturesSettlement = "Physical"
)

Futures settlement methods.

type FuturesSnapshotQuery added in v0.7.0

type FuturesSnapshotQuery struct {
	// Symbols is the list of futures contract symbols to query, at most 100.
	Symbols []string
	// Category is the futures market category. Defaults to US_FUTURES if empty.
	Category FuturesCategory
}

FuturesSnapshotQuery parameterizes Client.GetFuturesSnapshot. Symbols is required.

type FuturesTickQuery added in v0.7.0

type FuturesTickQuery struct {
	// Symbol is the futures contract symbol, for example "ESZ5".
	Symbol string
	// Category is the futures market category. Defaults to US_FUTURES if empty.
	Category FuturesCategory
	// Count is the number of ticks to return. Zero means the server default
	// (30); the documented maximum is 1000.
	Count int
}

FuturesTickQuery parameterizes Client.GetFuturesTick. Symbol is required.

type GainersLosersQuery

type GainersLosersQuery struct {
	// RankType is the time window used to rank the price change. Required.
	RankType GainersLosersRankType
	// Category is the security market. Required, and only [StockCategoryUS]
	// is supported.
	Category StockCategory
	// SortBy is the secondary sort field. Required.
	SortBy ScreenerSortBy
	// Direction is the sort direction. Empty uses the server default.
	Direction SortDirection
}

GainersLosersQuery parameterizes Client.GetTopGainersLosers. RankType, Category and SortBy are required. Direction defaults to descending on the server; pass SortDirectionAsc to retrieve losers rather than gainers.

type GainersLosersRankType

type GainersLosersRankType string

GainersLosersRankType is the time window over which gainers and losers are ranked.

const (
	// GainersLosersRankPreMarket ranks by the pre-market move.
	GainersLosersRankPreMarket GainersLosersRankType = "PRE_MARKET"
	// GainersLosersRankAfterMarket ranks by the after-market move.
	GainersLosersRankAfterMarket GainersLosersRankType = "AFTER_MARKET"
	// GainersLosersRankMin3 ranks by the three-minute move.
	GainersLosersRankMin3 GainersLosersRankType = "MIN_3"
	// GainersLosersRankMin5 ranks by the five-minute move.
	GainersLosersRankMin5 GainersLosersRankType = "MIN_5"
	// GainersLosersRankDay1 ranks by the one-day move.
	GainersLosersRankDay1 GainersLosersRankType = "DAY_1"
	// GainersLosersRankDay5 ranks by the five-day move.
	GainersLosersRankDay5 GainersLosersRankType = "DAY_5"
	// GainersLosersRankMonth1 ranks by the one-month move.
	GainersLosersRankMonth1 GainersLosersRankType = "MONTH_1"
	// GainersLosersRankMonth3 ranks by the three-month move.
	GainersLosersRankMonth3 GainersLosersRankType = "MONTH_3"
	// GainersLosersRankWeek52 ranks by the 52-week move.
	GainersLosersRankWeek52 GainersLosersRankType = "WEEK_52"
)

Gainers/losers ranking windows.

type HighDividendQuery added in v0.7.0

type HighDividendQuery struct {
	// Category is the security market. Required.
	Category StockCategory
	// SortBy is the secondary sort field. Empty uses the server default.
	SortBy ScreenerSortBy
	// Direction is the sort direction. Empty uses the server default.
	Direction SortDirection
}

HighDividendQuery parameterizes Client.GetHighDividendRank.

type IndustryComparison added in v0.4.0

type IndustryComparison struct {
	FiscalYear   int                      `json:"fiscal_year"`
	FiscalPeriod int                      `json:"fiscal_period"`
	IndustryName string                   `json:"industry_name"`
	Type         string                   `json:"type"`
	Data         []IndustryComparisonItem `json:"data"`
}

IndustryComparison holds industry comparison data for a single fiscal period.

type IndustryComparisonItem added in v0.4.0

type IndustryComparisonItem struct {
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
	Rank   int    `json:"rank"`
	Value  string `json:"value"`
}

IndustryComparisonItem is one entry in an industry comparison.

type InstrumentStatus

type InstrumentStatus string

InstrumentStatus is the tradable status of a stock or futures instrument.

const (
	// InstrumentStatusTradable means the instrument is available for trading
	// (OC).
	InstrumentStatusTradable InstrumentStatus = "OC"
	// InstrumentStatusLiquidateOnly means the instrument can only be sold, with
	// no purchases allowed (CO).
	InstrumentStatusLiquidateOnly InstrumentStatus = "CO"
	// InstrumentStatusNonTradable means the instrument cannot be traded (NT).
	InstrumentStatusNonTradable InstrumentStatus = "NT"
)

Instrument tradable status values.

type Logo struct {
	Symbol string `json:"symbol"`
}

Logo URLs returned by the batch logo endpoint. URLs are hosted on Webull's CDN.

type LogoQuery added in v0.5.0

type LogoQuery struct {
	Symbols []string
}

LogoQuery parameterizes Client.GetLogos.

type MarketSector added in v0.7.0

type MarketSector struct {
	SectorName  string          `json:"sector_name"`
	ChangeRatio string          `json:"change_ratio"`
	Volume      string          `json:"volume"`
	MarketValue string          `json:"market_value"`
	Stocks      []ScreenerStock `json:"stocks"`
}

MarketSector represents a market sector overview.

type MarketSectorDetailQuery added in v0.7.0

type MarketSectorDetailQuery struct {
	// SectorName is the sector to query. Required.
	SectorName string
	// Category is the security market. Required.
	Category StockCategory
	// SortBy is the secondary sort field. Empty uses the server default.
	SortBy ScreenerSortBy
	// Direction is the sort direction. Empty uses the server default.
	Direction SortDirection
}

MarketSectorDetailQuery parameterizes Client.GetMarketSectorDetail.

type MilestonePage added in v1.1.0

type MilestonePage struct {
	Data          []map[string]any `json:"data"`
	PaginationKey string           `json:"pagination_key"`
}

MilestonePage is a paginated list of milestones.

type MilestoneQuery added in v1.1.0

type MilestoneQuery struct {
	MinimumStartDate   string
	Category           string
	Competition        string
	RelatedEventSymbol string
	PaginationKey      string
}

MilestoneQuery parameterizes Client.GetEventContractMilestones.

type MostActiveQuery

type MostActiveQuery struct {
	// Category is the security market. Required, and only [StockCategoryUS]
	// is supported.
	Category StockCategory
	// RankType is the activity metric used to rank the result. Empty uses the
	// server default of [MostActiveRankVolume].
	RankType MostActiveRankType
	// SortBy is the secondary sort field. Empty uses the server default of
	// [ScreenerSortVolume].
	SortBy ScreenerSortBy
	// Direction is the sort direction. Empty uses the server default.
	Direction SortDirection
}

MostActiveQuery parameterizes Client.GetMostActive. Category is required; the remaining fields default on the server.

type MostActiveRankType

type MostActiveRankType string

MostActiveRankType is the activity metric used to rank the most active stocks.

const (
	// MostActiveRankVolume ranks by cumulative volume.
	MostActiveRankVolume MostActiveRankType = "VOLUME"
	// MostActiveRankRelativeVolume10D ranks by relative volume against the
	// ten-day average.
	MostActiveRankRelativeVolume10D MostActiveRankType = "RELATIVE_VOLUME_10D"
	// MostActiveRankTurnover ranks by cumulative turnover.
	MostActiveRankTurnover MostActiveRankType = "TURNOVER"
	// MostActiveRankTurnoverRate ranks by turnover rate.
	MostActiveRankTurnoverRate MostActiveRankType = "TURNOVER_RATE"
	// MostActiveRankAmplitude ranks by price amplitude.
	MostActiveRankAmplitude MostActiveRankType = "AMPLITUDE"
)

Most-active ranking metrics.

type NOIIActionType

type NOIIActionType string

NOIIActionType selects which auction imbalance a NOII request describes.

const (
	// NOIIActionPreOpen is the opening auction imbalance.
	NOIIActionPreOpen NOIIActionType = "PRE_OPEN"
	// NOIIActionPreClose is the closing auction imbalance.
	NOIIActionPreClose NOIIActionType = "PRE_CLOSE"
)

NOII auction types.

type NOIIBar

type NOIIBar struct {
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the security symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// ImbalanceTime is the data publish time, in milliseconds since the Unix
	// epoch.
	ImbalanceTime int64 `json:"imbalance_time"`
	// ImbalanceRefPrice is the reference price, as a decimal string.
	ImbalanceRefPrice string `json:"imbalance_ref_price"`
	// ImbalanceNearPrice is the indicative match price (the most likely
	// execution price), as a decimal string.
	ImbalanceNearPrice string `json:"imbalance_near_price"`
	// ImbalanceFarPrice is the far price (the price at which orders could
	// execute in extreme scenarios), as a decimal string.
	ImbalanceFarPrice string `json:"imbalance_far_price"`
	// ImbalanceActionType is the auction the bar belongs to.
	ImbalanceActionType NOIIActionType `json:"imbalance_action_type"`
}

NOIIBar is a single Net Order Imbalance Indicator bar.

type NOIIQuery

type NOIIQuery struct {
	// Symbol is the security symbol. Only a single symbol is supported.
	Symbol string
	// Category is the security type. Only [StockCategoryUS] is supported.
	Category StockCategory
	// ImbalanceActionType selects the opening or closing auction.
	ImbalanceActionType NOIIActionType
}

NOIIQuery parameterizes Client.GetNOIIBars and Client.GetNOIISnapshot. Every field is required.

type NOIISnapshot

type NOIISnapshot struct {
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the security symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// PairedShares is the number of shares that can be matched under current
	// conditions, as a decimal string.
	PairedShares string `json:"paired_shares"`
	// ImbalanceShares is the number of unmatched buy or sell shares, as a
	// decimal string.
	ImbalanceShares string `json:"imbalance_shares"`
	// ImbalanceSide is the direction of the imbalance.
	ImbalanceSide string `json:"imbalance_side"`
	// ImbalanceRefPrice is the reference price, as a decimal string.
	ImbalanceRefPrice string `json:"imbalance_ref_price"`
	// ImbalanceNearPrice is the indicative match price (the most likely
	// execution price), as a decimal string.
	ImbalanceNearPrice string `json:"imbalance_near_price"`
	// ImbalanceFarPrice is the far price (the price at which orders could
	// execute in extreme scenarios), as a decimal string.
	ImbalanceFarPrice string `json:"imbalance_far_price"`
	// ImbalanceActionType is the auction the snapshot describes.
	ImbalanceActionType NOIIActionType `json:"imbalance_action_type"`
	// ImbalanceTime is the snapshot timestamp, in milliseconds since the Unix
	// epoch.
	ImbalanceTime int64 `json:"imbalance_time"`
	// ImbalanceVarIndicator is the volatility/imbalance status indicator.
	ImbalanceVarIndicator string `json:"imbalance_var_indicator"`
}

NOIISnapshot is the latest Net Order Imbalance Indicator snapshot.

type NewsCategorySymbols

type NewsCategorySymbols struct {
	// Category is the security type. Only [StockCategoryUS] is currently
	// accepted.
	Category StockCategory `json:"category"`
	// Symbols lists the security symbols, for example ["AAPL", "GOOG"].
	Symbols []string `json:"symbols"`
}

NewsCategorySymbols groups the security symbols of one category in a news summary request.

type NewsSummaryEvent

type NewsSummaryEvent struct {
	// Type is the event kind: "meta", "text", or "table".
	Type string `json:"type"`
	// Message is the Markdown text of a "text" event.
	Message string `json:"message,omitempty"`
	// Args is the raw JSON metadata of a "meta" event, for example
	// {"sessionId":"1","convId":451107711450219}. It is left undecoded so
	// callers can read the fields they need.
	Args json.RawMessage `json:"args,omitempty"`
	// Headers is the column headers of a "table" event.
	Headers []NewsSummaryText `json:"headers,omitempty"`
	// Rows is the row data of a "table" event.
	Rows [][]NewsSummaryText `json:"rows,omitempty"`
}

NewsSummaryEvent is one event in the news-summary SSE stream.

The stream emits a single "meta" event that carries the conversation identifiers in RawArgs, followed by any number of "text" events (Markdown in Message) and "table" events (Headers and Rows). Unknown event types are returned with only Type populated so callers can ignore or log them.

type NewsSummaryParam

type NewsSummaryParam struct {
	// CategorySymbols lists the security symbols to summarize, grouped by
	// category. Required.
	CategorySymbols []NewsCategorySymbols `json:"category_symbols"`
	// Lang is the response language. Only "en" is currently supported; empty
	// means the server default.
	Lang string `json:"lang,omitempty"`
}

NewsSummaryParam parameterizes Client.GetNewsSummary. CategorySymbols is required.

type NewsSummaryStream

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

NewsSummaryStream reads a news-summary SSE response. Call [Next] until it returns io.EOF, then [Close]. A stream is NOT safe for concurrent use.

func (*NewsSummaryStream) Close

func (s *NewsSummaryStream) Close() error

Close releases the underlying HTTP response body. It is safe to call more than once.

func (*NewsSummaryStream) Next

Next returns the next news-summary event, or io.EOF when the stream ends. SSE comment lines and field lines other than "data" are skipped.

type NewsSummaryText

type NewsSummaryText struct {
	// Text is the cell text, which may contain Markdown.
	Text string `json:"text"`
}

NewsSummaryText is a single cell of a news-summary table event.

type OptionBar

type OptionBar struct {
	// Time is the bar time in ISO 8601 form.
	Time string `json:"time"`
	// Open is the open price, as a decimal string.
	Open string `json:"open"`
	// Close is the close price, as a decimal string.
	Close string `json:"close"`
	// High is the high price, as a decimal string.
	High string `json:"high"`
	// Low is the low price, as a decimal string.
	Low string `json:"low"`
	// Volume is the bar volume, as a string.
	Volume string `json:"volume"`
}

OptionBar is a single historical option price bar.

type OptionBarTimespan

type OptionBarTimespan string

OptionBarTimespan is the time granularity of option historical bars.

const (
	// OptionBarTimespanM1 is a one-minute bar.
	OptionBarTimespanM1 OptionBarTimespan = "M1"
	// OptionBarTimespanM5 is a five-minute bar.
	OptionBarTimespanM5 OptionBarTimespan = "M5"
	// OptionBarTimespanM15 is a fifteen-minute bar.
	OptionBarTimespanM15 OptionBarTimespan = "M15"
	// OptionBarTimespanM30 is a thirty-minute bar.
	OptionBarTimespanM30 OptionBarTimespan = "M30"
	// OptionBarTimespanM60 is a sixty-minute bar.
	OptionBarTimespanM60 OptionBarTimespan = "M60"
	// OptionBarTimespanM120 is a two-hour bar.
	OptionBarTimespanM120 OptionBarTimespan = "M120"
	// OptionBarTimespanM240 is a four-hour bar.
	OptionBarTimespanM240 OptionBarTimespan = "M240"
	// OptionBarTimespanD is a daily bar.
	OptionBarTimespanD OptionBarTimespan = "D"
	// OptionBarTimespanW is a weekly bar.
	OptionBarTimespanW OptionBarTimespan = "W"
	// OptionBarTimespanM is a monthly bar.
	OptionBarTimespanM OptionBarTimespan = "M"
	// OptionBarTimespanY is a yearly bar.
	OptionBarTimespanY OptionBarTimespan = "Y"
)

Option bar timespans.

type OptionBarsQuery

type OptionBarsQuery struct {
	// Symbols is the option contract symbols to query, at most 20 per query.
	// Required.
	Symbols []string
	// Category is the option market. Empty means [OptionCategoryUS].
	Category OptionCategory
	// Timespan is the bar granularity. Required.
	Timespan OptionBarTimespan
	// Count is the number of bars to return, at most 1200. Zero means unset.
	Count int
	// RealTimeRequired, when true, asks the server to include the latest
	// in-progress bar.
	RealTimeRequired bool
}

OptionBarsQuery parameterizes Client.GetOptionBars. Symbols, Category, and Timespan are required; Count defaults to the server's value when zero.

type OptionCategory

type OptionCategory string

OptionCategory identifies the option market. The option endpoints currently support US options only.

const (
	// OptionCategoryUS identifies United States options, the only category
	// currently supported by the option endpoints.
	OptionCategoryUS OptionCategory = "US_OPTION"
	// OptionCategoryHK identifies Hong Kong options.
	OptionCategoryHK OptionCategory = "HK"
	// OptionCategoryCN identifies China options.
	OptionCategoryCN OptionCategory = "CN"
)

Option market categories.

type OptionContract added in v0.6.0

type OptionContract struct {
	// InstrumentID is the unique identifier of the option contract.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the option contract symbol, for example
	// "AAPL260116C00300000".
	Symbol string `json:"symbol"`
	// UnderlyingSymbol is the symbol of the underlying stock, for example
	// "AAPL".
	UnderlyingSymbol string `json:"underlying_symbol"`
	// OptionType is the contract direction, a call or a put.
	OptionType OptionType `json:"option_type"`
	// StrikePrice is the strike price, as a decimal string.
	StrikePrice string `json:"strike_price"`
	// ExpirationDate is the contract expiration date as returned by the API.
	ExpirationDate string `json:"expiration_date"`
	// ExchangeCode is the listing exchange code, for example "OPRA".
	ExchangeCode string `json:"exchange_code"`
	// Category is the option market.
	Category OptionCategory `json:"category"`
	// Currency is the trading currency, for example "USD".
	Currency string `json:"currency"`
	// LotSize is the contract size, as a decimal string.
	LotSize string `json:"lot_size"`
}

OptionContract is the profile of a single option contract.

type OptionContractsQuery added in v1.0.2

type OptionContractsQuery struct {
	// Symbol is the underlying stock symbol, for example "AAPL". Required.
	Symbol string
	// Category is the option market. Empty means [OptionCategoryUS].
	Category OptionCategory
	// Expiration restricts the result to one expiration date. Empty means
	// all expirations.
	Expiration string
	// OptionType restricts the result to calls or puts. Empty means both.
	OptionType OptionType
	// StrikeMin is the inclusive lower bound of the strike range, as a
	// decimal string. Empty means unset.
	StrikeMin string
	// StrikeMax is the inclusive upper bound of the strike range, as a
	// decimal string. Empty means unset.
	StrikeMax string
	// PaginationKey continues from a previous page. Empty means unset.
	PaginationKey string
}

OptionContractsQuery parameterizes Client.GetOptionContracts. Symbol is required; every other field narrows the result set and is optional.

type OptionContractsResult added in v1.0.2

type OptionContractsResult struct {
	// Contracts lists the option contracts matching the query.
	Contracts []OptionContract
	// PaginationKey continues from a previous page; empty when there are no
	// more pages.
	PaginationKey string
}

OptionContractsResult is the result of Client.GetOptionContracts.

type OptionSnapshot

type OptionSnapshot struct {
	// InstrumentID is the unique identifier of the option contract.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the option contract symbol.
	Symbol string `json:"symbol"`
	// Price is the last traded price, as a decimal string.
	Price string `json:"price"`
	// Open is the session open price, as a decimal string.
	Open string `json:"open"`
	// High is the session high price, as a decimal string.
	High string `json:"high"`
	// Low is the session low price, as a decimal string.
	Low string `json:"low"`
	// PreClose is the previous settlement or close price, as a decimal string.
	PreClose string `json:"pre_close"`
	// Volume is the accumulated session volume, as a string.
	Volume string `json:"volume"`
	// Change is the absolute change from PreClose, as a decimal string.
	Change string `json:"change"`
	// ChangeRatio is the change relative to PreClose, as a decimal string.
	ChangeRatio string `json:"change_ratio"`
	// LastTradeTime is the last trade time as a Unix epoch millisecond
	// timestamp.
	LastTradeTime int64 `json:"last_trade_time"`
	// Close is the close price, as a decimal string.
	Close string `json:"close"`
	// StrikePrice is the option strike price, as a decimal string.
	StrikePrice string `json:"strike_price"`
	// Gamma is the option gamma, as a decimal string.
	Gamma string `json:"gamma"`
	// Delta is the option delta, as a decimal string.
	Delta string `json:"delta"`
	// Rho is the option rho, as a decimal string.
	Rho string `json:"rho"`
	// Theta is the option theta, as a decimal string.
	Theta string `json:"theta"`
	// Vega is the option vega, as a decimal string.
	Vega string `json:"vega"`
	// ImpVol is the implied volatility, as a decimal string.
	ImpVol string `json:"imp_vol"`
	// OpenInterest is the open interest, as a string.
	OpenInterest string `json:"open_interest"`
	// QuoteTime is the quote time as a Unix epoch millisecond timestamp.
	QuoteTime int64 `json:"quote_time"`
	// Bid is the best bid price, as a decimal string.
	Bid string `json:"bid"`
	// Ask is the best ask price, as a decimal string.
	Ask string `json:"ask"`
	// AskSize is the quantity available at the best ask, as a string.
	AskSize string `json:"ask_size"`
	// BidSize is the quantity available at the best bid, as a string.
	BidSize string `json:"bid_size"`
	// DealAmount is the accumulated traded value, as a decimal string.
	DealAmount string `json:"deal_amount"`
}

OptionSnapshot is the real-time market snapshot of one option contract.

type OptionSnapshotQuery

type OptionSnapshotQuery struct {
	// Symbols is the option contract symbols to query. Required.
	Symbols []string
	// Category is the option market. Empty means [OptionCategoryUS].
	Category OptionCategory
}

OptionSnapshotQuery parameterizes Client.GetOptionSnapshot. Symbols is required and is limited to 20 symbols per query; Category defaults to OptionCategoryUS.

type OptionSymbolBars

type OptionSymbolBars struct {
	// Symbol is the option contract symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the option contract.
	InstrumentID string `json:"instrument_id"`
	// Result lists the historical bars.
	Result []OptionBar `json:"result"`
}

OptionSymbolBars is the historical bars of one option contract.

type OptionTick

type OptionTick struct {
	// Time is the trade time as a Unix epoch millisecond timestamp string.
	Time string `json:"time"`
	// Price is the executed trade price, as a decimal string.
	Price string `json:"price"`
	// Volume is the executed trade volume, as a string.
	Volume string `json:"volume"`
	// Side is the aggressor side, for example "B" or "S".
	Side string `json:"side"`
}

OptionTick is a single executed option trade.

type OptionTickQuery

type OptionTickQuery struct {
	// Symbol is the option contract symbol, for example
	// "AAPL260522C00300000". Required.
	Symbol string
	// Category is the option market. Empty means [OptionCategoryUS].
	Category OptionCategory
	// Count is the number of ticks to return, at most 1200. Zero means unset.
	Count int
}

OptionTickQuery parameterizes Client.GetOptionTick. Symbol is required; Category defaults to OptionCategoryUS and Count defaults to the server's value when zero.

type OptionTickResult

type OptionTickResult struct {
	// Symbol is the option contract symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the option contract.
	InstrumentID string `json:"instrument_id"`
	// Result lists the trade ticks.
	Result []OptionTick `json:"result"`
}

OptionTickResult is the tick history of one option contract.

type OptionType added in v0.6.0

type OptionType string

OptionType is the contract direction of an option, a call or a put.

const (
	// OptionTypeCall identifies a call option contract.
	OptionTypeCall OptionType = "CALL"
	// OptionTypePut identifies a put option contract.
	OptionTypePut OptionType = "PUT"
)

Option contract types.

type Quote

type Quote struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// QuoteTime is the quote time, as a Unix timestamp in milliseconds. The
	// sandbox returns it as a JSON number even though the reference documents
	// it as a string.
	QuoteTime int64 `json:"quote_time"`
	// Asks is the ask side of the book, best (lowest) price first.
	Asks []QuoteLevel `json:"asks"`
	// Bids is the bid side of the book, best (highest) price first.
	Bids []QuoteLevel `json:"bids"`
}

Quote is the order-book depth for a single security.

type QuoteBroker

type QuoteBroker struct {
	// Bid is the broker identifier.
	Bid string `json:"bid"`
	// Name is the broker display name.
	Name string `json:"name"`
}

QuoteBroker is a broker attribution for a price level.

type QuoteLevel

type QuoteLevel struct {
	// Price is the level price, as a decimal string.
	Price string `json:"price"`
	// Size is the aggregate quantity at the level, as a decimal string.
	Size string `json:"size"`
	// Order lists the contributing market-participant orders.
	Order []QuoteOrder `json:"order"`
	// Broker lists the contributing brokers, when supplied.
	Broker []QuoteBroker `json:"broker"`
}

QuoteLevel is one side of the order book at a single price.

type QuoteOrder

type QuoteOrder struct {
	// MPID is the market participant identifier, for example "NSDQ".
	MPID string `json:"mpid"`
	// Size is the quantity contributed by the participant, as a decimal string.
	Size string `json:"size"`
}

QuoteOrder is a single market-participant order contributing to a price level.

type ScreenerSortBy

type ScreenerSortBy string

ScreenerSortBy is the secondary sort field shared by the screener endpoints.

const (
	// ScreenerSortChangeRatio sorts by price change percentage.
	ScreenerSortChangeRatio ScreenerSortBy = "CHANGE_RATIO"
	// ScreenerSortRelativeVolume10D sorts by relative ten-day volume.
	ScreenerSortRelativeVolume10D ScreenerSortBy = "RELATIVE_VOLUME_10D"
	// ScreenerSortMarketValue sorts by market capitalization.
	ScreenerSortMarketValue ScreenerSortBy = "MARKET_VALUE"
	// ScreenerSortClose sorts by the latest close.
	ScreenerSortClose ScreenerSortBy = "CLOSE"
	// ScreenerSortPrice sorts by the latest price.
	ScreenerSortPrice ScreenerSortBy = "PRICE"
	// ScreenerSortPETTM sorts by trailing-twelve-month price/earnings.
	ScreenerSortPETTM ScreenerSortBy = "PE_TTM"
	// ScreenerSortHigh sorts by the intraday high.
	ScreenerSortHigh ScreenerSortBy = "HIGH"
	// ScreenerSortLow sorts by the intraday low.
	ScreenerSortLow ScreenerSortBy = "LOW"
	// ScreenerSortAmplitude sorts by price amplitude.
	ScreenerSortAmplitude ScreenerSortBy = "AMPLITUDE"
	// ScreenerSortTurnover sorts by turnover.
	ScreenerSortTurnover ScreenerSortBy = "TURNOVER"
	// ScreenerSortVolume sorts by volume.
	ScreenerSortVolume ScreenerSortBy = "VOLUME"
)

Screener sort fields.

type ScreenerStock

type ScreenerStock struct {
	// InstrumentID is the unique identifier of the tradable instrument.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the trading symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// Name is the full name of the instrument.
	Name string `json:"name"`
	// ExchangeCode is the standardized exchange code, for example "NSQ".
	ExchangeCode string `json:"exchange_code"`
	// CurrencyCode is the denomination currency (ISO 4217), for example "USD".
	CurrencyCode string `json:"currency_code"`
	// PreClose is the previous trading day's closing price.
	PreClose string `json:"pre_close"`
	// Open is the opening price for the current trading day.
	Open string `json:"open"`
	// High is the intraday high for the current trading day.
	High string `json:"high"`
	// Low is the intraday low for the current trading day.
	Low string `json:"low"`
	// Close is the latest traded price for the current trading day.
	Close string `json:"close"`
	// Price is the most recent quoted price within the selected time interval.
	Price string `json:"price"`
	// Change is the absolute price change within the selected time interval.
	Change string `json:"change"`
	// ChangeRatio is the price change percentage within the selected time
	// interval, as a decimal ratio.
	ChangeRatio string `json:"change_ratio"`
	// Volume is the cumulative traded volume for the current day.
	Volume string `json:"volume"`
	// Turnover is the cumulative turnover amount in the denomination currency.
	Turnover string `json:"turnover"`
	// TurnoverRate is the turnover rate as a decimal ratio.
	TurnoverRate string `json:"turnover_rate"`
	// MarketValue is the total market capitalization in the denomination
	// currency.
	MarketValue string `json:"market_value"`
	// Amplitude is (high-low)/pre_close as a decimal ratio.
	Amplitude string `json:"amplitude"`
	// RelativeVolume10D is the current-day volume divided by the ten-day
	// average volume.
	RelativeVolume10D string `json:"relative_volume_10d"`
}

ScreenerStock is a single stock row returned by the screener endpoints. Not every field is populated by every endpoint; for example RelativeVolume10D is only reported by the most-active endpoint.

type Snapshot

type Snapshot struct {
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// PreClose is the previous close price, as a decimal string.
	PreClose string `json:"pre_close"`
	// ChangeRatio is the price change ratio, as a decimal string.
	ChangeRatio string `json:"change_ratio"`
	// Symbol is the trading symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// LastTradeTime is the last trade time, as a Unix timestamp in
	// milliseconds.
	LastTradeTime int64 `json:"last_trade_time"`
	// Price is the current price, as a decimal string.
	Price string `json:"price"`
	// Open is the intraday open price, as a decimal string. For US stocks this
	// excludes pre/post-market data and is unset when no trading occurred.
	Open string `json:"open"`
	// Close is the intraday close price, as a decimal string.
	Close string `json:"close"`
	// High is the intraday high price, as a decimal string.
	High string `json:"high"`
	// Low is the intraday low price, as a decimal string.
	Low string `json:"low"`
	// Volume is the traded volume, as a decimal string.
	Volume string `json:"volume"`
	// Change is the price change amount, as a decimal string.
	Change string `json:"change"`
	// Ask is the best ask price, as a decimal string.
	Ask string `json:"ask"`
	// AskSize is the best ask size, as a decimal string.
	AskSize string `json:"ask_size"`
	// Bid is the best bid price, as a decimal string.
	Bid string `json:"bid"`
	// BidSize is the best bid size, as a decimal string.
	BidSize string `json:"bid_size"`
	// Turnover is the turnover rate, as a decimal string.
	Turnover string `json:"turnover"`
	// EPS is the earnings per share, as a decimal string.
	EPS string `json:"eps"`
	// EPSTTM is the trailing-twelve-month earnings per share, as a decimal
	// string.
	EPSTTM string `json:"eps_ttm"`
	// LotSize is the number of shares per lot, as a decimal string.
	LotSize string `json:"lot_size"`
	// BPS is the book value per share, as a decimal string.
	BPS string `json:"bps"`
	// ExtendHourLastPrice is the pre/post-market latest price, as a decimal
	// string.
	ExtendHourLastPrice string `json:"extend_hour_last_price"`
	// ExtendHourHigh is the pre/post-market high price, as a decimal string.
	ExtendHourHigh string `json:"extend_hour_high"`
	// ExtendHourLow is the pre/post-market low price, as a decimal string.
	ExtendHourLow string `json:"extend_hour_low"`
	// ExtendHourChange is the pre/post-market change amount, as a decimal
	// string.
	ExtendHourChange string `json:"extend_hour_change"`
	// ExtendHourChangeRatio is the pre/post-market change ratio, as a decimal
	// string.
	ExtendHourChangeRatio string `json:"extend_hour_change_ratio"`
	// ExtendHourVolume is the pre/post-market volume, as a decimal string.
	ExtendHourVolume string `json:"extend_hour_volume"`
	// ExtendHourLastTradeTime is the pre/post-market last trade time, as a Unix
	// timestamp in milliseconds.
	ExtendHourLastTradeTime int64 `json:"extend_hour_last_trade_time"`
	// OvnPrice is the overnight price, as a decimal string.
	OvnPrice string `json:"ovn_price"`
	// OvnHigh is the overnight high price, as a decimal string.
	OvnHigh string `json:"ovn_high"`
	// OvnLow is the overnight low price, as a decimal string.
	OvnLow string `json:"ovn_low"`
	// OvnVolume is the overnight volume, as a decimal string.
	OvnVolume string `json:"ovn_volume"`
	// OvnChange is the overnight change amount, as a decimal string.
	OvnChange string `json:"ovn_change"`
	// OvnChangeRatio is the overnight change ratio, as a decimal string.
	OvnChangeRatio string `json:"ovn_change_ratio"`
	// OvnLastTradeTime is the overnight last trade time, as a Unix timestamp in
	// milliseconds.
	OvnLastTradeTime int64 `json:"ovn_last_trade_time"`
	// OvnAsk is the overnight best ask price, as a decimal string.
	OvnAsk string `json:"ovn_ask"`
	// OvnAskSize is the overnight best ask size, as a decimal string.
	OvnAskSize string `json:"ovn_ask_size"`
	// OvnBid is the overnight best bid price, as a decimal string.
	OvnBid string `json:"ovn_bid"`
	// OvnBidSize is the overnight best bid size, as a decimal string.
	OvnBidSize string `json:"ovn_bid_size"`
}

Snapshot is a real-time market snapshot for a single security.

type SnapshotQuery

type SnapshotQuery struct {
	// Symbols is the list of security symbols to query, at most 100.
	Symbols []string
	// Category is the market to query. Required. Besides the
	// [StockCategoryUS], [StockCategoryHK] and [StockCategoryCN] values it
	// accepts the snapshot-specific StockCategory("US_ETF").
	Category StockCategory
	// ExtendHourRequired includes pre-market and after-hours trading data when
	// true.
	ExtendHourRequired bool
	// OvernightRequired includes overnight trading data when true.
	OvernightRequired bool
}

SnapshotQuery parameterizes Client.GetSnapshot. Symbols and Category are required; the remaining fields are optional.

type SortDirection

type SortDirection string

SortDirection is the direction of a screener sort.

const (
	// SortDirectionAsc sorts ascending.
	SortDirectionAsc SortDirection = "ASC"
	// SortDirectionDesc sorts descending.
	SortDirectionDesc SortDirection = "DESC"
)

Sort directions.

type StockBars

type StockBars struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Result is the list of bars.
	Result []Bar `json:"result"`
}

StockBars is the historical-bars response for a single symbol.

type StockCategory

type StockCategory string

StockCategory identifies the market of a stock instrument.

const (
	// StockCategoryUS identifies United States stocks.
	StockCategoryUS StockCategory = "US_STOCK"
	// StockCategoryHK identifies Hong Kong stocks.
	StockCategoryHK StockCategory = "HK_STOCK"
	// StockCategoryCN identifies mainland China stocks.
	StockCategoryCN StockCategory = "CN_STOCK"
)

Stock market categories accepted by the instrument-list endpoint.

type StockFootprint

type StockFootprint struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Result is the ordered footprint bars.
	Result []FootprintBar `json:"result"`
}

StockFootprint is the footprint (order-flow) chart for a single symbol.

type StockInstrument

type StockInstrument struct {
	// Name is the display name, for example "APPLE INC".
	Name string `json:"name"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// ExchangeCode is the exchange code, for example "NSQ" (Nasdaq).
	ExchangeCode string `json:"exchange_code"`
	// Category is the instrument's market.
	Category StockCategory `json:"category"`
	// Symbol is the trading symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// Status is the tradable status.
	Status InstrumentStatus `json:"status"`
	// Shortable reports whether the instrument can be sold short.
	Shortable bool `json:"shortable"`
	// Fractionable reports whether fractional trading is supported.
	Fractionable bool `json:"fractionable"`
	//nolint:misspell // "marginable" is the Webull API field name, not a typo.
	// Marginable reports whether the instrument can be bought on margin.
	Marginable bool `json:"marginable"` //nolint:misspell
	// OvernightTradingSupported reports whether overnight trading is supported.
	OvernightTradingSupported bool `json:"overnight_trading_supported"`
	// MarginRequirementLong is the margin requirement ratio for a long
	// position, as a decimal string.
	MarginRequirementLong string `json:"margin_requirement_long"`
	// MarginRequirementShort is the margin requirement ratio for a short
	// position, as a decimal string.
	MarginRequirementShort string `json:"margin_requirement_short"`
	// IntradayMarginLong is the intraday margin requirement ratio for a long
	// position, as a decimal string.
	IntradayMarginLong string `json:"intraday_margin_long"`
	// IntradayMarginShort is the intraday margin requirement ratio for a short
	// position, as a decimal string.
	IntradayMarginShort string `json:"intraday_margin_short"`
	// MaintenanceMarginLong is the maintenance margin ratio for a long
	// position, as a decimal string.
	MaintenanceMarginLong string `json:"maintenance_margin_long"`
	// MaintenanceMarginShort is the maintenance margin ratio for a short
	// position, as a decimal string.
	MaintenanceMarginShort string `json:"maintenance_margin_short"`
	// EasyToBorrow reports whether the instrument is easy to borrow.
	EasyToBorrow bool `json:"easy_to_borrow"`
	// LotSize is the minimum tradable quantity, as a decimal string.
	LotSize string `json:"lot_size"`
	// Currency is the trading currency, for example "USD".
	Currency string `json:"currency"`
	// SubCategory is the finer instrument classification.
	SubCategory StockSubCategory `json:"sub_category"`
}

StockInstrument is the profile of a single stock instrument.

type StockInstrumentQuery

type StockInstrumentQuery struct {
	// Category is the market to query. Required.
	Category StockCategory
	// Symbols restricts the result to the named symbols, at most 100 per query.
	// When empty the endpoint pages through all instruments in Category.
	Symbols []string
	// Status filters by tradable status.
	Status InstrumentStatus
	// SubCategory filters by sub-category. It is only effective when Symbols is
	// empty.
	SubCategory StockSubCategory
	// PaginationKey continues from a previous page. It is only used by
	// paginated endpoints.
	PaginationKey string
}

StockInstrumentQuery parameterizes Client.GetStockInstruments. Category is required; every other field is optional.

type StockProfilesV3Query added in v0.5.0

type StockProfilesV3Query struct {
	Symbols       []string
	Category      StockCategory
	SubCategory   StockSubCategory
	ExchangeCodes []string
	Status        InstrumentStatus
	PaginationKey string
}

StockProfilesV3Query parameterizes Client.GetStockProfilesV3.

type StockProfilesV3Result added in v0.5.0

type StockProfilesV3Result struct {
	Instruments   []StockInstrument
	PaginationKey string
}

StockProfilesV3Result is the result of Client.GetStockProfilesV3.

type StockSubCategory

type StockSubCategory string

StockSubCategory is a finer classification of a stock instrument. It is only effective when a symbol list is not supplied.

const (
	// StockSubCategoryCommonStock identifies common shares.
	StockSubCategoryCommonStock StockSubCategory = "COMMON_STOCK"
	// StockSubCategoryETF identifies exchange-traded funds.
	StockSubCategoryETF StockSubCategory = "ETF"
	// StockSubCategoryPreferredStock identifies preferred shares.
	StockSubCategoryPreferredStock StockSubCategory = "PREFERRED_STOCK"
	// StockSubCategoryWarrant identifies warrants.
	StockSubCategoryWarrant StockSubCategory = "WARRANT"
	// StockSubCategoryUnits identifies units.
	StockSubCategoryUnits StockSubCategory = "UNITS"
	// StockSubCategoryRight identifies rights.
	StockSubCategoryRight StockSubCategory = "RIGHT"
)

Stock sub-categories. All values are accepted for US stocks; Hong Kong and mainland China stocks support only StockSubCategoryCommonStock and StockSubCategoryETF.

type StockTicks

type StockTicks struct {
	// Symbol is the security symbol.
	Symbol string `json:"symbol"`
	// InstrumentID is the unique identifier of the security.
	InstrumentID string `json:"instrument_id"`
	// Result is the list of executed trades, newest first.
	Result []Tick `json:"result"`
}

StockTicks is the tick-by-tick response for a single security.

type StringOrNumber added in v1.0.1

type StringOrNumber struct {
	Str string
}

StringOrNumber handles JSON values that may be either a string or a numeric type. The Webull API occasionally sends numeric values where a string is expected (for example, the futures instrument unit field).

func (StringOrNumber) String added in v1.0.1

func (s StringOrNumber) String() string

func (*StringOrNumber) UnmarshalJSON added in v1.0.1

func (s *StringOrNumber) UnmarshalJSON(data []byte) error

type SuccessResponse

type SuccessResponse struct {
	// Success reports whether the server applied the operation.
	Success bool `json:"success"`
}

SuccessResponse reports the outcome of a mutating watchlist operation.

type Tick

type Tick struct {
	// Time is the trade time, as a Unix timestamp in milliseconds encoded as a
	// string.
	Time string `json:"time"`
	// Price is the executed trade price, as a decimal string.
	Price string `json:"price"`
	// Volume is the executed trade volume, as a decimal string.
	Volume string `json:"volume"`
	// Side is the aggressor side. Documented values include "B", "S", "G",
	// "L" and "N".
	Side string `json:"side"`
}

Tick is a single executed trade.

type TickQuery

type TickQuery struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string
	// Category is the market to query. Required.
	Category StockCategory
	// Count is the number of ticks to return. Zero means the server default
	// (30); the documented maximum is 1000.
	Count int
	// TradingSessions restricts the result to the given trading sessions.
	// When empty the server default applies.
	TradingSessions []TradingSession
}

TickQuery parameterizes Client.GetTick. Symbol and Category are required.

type TradingSession

type TradingSession string

TradingSession identifies a portion of the trading day. It is shared by the market-data endpoints that accept a trading_sessions parameter.

const (
	// TradingSessionPre is the pre-market session.
	TradingSessionPre TradingSession = "PRE"
	// TradingSessionRTH is the regular trading hours session.
	TradingSessionRTH TradingSession = "RTH"
	// TradingSessionAfter is the after-hours session.
	TradingSessionAfter TradingSession = "ATH"
	// TradingSessionOvernight is the overnight session.
	TradingSessionOvernight TradingSession = "OVN"
)

Trading sessions accepted by the market-data endpoints. The footprint endpoint does not accept TradingSessionOvernight.

type UpdateWatchlistParams

type UpdateWatchlistParams struct {
	// WatchlistID identifies the watchlist to update. Required.
	WatchlistID string `json:"watchlist_id"`
	// Name is the new watchlist name. Empty means unchanged.
	Name string `json:"name,omitempty"`
	// Sort is the new display ordering number. Zero means unchanged.
	Sort int32 `json:"sort,omitempty"`
}

UpdateWatchlistParams parameterizes Client.UpdateWatchlist. WatchlistID is required; a zero Sort or empty Name leaves the corresponding field unchanged.

type Watchlist

type Watchlist struct {
	// WatchlistID is the unique identifier of the watchlist, for example
	// "12345678".
	WatchlistID string `json:"watchlist_id"`
	// Name is the display name of the watchlist.
	Name string `json:"name"`
	// Sort is the display ordering number.
	Sort int32 `json:"sort"`
	// CreateTime is the watchlist creation time in ISO 8601 form.
	CreateTime string `json:"create_time"`
	// UpdateTime is the time of the last watchlist update in ISO 8601 form.
	UpdateTime string `json:"update_time"`
}

Watchlist is the metadata of one user watchlist.

type WatchlistInstrument

type WatchlistInstrument struct {
	// InstrumentID is the unique identifier of the instrument.
	InstrumentID string `json:"instrument_id"`
	// Symbol is the trading symbol, for example "AAPL" or "00700".
	Symbol string `json:"symbol"`
	// Name is the display name of the instrument.
	Name string `json:"name"`
	// ExchangeCode is the standardized exchange code, for example "NSQ".
	ExchangeCode string `json:"exchange_code"`
	// Sort is the sort order within the watchlist.
	Sort int32 `json:"sort"`
	// AddedTime is when the instrument was added, in ISO 8601 form.
	AddedTime string `json:"added_time"`
}

WatchlistInstrument is one instrument held in a watchlist.

type WatchlistInstrumentParam

type WatchlistInstrumentParam struct {
	// Symbol is the security symbol, for example "AAPL".
	Symbol string `json:"symbol"`
	// Category is the security category, for example
	// [StockCategoryUS]. Required.
	Category StockCategory `json:"category"`
	// Sort is the display ordering number. Zero means unset.
	Sort int32 `json:"sort,omitempty"`
}

WatchlistInstrumentParam identifies one instrument in a watchlist mutation request. Symbol and Category are required; Sort is only meaningful for Client.UpdateWatchlistInstruments.

type WatchlistInstruments

type WatchlistInstruments struct {
	// WatchlistID is the unique identifier of the watchlist.
	WatchlistID string `json:"watchlist_id"`
	// Instruments lists the instruments in the watchlist.
	Instruments []WatchlistInstrument `json:"instruments"`
}

WatchlistInstruments is a watchlist together with the instruments it holds.

type WatchlistInstrumentsParam

type WatchlistInstrumentsParam struct {
	// WatchlistID identifies the watchlist to mutate. Required.
	WatchlistID string `json:"watchlist_id"`
	// Instruments is the non-empty list of instruments to add, remove, or
	// reorder. Required.
	Instruments []WatchlistInstrumentParam `json:"instruments"`
}

WatchlistInstrumentsParam parameterizes the watchlist instrument mutation endpoints (Client.AddWatchlistInstruments, Client.RemoveWatchlistInstruments, and Client.UpdateWatchlistInstruments).

type Week52HighLowQuery added in v0.7.0

type Week52HighLowQuery struct {
	// Category is the security market. Required.
	Category StockCategory
	// SortBy is the secondary sort field. Empty uses the server default.
	SortBy ScreenerSortBy
	// Direction is the sort direction. Empty uses the server default.
	Direction SortDirection
}

Week52HighLowQuery parameterizes Client.GetWeek52HighLow.

Jump to

Keyboard shortcuts

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