| Xlight API用户手册 v1.6.0.23 Xlight极速柜台接口文档

载入中...
搜索中...
未找到
xlt_quote_api.h
浏览该文件的文档.
1
8#pragma once
9
10#include <cstdint>
11#include <cstddef>
12#include "xlt_quote_data_type.h"
13#include "xlt_quote_define.h"
14#include "xlt_quote_struct.h"
15#include "xlt_quote_config.h"
16#include "xlt_quote_list.h"
17
18 namespace x1 {
19
23 class XLTQuoteSpi {
24 public:
25 XLTQuoteSpi() = default;
26 virtual ~XLTQuoteSpi() = default;
32 virtual void on_disconnect(uint64_t session_id) {};
39 virtual void on_login(uint64_t session_id, uint64_t request_id, const xlt_error_info_t* error_info) {};
46 virtual void on_quote(QuoteMCType mc_type, const void* msg_data, uint32_t msg_len) {};
56 virtual void on_query_static_quote_info(uint64_t session_id, uint64_t request_id, const XLTStaticQuoteList* static_quotes, bool is_last, const xlt_error_info_t* error_info) {};
64 virtual void on_query_level1_quote(uint64_t session_id, uint64_t request_id, const xlt_level1_quote_t* level1_quote, const xlt_error_info_t* error_info) {};
74 virtual void on_query_all_level1_quote(uint64_t session_id, uint64_t request_id, const XLTLevel1QuoteList* level1_quotes, bool is_last, const xlt_error_info_t* error_info) {};
81 virtual void on_request_rebuild_tick_quote_error(uint64_t session_id, uint64_t request_id, const xlt_error_info_t* error_info) {};
90 virtual void on_rebuild_tick_quote(uint64_t session_id, uint64_t request_id, ExchangeIndex exchange_index, QuoteMsgType msg_type, const xlt_tick_quote_union_t* tick_quote) {};
91 };
92
96 class XLTQuoteApi {
97 public:
102 static XLTQuoteApi* create();
103 ~XLTQuoteApi() = default;
108 static const char* get_api_version();
113 static xlt_error_info_t get_last_error();
118 uint32_t get_trading_day();
125 bool initialize(XLTQuoteConfig* quote_config, XLTQuoteSpi* quote_spi);
131 void stop();
143 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);
149 bool logout(uint64_t session_id);
159 bool subscribe_quote(uint64_t session_id, uint16_t thread_count, quote_thread_t* quote_threads, QuoteRxMode rx_mode=QuoteRxMode::RX_MODE_AUTO);
166 bool unsubscribe_quote(uint64_t session_id);
174 bool query_static_quote_info(uint64_t session_id, uint64_t request_id);
184 bool query_level1_quote(uint64_t session_id, uint64_t request_id, ExchangeIndex exchange_index, const char* security_code);
192 bool query_all_level1_quote(uint64_t session_id, uint64_t request_id);
200 bool request_rebuild_tick_quote(uint64_t session_id, uint64_t request_id, const xlt_rebuild_tick_quote_req_t* request);
201 private:
202 XLTQuoteApi()=default;
203 };
204}
x1::XLTLevel1QuoteList
只读Level1行情信息列表
定义 xlt_quote_list.h:21
x1::XLTQuoteApi
接口类
定义 xlt_quote_api.h:96
x1::XLTQuoteApi::get_api_version
static const char * get_api_version()
获取API版本号
x1::XLTQuoteApi::query_static_quote_info
bool query_static_quote_info(uint64_t session_id, uint64_t request_id)
查询静态行情信息请求
x1::XLTQuoteApi::subscribe_quote
bool subscribe_quote(uint64_t session_id, uint16_t thread_count, quote_thread_t *quote_threads, QuoteRxMode rx_mode=QuoteRxMode::RX_MODE_AUTO)
订阅行情请求
x1::XLTQuoteApi::initialize
bool initialize(XLTQuoteConfig *quote_config, XLTQuoteSpi *quote_spi)
初始化行情，登录之前必须调用此函数，只能初始化一次
x1::XLTQuoteApi::logout
bool logout(uint64_t session_id)
行情登出请求
x1::XLTQuoteApi::create
static XLTQuoteApi * create()
创建实例（只能创建一次）
x1::XLTQuoteApi::query_level1_quote
bool query_level1_quote(uint64_t session_id, uint64_t request_id, ExchangeIndex exchange_index, const char *security_code)
查询level1行情请求
x1::XLTQuoteApi::request_rebuild_tick_quote
bool request_rebuild_tick_quote(uint64_t session_id, uint64_t request_id, const xlt_rebuild_tick_quote_req_t *request)
回补level2逐笔行情请求
x1::XLTQuoteApi::query_all_level1_quote
bool query_all_level1_quote(uint64_t session_id, uint64_t request_id)
查询全量level1行情请求
x1::XLTQuoteApi::login
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)
用户行情登录请求
x1::XLTQuoteApi::stop
void stop()
停止行情API 断开所有行情session连接，清空所有session上的回调指针，停止回调。
x1::XLTQuoteApi::~XLTQuoteApi
~XLTQuoteApi()=default
x1::XLTQuoteApi::unsubscribe_quote
bool unsubscribe_quote(uint64_t session_id)
退订行情请求
x1::XLTQuoteApi::get_last_error
static xlt_error_info_t get_last_error()
获取错误信息
x1::XLTQuoteApi::get_trading_day
uint32_t get_trading_day()
获取当前交易日。只有登录成功后,才能得到正确的交易日。
x1::XLTQuoteConfig
API行情配置类 用户需要在调用XLTQuoteApi::initialize方法前，创建此类实例，并设置相应的配置参数，然后将此实例传递给XLTQuoteApi::initialize方法。
定义 xlt_quote_config.h:20
x1::XLTQuoteSpi
行情回调接口
定义 xlt_quote_api.h:23
x1::XLTQuoteSpi::~XLTQuoteSpi
virtual ~XLTQuoteSpi()=default
x1::XLTQuoteSpi::on_query_level1_quote
virtual void on_query_level1_quote(uint64_t session_id, uint64_t request_id, const xlt_level1_quote_t *level1_quote, const xlt_error_info_t *error_info)
查询level1行情响应
定义 xlt_quote_api.h:64
x1::XLTQuoteSpi::on_query_all_level1_quote
virtual void on_query_all_level1_quote(uint64_t session_id, uint64_t request_id, const XLTLevel1QuoteList *level1_quotes, bool is_last, const xlt_error_info_t *error_info)
查询全量level1行情响应
定义 xlt_quote_api.h:74
x1::XLTQuoteSpi::on_query_static_quote_info
virtual void on_query_static_quote_info(uint64_t session_id, uint64_t request_id, const XLTStaticQuoteList *static_quotes, bool is_last, const xlt_error_info_t *error_info)
查询全量静态行情信息响应
定义 xlt_quote_api.h:56
x1::XLTQuoteSpi::XLTQuoteSpi
XLTQuoteSpi()=default
x1::XLTQuoteSpi::on_request_rebuild_tick_quote_error
virtual void on_request_rebuild_tick_quote_error(uint64_t session_id, uint64_t request_id, const xlt_error_info_t *error_info)
回补level2逐笔行情请求错误响应
定义 xlt_quote_api.h:81
x1::XLTQuoteSpi::on_rebuild_tick_quote
virtual void on_rebuild_tick_quote(uint64_t session_id, uint64_t request_id, ExchangeIndex exchange_index, QuoteMsgType msg_type, const xlt_tick_quote_union_t *tick_quote)
回补level2逐笔行情数据推送
定义 xlt_quote_api.h:90
x1::XLTQuoteSpi::on_disconnect
virtual void on_disconnect(uint64_t session_id)
断线通知 用户断线之后需要重新调用login方法，建立连接并登录
定义 xlt_quote_api.h:32
x1::XLTQuoteSpi::on_login
virtual void on_login(uint64_t session_id, uint64_t request_id, const xlt_error_info_t *error_info)
登录通知
定义 xlt_quote_api.h:39
x1::XLTQuoteSpi::on_quote
virtual void on_quote(QuoteMCType mc_type, const void *msg_data, uint32_t msg_len)
通用行情推送回调
定义 xlt_quote_api.h:46
x1::XLTStaticQuoteList
只读静态行情信息列表
定义 xlt_quote_list.h:10
x1
定义 xlt_data_type.h:13
x1::QuoteMsgType
QuoteMsgType
xlight 行情消息类型
定义 xlt_quote_data_type.h:17
x1::QuoteRxMode
QuoteRxMode
定义 xlt_quote_define.h:21
x1::RX_MODE_AUTO
@ RX_MODE_AUTO
自动选择行情接收模式，优先使用EFVI，如果EFVI不可用则回退到内核socket模式
定义 xlt_quote_define.h:22
x1::QuoteMCType
QuoteMCType
定义 xlt_quote_define.h:5
x1::ExchangeIndex
ExchangeIndex
交易所编号定义
定义 xlt_data_type.h:57
x1::quote_thread_t
定义 xlt_quote_define.h:27
x1::xlt_error_info_t
错误信息
定义 xlt_struct.h:18
x1::xlt_level1_quote_t
L1行情数据结构体，包含行情类型和对应的行情数据
定义 xlt_quote_struct.h:242
x1::xlt_rebuild_tick_quote_req_t
重建逐笔数据请求结构体
定义 xlt_quote_struct.h:349
x1::xlt_user_terminal_info_t
申报用户的ip和mac等信息
定义 xlt_struct.h:27
x1::xlt_tick_quote_union_t
xlight逐笔行情数据
定义 xlt_quote_struct.h:359
xlt_quote_config.h
本文件定义XLT 行情API配置类
xlt_quote_data_type.h
本文件定义XLT 行情API中使用的基本数据类型和常量
xlt_quote_define.h
xlt_quote_list.h
xlt_quote_struct.h
本文件定义XLT行情数据结构体