[update] CTP 6.3.19

This commit is contained in:
msincenselee 2021-03-16 15:04:54 +08:00
parent c439195056
commit a5aac33698
35 changed files with 543 additions and 55 deletions

View File

@ -21,6 +21,8 @@ THOST_FTDC_ICT_HKMCIDCard = 'I'
THOST_FTDC_ICT_AccountsPermits = 'J'
THOST_FTDC_ICT_FrgPrmtRdCard = 'K'
THOST_FTDC_ICT_CptMngPrdLetter = 'L'
THOST_FTDC_ICT_UniformSocialCreditCode = 'N'
THOST_FTDC_ICT_CorporationCertNo = 'O'
THOST_FTDC_ICT_OtherCard = 'x'
THOST_FTDC_IR_All = '1'
THOST_FTDC_IR_Group = '2'
@ -142,6 +144,16 @@ THOST_FTDC_PC_Combination = '3'
THOST_FTDC_PC_Spot = '4'
THOST_FTDC_PC_EFP = '5'
THOST_FTDC_PC_SpotOption = '6'
THOST_FTDC_PC_TAS = '7'
THOST_FTDC_PC_MI = 'I'
THOST_FTDC_APC_FutureSingle = '1'
THOST_FTDC_APC_OptionSingle = '2'
THOST_FTDC_APC_Futures = '3'
THOST_FTDC_APC_Options = '4'
THOST_FTDC_APC_TradingComb = '5'
THOST_FTDC_APC_UnTradingComb = '6'
THOST_FTDC_APC_AllTrading = '7'
THOST_FTDC_APC_All = '8'
THOST_FTDC_IP_NotStart = '0'
THOST_FTDC_IP_Started = '1'
THOST_FTDC_IP_Pause = '2'
@ -251,6 +263,8 @@ THOST_FTDC_TRDT_OTC = '2'
THOST_FTDC_TRDT_EFPDerived = '3'
THOST_FTDC_TRDT_CombinationDerived = '4'
THOST_FTDC_TRDT_BlockTrade = '5'
THOST_FTDC_SPOST_Common = '#'
THOST_FTDC_SPOST_Tas = '0'
THOST_FTDC_PSRC_LastPrice = '0'
THOST_FTDC_PSRC_Buy = '1'
THOST_FTDC_PSRC_Sell = '2'
@ -506,6 +520,8 @@ THOST_FTDC_UET_Trading = '3'
THOST_FTDC_UET_TradingError = '4'
THOST_FTDC_UET_UpdatePassword = '5'
THOST_FTDC_UET_Authenticate = '6'
THOST_FTDC_UET_SubmitSysInfo = '7'
THOST_FTDC_UET_Transfer = '8'
THOST_FTDC_UET_Other = '9'
THOST_FTDC_ICS_Close = '0'
THOST_FTDC_ICS_CloseToday = '1'
@ -1140,6 +1156,8 @@ THOST_FTDC_COMBT_STD = '3'
THOST_FTDC_COMBT_STG = '4'
THOST_FTDC_COMBT_PRT = '5'
THOST_FTDC_COMBT_CLD = '6'
THOST_FTDC_COMBT_OPL = '7'
THOST_FTDC_COMBT_BFO = '8'
THOST_FTDC_DCECOMBT_SPL = '0'
THOST_FTDC_DCECOMBT_OPL = '1'
THOST_FTDC_DCECOMBT_SP = '2'
@ -1195,6 +1213,7 @@ THOST_FTDC_CFUFN_SUFN_F = 'F'
THOST_FTDC_CFUFN_SUFN_S = 'S'
THOST_FTDC_CMDR_Comb = '0'
THOST_FTDC_CMDR_UnComb = '1'
THOST_FTDC_CMDR_DelComb = '2'
THOST_FTDC_STOV_RealValue = '1'
THOST_FTDC_STOV_ProfitValue = '2'
THOST_FTDC_STOV_RealRatio = '3'

View File

