From 6ceacc94c1f2a1f54404f5196e5abef2ba47ed40 Mon Sep 17 00:00:00 2001 From: nanoric Date: Fri, 22 Mar 2019 04:12:19 -0400 Subject: [PATCH] [Add] oes: added order_type to OrderData. --- vnpy/gateway/oes/oes_gateway.py | 1 + vnpy/gateway/oes/oes_td.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vnpy/gateway/oes/oes_gateway.py b/vnpy/gateway/oes/oes_gateway.py index fe7219bb..78701b05 100644 --- a/vnpy/gateway/oes/oes_gateway.py +++ b/vnpy/gateway/oes/oes_gateway.py @@ -1,5 +1,6 @@ # encoding: UTF-8 """ +Author: nanoric """ import hashlib import os diff --git a/vnpy/gateway/oes/oes_td.py b/vnpy/gateway/oes/oes_td.py index dadc40fc..e6aef6fa 100644 --- a/vnpy/gateway/oes/oes_td.py +++ b/vnpy/gateway/oes/oes_td.py @@ -18,7 +18,6 @@ from vnpy.api.oes.vnoes import OesApiClientEnvT, OesApiSubscribeInfoT, OesApi_De OesRspMsgBodyT, OesStockBaseInfoT, OesTrdCnfmT, SGeneralClientChannelT, SMSG_PROTO_BINARY, \ SMsgHeadT, cast, eOesBuySellTypeT, eOesMarketIdT, eOesMsgTypeT, \ eOesOrdStatusT, eOesOrdTypeShT, eOesOrdTypeSzT, eOesSubscribeReportTypeT - from vnpy.gateway.oes.error_code import error_to_str from vnpy.gateway.oes.utils import create_remote_config, is_disconnected from vnpy.trader.constant import Direction, Exchange, Offset, OrderType, Product, Status @@ -44,6 +43,10 @@ ORDER_TYPE_VT2OES = { (Exchange.SSE, OrderType.LIMIT): eOesOrdTypeShT.OES_ORD_TYPE_SH_LMT, (Exchange.SZSE, OrderType.LIMIT): eOesOrdTypeSzT.OES_ORD_TYPE_SZ_LMT, } +ORDER_TYPE_OES2VT = { + (eOesMarketIdT.OES_MKT_SH_ASHARE, eOesOrdTypeShT.OES_ORD_TYPE_SH_LMT): OrderType.LIMIT, + (eOesMarketIdT.OES_MKT_SZ_ASHARE, eOesOrdTypeSzT.OES_ORD_TYPE_SZ_LMT): OrderType.LIMIT, +} BUY_SELL_TYPE_VT2OES = { (Exchange.SSE, Offset.OPEN, Direction.LONG): eOesBuySellTypeT.OES_BS_TYPE_BUY, @@ -737,12 +740,14 @@ class OesTdApi: symbol=data.securityId, exchange=EXCHANGE_OES2VT[data.mktId], orderid=str(order_id if order_id else data.origClSeqNo), # generated id + type=ORDER_TYPE_OES2VT[(data.mktId, data.ordType)], direction=Direction.NET, offset=offset, price=data.ordPrice / 10000, volume=data.ordQty - data.canceledQty, traded=data.cumQty, - status=STATUS_OES2VT[data.ordStatus], + status=STATUS_OES2VT[ + data.ordStatus], # this time should be generated automatically or by a static function time=datetime.utcnow().isoformat(),