From c01e7e9a4678d6255091bfff5967fdb64621136e Mon Sep 17 00:00:00 2001 From: nanoric Date: Fri, 14 Jun 2019 10:57:30 +0800 Subject: [PATCH 1/2] [Add] Tora: todo list --- vnpy/gateway/tora/td.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vnpy/gateway/tora/td.py b/vnpy/gateway/tora/td.py index 67990c5f..cbefb4a8 100644 --- a/vnpy/gateway/tora/td.py +++ b/vnpy/gateway/tora/td.py @@ -4,6 +4,7 @@ author: nanoric TODOS: * market price order @ SSE * market price order @ SZSE + * send_order @ sell * cancel_order @ local submitted * cancel_order @ non-local submitted * test of reconnection(am i need re-login?) From ef4976338147e503b6e5db271a130e639ec79a49 Mon Sep 17 00:00:00 2001 From: nanoric Date: Tue, 25 Jun 2019 14:58:57 +0800 Subject: [PATCH 2/2] [Add] tora_td: print detail about OnErrRtnOrderInsert, [Add] tora_td: ignore non-number OrderRef --- vnpy/gateway/tora/td.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vnpy/gateway/tora/td.py b/vnpy/gateway/tora/td.py index cbefb4a8..e435f9f1 100644 --- a/vnpy/gateway/tora/td.py +++ b/vnpy/gateway/tora/td.py @@ -178,14 +178,20 @@ class ToraTdSpi(CTORATstpTraderSpi): @_check_error(error_return=False, write_log=False, print_function_name=False) def OnErrRtnOrderInsert(self, info: CTORATstpInputOrderField, error_info: CTORATstpRspInfoField) -> None: - self._api.update_last_local_order_id(int(info.OrderRef)) + try: + self._api.update_last_local_order_id(int(info.OrderRef)) + except ValueError: + pass try: order_data = self.parse_order_field(info) except KeyError: + # no prints here because we don't care about insertion failure. return order_data.status = Status.REJECTED self.gateway.on_order(order_data) + self.gateway.write_log(f"拒单({order_data.orderid}):" + f"错误码:{error_info.ErrorID}, 错误消息:{error_info.ErrorMsg}") @_check_error(error_return=False, write_log=False, print_function_name=False) def OnErrRtnOrderAction(self, info: CTORATstpOrderActionField, @@ -199,7 +205,7 @@ class ToraTdSpi(CTORATstpTraderSpi): @_check_error() def OnRspOrderAction(self, info: CTORATstpInputOrderActionField, error_info: CTORATstpRspInfoField, request_id: int, is_last: bool) -> None: - pass + print("order action succeed!") @_check_error() def OnRspOrderInsert(self, info: CTORATstpInputOrderField,