接口类
更多...
#include <xlt_quote_api.h>
|
| | ~XLTQuoteApi ()=default |
| |
| uint32_t | get_trading_day () |
| | 获取当前交易日。只有登录成功后,才能得到正确的交易日。
|
| |
| bool | initialize (XLTQuoteConfig *quote_config, XLTQuoteSpi *quote_spi) |
| | 初始化行情,登录之前必须调用此函数,只能初始化一次
|
| |
| void | stop () |
| | 停止行情API 断开所有行情session连接,清空所有session上的回调指针,停止回调。
|
| |
| bool | login (uint64_t request_id, uint16_t client_id, const char *account_name, const char *password, const char *pub_key, const xlt_user_terminal_info_t *info=nullptr) |
| | 用户行情登录请求
|
| |
| bool | logout (uint64_t session_id) |
| | 行情登出请求
|
| |
| bool | subscribe_quote (uint64_t session_id, uint16_t thread_count, quote_thread_t *quote_threads, QuoteRxMode rx_mode=QuoteRxMode::RX_MODE_AUTO) |
| | 订阅行情请求
|
| |
| bool | unsubscribe_quote (uint64_t session_id) |
| | 退订行情请求
|
| |
| bool | query_static_quote_info (uint64_t session_id, uint64_t request_id) |
| | 查询静态行情信息请求
|
| |
| bool | query_level1_quote (uint64_t session_id, uint64_t request_id, ExchangeIndex exchange_index, const char *security_code) |
| | 查询level1行情请求
|
| |
| bool | query_all_level1_quote (uint64_t session_id, uint64_t request_id) |
| | 查询全量level1行情请求
|
| |
| bool | request_rebuild_tick_quote (uint64_t session_id, uint64_t request_id, const xlt_rebuild_tick_quote_req_t *request) |
| | 回补level2逐笔行情请求
|
| |
◆ ~XLTQuoteApi()
| x1::XLTQuoteApi::~XLTQuoteApi |
( |
| ) |
|
|
default |
◆ create()
◆ get_api_version()
| static const char * x1::XLTQuoteApi::get_api_version |
( |
| ) |
|
|
static |
◆ get_last_error()
◆ get_trading_day()
| uint32_t x1::XLTQuoteApi::get_trading_day |
( |
| ) |
|
获取当前交易日。只有登录成功后,才能得到正确的交易日。
- 返回
- 返回日期,格式为YYYYMMDD
◆ initialize()
初始化行情,登录之前必须调用此函数,只能初始化一次
- 参数
-
| quote_config | 配置参数 |
| quote_spi | 派生自行情响应类的实例,请在登录之前设定 |
- 返回
- 初始化是否成功
◆ login()
| bool x1::XLTQuoteApi::login |
( |
uint64_t | request_id, |
|
|
uint16_t | client_id, |
|
|
const char * | account_name, |
|
|
const char * | password, |
|
|
const char * | pub_key, |
|
|
const xlt_user_terminal_info_t * | info = nullptr ) |
用户行情登录请求
- 参数
-
| request_id | 用于用户定位请求响应的ID,由用户自定义 |
| client_id | 客户端标识ID |
| account_name | 登录账号 |
| password | 登录密码 |
| pub_key | 用户公钥(长度64字节),用户开户时申请得到 |
| info | 终端信息,若当前API为最终端则填nullptr,否则填写终端信息 |
- 返回
- 登录请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ logout()
| bool x1::XLTQuoteApi::logout |
( |
uint64_t | session_id | ) |
|
行情登出请求
- 参数
-
- 返回
- true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ query_all_level1_quote()
| bool x1::XLTQuoteApi::query_all_level1_quote |
( |
uint64_t | session_id, |
|
|
uint64_t | request_id ) |
查询全量level1行情请求
- 参数
-
| session_id | 会话id,登录时得到 |
| request_id | 用于用户定位查询响应的ID,由用户自定义 |
- 返回
- 请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ query_level1_quote()
| bool x1::XLTQuoteApi::query_level1_quote |
( |
uint64_t | session_id, |
|
|
uint64_t | request_id, |
|
|
ExchangeIndex | exchange_index, |
|
|
const char * | security_code ) |
查询level1行情请求
- 参数
-
| session_id | 会话id,登录时得到 |
| request_id | 用于用户定位查询响应的ID,由用户自定义 |
| exchange_index | 市场 |
| security_code | 证券代码 |
- 返回
- 请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ query_static_quote_info()
| bool x1::XLTQuoteApi::query_static_quote_info |
( |
uint64_t | session_id, |
|
|
uint64_t | request_id ) |
查询静态行情信息请求
- 参数
-
| session_id | 会话id,登录时得到 |
| request_id | 用于用户定位查询响应的ID,由用户自定义 |
- 返回
- 请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ request_rebuild_tick_quote()
回补level2逐笔行情请求
- 参数
-
| session_id | 会话id,登录时得到 |
| request_id | 用于用户定位查询响应的ID,由用户自定义 |
| request | 回补请求 |
- 返回
- 请求发送是否成功,true表示成功,false表示出错。请求失败响应将在on_request_rebuild_tick_quote_error中返回,如果成功则直接在on_rebuild_tick_quote中推送回补数据。
◆ stop()
| void x1::XLTQuoteApi::stop |
( |
| ) |
|
停止行情API 断开所有行情session连接,清空所有session上的回调指针,停止回调。
◆ subscribe_quote()
订阅行情请求
- 参数
-
| session_id | 会话id,登录时得到 |
| thread_count | 行情接收线程数量 |
| quote_threads | 行情接收线程配置列表,每个元素包含一个线程的CPU亲和力设置和负责接收的行情组播类型列表 |
| rx_mode | 行情接收模式,默认为自动模式(QuoteRxMode::RX_MODE_AUTO),在自动模式下,API会根据系统环境和配置自动选择最优的接收模式(如ef_vi或内核socket)。用户也可以根据实际情况强制指定接收模式(如ef_vi模式或内核socket模式)。请注意,ef_vi模式需要满足特定的系统环境和配置要求,如使用Solarflare网卡,并正确设置网卡驱动和系统参数,否则可能无法正常工作或性能不佳。 |
- 返回
- 请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
◆ unsubscribe_quote()
| bool x1::XLTQuoteApi::unsubscribe_quote |
( |
uint64_t | session_id | ) |
|
退订行情请求
- 参数
-
- 返回
- 请求发送是否成功,true表示成功,false表示出错,此时用户可以调用get_last_error()来获取错误信息。
该类的文档由以下文件生成: