期货

获取所有期货合约

签名


pub async fn get_all_future_contracts( &self, req: AllFutureContractsRequest, ) -> Result<Vec<FutureContractInfo>, TigerError>

说明

contract_type/exchange 查询全部合约。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_typeOption<String>条件必填:contract_type / exchange 至少一个None(不序列化)
req.exchangeOption<String>条件必填:contract_type / exchange 至少一个None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureContractInfo>, TigerError>. continuous: bool, trade: bool, r#type: String, contract_code: String, ib_code: String, name: String, contract_month: String, last_trading_date: String, first_notice_date: String, last_bidding_close_time: i64, currency: String, exchange_code: String, multiplier: f64, min_tick: f64, display_multiplier: f64, exchange: String, product_worth: String, delivery_mode: String, product_type: String, product_scale: String, last_trading_timestamp: i64.

Vec<FutureContractInfo>

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_all_future_contracts(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_all_future_contracts(AllFutureContractsRequest { contract_type: Some("ES".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "continuous": false,
    "trade": true,
    "type": "FUT",
    "contract_code": "ES2509",
    "ib_code": "ES",
    "name": "E-mini S&P 500",
    "contract_month": "202509",
    "last_trading_date": "2025-09-19"
  }
]

获取当前合约

签名


pub async fn get_current_future_contract( &self, req: FutureContractSingleRequest, ) -> Result<Option<FutureContractInfo>, TigerError>

说明

当前主力;通常传 contract_type

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codeOption<String>条件必填:contract_code / contract_type 至少一个None(不序列化)
req.contract_typeOption<String>条件必填:contract_code / contract_type 至少一个None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Option<FutureContractInfo>, TigerError>. continuous: bool, trade: bool, r#type: String, contract_code: String, ib_code: String, name: String, contract_month: String, last_trading_date: String, first_notice_date: String, last_bidding_close_time: i64, currency: String, exchange_code: String, multiplier: f64, min_tick: f64, display_multiplier: f64, exchange: String, product_worth: String, delivery_mode: String, product_type: String, product_scale: String, last_trading_timestamp: i64.

可空单个合约。

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_current_future_contract(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_current_future_contract(FutureContractSingleRequest { contract_code: Some("ES2609".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

{
  "continuous": false,
  "trade": true,
  "type": "FUT",
  "contract_code": "ES2509",
  "ib_code": "ES",
  "name": "E-mini S&P 500",
  "contract_month": "202509",
  "last_trading_date": "2025-09-19"
}

获取连续合约

签名


pub async fn get_future_continuous_contracts( &self, req: FutureContinuousContractsRequest, ) -> Result<Vec<FutureContractInfo>, TigerError>

说明

连续合约;contract_type 必填。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_typeOption<String>可选None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureContractInfo>, TigerError>. continuous: bool, trade: bool, r#type: String, contract_code: String, ib_code: String, name: String, contract_month: String, last_trading_date: String, first_notice_date: String, last_bidding_close_time: i64, currency: String, exchange_code: String, multiplier: f64, min_tick: f64, display_multiplier: f64, exchange: String, product_worth: String, delivery_mode: String, product_type: String, product_scale: String, last_trading_timestamp: i64.

Vec<FutureContractInfo>

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_continuous_contracts(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_continuous_contracts(FutureContinuousContractsRequest { contract_type: Some("ES".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "continuous": false,
    "trade": true,
    "type": "FUT",
    "contract_code": "ES2509",
    "ib_code": "ES",
    "name": "E-mini S&P 500",
    "contract_month": "202509",
    "last_trading_date": "2025-09-19"
  }
]

获取期货合约

签名


pub async fn get_future_contract( &self, req: FutureContractSingleRequest, ) -> Result<Vec<FutureContractInfo>, TigerError>

说明

contract_codecontract_type 查询;单对象也统一为 Vec。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codeOption<String>条件必填:contract_code / contract_type 至少一个None(不序列化)
req.contract_typeOption<String>条件必填:contract_code / contract_type 至少一个None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureContractInfo>, TigerError>. continuous: bool, trade: bool, r#type: String, contract_code: String, ib_code: String, name: String, contract_month: String, last_trading_date: String, first_notice_date: String, last_bidding_close_time: i64, currency: String, exchange_code: String, multiplier: f64, min_tick: f64, display_multiplier: f64, exchange: String, product_worth: String, delivery_mode: String, product_type: String, product_scale: String, last_trading_timestamp: i64.

Vec<FutureContractInfo>

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_contract(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_contract(FutureContractSingleRequest { contract_code: Some("ES2609".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "continuous": false,
    "trade": true,
    "type": "FUT",
    "contract_code": "ES2509",
    "ib_code": "ES",
    "name": "E-mini S&P 500",
    "contract_month": "202509",
    "last_trading_date": "2025-09-19"
  }
]

获取期货合约列表

签名


pub async fn get_future_contracts( &self, exchange_code: &str, ) -> Result<Vec<FutureContractInfo>, TigerError>

说明

按交易所查合约;代码必填。

参数

参数Rust 类型必填性/条件SDK 默认值
exchange_code&str必填

返回

  • QuoteClient: Result<Vec<FutureContractInfo>, TigerError>. continuous: bool, trade: bool, r#type: String, contract_code: String, ib_code: String, name: String, contract_month: String, last_trading_date: String, first_notice_date: String, last_bidding_close_time: i64, currency: String, exchange_code: String, multiplier: f64, min_tick: f64, display_multiplier: f64, exchange: String, product_worth: String, delivery_mode: String, product_type: String, product_scale: String, last_trading_timestamp: i64.

合约代码、月份、交易日、币种、乘数、tick、交易所。

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_contracts(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_contracts("CME").await?;

    Ok(())

}

返回示例

[
  {
    "continuous": false,
    "trade": true,
    "type": "FUT",
    "contract_code": "ES2509",
    "ib_code": "ES",
    "name": "E-mini S&P 500",
    "contract_month": "202509",
    "last_trading_date": "2025-09-19"
  }
]

获取期货深度

签名


pub async fn get_future_depth( &self, req: FutureDepthRequest, ) -> Result<Vec<FutureDepth>, TigerError>

说明

盘口;contract_codes 必填。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codesOption<Vec<String>>服务端必填;SDK 不预校验None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureDepth>, TigerError>. contract_code: String, timestamp: i64, asks: Vec

合约代码及买卖档位。

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_depth(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_depth(FutureDepthRequest { contract_codes: Some(vec!["ES2609".into()]), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "contract_code": "ES2509",
    "timestamp": 1738180800000,
    "asks": [
      {
        "price": 5638.25,
        "volume": 120
      },
      {
        "price": 5638.5,
        "volume": 85
      }
    ],
    "bids": [
      {
        "price": 5638.0,
        "volume": 95
      },
      {
        "price": 5637.75,
        "volume": 110
      }
    ]
  }
]

获取期货交易所

签名


pub async fn get_future_exchange(&self) -> Result<Vec<FutureExchange>, TigerError>

说明

支持的期货交易所,无参数。

参数

参数Rust 类型必填性/条件SDK 默认值
none-必填

返回

  • QuoteClient: Result<Vec<FutureExchange>, TigerError>. code: String, name: String, zone_id: String.

code/name/zone_id

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_exchange(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_exchange().await?;

    Ok(())

}

返回示例

[
  {
    "code": "CME",
    "name": "Chicago Mercantile Exchange",
    "zone_id": "America/Chicago"
  }
]

获取历史主力合约

签名


pub async fn get_future_history_main_contract( &self, req: FutureHistoryMainContractRequest, ) -> Result<Vec<FutureMainContractHistory>, TigerError>

说明

历史主力;合约代码与毫秒时间窗。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codesOption<Vec<String>>服务端必填;SDK 不预校验None(不序列化)
req.begin_timeOption<i64>可选None(不序列化)
req.end_timeOption<i64>可选None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureMainContractHistory>, TigerError>. contract_code: String, symbol: String, begin_date: String, end_date: String.

contract_code/symbol/begin_date/end_date

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_history_main_contract(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_history_main_contract(FutureHistoryMainContractRequest { contract_codes: Some(vec!["ES2609".into()]), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "contract_code": "ES2509",
    "symbol": "ES",
    "begin_date": "2025-06-20",
    "end_date": "2025-09-19"
  }
]

获取期货 K 线

签名


pub async fn get_future_kline( &self, mut req: FutureKlineRequest, ) -> Result<Vec<FutureKline>, TigerError>

说明

K 线;代码与周期必填;时间 Some(0) 被 SDK 改为 Some(-1)

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codesOption<Vec<String>>条件必填:contract_code / contract_codes 至少一个None(不序列化)
req.contract_codeOption<String>条件必填:contract_code / contract_codes 至少一个None(不序列化)
req.periodOption<String>服务端必填;SDK 不预校验None(不序列化)
req.begin_timeOption<i64>可选Some(0) 时 SDK 设为 Some(-1)
req.end_timeOption<i64>可选Some(0) 时 SDK 设为 Some(-1)
req.begin_indexOption<i32>可选None(不序列化)
req.end_indexOption<i32>可选None(不序列化)
req.limitOption<i32>可选None(不序列化)
req.page_tokenOption<String>可选None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureKline>, TigerError>. contract_code: String, next_page_token: String, items: Vec

contract_code/next_page_token/items

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_kline(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_kline(FutureKlineRequest { contract_code: Some("ES2609".into()), period: Some("day".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "contract_code": "ES2509",
    "next_page_token": "eyJzIjoiMTczODE4MDgwMDAwMCJ9",
    "items": [
      {
        "time": 1738094400000,
        "volume": 1423500,
        "open": 5610.25,
        "close": 5638.0,
        "high": 5645.75,
        "low": 5605.25,
        "last_time": 1738180799000,
        "open_interest": 2150000,
        "settlement": 5635.5
      }
    ]
  }
]

分页获取期货 K 线

签名


pub async fn get_future_kline_by_page( &self, req: FutureKlineByPageRequest, ) -> Result<Vec<FutureKlineItem>, TigerError>

说明

客户端分页;page_size=200total_size=1000;空时间按 -1。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codeOption<String>服务端必填;SDK 不预校验None(不序列化)
req.periodOption<String>服务端必填;SDK 不预校验None(不序列化)
req.begin_timeOption<i64>可选None(不序列化)
req.end_timeOption<i64>可选None(不序列化)
req.total_sizeOption<i32>可选None 时 1000
req.page_sizeOption<i32>可选None 时 200
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureKlineItem>, TigerError>. time: i64, volume: i64, open: f64, close: f64, high: f64, low: f64, last_time: i64, open_interest: i64, settlement: f64.

扁平 Vec<FutureKlineItem>

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_kline_by_page(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_kline_by_page(FutureKlineByPageRequest { contract_code: Some("ES2609".into()), period: Some("day".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "time": 1738180800000,
    "volume": 58263100,
    "open": 5620.5,
    "close": 5638.0,
    "high": 5645.75,
    "low": 5605.25,
    "last_time": 1738180800000,
    "open_interest": 2150000
  }
]

获取期货实时行情

签名


pub async fn get_future_real_time_quote( &self, req: FutureRealTimeQuoteRequest, ) -> Result<Vec<FutureQuote>, TigerError>

说明

快照;contract_codes 必填;需期货行情权限。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codesOption<Vec<String>>服务端必填;SDK 不预校验None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureQuote>, TigerError>. contract_code: String, latest_price: f64, latest_size: i64, latest_time: i64, bid_price: f64, ask_price: f64, bid_size: i64, ask_size: i64, open_interest: i64, open_interest_change: i64, volume: i64, open: f64, high: f64, low: f64, settlement: f64, limit_up: f64, limit_down: f64, avg_price: f64.

最新价、买卖价量、成交量、持仓、OHLC、结算及涨跌停。

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_real_time_quote(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_real_time_quote(FutureRealTimeQuoteRequest { contract_codes: Some(vec!["ES2609".into()]), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "contract_code": "ES2509",
    "latest_price": 5638.0,
    "latest_size": 15,
    "latest_time": 1738180800000,
    "bid_price": 5638.0,
    "ask_price": 5638.25,
    "bid_size": 300,
    "ask_size": 300
  }
]

获取期货逐笔

签名


pub async fn get_future_trade_ticks( &self, req: FutureTradeTicksRequest, ) -> Result<Vec<FutureTradeTickItem>, TigerError>

说明

v3 逐笔;contract_code 必填;end_index SDK 默认 30。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codeOption<String>服务端必填;SDK 不预校验None(不序列化)
req.begin_indexOption<i32>可选None(不序列化)
req.end_indexOption<i32>可选None 时 SDK 设为 30
req.limitOption<i32>可选None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Vec<FutureTradeTickItem>, TigerError>. contract_code: String, index: i64, time: i64, price: f64, volume: i64, direction: String.

contract_code/index/time/price/volume/direction

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_trade_ticks(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_trade_ticks(FutureTradeTicksRequest { contract_code: Some("ES2609".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

[
  {
    "contract_code": "ES2509",
    "index": 1,
    "time": 1738180800000,
    "price": 195.5,
    "volume": 58263100,
    "direction": "BUY"
  }
]

获取期货交易时间

签名


pub async fn get_future_trading_times( &self, req: FutureTradingTimesRequest, ) -> Result<Option<FutureTradingTime>, TigerError>

说明

交易时段;contract_code 必填,交易日可选。

参数

参数Rust 类型必填性/条件SDK 默认值
req.contract_codeOption<String>服务端必填;SDK 不预校验None(不序列化)
req.trading_dateOption<String>可选None(不序列化)
req.langOption<String>可选None(不序列化)

返回

  • QuoteClient: Result<Option<FutureTradingTime>, TigerError>. contract_code: String, biz_date: String, zone: String, trading_times: Vec

contract_code/biz_date/zone/trading_times(start,end,type)

示例


use std::sync::Arc;

use tigeropen::client::http_client::HttpClient;

use tigeropen::config::ClientConfig;

use tigeropen::error::TigerError;

use tigeropen::model::order::*;

use tigeropen::model::quote::*;

use tigeropen::model::quote_requests::*;

use tigeropen::model::trade_requests::*;

use tigeropen::push::*;

use tigeropen::quote::QuoteClient;

use tigeropen::trade::TradeClient;

async fn example_get_future_trading_times(config: ClientConfig, quote: &QuoteClient, trade: &TradeClient, push: &Arc<PushClient>) -> Result<(), TigerError> {

    let result_0 = quote.get_future_trading_times(FutureTradingTimesRequest { contract_code: Some("ES2609".into()), ..Default::default() }).await?;

    Ok(())

}

返回示例

{
  "contract_code": "ES2509",
  "biz_date": "2025-01-29",
  "zone": "America/Chicago",
  "trading_times": [
    {
      "start": 1738015800000,
      "end": 1738094400000,
      "type": "TRADING"
    },
    {
      "start": 1738094400000,
      "end": 1738101600000,
      "type": "POST_MARKET"
    }
  ]
}


Did this page help you?