-
Notifications
You must be signed in to change notification settings - Fork 15
/
mdspi.h
59 lines (48 loc) · 2.02 KB
/
mdspi.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
#ifndef MD_SPI_H_
#define MD_SPI_H_
#include "StdAfx.h"
class CtpMdSpi : public CThostFtdcMdSpi
{
public:
CtpMdSpi(CThostFtdcMdApi* api):pUserApi(api){ m_iRequestID = 0;}
///错误应答
virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo,
int nRequestID, bool bIsLast);
///当客户端与交易后台通信连接断开时,该方法被调用。当发生这个情况后,API会自动重新连接,客户端可不做处理。
///@param nReason 错误原因
/// 0x1001 网络读失败
/// 0x1002 网络写失败
/// 0x2001 接收心跳超时
/// 0x2002 发送心跳失败
/// 0x2003 收到错误报文
virtual void OnFrontDisconnected(int nReason);
///心跳超时警告。当长时间未收到报文时,该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse);
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected();
///登录请求响应
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///登出请求响应
virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///订阅行情应答
virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///取消订阅行情应答
virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///深度行情通知
virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData);
public:
//LoginDlg* m_pDlg;
void ReqUserLogin(TThostFtdcBrokerIDType appId);
void ReqUserLogout();
//TThostFtdcUserIDType userId, TThostFtdcPasswordType passwd);
void SubscribeMarketData(char* instIdList);
void UnSubscribeMarketData(char* instIdList);
bool IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo);
public:
int m_iRequestID;
TThostFtdcBrokerIDType m_sBkrID;
private:
CThostFtdcMdApi* pUserApi;
};
#endif