Stream quotes
subscribe_quotesStart a live top-of-book quote stream for a single contract, returning a subscription handle to retrieve bid, ask, last price, sizes, OHLC, volume, and options greeks via get_subscription_data.
Instructions
Start streaming live top-of-book quotes for one contract (read with get_subscription_data).
Returns a subscription handle. get_subscription_data(subscription_id) then returns
the current quote (bid/ask/last, sizes, OHLC, volume, greeks for options), the
requested generic tick values under `extras`, and IBKR notices. There is one quote
stream per contract: subscribing again returns the same handle (`deduplicated`
true), adding any new generic ticks to it. Each stream uses one of the login's
market data lines (100 by default); streams nobody reads for `idle_ttl_s` seconds
are cancelled, and unsubscribe frees the line at once.
Needs market data permissions (see set_market_data_type for delayed data). If IBKR
refuses the stream right away (354, 10089, 10168, 10197), the call fails with the
reason; later problems show in the data as `active: false` and `error`.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contract | Yes | The instrument. A con_id alone is unambiguous; otherwise give symbol and sec_type, plus expiry, strike and right for options. | |
| generic_ticks | No | Extra fields to stream: option_volume, option_open_interest, historical_volatility, avg_option_volume, implied_volatility (these five for stocks: the underlying's option statistics), index_future_premium, misc_stats (13/26/52-week high/low, average volume), mark_price, auction, rt_volume (time & sales, VWAP), shortable (short availability and shares), fundamental_ratios (needs a Refinitiv subscription), trade_count, trade_rate, volume_rate, rt_trade_volume, rt_historical_volatility, dividends, futures_open_interest, last_rth_trade, bond_factor_multiplier, short_term_volume (3/5/10-minute volume), ipo_prices, and for ETFs etf_nav_bid_ask, etf_nav_last, etf_nav_close, etf_nav_high_low, etf_nav_frozen_last (IBKR's intraday NAV of the fund). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | What it streams for: the contract id plus parameters. | |
| kind | Yes | What streams: quotes, depth, tick_by_tick, realtime_bars, bars, scanner, news_bulletins, news or display_group. | |
| contract | No | The instrument, when there is one. | |
| created_at | Yes | ||
| idle_ttl_s | Yes | Seconds without a read before it is cancelled. | |
| deduplicated | No | True when an identical stream was already open and its handle was returned instead of opening a second one. | |
| subscription_id | Yes | Handle for get_subscription_data and unsubscribe. |