-
Notifications
You must be signed in to change notification settings - Fork 1
/
quoter.h
71 lines (64 loc) · 3.37 KB
/
quoter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/////////////////////////////////////////////////////////////////////////
//// Ftdc C++ => C Adapter
//// Author : [email protected]
//// Generated at 2016/8/14 13:47:00
/////////////////////////////////////////////////////////////////////////
#pragma once
#include </home/charles/sda3/CLionProjects/ctpdll/linuxapi/ThostFtdcMdApi.h>
#include "enums.h"
class Quoter : public CThostFtdcMdSpi
{
public:
CThostFtdcMdApi* RawApi{ nullptr };
CbOnFrontEvent mOnFrontEvent{ nullptr };
CbOnRspEvent mOnRspEvent{ nullptr };
CbOnRtnEvent mOnRtnEvent{ nullptr };
void* pObject;
Quoter(const char* pszFlowPath, const bool bIsUsingUdp, const bool bIsMulticast) {
RawApi = CThostFtdcMdApi::CreateFtdcMdApi(pszFlowPath, bIsUsingUdp, bIsMulticast);
RawApi->RegisterSpi(this);
pObject = this;
}
virtual ~Quoter() {
if (RawApi){
RawApi->RegisterSpi(nullptr);
RawApi->Release();
RawApi = nullptr;
}
};
virtual void OnFrontConnected() {
mOnFrontEvent(pObject, (int)EnumOnFrontEvent::OnFrontConnected, 0);
};
virtual void OnFrontDisconnected(int nReason) {
mOnFrontEvent(pObject, (int)EnumOnFrontEvent::OnFrontDisconnected, nReason);
};
virtual void OnHeartBeatWarning(int nTimeLapse) {
};
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField* pRspUserLogin, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspUserLogin, pRspUserLogin, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspUserLogout(CThostFtdcUserLogoutField* pUserLogout, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspUserLogout, pUserLogout, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspError(CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspError, nullptr, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspSubMarketData, pSpecificInstrument, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspUnSubMarketData, pSpecificInstrument, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspSubForQuoteRsp, pSpecificInstrument, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast) {
mOnRspEvent(pObject, (int)EnumOnRspEvent::OnRspUnSubForQuoteRsp, pSpecificInstrument, pRspInfo, nRequestID, bIsLast);
};
virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField* pDepthMarketData) {
mOnRtnEvent(pObject, (int)EnumOnRtnEvent::OnRtnDepthMarketData, pDepthMarketData);
};
virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField* pForQuoteRsp) {
mOnRtnEvent(pObject, (int)EnumOnRtnEvent::OnRtnForQuoteRsp, pForQuoteRsp);
};
}; // end of class