gitee.com/haifengat/gotap_dipper@v0.0.4-0.20231212021028-041a6fa876e5/c/quote.h (about) 1 #pragma once 2 #ifdef _WINDOWS // 64位系统没有预定义 WIN32 3 #ifdef __cplusplus // 有定义表示是 c++ 代码, 此值为 ld 类型, 内容为c+标准版本号 4 #define DLL_EXPORT_C_DECL extern "C" __declspec(dllexport) 5 #else 6 #define DLL_EXPORT_DECL __declspec(dllexport) 7 #endif 8 #else 9 #ifdef __cplusplus // 有定义表示是 c++ 代码, 此值为 ld 类型, 内容为c+标准版本号 10 #define DLL_EXPORT_C_DECL extern "C" 11 #else 12 #define DLL_EXPORT_DECL extern 13 #endif 14 #endif 15 16 #include "../quote_v9.3.1.4_20190925/TapQuoteAPI.h" 17 18 #if defined WIN32 || defined WIN64 19 #define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息 20 #include "stddef.h" 21 #pragma comment(lib, "../lib/iTapTradeAPI_64.lib") 22 #ifdef WIN32 23 #define WINAPI __cdecl 24 #else 25 #define WINAPI __stdcall 26 #endif 27 #else 28 #define WINAPI 29 #endif 30 31 class Quote : ITapQuoteAPINotify { 32 public: 33 Quote(void); 34 35 typedef void(WINAPI* OnRspLoginType)(TAPIINT32 errorCode, const TapAPIQuotLoginRspInfo* info); 36 void* _OnRspLogin; 37 virtual void OnRspLogin(TAPIINT32 errorCode, const TapAPIQuotLoginRspInfo* info) { 38 if (_OnRspLogin) 39 ((OnRspLoginType)_OnRspLogin)(errorCode, info); 40 } 41 42 typedef void(WINAPI* OnAPIReadyType)(); 43 void* _OnAPIReady; 44 virtual void OnAPIReady() { 45 if (_OnAPIReady) 46 ((OnAPIReadyType)_OnAPIReady)(); 47 } 48 49 typedef void(WINAPI* OnDisconnectType)(TAPIINT32 reasonCode); 50 void* _OnDisconnect; 51 virtual void OnDisconnect(TAPIINT32 reasonCode) { 52 if (_OnDisconnect) 53 ((OnDisconnectType)_OnDisconnect)(reasonCode); 54 } 55 56 typedef void(WINAPI* OnRspQryCommodityType)(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteCommodityInfo* info); 57 void* _OnRspQryCommodity; 58 virtual void OnRspQryCommodity(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteCommodityInfo* info) { 59 if (_OnRspQryCommodity) 60 ((OnRspQryCommodityType)_OnRspQryCommodity)(sessionID, errorCode, isLast, info); 61 } 62 63 typedef void(WINAPI* OnRspQryContractType)(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteContractInfo* info); 64 void* _OnRspQryContract; 65 virtual void OnRspQryContract(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteContractInfo* info) { 66 if (_OnRspQryContract) 67 ((OnRspQryContractType)_OnRspQryContract)(sessionID, errorCode, isLast, info); 68 } 69 70 typedef void(WINAPI* OnRspSubscribeQuoteType)(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteWhole* info); 71 void* _OnRspSubscribeQuote; 72 virtual void OnRspSubscribeQuote(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIQuoteWhole* info) { 73 if (_OnRspSubscribeQuote) 74 ((OnRspSubscribeQuoteType)_OnRspSubscribeQuote)(sessionID, errorCode, isLast, info); 75 } 76 77 typedef void(WINAPI* OnRspUnSubscribeQuoteType)(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIContract* info); 78 void* _OnRspUnSubscribeQuote; 79 virtual void OnRspUnSubscribeQuote(TAPIUINT32 sessionID, TAPIINT32 errorCode, TAPIYNFLAG isLast, const TapAPIContract* info) { 80 if (_OnRspUnSubscribeQuote) 81 ((OnRspUnSubscribeQuoteType)_OnRspUnSubscribeQuote)(sessionID, errorCode, isLast, info); 82 } 83 84 typedef void(WINAPI* OnRtnQuoteType)(const TapAPIQuoteWhole* info); 85 void* _OnRtnQuote; 86 virtual void OnRtnQuote(const TapAPIQuoteWhole* info) { 87 if (_OnRtnQuote) 88 ((OnRtnQuoteType)_OnRtnQuote)(info); 89 } 90 };