vnpy/vn.api/vn.ksgold/ksgoldapi/GoldTradeApi.h

161 lines
5.0 KiB
C
Raw Normal View History

2016-07-02 03:12:44 +00:00
#ifndef GOLD_TRADE_API_H
#define GOLD_TRADE_API_H
#ifdef GOLDTRADEAPI_EXPORTS
#define GOLDTRADEAPI_LIB __declspec(dllexport)
#else
#ifdef WIN32
#define GOLDTRADEAPI_LIB __declspec(dllimport)
#else
#define GOLDTRADEAPI_LIB
#endif
#endif
#include <stdio.h>
#include "APIError.h"
#include "KSUserApiStructEx.h"
class CGoldTradeSpi //<2F>ص<EFBFBD><D8B5>ӿ<EFBFBD>
{
public:
virtual ~CGoldTradeSpi(){};
//<2F><><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>֪ͨ
virtual void OnFrontConnected(){};
//<2F><><EFBFBD>ӶϿ<D3B6>
virtual void OnFrontDisconnected(int nReason){};
///<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
//<2F>г<EFBFBD>״̬֪ͨ
virtual void OnNtyMktStatus(const CThostFtdcMarketStatusField *pfldMktStatus){};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Լ<EFBFBD><D4BC>Ӧ
virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨ
virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {};
///<2F><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ(<28><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {};
///<2F><><EFBFBD><EFBFBD>֪ͨ
virtual void OnRtnOrder(CThostFtdcOrderRtnField *pOrder) {};
//ǿ<><C7BF>֪ͨ
virtual void OnForceLogout(CThostFtdcUserLogoutField *pLogout) {};
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ(<28><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD>Ϣ)
virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {};
///<2F>ɽ<EFBFBD>֪ͨ
virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>ʽ<EFBFBD><CABD>˻<EFBFBD><CBBB><EFBFBD>Ӧ
virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>Ӧ
virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯͶ<D1AF><CDB6><EFBFBD>ֲ߳<DFB3><D6B2><EFBFBD>Ӧ
virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
//<2F><>ѯ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
virtual void OnRspQryClientStorage(CThostFtdcStorageField *pStorage, CThostFtdcRspInfoField *pRspInfo,int nRequestID,bool bIsLast){};
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
//virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
};
class GOLDTRADEAPI_LIB CGoldTradeApi
{
public:
static CGoldTradeApi *CreateGoldTradeApi();
//<2F>ͷŽӿ<C5BD>
virtual void Release()=0;
//ע<><D7A2>ǰ<EFBFBD>õ<EFBFBD>ַ
virtual void RegisterFront(char *pszFrontAddress) = 0;
//ע<><D7A2>API<50>ص<EFBFBD><D8B5>ӿ<EFBFBD>
virtual void RegisterSpi(CGoldTradeSpi *pGeneralSpi)=0;
//<2F><><EFBFBD><EFBFBD>API<50>߳<EFBFBD>
virtual int Init(bool logflag=true)=0;
//ֹͣAPI<50>߳<EFBFBD>
virtual void Join()=0;
//<2F>û<EFBFBD><C3BB><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;
//<2F>û<EFBFBD><C3BB>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqUserReLogin() = 0;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual int SubscribeMarketData(char *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(char *ppInstrumentID[], int nCount) = 0;
//<2F><>ѯ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>Լ
virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0;
//<2F>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0;
//<2F><>ѯ<EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pInvestorPosition, int nRequestID) = 0;
//<2F><>ѯ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0;
//<2F>ɽ<EFBFBD><C9BD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0;
//ί<>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0;
//<2F><>ѯ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual int ReqQryStorage(CThostFtdcQryStorageField *pfldStorage, int nRequestID)=0;
protected:
virtual ~CGoldTradeApi();
};
#endif