期货行情
get_future_exchange 获取期货交易所列表
value QuoteClient::get_future_exchange(SecType sec_type)
说明
获取期货支持的交易所列表
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| sec_type | SecType | No | 合约类型,默认 SecType::FUT |
返回
web::json::value JSON 对象
示例
#include "tigerapi/quote_client.h"
#include "tigerapi/client_config.h"
using namespace TIGER_API;
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value result = quote_client.get_future_exchange();
ucout << result.serialize() << std::endl;get_future_contracts 获取期货合约列表
value QuoteClient::get_future_contracts(utility::string_t type)
说明
获取指定品种的期货合约列表
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| type | utility::string_t | Yes | 期货品种代码,如 U("CL")(原油)、U("ES")(标普500) |
返回
web::json::value JSON 对象
示例
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value result = quote_client.get_future_contracts(U("CL"));
ucout << result.serialize() << std::endl;get_future_continuous_contracts 获取连续合约
value QuoteClient::get_future_continuous_contracts(utility::string_t type)
说明
获取指定品种的连续合约信息
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| type | utility::string_t | Yes | 期货品种代码 |
返回
web::json::value JSON 对象
get_future_current_contract 获取当前合约
value QuoteClient::get_future_current_contract(utility::string_t type)
说明
获取指定品种的当前主力合约
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| type | utility::string_t | Yes | 期货品种代码 |
返回
web::json::value JSON 对象
get_future_contract_by_contract_code 通过合约代码获取期货合约
value QuoteClient::get_future_contract_by_contract_code(utility::string_t contract_code)
说明
通过具体的合约代码获取期货合约信息
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_code | utility::string_t | Yes | 合约代码,如 U("CL2312") |
返回
web::json::value JSON 对象
get_future_contract_by_exchange_code 通过交易所获取期货合约
value QuoteClient::get_future_contract_by_exchange_code(utility::string_t exchange_code)
说明
通过交易所代码获取期货合约列表
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| exchange_code | utility::string_t | Yes | 交易所代码,如 U("CME")、U("NYMEX") |
返回
web::json::value JSON 对象
get_future_kline 获取期货K线
value QuoteClient::get_future_kline(value contract_codes, utility::string_t period, time_t begin_time, time_t end_time, int limit, utility::string_t page_token)
说明
获取期货合约的K线数据
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_codes | value | Yes | 合约代码数组 |
| period | BarPeriod 或 utility::string_t | No | K线周期,默认 BarPeriod::DAY。可选值:day/week/month/year/1min/5min/15min/30min/60min |
| begin_time | time_t | No | 起始时间戳,默认 -1 |
| end_time | time_t | No | 结束时间戳,默认 -1 |
| limit | int | No | 返回条数,默认 251 |
| page_token | utility::string_t | No | 翻页标记 |
返回
web::json::value JSON 对象,或 vector<Kline> Kline 对象列表
示例
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value codes = value::array();
codes[0] = value::string(U("CL2312"));
value result = quote_client.get_future_kline(codes, U("day"));
ucout << result.serialize() << std::endl;get_future_real_time_quote 获取期货实时行情
vector<RealtimeQuote> QuoteClient::get_future_real_time_quote(value contract_codes)
说明
获取期货合约的实时行情数据
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_codes | value | Yes | 合约代码数组 |
返回
vector<RealtimeQuote> 实时行情对象列表
RealtimeQuote 对象属性(期货额外字段)
| 属性名 | 类型 | 描述 |
|---|---|---|
| contract_code | utility::string_t | 合约代码 |
| open_interest | long long | 未平仓合约数 |
| limit_down | int | 跌停价 |
| limit_up | int | 涨停价 |
示例
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value codes = value::array();
codes[0] = value::string(U("CL2312"));
vector<RealtimeQuote> quotes = quote_client.get_future_real_time_quote(codes);
for (auto& q : quotes) {
ucout << q.contract_code << U(" price: ") << q.latest_price << std::endl;
}get_future_tick 获取期货逐笔成交
value QuoteClient::get_future_tick(utility::string_t contract_code, long begin_index, long end_index, int limit)
说明
获取期货合约的逐笔成交数据
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_code | utility::string_t | Yes | 合约代码 |
| begin_index | long | No | 起始索引,默认 0 |
| end_index | long | No | 结束索引,默认 100 |
| limit | int | No | 返回条数,默认 1000 |
返回
web::json::value JSON 对象
get_future_trading_date 获取期货交易日
value QuoteClient::get_future_trading_date(utility::string_t contract_code, utility::string_t trading_date)
说明
获取期货合约的交易日信息
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_code | utility::string_t | Yes | 合约代码 |
| trading_date | utility::string_t | Yes | 交易日期 |
返回
web::json::value JSON 对象
get_future_depth 获取期货深度行情
value QuoteClient::get_future_depth(value contract_codes, utility::string_t lang)
说明
获取期货合约的深度行情数据
参数
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| contract_codes | value | Yes | 合约代码数组 |
| lang | utility::string_t | No | 语言,默认空 |
返回
web::json::value JSON 对象
Updated 11 days ago
