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

ParameterTypeRequiredDescription
symbol&strYesSymbol, e.g. AAPL
sec_type&strYesSecurity type: STK/OPT/FUT/WAR/IOPT

Response

Result<Vec<Contract>, TigerError>

FieldTypeDescription
contract_idOption<i64>Contract ID
symbolStringSymbol
sec_typeStringSecurity type
currencyOption<String>Currency
exchangeOption<String>Exchange
primary_exchangeOption<String>Primary exchange
expiryOption<String>Expiration date
strikeOption<f64>Strike price
rightOption<String>PUT/CALL
multiplierOption<f64>Contract multiplier
identifierOption<String>Unique identifier
nameOption<String>Name
marketOption<String>Market
tradeableOption<bool>Whether tradeable
lot_sizeOption<f64>Lot size
tick_sizesOption<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

ParameterTypeRequiredDescription
symbols&[&str]YesSymbol array, e.g. &["AAPL", "GOOG"]
sec_type&strYesSecurity 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

ParameterTypeRequiredDescription
symbol&strYesSymbol
sec_type&strYesSecurity type: OPT/FUT/WAR/IOPT
expiry&strYesExpiration 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"
  }
]

Did this page help you?