@ -21,6 +21,8 @@ THOST_FTDC_ICT_HKMCIDCard = 'I'
THOST_FTDC_ICT_AccountsPermits = 'J'
THOST_FTDC_ICT_FrgPrmtRdCard = 'K'
THOST_FTDC_ICT_CptMngPrdLetter = 'L'
THOST_FTDC_ICT_UniformSocialCreditCode = 'N'
THOST_FTDC_ICT_CorporationCertNo = 'O'
THOST_FTDC_ICT_OtherCard = 'x'
THOST_FTDC_IR_All = '1'
THOST_FTDC_IR_Group = '2'
@ -142,6 +144,16 @@ THOST_FTDC_PC_Combination = '3'
THOST_FTDC_PC_Spot = '4'
THOST_FTDC_PC_EFP = '5'
THOST_FTDC_PC_SpotOption = '6'
THOST_FTDC_PC_TAS = '7'
THOST_FTDC_PC_MI = 'I'
THOST_FTDC_APC_FutureSingle = '1'
THOST_FTDC_APC_OptionSingle = '2'
THOST_FTDC_APC_Futures = '3'
THOST_FTDC_APC_Options = '4'
THOST_FTDC_APC_TradingComb = '5'
THOST_FTDC_APC_UnTradingComb = '6'
THOST_FTDC_APC_AllTrading = '7'
THOST_FTDC_APC_All = '8'
THOST_FTDC_IP_NotStart = '0'
THOST_FTDC_IP_Started = '1'
THOST_FTDC_IP_Pause = '2'
@ -164,6 +176,8 @@ THOST_FTDC_HF_Speculation = '1'
THOST_FTDC_HF_Arbitrage = '2'
THOST_FTDC_HF_Hedge = '3'
THOST_FTDC_HF_MarketMaker = '5'
THOST_FTDC_HF_SpecHedge = '6'
THOST_FTDC_HF_HedgeSpec = '7'
THOST_FTDC_BHF_Speculation = '1'
THOST_FTDC_BHF_Arbitrage = '2'
THOST_FTDC_BHF_Hedge = '3'
@ -208,7 +222,8 @@ THOST_FTDC_ORDT_DeriveFromCombination = '2'
THOST_FTDC_ORDT_Combination = '3'
THOST_FTDC_ORDT_ConditionalOrder = '4'
THOST_FTDC_ORDT_Swap = '5'
THOST_FTDC_ORDT_DeriveFromEFP = '6'
THOST_FTDC_ORDT_DeriveFromBlockTrade = '6'
THOST_FTDC_ORDT_DeriveFromEFPTrade = '7'
THOST_FTDC_TC_IOC = '1'
THOST_FTDC_TC_GFS = '2'
THOST_FTDC_TC_GFD = '3'
@ -247,9 +262,13 @@ THOST_FTDC_TRDT_OptionsExecution = '1'
THOST_FTDC_TRDT_OTC = '2'
THOST_FTDC_TRDT_EFPDerived = '3'
THOST_FTDC_TRDT_CombinationDerived = '4'
THOST_FTDC_TRDT_BlockTrade = '5'
THOST_FTDC_SPOST_Common = '#'
THOST_FTDC_SPOST_Tas = '0'
THOST_FTDC_PSRC_LastPrice = '0'
THOST_FTDC_PSRC_Buy = '1'
THOST_FTDC_PSRC_Sell = '2'
THOST_FTDC_PSRC_OTC = '3'
THOST_FTDC_IS_BeforeTrading = '0'
THOST_FTDC_IS_NoTrading = '1'
THOST_FTDC_IS_Continous = '2'
@ -501,6 +520,8 @@ THOST_FTDC_UET_Trading = '3'
THOST_FTDC_UET_TradingError = '4'
THOST_FTDC_UET_UpdatePassword = '5'
THOST_FTDC_UET_Authenticate = '6'
THOST_FTDC_UET_SubmitSysInfo = '7'
THOST_FTDC_UET_Transfer = '8'
THOST_FTDC_UET_Other = '9'
THOST_FTDC_ICS_Close = '0'
THOST_FTDC_ICS_CloseToday = '1'
@ -1135,6 +1156,19 @@ THOST_FTDC_COMBT_STD = '3'
THOST_FTDC_COMBT_STG = '4'
THOST_FTDC_COMBT_PRT = '5'
THOST_FTDC_COMBT_CLD = '6'
THOST_FTDC_COMBT_OPL = '7'
THOST_FTDC_COMBT_BFO = '8'
THOST_FTDC_DCECOMBT_SPL = '0'
THOST_FTDC_DCECOMBT_OPL = '1'
THOST_FTDC_DCECOMBT_SP = '2'
THOST_FTDC_DCECOMBT_SPC = '3'
THOST_FTDC_DCECOMBT_BLS = '4'
THOST_FTDC_DCECOMBT_BES = '5'
THOST_FTDC_DCECOMBT_CAS = '6'
THOST_FTDC_DCECOMBT_STD = '7'
THOST_FTDC_DCECOMBT_STG = '8'
THOST_FTDC_DCECOMBT_BFO = '9'
THOST_FTDC_DCECOMBT_SFO = 'a'
THOST_FTDC_ORPT_PreSettlementPrice = '1'
THOST_FTDC_ORPT_OpenPrice = '4'
THOST_FTDC_ORPT_MaxPreSettlementPrice = '5'
@ -1179,6 +1213,7 @@ THOST_FTDC_CFUFN_SUFN_F = 'F'
THOST_FTDC_CFUFN_SUFN_S = 'S'
THOST_FTDC_CMDR_Comb = '0'
THOST_FTDC_CMDR_UnComb = '1'
THOST_FTDC_CMDR_DelComb = '2'
THOST_FTDC_STOV_RealValue = '1'
THOST_FTDC_STOV_ProfitValue = '2'
THOST_FTDC_STOV_RealRatio = '3'

View File

@ -3,10 +3,11 @@
#define ONHEARTBEATWARNING 2
#define ONRSPUSERLOGIN 3
#define ONRSPUSERLOGOUT 4
#define ONRSPERROR 5
#define ONRSPSUBMARKETDATA 6
#define ONRSPUNSUBMARKETDATA 7
#define ONRSPSUBFORQUOTERSP 8
#define ONRSPUNSUBFORQUOTERSP 9
#define ONRTNDEPTHMARKETDATA 10
#define ONRTNFORQUOTERSP 11
#define ONRSPQRYMULTICASTINSTRUMENT 5
#define ONRSPERROR 6
#define ONRSPSUBMARKETDATA 7
#define ONRSPUNSUBMARKETDATA 8
#define ONRSPSUBFORQUOTERSP 9
#define ONRSPUNSUBFORQUOTERSP 10
#define ONRTNDEPTHMARKETDATA 11
#define ONRTNFORQUOTERSP 12

View File

@ -2,3 +2,5 @@ int reqUserLogin(const dict &req, int reqid);
int reqUserLogout(const dict &req, int reqid);
int reqQryMulticastInstrument(const dict &req, int reqid);

View File

