136 lines
4.0 KiB
C
136 lines
4.0 KiB
C
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
///@company shanghai liber information Technology Co.,Ltd
|
|||
|
///@file SecurityFtdcMdApi.h
|
|||
|
///@brief <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB>˽ӿ<CBBD>
|
|||
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#if !defined(SECURITY_FTDCMDAPI_H)
|
|||
|
#define SECURITY_FTDCMDAPI_H
|
|||
|
|
|||
|
#if _MSC_VER > 1000
|
|||
|
#pragma once
|
|||
|
#endif // _MSC_VER > 1000
|
|||
|
|
|||
|
#include "SecurityFtdcUserApiStruct.h"
|
|||
|
|
|||
|
#if defined(ISLIB) && defined(WIN32)
|
|||
|
#ifdef LIB_MD_API_EXPORT
|
|||
|
#define MD_API_EXPORT __declspec(dllexport)
|
|||
|
#else
|
|||
|
#define MD_API_EXPORT __declspec(dllimport)
|
|||
|
#endif
|
|||
|
#else
|
|||
|
#define MD_API_EXPORT
|
|||
|
#endif
|
|||
|
|
|||
|
class CSecurityFtdcMdSpi
|
|||
|
{
|
|||
|
public:
|
|||
|
///<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>뽻<EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>¼ǰ<C2BC><C7B0><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
|||
|
virtual void OnFrontConnected(){};
|
|||
|
|
|||
|
///<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>뽻<EFBFBD><EFBFBD>̨ͨ<CCA8><CDA8><EFBFBD><EFBFBD><EFBFBD>ӶϿ<D3B6>ʱ<EFBFBD><CAB1><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>API<50><49><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3>ͻ<EFBFBD><CDBB>˿ɲ<CBBF><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@param nReason <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
/// 0x1001 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
|||
|
/// 0x1002 <20><><EFBFBD><EFBFBD>дʧ<D0B4><CAA7>
|
|||
|
/// 0x2001 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|||
|
/// 0x2002 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
|||
|
/// 0x2003 <20>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual void OnFrontDisconnected(int nReason){};
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>档<EFBFBD><E6A1A3><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>δ<EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
|||
|
///@param nTimeLapse <20><><EFBFBD><EFBFBD><EFBFBD>ϴν<CFB4><CEBD>ձ<EFBFBD><D5B1>ĵ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
virtual void OnHeartBeatWarning(int nTimeLapse){};
|
|||
|
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
virtual void OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
|
|||
|
|
|||
|
///<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
virtual void OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
|
|||
|
|
|||
|
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
virtual void OnRspUserLogout(CSecurityFtdcUserLogoutField *pUserLogout, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
virtual void OnRspSubMarketData(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
|
|||
|
|
|||
|
///ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
virtual void OnRspUnSubMarketData(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨ
|
|||
|
virtual void OnRtnDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData) {};
|
|||
|
};
|
|||
|
|
|||
|
#ifndef WINDOWS
|
|||
|
#if __GNUC__ >= 4
|
|||
|
#pragma GCC visibility push(default)
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
|
|||
|
class MD_API_EXPORT CSecurityFtdcMdApi
|
|||
|
{
|
|||
|
public:
|
|||
|
///<2F><><EFBFBD><EFBFBD>MdApi
|
|||
|
///@param pszFlowPath <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼<C4BF><C2BC>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>ǰĿ¼
|
|||
|
///@return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UserApi
|
|||
|
///modify for udp marketdata
|
|||
|
static CSecurityFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "");
|
|||
|
|
|||
|
///ɾ<><C9BE><EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD>ʹ<EFBFBD>ñ<EFBFBD><C3B1>ӿڶ<D3BF><DAB6><EFBFBD>ʱ,<2C><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD>
|
|||
|
virtual void Release() = 0;
|
|||
|
|
|||
|
///<2F><>ʼ<EFBFBD><CABC>
|
|||
|
///@remark <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>,ֻ<>е<EFBFBD><D0B5>ú<EFBFBD>,<2C>ӿڲſ<DAB2>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
virtual void Init() = 0;
|
|||
|
|
|||
|
///<2F>ȴ<EFBFBD><C8B4>ӿ<EFBFBD><D3BF>߳̽<DFB3><CCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@return <20>߳<EFBFBD><DFB3>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual int Join() = 0;
|
|||
|
|
|||
|
///<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@retrun <20><>ȡ<EFBFBD><C8A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark ֻ<>е<EFBFBD>¼<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>,<2C><><EFBFBD>ܵõ<DCB5><C3B5><EFBFBD>ȷ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual const char *GetTradingDay() = 0;
|
|||
|
|
|||
|
///ע<><D7A2>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
///@param pszFrontAddress<73><73>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ĸ<EFBFBD>ʽΪ<CABD><CEAA><EFBFBD><EFBFBD>protocol://ipaddress:port<72><74><EFBFBD><EFBFBD><EFBFBD>磺<EFBFBD><E7A3BA>tcp://127.0.0.1:17001<30><31><EFBFBD><EFBFBD>
|
|||
|
///@remark <20><>tcp<63><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD>飬<EFBFBD><E9A3AC>127.0.0.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>17001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ںš<EFBFBD>
|
|||
|
virtual void RegisterFront(char *pszFrontAddress) = 0;
|
|||
|
|
|||
|
///ע<><D7A2><EFBFBD>ص<EFBFBD><D8B5>ӿ<EFBFBD>
|
|||
|
///@param pSpi <20><><EFBFBD><EFBFBD><EFBFBD>Իص<D4BB><D8B5>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|||
|
virtual void RegisterSpi(CSecurityFtdcMdSpi *pSpi) = 0;
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>顣
|
|||
|
///@param ppInstrumentID <20><>ԼID
|
|||
|
///@param nCount Ҫ<><D2AA><EFBFBD><EFBFBD>/<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
|
|||
|
///@remark
|
|||
|
virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount, char* pExchageID) = 0;
|
|||
|
|
|||
|
///<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>顣
|
|||
|
///@param ppInstrumentID <20><>ԼID
|
|||
|
///@param nCount Ҫ<><D2AA><EFBFBD><EFBFBD>/<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
|
|||
|
///@remark
|
|||
|
virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount, char* pExchageID) = 0;
|
|||
|
|
|||
|
///<2F>û<EFBFBD><C3BB><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
|
|||
|
virtual int ReqUserLogin(CSecurityFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;
|
|||
|
|
|||
|
|
|||
|
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual int ReqUserLogout(CSecurityFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;
|
|||
|
protected:
|
|||
|
~CSecurityFtdcMdApi(){};
|
|||
|
};
|
|||
|
|
|||
|
#ifndef WINDOWS
|
|||
|
#if __GNUC__ >= 4
|
|||
|
#pragma GCC visibility pop
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
|
|||
|
#endif
|