Get Contracts
Get Contract
Signature
pub async fn get_contract(&self, symbol: &str, sec_type: &str) -> Result<Vec<Contract>, TigerError>Description
Get contract information for a single symbol.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | &str | Yes | Symbol, e.g. AAPL |
| sec_type | &str | Yes | Security type: STK/OPT/FUT/WAR/IOPT |
Response
Result<Vec<Contract>, TigerError>
| Field | Type | Description |
|---|---|---|
| contract_id | Option<i64> | Contract ID |
| symbol | String | Symbol |
| sec_type | String | Security type |
| currency | Option<String> | Currency |
| exchange | Option<String> | Exchange |
| primary_exchange | Option<String> | Primary exchange |
| expiry | Option<String> | Expiration date |
| strike | Option<f64> | Strike price |
| right | Option<String> | PUT/CALL |
| multiplier | Option<f64> | Contract multiplier |
| identifier | Option<String> | Unique identifier |
| name | Option<String> | Name |
| market | Option<String> | Market |
| tradeable | Option<bool> | Whether tradeable |
| lot_size | Option<f64> | Lot size |
| tick_sizes | Option<Vec<TickSize>> | Tick size list |
Example
use tigeropen::config::ClientConfig;
use tigeropen::trade::TradeClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::builder().build()?;
let trade = TradeClient::from_config(config);
let contracts = trade.get_contract("AAPL", "STK").await?;
for c in &contracts {
println!("{} {} exchange={:?}", c.symbol, c.sec_type, c.exchange);
}
Ok(())
}Response Example
[
{
"contract_id": 11234,
"symbol": "AAPL",
"sec_type": "STK",
"currency": "USD",
"exchange": "SMART",
"primary_exchange": "NASDAQ",
"market": "US",
"tradeable": true,
"lot_size": 1.0,
"multiplier": 1.0
}
]Get Contracts (Batch)
Signature
pub async fn get_contracts(&self, symbols: &[&str], sec_type: &str) -> Result<Vec<Contract>, TigerError>Description
Get contract information for multiple symbols.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | &[&str] | Yes | Symbol array, e.g. &["AAPL", "GOOG"] |
| sec_type | &str | Yes | Security type: STK/OPT/FUT/WAR/IOPT |
Response
Same fields as Get Contract.
Example
let contracts = trade.get_contracts(&["AAPL", "GOOG", "TSLA"], "STK").await?;
println!("Got {} contracts", contracts.len());Get Quote Contract
Signature
pub async fn get_quote_contract(&self, symbol: &str, sec_type: &str, expiry: &str) -> Result<Vec<Contract>, TigerError>Description
Get quote contract for derivatives (options, futures).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | &str | Yes | Symbol |
| sec_type | &str | Yes | Security type: OPT/FUT/WAR/IOPT |
| expiry | &str | Yes | Expiration date, format YYYYMMDD |
Response
Same fields as Get Contract, with additional strike/expiry/right/identifier for derivatives.
Example
let contracts = trade.get_quote_contract("AAPL", "OPT", "20260919").await?;
for c in &contracts {
println!("{} strike={:?} right={:?}", c.symbol, c.strike, c.right);
}Response Example
[
{
"contract_id": 55678,
"symbol": "AAPL",
"sec_type": "OPT",
"currency": "USD",
"exchange": "SMART",
"expiry": "20260919",
"strike": 200.0,
"right": "CALL",
"multiplier": 100.0,
"identifier": "AAPL 260919C00200000"
}
]Updated 1 day ago
Did this page help you?