@ -8,6 +8,8 @@ virtual void onRspUserLogin(const dict &data, const dict &error, int reqid, bool
virtual void onRspUserLogout(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryMulticastInstrument(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspError(const dict &error, int reqid, bool last) {};
virtual void onRspSubMarketData(const dict &data, const dict &error, int reqid, bool last) {};

View File

@ -8,6 +8,8 @@ void processRspUserLogin(Task *task);
void processRspUserLogout(Task *task);
void processRspQryMulticastInstrument(Task *task);
void processRspError(Task *task);
void processRspSubMarketData(Task *task);

View File

@ -28,3 +28,13 @@ int MdApi::reqUserLogout(const dict &req, int reqid)
return i;
};
int MdApi::reqQryMulticastInstrument(const dict &req, int reqid)
{
CThostFtdcQryMulticastInstrumentField myreq = CThostFtdcQryMulticastInstrumentField();
memset(&myreq, 0, sizeof(myreq));
getInt(req, "TopicID", &myreq.TopicID);
getString(req, "InstrumentID", myreq.InstrumentID);
int i = this->api->ReqQryMulticastInstrument(&myreq, reqid);
return i;
};

View File

@ -1,11 +1,12 @@
.def("reqUserLogin", &MdApi::reqUserLogin)
.def("reqUserLogout", &MdApi::reqUserLogout)
.def("reqQryMulticastInstrument", &MdApi::reqQryMulticastInstrument)
.def("onFrontConnected", &MdApi::onFrontConnected)
.def("onFrontDisconnected", &MdApi::onFrontDisconnected)
.def("onHeartBeatWarning", &MdApi::onHeartBeatWarning)
.def("onRspUserLogin", &MdApi::onRspUserLogin)
.def("onRspUserLogout", &MdApi::onRspUserLogout)
.def("onRspQryMulticastInstrument", &MdApi::onRspQryMulticastInstrument)
.def("onRspError", &MdApi::onRspError)
.def("onRspSubMarketData", &MdApi::onRspSubMarketData)
.def("onRspUnSubMarketData", &MdApi::onRspUnSubMarketData)

View File

@ -58,6 +58,18 @@ void onRspUserLogout(const dict &data, const dict &error, int reqid, bool last)
}
};
void onRspQryMulticastInstrument(const dict &data, const dict &error, int reqid, bool last) override
{
try
{
PYBIND11_OVERLOAD(void, MdApi, onRspQryMulticastInstrument, data, error, reqid, last);
}
catch (const error_already_set &e)
{
cout << e.what() << endl;
}
};
void onRspError(const dict &error, int reqid, bool last) override
{
try

View File

@ -71,6 +71,32 @@ void MdApi::processRspUserLogout(Task *task)
this->onRspUserLogout(data, error, task->task_id, task->task_last);
};
void MdApi::processRspQryMulticastInstrument(Task *task)
{
gil_scoped_acquire acquire;
dict data;
if (task->task_data)
{
CThostFtdcMulticastInstrumentField *task_data = (CThostFtdcMulticastInstrumentField*)task->task_data;
data["TopicID"] = task_data->TopicID;
data["InstrumentID"] = toUtf(task_data->InstrumentID);
data["InstrumentNo"] = task_data->InstrumentNo;
data["CodePrice"] = task_data->CodePrice;
data["VolumeMultiple"] = task_data->VolumeMultiple;
data["PriceTick"] = task_data->PriceTick;
delete task_data;
}
dict error;
if (task->task_error)
{
CThostFtdcRspInfoField *task_error = (CThostFtdcRspInfoField*)task->task_error;
error["ErrorID"] = task_error->ErrorID;
error["ErrorMsg"] = toUtf(task_error->ErrorMsg);
delete task_error;
}
this->onRspQryMulticastInstrument(data, error, task->task_id, task->task_last);
};
void MdApi::processRspError(Task *task)
{
gil_scoped_acquire acquire;

View File

@ -28,6 +28,12 @@ case ONRSPUSERLOGOUT:
break;
}
case ONRSPQRYMULTICASTINSTRUMENT:
{
this->processRspQryMulticastInstrument(&task);
break;
}
case ONRSPERROR:
{
this->processRspError(&task);

View File

@ -63,6 +63,27 @@ void MdApi::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRs
this->task_queue.push(task);
};
void MdApi::OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYMULTICASTINSTRUMENT;
if (pMulticastInstrument)
{
CThostFtdcMulticastInstrumentField *task_data = new CThostFtdcMulticastInstrumentField();
*task_data = *pMulticastInstrument;
task.task_data = task_data;
}
if (pRspInfo)
{
CThostFtdcRspInfoField *task_error = new CThostFtdcRspInfoField();
*task_error = *pRspInfo;
task.task_error = task_error;
}
task.task_id = nRequestID;
task.task_last = bIsLast;
this->task_queue.push(task);
};
void MdApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();

View File

