Appearance
Market Data
Quotes
python
quote = client.get_quote("SPY")Returns: Quote dataclass
python
Quote(
conid=756733,
symbol='SPY',
last=693.2,
bid=693.19,
ask=693.2,
bid_size=5560,
ask_size=480,
volume=17353480,
change=3.97,
change_pct=0.58
)| Field | Type | Description |
|---|---|---|
conid | int | Contract ID |
symbol | str | Ticker symbol |
last | float | Last trade price |
bid | float | Best bid price |
ask | float | Best ask price |
bid_size | int | Bid size |
ask_size | int | Ask size |
volume | int | Daily volume |
change | float | Price change |
change_pct | float | Percent change |
Quick Price
python
price = client.get_price("SPY") # Returns float: 693.2Returns last price, falls back to bid or ask if unavailable.
Batch Quotes
Fetch quotes for multiple symbols in a single call:
python
quotes = client.get_tickers("SPY", "QQQ", "IWM", "DIA")Returns: List[Quote]
python
[
Quote(conid=756733, symbol='SPY', last=693.2, bid=693.19, ask=693.2, ...),
Quote(conid=320227571, symbol='QQQ', last=520.15, bid=520.14, ask=520.16, ...),
...
]More efficient than calling get_quote() in a loop. Falls back to individual lookups if batch endpoint fails.
Dividend Yield
python
data = client.get_dividend_yield("SPY")Returns: Dict
python
{
'conid': 756733,
'symbol': 'SPY',
'dividend_yield': 0.0099,
'annual_dividend_forward': 7.32,
'annual_dividend_ttm': 7.38,
'spot_price': 738.94,
'yield_basis': 'forward_12m',
'market_data_availability': 'RpB'
}Fund Account Behavior
Fund accounts may return None for dividend yield and greeks fields. Paper accounts return string-formatted values.
Historical Bars
python
bars = client.get_historical_bars("SPY", duration="2 M", bar_size="1 day")Returns: List[Bar]
python
Bar(
timestamp=1769178600000,
open=688.15,
high=690.96,
low=687.16,
close=689.23,
volume=1207682
)| Field | Type | Description |
|---|---|---|
timestamp | int | Unix timestamp (ms) |
open | float | Open price |
high | float | High price |
low | float | Low price |
close | float | Close price |
volume | int | Volume |
Duration & Bar Size Options
Duration (IB-style strings):
| Days | Weeks | Months | Years |
|---|---|---|---|
"1 D", "2 D", "3 D", "4 D", "5 D", "7 D", "10 D", "14 D" | "1 W", "2 W", "3 W", "4 W" | "1 M", "2 M", "3 M", "6 M" | "1 Y", "2 Y" |
Case-insensitive: "5 D", "5 d", and "5D" all work.
Bar Size: "1 min", "5 mins", "15 mins", "30 mins", "1 hour", "1 day"
Historical Data (pandas)
python
df = client.get_historical_data("SPY", duration="1 D", bar_size="30 mins")Returns: pd.DataFrame with columns: date, open, high, low, close, volume.
Short-form History
python
bars = client.get_history("SPY", period="1d", bar_size="5min")Returns: List[Bar]
Period (short-form): "1d", "2d", "3d", "4d", "5d", "7d", "10d", "14d", "1w"–"4w", "1m"–"6m", "1y"–"2y"
Bar Size: "1min", "5min", "15min", "30min", "1h", "1d"
Market Depth (L2)
python
depth = client.get_market_depth(conid, rows=3)Returns: Dict
python
{
'conid': 756733,
'bid': 693.19,
'ask': 693.2,
'bid_size': 5560.0,
'ask_size': 480.0,
'rows': 3
}Returns parsed floats. Use this instead of get_option_quote() when you need numeric bid/ask for options.
Last Trade
python
last = client.get_last_trade(conid)Returns: Dict
python
{
'conid': 756733,
'last': 693.2,
'last_size': 100.0,
'volume': 17353480.0
}WARNING
For indices like SPX, last may be None. Use get_quote("SPX") which pulls snapshot fields for indices.
Tick History
python
ticks = client.get_ticks(conid, start="20260126-09:30:00", end="20260126-16:00:00")Returns: Dict with tick data. tick_type defaults to "TRADES".
Halt Status
python
status = client.get_halt_status(conid)
halted = client.is_halted(conid) # Returns boolTrading Hours
python
hours = client.get_trading_hours("SPY")
is_open = client.is_market_open_for("SPY") # Returns boolContract ID Resolution
python
conid = client.get_conid("SPY") # Stock: 756733
conid = client.get_index_conid("SPX") # Index: 416904Returns: int or None