vnpy/vn.api/vn.ksotp/pyscript/KSOTPMdApi.h

138 lines
4.3 KiB
C
Raw Normal View History

2016-07-02 03:12:44 +00:00
#ifndef __KSOTPMDAPI_H_INCLUDED_
#define __KSOTPMDAPI_H_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "KSOTPUserApiStruct.h"
#if defined(ISLIB) && defined(WIN32)
#ifdef LIB_OTP_MD_API_EXPORT
#define OTP_MD_API_EXPORT __declspec(dllexport)
#else
#define OTP_MD_API_EXPORT __declspec(dllimport)
#endif
#else
#ifdef WIN32
#define OTP_MD_API_EXPORT
#else
#define OTP_MD_API_EXPORT __attribute__((visibility("default")))
#endif
#endif
namespace KingstarAPI
{
class CKSOTPMdSpi
{
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>󣬿ͻ<F3A3ACBF><CDBB><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><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><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
virtual void OnRspUserLogin(CKSOTPRspUserLoginField *pRspUserLogin, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
virtual void OnRspUserLogout(CKSOTPUserLogoutField *pUserLogout, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
virtual void OnRspError(CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
virtual void OnRspSubMarketData(CKSOTPSpecificInstrumentField *pSpecificInstrument, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
virtual void OnRspUnSubMarketData(CKSOTPSpecificInstrumentField *pSpecificInstrument, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ<EFBFBD><D3A6>
virtual void OnRspSubForQuoteRsp(CKSOTPSpecificInstrumentField *pSpecificInstrument, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ<EFBFBD><D3A6>
virtual void OnRspUnSubForQuoteRsp(CKSOTPSpecificInstrumentField *pSpecificInstrument, CKSOTPRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨ
virtual void OnRtnDepthMarketData(CKSOTPDepthMarketDataField *pDepthMarketData) {};
///ѯ<><D1AF>֪ͨ
virtual void OnRtnForQuoteRsp(CKSOTPForQuoteRspField *pForQuoteRsp) {};
};
class OTP_MD_API_EXPORT CKSOTPMdApi
{
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 CKSOTPMdApi *CreateOTPMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false);
///ɾ<><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><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(CKSOTPMdSpi *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(CKSOTPSpecificInstrumentField *ppInstrumentID[], int nCount) = 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(CKSOTPSpecificInstrumentField *ppInstrumentID[], int nCount) = 0;
///<2F><><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 SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;
///<2F>˶<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 UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;
///<2F>û<EFBFBD><C3BB><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
virtual int ReqUserLogin(CKSOTPReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqUserLogout(CKSOTPUserLogoutField *pUserLogout, int nRequestID) = 0;
protected:
~CKSOTPMdApi(){};
};
} // end of namespace KingstarAPI
#endif