@ -68,6 +68,7 @@ CThostFtdcAuthenticationInfoField = {
"IsResult": "int",
"AppID": "string",
"AppType": "char",
"ClientIPAddress": "string",
}
CThostFtdcRspUserLogin2Field = {
@ -410,6 +411,9 @@ CThostFtdcInvestorPositionField = {
"ExchangeID": "string",
"YdStrikeFrozen": "int",
"InvestUnitID": "string",
"PositionCostOffset": "double",
"TasPosition": "int",
"TasPositionCost": "double",
}
CThostFtdcInstrumentMarginRateField = {
@ -1160,6 +1164,9 @@ CThostFtdcSyncingInvestorPositionField = {
"ExchangeID": "string",
"YdStrikeFrozen": "int",
"InvestUnitID": "string",
"PositionCostOffset": "double",
"TasPosition": "int",
"TasPositionCost": "double",
}
CThostFtdcSyncingInstrumentMarginRateField = {
@ -2185,6 +2192,8 @@ CThostFtdcInputCombActionField = {
"IPAddress": "string",
"MacAddress": "string",
"InvestUnitID": "string",
"FrontID": "int",
"SessionID": "int",
}
CThostFtdcCombActionField = {
@ -2569,6 +2578,8 @@ CThostFtdcSyncDelaySwapField = {
"FromRemainSwap": "double",
"ToCurrencyID": "string",
"ToAmount": "double",
"IsManualSwap": "int",
"IsAllRemainSetZero": "int",
}
CThostFtdcQrySyncDelaySwapField = {
@ -2796,7 +2807,9 @@ CThostFtdcInvestorPositionDetailField = {
"SettlementPrice": "double",
"CloseVolume": "int",
"CloseAmount": "double",
"TimeFirstVolume": "int",
"InvestUnitID": "string",
"SpecPosiType": "char",
}
CThostFtdcTradingAccountPasswordField = {
@ -3546,6 +3559,26 @@ CThostFtdcQryBulletinField = {
"NewsUrgency": "char",
}
CThostFtdcMulticastInstrumentField = {
"TopicID": "int",
"InstrumentID": "string",
"InstrumentNo": "int",
"CodePrice": "double",
"VolumeMultiple": "int",
"PriceTick": "double",
}
CThostFtdcQryMulticastInstrumentField = {
"TopicID": "int",
"InstrumentID": "string",
}
CThostFtdcAppIDAuthAssignField = {
"BrokerID": "string",
"AppID": "string",
"DRIdentityID": "int",
}
CThostFtdcReqOpenAccountField = {
"TradeCode": "string",
"BankID": "string",
@ -4906,3 +4939,21 @@ CThostFtdcDepartmentUserField = {
CThostFtdcQueryFreqField = {
"QueryFreq": "int",
}
CThostFtdcAuthForbiddenIPField = {
"IPAddress": "string",
}
CThostFtdcQryAuthForbiddenIPField = {
"IPAddress": "string",
}
CThostFtdcSyncDelaySwapFrozenField = {
"DelaySwapSeqNo": "string",
"BrokerID": "string",
"InvestorID": "string",
"FromCurrencyID": "string",
"FromRemainSwap": "double",
"IsManualSwap": "int",
}

View File

@ -559,6 +559,8 @@ int TdApi::reqCombActionInsert(const dict &req, int reqid)
getString(req, "IPAddress", myreq.IPAddress);
getString(req, "MacAddress", myreq.MacAddress);
getString(req, "InvestUnitID", myreq.InvestUnitID);
getInt(req, "FrontID", &myreq.FrontID);
getInt(req, "SessionID", &myreq.SessionID);
int i = this->api->ReqCombActionInsert(&myreq, reqid);
return i;
};

View File

@ -806,6 +806,8 @@ void TdApi::processRspCombActionInsert(Task *task)
data["IPAddress"] = toUtf(task_data->IPAddress);
data["MacAddress"] = toUtf(task_data->MacAddress);
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["FrontID"] = task_data->FrontID;
data["SessionID"] = task_data->SessionID;
delete task_data;
}
dict error;
@ -1006,6 +1008,9 @@ void TdApi::processRspQryInvestorPosition(Task *task)
data["ExchangeID"] = toUtf(task_data->ExchangeID);
data["YdStrikeFrozen"] = task_data->YdStrikeFrozen;
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["PositionCostOffset"] = task_data->PositionCostOffset;
data["TasPosition"] = task_data->TasPosition;
data["TasPositionCost"] = task_data->TasPositionCost;
delete task_data;
}
dict error;
@ -1475,7 +1480,9 @@ void TdApi::processRspQryInvestorPositionDetail(Task *task)
data["SettlementPrice"] = task_data->SettlementPrice;
data["CloseVolume"] = task_data->CloseVolume;
data["CloseAmount"] = task_data->CloseAmount;
data["TimeFirstVolume"] = task_data->TimeFirstVolume;
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["SpecPosiType"] = task_data->SpecPosiType;
delete task_data;
}
dict error;
@ -3514,6 +3521,8 @@ void TdApi::processErrRtnCombActionInsert(Task *task)
data["IPAddress"] = toUtf(task_data->IPAddress);
data["MacAddress"] = toUtf(task_data->MacAddress);
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["FrontID"] = task_data->FrontID;
data["SessionID"] = task_data->SessionID;
delete task_data;
}
dict error;

View File

@ -59,6 +59,7 @@ TThostFtdcPositionDateType = "char"
TThostFtdcPositionDateTypeType = "char"
TThostFtdcTradingRoleType = "char"
TThostFtdcProductClassType = "char"
TThostFtdcAPIProductClassType = "char"
TThostFtdcInstLifePhaseType = "char"
TThostFtdcDirectionType = "char"
TThostFtdcPositionTypeType = "char"
@ -79,6 +80,7 @@ TThostFtdcActionFlagType = "char"
TThostFtdcTradingRightType = "char"
TThostFtdcOrderSourceType = "char"
TThostFtdcTradeTypeType = "char"
TThostFtdcSpecPosiTypeType = "char"
TThostFtdcPriceSourceType = "char"
TThostFtdcInstrumentStatusType = "char"
TThostFtdcInstStatusEnterReasonType = "char"
@ -299,7 +301,6 @@ TThostFtdcAMLInvestorTypeType = "string"
TThostFtdcAMLIdCardTypeType = "string"
TThostFtdcAMLTradeDirectType = "string"
TThostFtdcAMLTradeModelType = "string"
TThostFtdcAMLParamIDType = "string"
TThostFtdcAMLOpParamValueType = "double"
TThostFtdcAMLCustomerCardTypeType = "string"
TThostFtdcAMLInstitutionNameType = "string"
@ -722,6 +723,7 @@ TThostFtdcExecResultType = "char"
TThostFtdcStrikeSequenceType = "int"
TThostFtdcStrikeTimeType = "string"
TThostFtdcCombinationTypeType = "char"
TThostFtdcDceCombinationTypeType = "char"
TThostFtdcOptionRoyaltyPriceTypeType = "char"
TThostFtdcBalanceAlgorithmType = "char"
TThostFtdcActionTypeType = "char"

View File

@ -52,6 +52,9 @@ public:
///登出请求响应
virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///ÇëÇó²éѯ×é²¥ºÏÔ¼ÏìÓ¦
virtual void OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///错误应答
virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
@ -155,6 +158,9 @@ public:
///登出请求
virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;
///ÇëÇó²éѯ×é²¥ºÏÔ¼
virtual int ReqQryMulticastInstrument(CThostFtdcQryMulticastInstrumentField *pQryMulticastInstrument, int nRequestID) = 0;
protected:
~CThostFtdcMdApi(){};
};

View File

@ -252,6 +252,10 @@ typedef char TThostFtdcIdentifiedCardNoType[51];
#define THOST_FTDC_ICT_FrgPrmtRdCard 'K'
///资管产品备案函
#define THOST_FTDC_ICT_CptMngPrdLetter 'L'
///统一社会信用代码
#define THOST_FTDC_ICT_UniformSocialCreditCode 'N'
///机构成立证明文件
#define THOST_FTDC_ICT_CorporationCertNo 'O'
///其他证件
#define THOST_FTDC_ICT_OtherCard 'x'
@ -624,9 +628,35 @@ typedef char TThostFtdcTradingRoleType;
#define THOST_FTDC_PC_EFP '5'
///现货期权
#define THOST_FTDC_PC_SpotOption '6'
///TAS合约
#define THOST_FTDC_PC_TAS '7'
///金属指数
#define THOST_FTDC_PC_MI 'I'
typedef char TThostFtdcProductClassType;
/////////////////////////////////////////////////////////////////////////
///TFtdcAPIProductClassType是一个产品类型类型
/////////////////////////////////////////////////////////////////////////
///期货单一合约
#define THOST_FTDC_APC_FutureSingle '1'
///期权单一合约
#define THOST_FTDC_APC_OptionSingle '2'
///可交易期货(含期货组合和期货单一合约)
#define THOST_FTDC_APC_Futures '3'
///可交易期权(含期权组合和期权单一合约)
#define THOST_FTDC_APC_Options '4'
///可下单组合目前包含DCE和ZCE的期货组合
#define THOST_FTDC_APC_TradingComb '5'
///可申请的组合dce可以申请的组合合约 包含dce可以交易的合约
#define THOST_FTDC_APC_UnTradingComb '6'
///所有可以交易合约
#define THOST_FTDC_APC_AllTrading '7'
///所有合约(包含不能交易合约 慎用)
#define THOST_FTDC_APC_All '8'
typedef char TThostFtdcAPIProductClassType;
/////////////////////////////////////////////////////////////////////////
///TFtdcInstLifePhaseType是一个合约生命周期状态类型
/////////////////////////////////////////////////////////////////////////
@ -965,6 +995,16 @@ typedef char TThostFtdcOrderSourceType;
typedef char TThostFtdcTradeTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcSpecPosiTypeType是一个特殊持仓明细标识类型
/////////////////////////////////////////////////////////////////////////
///普通持仓明细
#define THOST_FTDC_SPOST_Common '#'
///TAS合约成交产生的标的合约持仓明细
#define THOST_FTDC_SPOST_Tas '0'
typedef char TThostFtdcSpecPosiTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcPriceSourceType是一个成交价来源类型
/////////////////////////////////////////////////////////////////////////
@ -2510,6 +2550,10 @@ typedef char TThostFtdcClearbarchIDType[6];
#define THOST_FTDC_UET_UpdatePassword '5'
///客户端认证
#define THOST_FTDC_UET_Authenticate '6'
///终端信息上报
#define THOST_FTDC_UET_SubmitSysInfo '7'
///转账
#define THOST_FTDC_UET_Transfer '8'
///其他
#define THOST_FTDC_UET_Other '9'
@ -2711,11 +2755,6 @@ typedef char TThostFtdcAMLTradeDirectType[3];
/////////////////////////////////////////////////////////////////////////
typedef char TThostFtdcAMLTradeModelType[3];
/////////////////////////////////////////////////////////////////////////
///TFtdcAMLParamIDType是一个参数代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TThostFtdcAMLParamIDType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcAMLOpParamValueType是一个业务参数代码值类型
/////////////////////////////////////////////////////////////////////////
@ -6192,6 +6231,10 @@ typedef char TThostFtdcStrikeTimeType[13];
#define THOST_FTDC_COMBT_PRT '5'
///时间价差组合
#define THOST_FTDC_COMBT_CLD '6'
///期权对锁组合
#define THOST_FTDC_COMBT_OPL '7'
///买备兑组合
#define THOST_FTDC_COMBT_BFO '8'
typedef char TThostFtdcCombinationTypeType;
@ -6386,6 +6429,8 @@ typedef char TThostFtdcCFFEXUploadFileNameType;
#define THOST_FTDC_CMDR_Comb '0'
///申请拆分
#define THOST_FTDC_CMDR_UnComb '1'
///操作员删组合单
#define THOST_FTDC_CMDR_DelComb '2'
typedef char TThostFtdcCombDirectionType;

View File

@ -150,6 +150,8 @@ struct CThostFtdcAuthenticationInfoField
TThostFtdcAppIDType AppID;
///App类型
TThostFtdcAppTypeType AppType;
///终端IP地址
TThostFtdcIPAddressType ClientIPAddress;
};
///用户登录应答2
@ -812,6 +814,10 @@ struct CThostFtdcInvestorPositionField
TThostFtdcInvestUnitIDType InvestUnitID;
///大商所持仓成本差值,只有大商所使用
TThostFtdcMoneyType PositionCostOffset;
///tas持仓手数
TThostFtdcVolumeType TasPosition;
///tas持仓成本
TThostFtdcMoneyType TasPositionCost;
};
///合约保证金率
@ -2273,6 +2279,10 @@ struct CThostFtdcSyncingInvestorPositionField
TThostFtdcInvestUnitIDType InvestUnitID;
///大商所持仓成本差值,只有大商所使用
TThostFtdcMoneyType PositionCostOffset;
///tas持仓手数
TThostFtdcVolumeType TasPosition;
///tas持仓成本
TThostFtdcMoneyType TasPositionCost;
};
///正在同步中的合约保证金率
@ -4237,6 +4247,10 @@ struct CThostFtdcInputCombActionField
TThostFtdcMacAddressType MacAddress;
///投资单元代码
TThostFtdcInvestUnitIDType InvestUnitID;
///前置编号
TThostFtdcFrontIDType FrontID;
///会话编号
TThostFtdcSessionIDType SessionID;
};
///申请组合
@ -4977,6 +4991,10 @@ struct CThostFtdcSyncDelaySwapField
TThostFtdcCurrencyIDType ToCurrencyID;
///目标金额
TThostFtdcMoneyType ToAmount;
///是否手工换汇
TThostFtdcBoolType IsManualSwap;
///是否将所有外币的剩余换汇额度设置为0
TThostFtdcBoolType IsAllRemainSetZero;
};
///查询延时换汇同步
@ -5405,10 +5423,12 @@ struct CThostFtdcInvestorPositionDetailField
TThostFtdcVolumeType CloseVolume;
///平仓金额
TThostFtdcMoneyType CloseAmount;
///按照时间顺序平仓的笔数,大商所专用
///先开先平剩余数量DCE
TThostFtdcVolumeType TimeFirstVolume;
///投资单元代码
TThostFtdcInvestUnitIDType InvestUnitID;
///特殊持仓标志
TThostFtdcSpecPosiTypeType SpecPosiType;
};
///资金账户口令域
@ -6835,6 +6855,43 @@ struct CThostFtdcQryBulletinField
TThostFtdcNewsUrgencyType NewsUrgency;
};
///MulticastInstrument
struct CThostFtdcMulticastInstrumentField
{
///主题号
TThostFtdcInstallIDType TopicID;
///合约代码
TThostFtdcInstrumentIDType InstrumentID;
///合约编号
TThostFtdcInstallIDType InstrumentNo;
///基准价
TThostFtdcPriceType CodePrice;
///合约数量乘数
TThostFtdcVolumeMultipleType VolumeMultiple;
///最小变动价位
TThostFtdcPriceType PriceTick;
};
///QryMulticastInstrument
struct CThostFtdcQryMulticastInstrumentField
{
///主题号
TThostFtdcInstallIDType TopicID;
///合约代码
TThostFtdcInstrumentIDType InstrumentID;
};
///App客户端权限分配
struct CThostFtdcAppIDAuthAssignField
{
///经纪公司代码
TThostFtdcBrokerIDType BrokerID;
///App代码
TThostFtdcAppIDType AppID;
///交易中心代码
TThostFtdcDRIdentityIDType DRIdentityID;
};
///转帐开户请求
struct CThostFtdcReqOpenAccountField
{
@ -9487,6 +9544,37 @@ struct CThostFtdcQueryFreqField
TThostFtdcQueryFreqType QueryFreq;
};
///禁止认证IP
struct CThostFtdcAuthForbiddenIPField
{
///IP地址
TThostFtdcIPAddressType IPAddress;
};
///查询禁止认证IP
struct CThostFtdcQryAuthForbiddenIPField
{
///IP地址
TThostFtdcIPAddressType IPAddress;
};
///换汇可提冻结
struct CThostFtdcSyncDelaySwapFrozenField
{
///换汇流水号
TThostFtdcDepositSeqNoType DelaySwapSeqNo;
///经纪公司代码
TThostFtdcBrokerIDType BrokerID;
///投资者代码
TThostFtdcInvestorIDType InvestorID;
///源币种
TThostFtdcCurrencyIDType FromCurrencyID;
///源剩余换汇额度(可提冻结)
TThostFtdcMoneyType FromRemainSwap;
///是否手工换汇
TThostFtdcBoolType IsManualSwap;
};
#endif

