Market Data
The Rust SDK provides an async QuoteClient built on Tokio. Every method returns Result<T, TigerError>. All network calls are async and must be .awaited inside a Tokio runtime.
Quick Start
use tigeropen::config::ClientConfig;
use tigeropen::quote::QuoteClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::from_properties_file("tiger_openapi_config.properties")?;
let qc = QuoteClient::new(config);
// Get US market status
let states = qc.market_state("US").await?;
println!("US market state: {:?}", states);
// Get real-time quotes
let briefs = qc.quote_real_time(&["AAPL", "TSLA"]).await?;
println!("Real-time quotes: {:?}", briefs);
// Get daily candlestick data
let klines = qc.kline("AAPL", "day").await?;
println!("K-line data: {:?}", klines);
Ok(())
}Basic Quotes
market_state
pub async fn market_state(&self, market: &str) -> Result<Vec<MarketState>, TigerError>Returns the current trading session status for the specified market.
| Parameter | Type | Required | Description |
|---|---|---|---|
market | &str | Yes | Market code: "US", "HK", "CN", "SG" |
Returns: Vec<MarketState> with fields market, status, open_time, close_time.
let states = qc.market_state("US").await?;
for s in &states {
println!("{}: {}", s.market, s.status);
}
let hk = qc.market_state("HK").await?;Data Example
Request parameters:
{ "market": "US" }Response data:
[
{
"market": "US",
"status": "trading",
"openTime": 1735020600000,
"closeTime": 1735044000000,
"timezone": "America/New_York"
}
]quote_real_time
pub async fn quote_real_time(&self, symbols: &[&str]) -> Result<Vec<QuoteBrief>, TigerError>Returns real-time snapshot quotes (latest price, bid/ask, volume, change, change ratio) for the given symbols.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | &[&str] | Yes | Stock symbols, e.g. &["AAPL", "TSLA"] |
let briefs = qc.quote_real_time(&["AAPL", "TSLA", "MSFT"]).await?;
for b in &briefs {
println!("{}: latest_price={:?}", b.symbol, b.latest_price);
}Data Example
Request parameters:
{ "symbols": ["AAPL", "TSLA"] }Response data:
[
{
"symbol": "AAPL",
"market": "US",
"name": "Apple Inc.",
"latestPrice": 227.52,
"preClose": 225.01,
"change": 2.51,
"changePercentage": 1.115,
"volume": 62345678,
"amount": 14189233280.0,
"open": 225.50,
"high": 228.10,
"low": 224.80,
"timestamp": 1735042800000
},
{
"symbol": "TSLA",
"market": "US",
"name": "Tesla Inc.",
"latestPrice": 410.44,
"preClose": 403.84,
"change": 6.60,
"changePercentage": 1.634,
"volume": 98765432,
"amount": 40542123456.0,
"open": 405.00,
"high": 415.20,
"low": 402.30,
"timestamp": 1735042800000
}
]kline
pub async fn kline(&self, symbol: &str, period: &str) -> Result<Vec<KlineBar>, TigerError>Returns historical OHLCV candlestick data for the specified symbol and period.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | &str | Yes | Stock symbol, e.g. "AAPL" |
period | &str | Yes | Bar period: "day", "week", "month", "1min", "5min", "15min", "30min", "60min" |
// Daily bars
let daily = qc.kline("AAPL", "day").await?;
// 5-minute intraday bars
let bars_5m = qc.kline("AAPL", "5min").await?;
for bar in &daily {
println!("O={} H={} L={} C={}", bar.open, bar.high, bar.low, bar.close);
}Data Example
Request parameters:
{ "symbols": ["AAPL"], "period": "day" }Response data:
{
"symbol": "AAPL",
"period": "day",
"items": [
{
"time": 1734912000000,
"open": 222.56,
"high": 225.72,
"low": 222.11,
"close": 225.01,
"volume": 55234100
},
{
"time": 1734998400000,
"open": 225.50,
"high": 228.10,
"low": 224.80,
"close": 227.52,
"volume": 62345678
}
]
}timeline
pub async fn timeline(&self, symbols: &[&str]) -> Result<Vec<Timeline>, TigerError>Returns intraday minute-level price and volume timeline for today's session.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | &[&str] | Yes | List of stock symbols |
let timeline = qc.timeline(&["AAPL"]).await?;Data Example
Request parameters:
{ "symbols": ["AAPL"] }Response data:
{
"symbol": "AAPL",
"items": [
{
"time": 1735020600000,
"price": 225.50,
"volume": 3021456,
"avgPrice": 225.48
},
{
"time": 1735020660000,
"price": 225.80,
"volume": 1234567,
"avgPrice": 225.55
}
]
}trade_tick
pub async fn trade_tick(&self, symbols: &[&str]) -> Result<Vec<TradeTick>, TigerError>Returns the most recent trade ticks (price, size, timestamp, direction) for the given symbols.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | &[&str] | Yes | List of stock symbols |
let ticks = qc.trade_tick(&["AAPL"]).await?;Data Example
Request parameters:
{ "symbols": ["AAPL"] }Response data:
{
"symbol": "AAPL",
"items": [
{
"time": 1735042780000,
"price": 227.52,
"volume": 100,
"direction": "BUY"
},
{
"time": 1735042781000,
"price": 227.50,
"volume": 200,
"direction": "SELL"
}
]
}quote_depth
pub async fn quote_depth(&self, symbol: &str) -> Result<DepthQuote, TigerError>Returns Level 2 order book (up to 10 levels of bids and asks) for the specified symbol.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | &str | Yes | Stock symbol |
let depth = qc.quote_depth("AAPL").await?;
println!("Best bid: {:?}", depth.bids.first());
println!("Best ask: {:?}", depth.asks.first());Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
{
"symbol": "AAPL",
"askList": [
{ "price": 227.53, "volume": 300, "orderCount": 2 },
{ "price": 227.55, "volume": 500, "orderCount": 4 },
{ "price": 227.58, "volume": 200, "orderCount": 1 },
{ "price": 227.60, "volume": 800, "orderCount": 6 },
{ "price": 227.65, "volume": 1200, "orderCount": 8 }
],
"bidList": [
{ "price": 227.52, "volume": 400, "orderCount": 3 },
{ "price": 227.50, "volume": 600, "orderCount": 5 },
{ "price": 227.48, "volume": 300, "orderCount": 2 },
{ "price": 227.45, "volume": 700, "orderCount": 5 },
{ "price": 227.40, "volume": 1000, "orderCount": 7 }
]
}Option Quotes
option_expiration
pub async fn option_expiration(&self, symbol: &str) -> Result<Vec<String>, TigerError>Returns all available option expiration dates for the underlying symbol.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | &str | Yes | Underlying symbol, e.g. "AAPL" |
let exp_dates = qc.option_expiration("AAPL").await?;
// ["2025-01-17", "2025-02-21", "2025-03-21", ...]
for date in &exp_dates {
println!("Expiry: {}", date);
}Data Example
Request parameters:
{ "symbols": ["AAPL"] }Response data:
["2025-01-17", "2025-02-21", "2025-03-21", "2025-06-20", "2025-09-19", "2025-12-19", "2026-01-16"]option_chain
pub async fn option_chain(&self, symbol: &str, expiry: &str) -> Result<OptionChain, TigerError>Returns the full option chain (all strikes, both calls and puts) for a given expiration date.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | &str | Yes | Underlying symbol |
expiry | &str | Yes | Expiration date in "YYYY-MM-DD" format |
let chain = qc.option_chain("AAPL", "2025-01-17").await?;Data Example
Request parameters:
{ "symbol": "AAPL", "expiry": "2025-01-17" }Response data:
[
{
"strike": 220.0,
"callSymbol": "AAPL 250117C00220000",
"putSymbol": "AAPL 250117P00220000",
"callLatestPrice": 9.50,
"putLatestPrice": 2.10,
"callImpliedVolatility": 0.285,
"putImpliedVolatility": 0.312
},
{
"strike": 225.0,
"callSymbol": "AAPL 250117C00225000",
"putSymbol": "AAPL 250117P00225000",
"callLatestPrice": 6.20,
"putLatestPrice": 3.80,
"callImpliedVolatility": 0.278,
"putImpliedVolatility": 0.299
}
]option_brief
pub async fn option_brief(&self, identifiers: &[&str]) -> Result<Vec<OptionBrief>, TigerError>Returns real-time quotes for specific option contracts.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifiers | &[&str] | Yes | OCC-style identifiers, e.g. &["AAPL 250117C00150000"] |
let opt_briefs = qc.option_brief(&["AAPL 250117C00150000"]).await?;Data Example
Request parameters:
{ "identifiers": ["AAPL 250117C00220000"] }Response data:
[
{
"identifier": "AAPL 250117C00220000",
"latestPrice": 9.50,
"preClose": 9.10,
"change": 0.40,
"impliedVolatility": 0.285,
"delta": 0.612,
"gamma": 0.028,
"theta": -0.085,
"vega": 0.156,
"openInterest": 12540,
"volume": 3820
}
]option_kline
pub async fn option_kline(&self, identifier: &str, period: &str) -> Result<Vec<KlineBar>, TigerError>Returns historical candlestick data for a specific option contract.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | &str | Yes | OCC-style option identifier |
period | &str | Yes | Bar period (same values as kline) |
let opt_kline = qc.option_kline("AAPL 250117C00150000", "day").await?;Data Example
Request parameters:
{ "identifier": "AAPL 250117C00220000", "period": "day" }Response data:
{
"identifier": "AAPL 250117C00220000",
"period": "day",
"items": [
{
"time": 1734912000000,
"open": 8.80,
"high": 9.60,
"low": 8.70,
"close": 9.10,
"volume": 2100
},
{
"time": 1734998400000,
"open": 9.10,
"high": 9.80,
"low": 9.00,
"close": 9.50,
"volume": 3820
}
]
}Futures Quotes
future_exchange
pub async fn future_exchange(&self) -> Result<Vec<Exchange>, TigerError>Returns the list of supported futures exchanges.
let exchanges = qc.future_exchange().await?;
for ex in &exchanges {
println!("{}: {}", ex.code, ex.name);
}Data Example
Response data:
[
{ "exchange": "CME", "name": "Chicago Mercantile Exchange" },
{ "exchange": "CBOT", "name": "Chicago Board of Trade" },
{ "exchange": "NYMEX", "name": "New York Mercantile Exchange" },
{ "exchange": "HKEX", "name": "Hong Kong Exchanges and Clearing" }
]future_contracts
pub async fn future_contracts(&self, exchange: &str) -> Result<Vec<FutureContract>, TigerError>Returns available futures contracts on the specified exchange.
| Parameter | Type | Required | Description |
|---|---|---|---|
exchange | &str | Yes | Exchange code, e.g. "CME", "CBOT" |
let contracts = qc.future_contracts("CME").await?;Data Example
Request parameters:
{ "exchange": "CME" }Response data:
[
{
"symbol": "ES",
"name": "E-mini S&P 500",
"contractMultiplier": 50,
"currency": "USD",
"minTick": 0.25,
"exchange": "CME"
},
{
"symbol": "NQ",
"name": "E-mini NASDAQ-100",
"contractMultiplier": 20,
"currency": "USD",
"minTick": 0.25,
"exchange": "CME"
}
]future_real_time_quote
pub async fn future_real_time_quote(&self, symbols: &[&str]) -> Result<Vec<FutureQuote>, TigerError>Returns real-time quotes for the specified futures contracts.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbols | &[&str] | Yes | Futures contract symbols, e.g. &["ES2506"] |
let fut_quotes = qc.future_real_time_quote(&["ES2506", "NQ2506"]).await?;Data Example
Request parameters:
{ "symbols": ["ES2506", "NQ2506"] }Response data:
[
{
"symbol": "ES2506",
"latestPrice": 5920.50,
"preClose": 5895.25,
"change": 25.25,
"changePercentage": 0.428,
"volume": 1234567,
"openInterest": 2345678,
"open": 5900.00,
"high": 5935.00,
"low": 5895.00,
"timestamp": 1735042800000
}
]future_kline
pub async fn future_kline(&self, symbol: &str, period: &str) -> Result<Vec<KlineBar>, TigerError>Returns historical candlestick data for a futures contract.
let fut_kline = qc.future_kline("ES2506", "day").await?;Data Example
Request parameters:
{ "symbol": "ES2506", "period": "day" }Response data:
{
"symbol": "ES2506",
"period": "day",
"items": [
{
"time": 1734912000000,
"open": 5870.00,
"high": 5900.00,
"low": 5860.00,
"close": 5895.25,
"volume": 1023456
},
{
"time": 1734998400000,
"open": 5900.00,
"high": 5935.00,
"low": 5895.00,
"close": 5920.50,
"volume": 1234567
}
]
}Fundamental Data
financial_daily
pub async fn financial_daily(&self, symbol: &str) -> Result<FinancialDaily, TigerError>Returns daily fundamental metrics (P/E ratio, market cap, EPS, dividend yield, etc.).
let daily = qc.financial_daily("AAPL").await?;Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
[
{
"date": "2024-12-24",
"pe": 38.5,
"pb": 58.2,
"eps": 6.52,
"dividendYield": 0.0044,
"marketCap": 3420000000000
}
]financial_report
pub async fn financial_report(&self, symbol: &str) -> Result<FinancialReport, TigerError>Returns quarterly and annual financial report data (income statement, balance sheet, cash flow).
let report = qc.financial_report("AAPL").await?;Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
[
{
"period": "2024Q4",
"periodType": "quarterly",
"revenue": 124300000000,
"netIncome": 36330000000,
"totalAssets": 352583000000,
"totalLiabilities": 308030000000,
"cashFlow": 29943000000,
"eps": 2.40
}
]corporate_action
pub async fn corporate_action(&self, symbol: &str) -> Result<Vec<CorporateAction>, TigerError>Returns historical corporate actions including dividends, stock splits, and rights offerings.
let actions = qc.corporate_action("AAPL").await?;
for action in &actions {
println!("{}: ex_date={}", action.action_type, action.ex_date);
}Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
[
{
"actionType": "dividend",
"exDate": "2024-11-08",
"payDate": "2024-11-14",
"amount": 0.25,
"currency": "USD"
},
{
"actionType": "split",
"exDate": "2020-08-31",
"ratio": 4.0,
"description": "4:1 stock split"
}
]Capital Flow
capital_flow
pub async fn capital_flow(&self, symbol: &str) -> Result<CapitalFlow, TigerError>Returns net capital inflow/outflow data segmented by trade size.
let flow = qc.capital_flow("AAPL").await?;Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
{
"symbol": "AAPL",
"inflow": 8234567890,
"outflow": 7123456789,
"netInflow": 1111111101,
"largeOrderInflow": 5123456789,
"largeOrderOutflow": 4012345678,
"mediumOrderInflow": 2012345678,
"smallOrderInflow": 1098765432,
"timestamp": 1735042800000
}capital_distribution
pub async fn capital_distribution(&self, symbol: &str) -> Result<CapitalDistribution, TigerError>Returns the distribution of buy/sell orders across different order-size tiers.
let dist = qc.capital_distribution("AAPL").await?;Data Example
Request parameters:
{ "symbol": "AAPL" }Response data:
{
"symbol": "AAPL",
"retailBuyRatio": 0.18,
"retailSellRatio": 0.15,
"institutionBuyRatio": 0.42,
"institutionSellRatio": 0.38,
"largeholderBuyRatio": 0.40,
"largeholderSellRatio": 0.47,
"timestamp": 1735042800000
}Market Scanner
market_scanner
pub async fn market_scanner(&self, params: serde_json::Value) -> Result<Vec<ScanResult>, TigerError>Scans the market and returns stocks matching the given filter criteria. Pass the parameters as a serde_json::Value.
| Parameter | Type | Required | Description |
|---|---|---|---|
params | serde_json::Value | Yes | Filter criteria as JSON |
use serde_json::json;
let scan_result = qc.market_scanner(json!({
"market": "US",
"filter": [
{ "fieldName": "marketCap", "filterMin": 1_000_000_000 },
{ "fieldName": "volume", "filterMin": 500_000 },
],
"sortFieldName": "marketCap",
"sortDir": "desc",
})).await?;
for item in &scan_result {
println!("Symbol: {}", item.symbol);
}Data Example
Request parameters:
{
"market": "US",
"filter": [
{ "fieldName": "marketCap", "filterMin": 1000000000 },
{ "fieldName": "changePercentage", "filterMin": 2.0 }
]
}Response data:
[
{
"symbol": "AAPL",
"name": "Apple Inc.",
"latestPrice": 227.52,
"changePercentage": 1.115,
"marketCap": 3420000000000,
"volume": 62345678
},
{
"symbol": "NVDA",
"name": "NVIDIA Corporation",
"latestPrice": 138.85,
"changePercentage": 3.240,
"marketCap": 3390000000000,
"volume": 185432100
}
]grab_quote_permission
pub async fn grab_quote_permission(&self) -> Result<QuotePermission, TigerError>Returns the current account's market data subscription permissions and authorized markets.
let perm = qc.grab_quote_permission().await?;
println!("Permitted markets: {:?}", perm.markets);Data Example
Response data:
["US_BASIC", "HK_BASIC", "US_REALTIME"]Updated 6 days ago
