From c7621cbfa3655629a05f30ef8dd61a342f0ec61c Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 16 Jul 2019 11:19:22 +0800 Subject: [PATCH] [Fix] bug when receiving empty offset flag --- vnpy/gateway/ctp/ctp_gateway.py | 2 +- vnpy/gateway/ctptest/ctptest_gateway.py | 2 +- vnpy/gateway/mini/mini_gateway.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vnpy/gateway/ctp/ctp_gateway.py b/vnpy/gateway/ctp/ctp_gateway.py index a4aa22f9..dacad210 100644 --- a/vnpy/gateway/ctp/ctp_gateway.py +++ b/vnpy/gateway/ctp/ctp_gateway.py @@ -447,7 +447,7 @@ class CtpTdApi(TdApi): exchange=exchange, orderid=orderid, direction=DIRECTION_CTP2VT[data["Direction"]], - offset=OFFSET_CTP2VT[data["CombOffsetFlag"]], + offset=OFFSET_CTP2VT.get(data["CombOffsetFlag"], Offset.NONE), price=data["LimitPrice"], volume=data["VolumeTotalOriginal"], status=Status.REJECTED, diff --git a/vnpy/gateway/ctptest/ctptest_gateway.py b/vnpy/gateway/ctptest/ctptest_gateway.py index 3b6bb51d..22aee478 100644 --- a/vnpy/gateway/ctptest/ctptest_gateway.py +++ b/vnpy/gateway/ctptest/ctptest_gateway.py @@ -446,7 +446,7 @@ class CtpTdApi(TdApi): exchange=exchange, orderid=orderid, direction=DIRECTION_CTP2VT[data["Direction"]], - offset=OFFSET_CTP2VT[data["CombOffsetFlag"]], + offset=OFFSET_CTP2VT.get(data["CombOffsetFlag"], Offset.NONE), price=data["LimitPrice"], volume=data["VolumeTotalOriginal"], status=Status.REJECTED, diff --git a/vnpy/gateway/mini/mini_gateway.py b/vnpy/gateway/mini/mini_gateway.py index c616be4d..ee1591bc 100644 --- a/vnpy/gateway/mini/mini_gateway.py +++ b/vnpy/gateway/mini/mini_gateway.py @@ -443,7 +443,7 @@ class MiniTdApi(TdApi): exchange=exchange, orderid=orderid, direction=DIRECTION_MINI2VT[data["Direction"]], - offset=OFFSET_MINI2VT[data["CombOffsetFlag"]], + offset=OFFSET_MINI2VT.get(data["CombOffsetFlag"], Offset.NONE), price=data["LimitPrice"], volume=data["VolumeTotalOriginal"], status=Status.REJECTED,