Binary file not shown.

Binary file not shown.

52
vnpy/api/ctp/readme.md Normal file
View File

@ -0,0 +1,52 @@
#总步骤
1、利用API头文件生成数据结构和函数
2、使用pybind11封装pyd或so
# 生成数据结构等映射py文件
1.生成数据类型
python generate_data_type.py
=> 产生两个文件: ctp_typedef.py, ctp_constant.py
2.生成数据结构
python generate_struct.py
=> 产生文件: ctp_struct.py
3.生成接口
python generate_api_functions.py
=> 产生 ctp_md_*.cpp ctp_md_*.h, ctp_td_*.cpp, ctp_td_*.h
# 6.3.15 升级6.3.19
1.更新覆盖 ctp/include/ctp目录下的*.h文件
2.更新覆盖 ctp/libs目录下的 *.lib文件
3.更新覆盖 ctp目录下的 *.dll, *.so文件
4.在ctp/generator目录下重新生成数据结构等映射文件
5.更新覆盖ctp目录下的 ctp_constant.py
6.对比ctp/generator目录下的 ctp_md_*.h 文件,与 vnctp/vnctpmd/vnctpmd.h文件增量更新常量、数据结构和函数名等代码
7.对比ctp/generator目录下的 ctp_md_*.cpp 文件,与 vnctp/vnctpmd/vnctpmd.cpp文件增量更新函数等
8.对比ctp/generator目录下的 ctp_td_*.h 文件,与 vnctp/vnctptd/vnctptd.h文件增量更新常量、数据结构和函数名等代码
9.对比ctp/generator目录下的 ctp_td_*.cpp 文件,与 vnctp/vnctptd/vnctptd.cpp文件增量更新函数等
#windows 编译
1.vs 2019 打开vnctp/vnctp.sln解决方案文件
2.检查两个子项目的属性:
--头文件目录包含python 3.7或者env目录下的include目录ctp api的include目录pybind11的include目录
--lib目录主要是ctp/libs目录 python 3.7或env下的libs目录
3.使用release模式进行编译
#linux编译
1. 复制so文件到ctp根目录并改名
mv thostmduserapi_se.so libthostmduserapi_se.so
mv thosttraderapi_se.so libthosttraderapi_se.so
在py37环境下运行
python setup.py build
2. 产生的so文件复制改名至ctp/目录下
cp build/lib.linux-x86_64-3.7/vnctpmd.cpython-37m-x86_64-linux-gnu.so vnctpmd.so
cp build/lib.linux-x86_64-3.7/vnctptd.cpython-37m-x86_64-linux-gnu.so vnctptd.so

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,11 @@
// vnctpmd.cpp : 定义 DLL 应用程序的导出函数。
// vnctpmd.cpp : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DLL Ӧ<>ó<EFBFBD><C3B3><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
#include "vnctpmd.h"
///-------------------------------------------------------------------------------------
///C++的回调函数将数据保存到队列中
///C++<EFBFBD>Ļص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void MdApi::OnFrontConnected()
@ -73,6 +73,27 @@ void MdApi::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRs
this->task_queue.push(task);
};
void MdApi::OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPQRYMULTICASTINSTRUMENT;
if (pMulticastInstrument)
{
CThostFtdcMulticastInstrumentField *task_data = new CThostFtdcMulticastInstrumentField();
*task_data = *pMulticastInstrument;
task.task_data = task_data;
}
if (pRspInfo)
{
CThostFtdcRspInfoField *task_error = new CThostFtdcRspInfoField();
*task_error = *pRspInfo;
task.task_error = task_error;
}
task.task_id = nRequestID;
task.task_last = bIsLast;
this->task_queue.push(task);
};
void MdApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
@ -201,7 +222,7 @@ void MdApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp)
///-------------------------------------------------------------------------------------
///工作线程从队列中取出数据转化为python对象后进行推送
///<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̴߳Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ת<EFBFBD><EFBFBD>Ϊpython<EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void MdApi::processTask()
@ -244,6 +265,12 @@ void MdApi::processTask()
break;
}
case ONRSPQRYMULTICASTINSTRUMENT:
{
this->processRspQryMulticastInstrument(&task);
break;
}
case ONRSPERROR:
{
this->processRspError(&task);
@ -366,6 +393,32 @@ void MdApi::processRspUserLogout(Task *task)
this->onRspUserLogout(data, error, task->task_id, task->task_last);
};
void MdApi::processRspQryMulticastInstrument(Task *task)
{
gil_scoped_acquire acquire;
dict data;
if (task->task_data)
{
CThostFtdcMulticastInstrumentField *task_data = (CThostFtdcMulticastInstrumentField*)task->task_data;
data["TopicID"] = task_data->TopicID;
data["InstrumentID"] = toUtf(task_data->InstrumentID);
data["InstrumentNo"] = task_data->InstrumentNo;
data["CodePrice"] = task_data->CodePrice;
data["VolumeMultiple"] = task_data->VolumeMultiple;
data["PriceTick"] = task_data->PriceTick;
delete task->task_data;
}
dict error;
if (task->task_error)
{
CThostFtdcRspInfoField *task_error = (CThostFtdcRspInfoField*)task->task_error;
error["ErrorID"] = task_error->ErrorID;
error["ErrorMsg"] = toUtf(task_error->ErrorMsg);
delete task_error;
}
this->onRspQryMulticastInstrument(data, error, task->task_id, task->task_last);
};
void MdApi::processRspError(Task *task)
{
gil_scoped_acquire acquire;
@ -539,7 +592,7 @@ void MdApi::processRtnForQuoteRsp(Task *task)
};
///-------------------------------------------------------------------------------------
///主动函数
///<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void MdApi::createFtdcMdApi(string pszFlowPath)
@ -637,6 +690,7 @@ int MdApi::reqUserLogin(const dict &req, int reqid)
getString(req, "OneTimePassword", myreq.OneTimePassword);
getString(req, "ClientIPAddress", myreq.ClientIPAddress);
getString(req, "LoginRemark", myreq.LoginRemark);
getInt(req, "ClientIPPort", &myreq.ClientIPPort);
int i = this->api->ReqUserLogin(&myreq, reqid);
return i;
};
@ -651,9 +705,18 @@ int MdApi::reqUserLogout(const dict &req, int reqid)
return i;
};
int MdApi::reqQryMulticastInstrument(const dict &req, int reqid)
{
CThostFtdcQryMulticastInstrumentField myreq = CThostFtdcQryMulticastInstrumentField();
memset(&myreq, 0, sizeof(myreq));
getInt(req, "TopicID", &myreq.TopicID);
getString(req, "InstrumentID", myreq.InstrumentID);
int i = this->api->ReqQryMulticastInstrument(&myreq, reqid);
return i;
};
///-------------------------------------------------------------------------------------
///Boost.Python封装
///Boost.Python<EFBFBD><EFBFBD>װ
///-------------------------------------------------------------------------------------
class PyMdApi: public MdApi
@ -721,6 +784,17 @@ public:
}
};
void onRspQryMulticastInstrument(const dict &data, const dict &error, int reqid, bool last) override
{
try
{
PYBIND11_OVERLOAD(void, MdApi, onRspQryMulticastInstrument, data, error, reqid, last);
}
catch (const error_already_set &e)
{
cout << e.what() << endl;
}
};
void onRspError(const dict &error, int reqid, bool last) override
{
try
@ -825,12 +899,13 @@ PYBIND11_MODULE(vnctpmd, m)
.def("unSubscribeForQuoteRsp", &MdApi::unSubscribeForQuoteRsp)
.def("reqUserLogin", &MdApi::reqUserLogin)
.def("reqUserLogout", &MdApi::reqUserLogout)
.def("reqQryMulticastInstrument", &MdApi::reqQryMulticastInstrument)
.def("onFrontConnected", &MdApi::onFrontConnected)
.def("onFrontDisconnected", &MdApi::onFrontDisconnected)
.def("onHeartBeatWarning", &MdApi::onHeartBeatWarning)
.def("onRspUserLogin", &MdApi::onRspUserLogin)
.def("onRspUserLogout", &MdApi::onRspUserLogout)
.def("onRspQryMulticastInstrument", &MdApi::onRspQryMulticastInstrument)
.def("onRspError", &MdApi::onRspError)
.def("onRspSubMarketData", &MdApi::onRspSubMarketData)
.def("onRspUnSubMarketData", &MdApi::onRspUnSubMarketData)

View File

@ -16,13 +16,14 @@ using namespace pybind11;
#define ONHEARTBEATWARNING 2
#define ONRSPUSERLOGIN 3
#define ONRSPUSERLOGOUT 4
#define ONRSPERROR 5
#define ONRSPSUBMARKETDATA 6
#define ONRSPUNSUBMARKETDATA 7
#define ONRSPSUBFORQUOTERSP 8
#define ONRSPUNSUBFORQUOTERSP 9
#define ONRTNDEPTHMARKETDATA 10
#define ONRTNFORQUOTERSP 11
#define ONRSPQRYMULTICASTINSTRUMENT 5
#define ONRSPERROR 6
#define ONRSPSUBMARKETDATA 7
#define ONRSPUNSUBMARKETDATA 8
#define ONRSPSUBFORQUOTERSP 9
#define ONRSPUNSUBFORQUOTERSP 10
#define ONRTNDEPTHMARKETDATA 11
#define ONRTNFORQUOTERSP 12
///-------------------------------------------------------------------------------------
@ -78,6 +79,9 @@ public:
///µÇ³öÇëÇóÏìÓ¦
virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
/// ×é²¥ºÏÔ¼·µ»Ø
virtual void OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///´íÎóÓ¦´ð
virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
@ -115,6 +119,8 @@ public:
void processRspUserLogout(Task *task);
void processRspQryMulticastInstrument(Task *task);
void processRspError(Task *task);
void processRspSubMarketData(Task *task);
@ -148,6 +154,8 @@ public:
virtual void onRspUserLogout(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspQryMulticastInstrument(const dict &data, const dict &error, int reqid, bool last) {};
virtual void onRspError(const dict &error, int reqid, bool last) {};
virtual void onRspSubMarketData(const dict &data, const dict &error, int reqid, bool last) {};
@ -191,4 +199,6 @@ public:
int reqUserLogin(const dict &req, int reqid);
int reqUserLogout(const dict &req, int reqid);
int reqQryMulticastInstrument(const dict &req, int reqid);
};

View File

@ -23,7 +23,7 @@
<ProjectGuid>{F00054FF-282F-4826-848E-D58BFB9E9D9F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>vnctpmd</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -88,16 +88,16 @@
<LinkIncremental>false</LinkIncremental>
<TargetExt>.pyd</TargetExt>
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
<ReferencePath>C:\GitHub\vnpy\vnpy\api\ctp\ctpapi;$(ReferencePath)</ReferencePath>
<ReferencePath>C:\GitHub\msincenselee\vnpy\api\ctp;$(ReferencePath)</ReferencePath>
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
<IncludePath>C:\Users\incen\AppData\Local\conda\conda\envs\py37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\pybind11;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
<ReferencePath>$(ReferencePath)</ReferencePath>
<TargetExt>.pyd</TargetExt>
<LibraryPath>C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -170,7 +170,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\GitHub\vnpy\vnpy\api\ctp\libs;C:\Miniconda3\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\GitHub\msincenselee\vnpy\api\ctp\libs;C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>thostmduserapi_se.lib;thosttraderapi_se.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

View File

@ -1,11 +1,11 @@
// vnctpmd.cpp : 定义 DLL 应用程序的导出函数。
// vnctpmd.cpp : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DLL Ӧ<>ó<EFBFBD><C3B3><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
#include "vnctptd.h"
///-------------------------------------------------------------------------------------
///C++的回调函数将数据保存到队列中
///C++<EFBFBD>Ļص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void TdApi::OnFrontConnected()
@ -2349,7 +2349,7 @@ void TdApi::OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccoun
///-------------------------------------------------------------------------------------
///工作线程从队列中取出数据转化为python对象后进行推送
///<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̴߳Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ת<EFBFBD><EFBFBD>Ϊpython<EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void TdApi::processTask()
@ -3927,6 +3927,8 @@ void TdApi::processRspCombActionInsert(Task *task)
data["IPAddress"] = toUtf(task_data->IPAddress);
data["MacAddress"] = toUtf(task_data->MacAddress);
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["FrontID"] = task_data->FrontID;
data["SessionID"] = task_data->SessionID;
delete task_data;
}
dict error;
@ -4127,6 +4129,9 @@ void TdApi::processRspQryInvestorPosition(Task *task)
data["ExchangeID"] = toUtf(task_data->ExchangeID);
data["YdStrikeFrozen"] = task_data->YdStrikeFrozen;
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["PositionCostOffset"] = task_data->PositionCostOffset;
data["TasPosition"] = task_data->TasPosition;
data["TasPositionCost"] = task_data->TasPositionCost;
delete task_data;
}
dict error;
@ -4596,7 +4601,9 @@ void TdApi::processRspQryInvestorPositionDetail(Task *task)
data["SettlementPrice"] = task_data->SettlementPrice;
data["CloseVolume"] = task_data->CloseVolume;
data["CloseAmount"] = task_data->CloseAmount;
data["TimeFirstVolume"] = task_data->TimeFirstVolume;
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["SpecPosiType"] = task_data->SpecPosiType;
delete task_data;
}
dict error;
@ -6635,6 +6642,8 @@ void TdApi::processErrRtnCombActionInsert(Task *task)
data["IPAddress"] = toUtf(task_data->IPAddress);
data["MacAddress"] = toUtf(task_data->MacAddress);
data["InvestUnitID"] = toUtf(task_data->InvestUnitID);
data["FrontID"] = task_data->FrontID;
data["SessionID"] = task_data->SessionID;
delete task_data;
}
dict error;
@ -8237,7 +8246,7 @@ void TdApi::processRtnChangeAccountByBank(Task *task)
///-------------------------------------------------------------------------------------
///主动函数
///<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///-------------------------------------------------------------------------------------
void TdApi::createFtdcTraderApi(string pszFlowPath)
@ -8859,6 +8868,8 @@ int TdApi::reqCombActionInsert(const dict &req, int reqid)
getString(req, "IPAddress", myreq.IPAddress);
getString(req, "MacAddress", myreq.MacAddress);
getString(req, "InvestUnitID", myreq.InvestUnitID);
getInt(req, "FrontID", &myreq.FrontID);
getInt(req, "SessionID", &myreq.SessionID);
int i = this->api->ReqCombActionInsert(&myreq, reqid);
return i;
};
@ -9636,7 +9647,7 @@ int TdApi::reqQueryBankAccountMoneyByFuture(const dict &req, int reqid)
///-------------------------------------------------------------------------------------
///Boost.Python封装
///Boost.Python<EFBFBD><EFBFBD>װ
///-------------------------------------------------------------------------------------
class PyTdApi : public TdApi

View File

@ -23,7 +23,7 @@
<ProjectGuid>{016732E6-5789-4F7C-9A1C-C46A249080CF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>vnctptd</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -94,8 +94,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.pyd</TargetExt>
<IncludePath>C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
<LibraryPath>C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
<IncludePath>C:\ProgramData\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
<LibraryPath>C:\ProgramData\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -168,7 +168,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Miniconda3\libs;C:\GitHub\vnpy\vnpy\api\ctp\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;C:\GitHub\msincenselee\vnpy\api\ctp\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>thostmduserapi_se.lib;thosttraderapi_se.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.