diff --git a/vnpy/api/ctp/ctp_constant.py b/vnpy/api/ctp/ctp_constant.py
index bf479ffe..420e60e4 100644
--- a/vnpy/api/ctp/ctp_constant.py
+++ b/vnpy/api/ctp/ctp_constant.py
@@ -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'
diff --git a/vnpy/api/ctp/generator/ctp_constant.py b/vnpy/api/ctp/generator/ctp_constant.py
index d91866df..420e60e4 100644
--- a/vnpy/api/ctp/generator/ctp_constant.py
+++ b/vnpy/api/ctp/generator/ctp_constant.py
@@ -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'
diff --git a/vnpy/api/ctp/generator/ctp_md_header_define.h b/vnpy/api/ctp/generator/ctp_md_header_define.h
index 2660f33d..ade2def5 100644
--- a/vnpy/api/ctp/generator/ctp_md_header_define.h
+++ b/vnpy/api/ctp/generator/ctp_md_header_define.h
@@ -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
diff --git a/vnpy/api/ctp/generator/ctp_md_header_function.h b/vnpy/api/ctp/generator/ctp_md_header_function.h
index 482250f8..188801df 100644
--- a/vnpy/api/ctp/generator/ctp_md_header_function.h
+++ b/vnpy/api/ctp/generator/ctp_md_header_function.h
@@ -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);
+
diff --git a/vnpy/api/ctp/generator/ctp_md_header_on.h b/vnpy/api/ctp/generator/ctp_md_header_on.h
index c0dbe668..57b12ec9 100644
--- a/vnpy/api/ctp/generator/ctp_md_header_on.h
+++ b/vnpy/api/ctp/generator/ctp_md_header_on.h
@@ -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) {};
diff --git a/vnpy/api/ctp/generator/ctp_md_header_process.h b/vnpy/api/ctp/generator/ctp_md_header_process.h
index f0142875..92213a01 100644
--- a/vnpy/api/ctp/generator/ctp_md_header_process.h
+++ b/vnpy/api/ctp/generator/ctp_md_header_process.h
@@ -8,6 +8,8 @@ void processRspUserLogin(Task *task);
void processRspUserLogout(Task *task);
+void processRspQryMulticastInstrument(Task *task);
+
void processRspError(Task *task);
void processRspSubMarketData(Task *task);
diff --git a/vnpy/api/ctp/generator/ctp_md_source_function.cpp b/vnpy/api/ctp/generator/ctp_md_source_function.cpp
index a2de4589..30359f92 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_function.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_function.cpp
@@ -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;
+};
+
diff --git a/vnpy/api/ctp/generator/ctp_md_source_module.cpp b/vnpy/api/ctp/generator/ctp_md_source_module.cpp
index eed36147..8b45ef30 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_module.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_module.cpp
@@ -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)
diff --git a/vnpy/api/ctp/generator/ctp_md_source_on.cpp b/vnpy/api/ctp/generator/ctp_md_source_on.cpp
index b9185795..4da14a9c 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_on.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_on.cpp
@@ -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
diff --git a/vnpy/api/ctp/generator/ctp_md_source_process.cpp b/vnpy/api/ctp/generator/ctp_md_source_process.cpp
index bdf740a1..41ef1228 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_process.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_process.cpp
@@ -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;
diff --git a/vnpy/api/ctp/generator/ctp_md_source_switch.cpp b/vnpy/api/ctp/generator/ctp_md_source_switch.cpp
index 4095ad46..91c034e9 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_switch.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_switch.cpp
@@ -28,6 +28,12 @@ case ONRSPUSERLOGOUT:
break;
}
+case ONRSPQRYMULTICASTINSTRUMENT:
+{
+ this->processRspQryMulticastInstrument(&task);
+ break;
+}
+
case ONRSPERROR:
{
this->processRspError(&task);
diff --git a/vnpy/api/ctp/generator/ctp_md_source_task.cpp b/vnpy/api/ctp/generator/ctp_md_source_task.cpp
index 93287c1b..9ea546ac 100644
--- a/vnpy/api/ctp/generator/ctp_md_source_task.cpp
+++ b/vnpy/api/ctp/generator/ctp_md_source_task.cpp
@@ -21,7 +21,7 @@ void MdApi::OnHeartBeatWarning(int nTimeLapse)
this->task_queue.push(task);
};
-void MdApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUSERLOGIN;
@@ -42,7 +42,7 @@ void MdApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtd
this->task_queue.push(task);
};
-void MdApi::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUSERLOGOUT;
@@ -63,7 +63,28 @@ void MdApi::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRs
this->task_queue.push(task);
};
-void MdApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+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();
task.task_name = ONRSPERROR;
@@ -78,7 +99,7 @@ void MdApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bI
this->task_queue.push(task);
};
-void MdApi::OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPSUBMARKETDATA;
@@ -99,7 +120,7 @@ void MdApi::OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstr
this->task_queue.push(task);
};
-void MdApi::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUNSUBMARKETDATA;
@@ -120,7 +141,7 @@ void MdApi::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificIns
this->task_queue.push(task);
};
-void MdApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPSUBFORQUOTERSP;
@@ -141,7 +162,7 @@ void MdApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInst
this->task_queue.push(task);
};
-void MdApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
+void MdApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
Task task = Task();
task.task_name = ONRSPUNSUBFORQUOTERSP;
@@ -162,7 +183,7 @@ void MdApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificIn
this->task_queue.push(task);
};
-void MdApi::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData)
+void MdApi::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData)
{
Task task = Task();
task.task_name = ONRTNDEPTHMARKETDATA;
@@ -175,7 +196,7 @@ void MdApi::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketDat
this->task_queue.push(task);
};
-void MdApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp)
+void MdApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp)
{
Task task = Task();
task.task_name = ONRTNFORQUOTERSP;
diff --git a/vnpy/api/ctp/generator/ctp_struct.py b/vnpy/api/ctp/generator/ctp_struct.py
index 79120795..7e55f76b 100644
--- a/vnpy/api/ctp/generator/ctp_struct.py
+++ b/vnpy/api/ctp/generator/ctp_struct.py
@@ -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",
+}
+
diff --git a/vnpy/api/ctp/generator/ctp_td_source_function.cpp b/vnpy/api/ctp/generator/ctp_td_source_function.cpp
index a25b87b5..cff28e4b 100644
--- a/vnpy/api/ctp/generator/ctp_td_source_function.cpp
+++ b/vnpy/api/ctp/generator/ctp_td_source_function.cpp
@@ -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;
};
diff --git a/vnpy/api/ctp/generator/ctp_td_source_process.cpp b/vnpy/api/ctp/generator/ctp_td_source_process.cpp
index 70092afd..54f4f61f 100644
--- a/vnpy/api/ctp/generator/ctp_td_source_process.cpp
+++ b/vnpy/api/ctp/generator/ctp_td_source_process.cpp
@@ -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;
diff --git a/vnpy/api/ctp/generator/ctp_typedef.py b/vnpy/api/ctp/generator/ctp_typedef.py
index 363a0343..f68bec7e 100644
--- a/vnpy/api/ctp/generator/ctp_typedef.py
+++ b/vnpy/api/ctp/generator/ctp_typedef.py
@@ -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"
diff --git a/vnpy/api/ctp/include/ctp/ThostFtdcMdApi.h b/vnpy/api/ctp/include/ctp/ThostFtdcMdApi.h
index ece33f7e..9ad4134c 100644
--- a/vnpy/api/ctp/include/ctp/ThostFtdcMdApi.h
+++ b/vnpy/api/ctp/include/ctp/ThostFtdcMdApi.h
@@ -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(){};
};
diff --git a/vnpy/api/ctp/include/ctp/ThostFtdcUserApiDataType.h b/vnpy/api/ctp/include/ctp/ThostFtdcUserApiDataType.h
index 30c22889..8cadd1f7 100644
--- a/vnpy/api/ctp/include/ctp/ThostFtdcUserApiDataType.h
+++ b/vnpy/api/ctp/include/ctp/ThostFtdcUserApiDataType.h
@@ -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;
diff --git a/vnpy/api/ctp/include/ctp/ThostFtdcUserApiStruct.h b/vnpy/api/ctp/include/ctp/ThostFtdcUserApiStruct.h
index 8640a88a..780a12b4 100644
--- a/vnpy/api/ctp/include/ctp/ThostFtdcUserApiStruct.h
+++ b/vnpy/api/ctp/include/ctp/ThostFtdcUserApiStruct.h
@@ -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
diff --git a/vnpy/api/ctp/libs/thostmduserapi_se.lib b/vnpy/api/ctp/libs/thostmduserapi_se.lib
index 36477303..19b1cfcb 100644
Binary files a/vnpy/api/ctp/libs/thostmduserapi_se.lib and b/vnpy/api/ctp/libs/thostmduserapi_se.lib differ
diff --git a/vnpy/api/ctp/libs/thosttraderapi_se.lib b/vnpy/api/ctp/libs/thosttraderapi_se.lib
index d58511ce..60b393a8 100644
Binary files a/vnpy/api/ctp/libs/thosttraderapi_se.lib and b/vnpy/api/ctp/libs/thosttraderapi_se.lib differ
diff --git a/vnpy/api/ctp/libthostmduserapi_se.so b/vnpy/api/ctp/libthostmduserapi_se.so
index 8c5f665d..5d7d2804 100644
Binary files a/vnpy/api/ctp/libthostmduserapi_se.so and b/vnpy/api/ctp/libthostmduserapi_se.so differ
diff --git a/vnpy/api/ctp/libthosttraderapi_se.so b/vnpy/api/ctp/libthosttraderapi_se.so
index 087d6ef2..e534853d 100644
Binary files a/vnpy/api/ctp/libthosttraderapi_se.so and b/vnpy/api/ctp/libthosttraderapi_se.so differ
diff --git a/vnpy/api/ctp/readme.md b/vnpy/api/ctp/readme.md
new file mode 100644
index 00000000..2d269705
--- /dev/null
+++ b/vnpy/api/ctp/readme.md
@@ -0,0 +1,52 @@
+
+#鎬绘楠
+
+ 1銆佸埄鐢ˋPI澶存枃浠讹紝鐢熸垚鏁版嵁缁撴瀯鍜屽嚱鏁
+ 2銆佷娇鐢╬ybind11灏佽pyd鎴杝o
+
+
+# 鐢熸垚鏁版嵁缁撴瀯绛夋槧灏刾y鏂囦欢
+
+ 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.鍦╟tp/generator鐩綍涓嬶紝閲嶆柊鐢熸垚鏁版嵁缁撴瀯绛夋槧灏勬枃浠
+ 5.鏇存柊瑕嗙洊ctp鐩綍涓嬬殑 ctp_constant.py
+ 6.瀵规瘮ctp/generator鐩綍涓嬬殑 ctp_md_*.h 鏂囦欢锛屼笌 vnctp/vnctpmd/vnctpmd.h鏂囦欢锛屽閲忔洿鏂板父閲忋佹暟鎹粨鏋勫拰鍑芥暟鍚嶇瓑浠g爜
+ 7.瀵规瘮ctp/generator鐩綍涓嬬殑 ctp_md_*.cpp 鏂囦欢锛屼笌 vnctp/vnctpmd/vnctpmd.cpp鏂囦欢锛屽閲忔洿鏂板嚱鏁扮瓑
+ 8.瀵规瘮ctp/generator鐩綍涓嬬殑 ctp_td_*.h 鏂囦欢锛屼笌 vnctp/vnctptd/vnctptd.h鏂囦欢锛屽閲忔洿鏂板父閲忋佹暟鎹粨鏋勫拰鍑芥暟鍚嶇瓑浠g爜
+ 9.瀵规瘮ctp/generator鐩綍涓嬬殑 ctp_td_*.cpp 鏂囦欢锛屼笌 vnctp/vnctptd/vnctptd.cpp鏂囦欢锛屽閲忔洿鏂板嚱鏁扮瓑
+
+#windows 缂栬瘧
+
+ 1.vs 2019 鎵撳紑vnctp/vnctp.sln瑙e喅鏂规鏂囦欢
+ 2.妫鏌ヤ袱涓瓙椤圭洰鐨勫睘鎬э細
+ --澶存枃浠剁洰褰曪紝鍖呭惈python 3.7鎴栬卐nv鐩綍涓嬬殑include鐩綍锛宑tp api鐨刬nclude鐩綍锛宲ybind11鐨刬nclude鐩綍
+ --lib鐩綍锛屼富瑕佹槸ctp/libs鐩綍锛 python 3.7鎴杄nv涓嬬殑libs鐩綍
+ 3.浣跨敤release妯″紡杩涜缂栬瘧
+
+
+ #linux缂栬瘧
+ 1. 澶嶅埗so鏂囦欢鍒癱tp鏍圭洰褰曪紝骞舵敼鍚
+ mv thostmduserapi_se.so libthostmduserapi_se.so
+ mv thosttraderapi_se.so libthosttraderapi_se.so
+ 鍦╬y37鐜涓嬭繍琛
+ python setup.py build
+ 2. 浜х敓鐨剆o鏂囦欢锛屽鍒舵敼鍚嶈嚦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
+
diff --git a/vnpy/api/ctp/thostmduserapi_se.dll b/vnpy/api/ctp/thostmduserapi_se.dll
index f71079ac..0960d2c2 100644
Binary files a/vnpy/api/ctp/thostmduserapi_se.dll and b/vnpy/api/ctp/thostmduserapi_se.dll differ
diff --git a/vnpy/api/ctp/thosttraderapi_se.dll b/vnpy/api/ctp/thosttraderapi_se.dll
index d0468331..468c76d6 100644
Binary files a/vnpy/api/ctp/thosttraderapi_se.dll and b/vnpy/api/ctp/thosttraderapi_se.dll differ
diff --git a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp
index e05bcdd4..0b56fc7e 100644
--- a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp
+++ b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp
@@ -1,11 +1,11 @@
-// vnctpmd.cpp : 定义 DLL 应用程序的导出函数。
+// vnctpmd.cpp : 锟斤拷锟斤拷 DLL 应锟矫筹拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟
//
#include "vnctpmd.h"
///-------------------------------------------------------------------------------------
-///C++的回调函数将数据保存到队列中
+///C++锟侥回碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷憋拷锟芥到锟斤拷锟斤拷锟斤拷
///-------------------------------------------------------------------------------------
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对象后,进行推送
+///锟斤拷锟斤拷锟竭程从讹拷锟斤拷锟斤拷取锟斤拷锟斤拷锟捷o拷转锟斤拷为python锟斤拷锟斤拷螅锟斤拷锟斤拷锟斤拷锟
///-------------------------------------------------------------------------------------
void MdApi::processTask()
@@ -211,7 +232,7 @@ void MdApi::processTask()
while (this->active)
{
Task task = this->task_queue.pop();
-
+
switch (task.task_name)
{
case ONFRONTCONNECTED:
@@ -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)
};
///-------------------------------------------------------------------------------------
-///主动函数
+///锟斤拷锟斤拷锟斤拷锟斤拷
///-------------------------------------------------------------------------------------
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锟斤拷装
///-------------------------------------------------------------------------------------
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)
diff --git a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.h b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.h
index 5b894f3f..ac57713d 100644
--- a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.h
+++ b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.h
@@ -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);
};
diff --git a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj
index 781eeaf2..f132c6ec 100644
--- a/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj
+++ b/vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj
@@ -23,7 +23,7 @@
{F00054FF-282F-4826-848E-D58BFB9E9D9F}
Win32Proj
vnctpmd
- 10.0.17134.0
+ 10.0.17763.0
@@ -88,16 +88,16 @@
false
.pyd
C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)
- C:\GitHub\vnpy\vnpy\api\ctp\ctpapi;$(ReferencePath)
+ C:\GitHub\msincenselee\vnpy\api\ctp;$(ReferencePath)
C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)
$(SolutionDir)..\
false
- C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)
+ C:\Users\incen\AppData\Local\conda\conda\envs\py37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\pybind11;$(SolutionDir)..\include\ctp;$(IncludePath)
$(ReferencePath)
.pyd
- C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)
+ C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;$(SolutionDir)..\libs;$(LibraryPath)
$(SolutionDir)..\
@@ -170,7 +170,7 @@
true
true
true
- C:\GitHub\vnpy\vnpy\api\ctp\libs;C:\Miniconda3\libs;%(AdditionalLibraryDirectories)
+ C:\GitHub\msincenselee\vnpy\api\ctp\libs;C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;%(AdditionalLibraryDirectories)
thostmduserapi_se.lib;thosttraderapi_se.lib;%(AdditionalDependencies)
@@ -197,4 +197,4 @@
-
\ No newline at end of file
+
diff --git a/vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp b/vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp
index af1b9b82..20543ebc 100644
--- a/vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp
+++ b/vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp
@@ -1,11 +1,11 @@
-// vnctpmd.cpp : 定义 DLL 应用程序的导出函数。
+// vnctpmd.cpp : 锟斤拷锟斤拷 DLL 应锟矫筹拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟
//
#include "vnctptd.h"
///-------------------------------------------------------------------------------------
-///C++的回调函数将数据保存到队列中
+///C++锟侥回碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷憋拷锟芥到锟斤拷锟斤拷锟斤拷
///-------------------------------------------------------------------------------------
void TdApi::OnFrontConnected()
@@ -2349,7 +2349,7 @@ void TdApi::OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccoun
///-------------------------------------------------------------------------------------
-///工作线程从队列中取出数据,转化为python对象后,进行推送
+///锟斤拷锟斤拷锟竭程从讹拷锟斤拷锟斤拷取锟斤拷锟斤拷锟捷o拷转锟斤拷为python锟斤拷锟斤拷螅锟斤拷锟斤拷锟斤拷锟
///-------------------------------------------------------------------------------------
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)
///-------------------------------------------------------------------------------------
-///主动函数
+///锟斤拷锟斤拷锟斤拷锟斤拷
///-------------------------------------------------------------------------------------
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,14 +9647,14 @@ int TdApi::reqQueryBankAccountMoneyByFuture(const dict &req, int reqid)
///-------------------------------------------------------------------------------------
-///Boost.Python封装
+///Boost.Python锟斤拷装
///-------------------------------------------------------------------------------------
class PyTdApi : public TdApi
{
public:
using TdApi::TdApi;
-
+
void onFrontConnected() override
{
try
diff --git a/vnpy/api/ctp/vnctp/vnctptd/vnctptd.vcxproj b/vnpy/api/ctp/vnctp/vnctptd/vnctptd.vcxproj
index 883d8068..4e521646 100644
--- a/vnpy/api/ctp/vnctp/vnctptd/vnctptd.vcxproj
+++ b/vnpy/api/ctp/vnctp/vnctptd/vnctptd.vcxproj
@@ -23,7 +23,7 @@
{016732E6-5789-4F7C-9A1C-C46A249080CF}
Win32Proj
vnctptd
- 10.0.17134.0
+ 10.0.17763.0
@@ -94,8 +94,8 @@
false
.pyd
- C:\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)
- C:\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)
+ C:\ProgramData\Miniconda3\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)
+ C:\ProgramData\Miniconda3\libs;$(SolutionDir)..\libs;$(LibraryPath)
$(SolutionDir)..\
@@ -168,7 +168,7 @@
true
true
true
- C:\Miniconda3\libs;C:\GitHub\vnpy\vnpy\api\ctp\libs;%(AdditionalLibraryDirectories)
+ C:\Users\incen\AppData\Local\conda\conda\envs\py37\libs;C:\GitHub\msincenselee\vnpy\api\ctp\libs;%(AdditionalLibraryDirectories)
thostmduserapi_se.lib;thosttraderapi_se.lib;%(AdditionalDependencies)
diff --git a/vnpy/api/ctp/vnctpmd.pyd b/vnpy/api/ctp/vnctpmd.pyd
index 476c6511..3a243161 100644
Binary files a/vnpy/api/ctp/vnctpmd.pyd and b/vnpy/api/ctp/vnctpmd.pyd differ
diff --git a/vnpy/api/ctp/vnctpmd.so b/vnpy/api/ctp/vnctpmd.so
index 089841c7..1cffb859 100644
Binary files a/vnpy/api/ctp/vnctpmd.so and b/vnpy/api/ctp/vnctpmd.so differ
diff --git a/vnpy/api/ctp/vnctptd.pyd b/vnpy/api/ctp/vnctptd.pyd
index c78343e5..b2b04f18 100644
Binary files a/vnpy/api/ctp/vnctptd.pyd and b/vnpy/api/ctp/vnctptd.pyd differ
diff --git a/vnpy/api/ctp/vnctptd.so b/vnpy/api/ctp/vnctptd.so
index 275a4679..5f05806c 100644
Binary files a/vnpy/api/ctp/vnctptd.so and b/vnpy/api/ctp/vnctptd.so differ