diff --git a/vnpy/gateway/oes/md.py b/vnpy/gateway/oes/md.py index 8d2ac0ad..40116eba 100644 --- a/vnpy/gateway/oes/md.py +++ b/vnpy/gateway/oes/md.py @@ -3,7 +3,13 @@ from threading import Thread # noinspection PyUnresolvedReferences from typing import Any, Callable, Dict -from vnoes import * +from vnoes import MdsApiClientEnvT, MdsApi_DestoryAll, MdsApi_InitAllByConvention, \ + MdsApi_IsValidQryChannel, MdsApi_IsValidTcpChannel, MdsApi_LogoutAll, \ + MdsApi_SubscribeMarketData, MdsApi_WaitOnMsg, MdsL2StockSnapshotBodyT, MdsMktDataRequestEntryT, \ + MdsMktDataRequestReqT, MdsMktRspMsgBodyT, MdsStockSnapshotBodyT, SGeneralClientChannelT, \ + SMsgHeadT, SPlatform_IsNegEpipe, SPlatform_IsNegEtimeout, cast, eMdsExchangeIdT, \ + eMdsMktSubscribeFlagT, eMdsMsgTypeT, eMdsSecurityTypeT, eMdsSubscribeDataTypeT, \ + eMdsSubscribeModeT, eMdsSubscribedTickExpireTypeT, eSMsgProtocolTypeT from vnpy.trader.constant import Exchange from vnpy.trader.gateway import BaseGateway @@ -72,7 +78,7 @@ class OesMdMessageLoop: def on_message(self, session_info: SGeneralClientChannelT, head: SMsgHeadT, body: Any): - if session_info.protocolType == SMSG_PROTO_BINARY: + if session_info.protocolType == eSMsgProtocolTypeT.SMSG_PROTO_BINARY: b = cast.toMdsMktRspMsgBodyT(body) if head.msgId in self.message_handlers: # self.gateway.write_log( diff --git a/vnpy/gateway/oes/oes_gateway.py b/vnpy/gateway/oes/oes_gateway.py index bd9ae897..c2069f93 100644 --- a/vnpy/gateway/oes/oes_gateway.py +++ b/vnpy/gateway/oes/oes_gateway.py @@ -2,20 +2,14 @@ """ """ import hashlib -import json import os -from threading import Thread -from typing import Any, Callable, Dict - -import vnoes - -from .md import OesMdApi -from .td import OesTdApi from vnpy.trader.gateway import BaseGateway -from vnpy.trader.object import (CancelRequest, OrderRequest, SubscribeRequest, ContractData, - AccountData, PositionData, OrderData, TradeData, TickData) +from vnpy.trader.object import (AccountData, CancelRequest, ContractData, OrderData, OrderRequest, + PositionData, SubscribeRequest, TickData, TradeData) from vnpy.trader.utility import get_file_path +from .md import OesMdApi +from .td import OesTdApi from .utils import config_template @@ -117,4 +111,3 @@ class OesGateway(BaseGateway): self.md_api.stop() self.td_api.stop() pass - diff --git a/vnpy/gateway/oes/td.py b/vnpy/gateway/oes/td.py index 3b734a20..007ab1ad 100644 --- a/vnpy/gateway/oes/td.py +++ b/vnpy/gateway/oes/td.py @@ -1,11 +1,19 @@ -from copy import copy from dataclasses import dataclass from datetime import datetime from threading import Thread # noinspection PyUnresolvedReferences -from typing import Any, Callable, Dict +from typing import Any, Callable, Dict, Tuple -from vnoes import * +from vnoes import OesApiClientEnvT, OesApi_DestoryAll, OesApi_InitAllByConvention, \ + OesApi_IsValidOrdChannel, OesApi_IsValidQryChannel, OesApi_IsValidRptChannel, OesApi_LogoutAll, \ + OesApi_QueryCashAsset, OesApi_QueryEtf, OesApi_QueryIssue, OesApi_QueryOptHolding, \ + OesApi_QueryOption, OesApi_QueryOrder, OesApi_QueryStkHolding, OesApi_QueryStock, \ + OesApi_SendOrderCancelReq, OesApi_SendOrderReq, OesApi_WaitReportMsg, OesOrdCancelReqT, \ + OesOrdCnfmT, OesOrdRejectT, OesOrdReqT, OesQryCashAssetFilterT, OesQryCursorT, OesQryEtfFilterT, \ + OesQryIssueFilterT, OesQryOptionFilterT, OesQryOrdFilterT, OesQryStkHoldingFilterT, \ + OesQryStockFilterT, OesRspMsgBodyT, OesStockBaseInfoT, OesTrdCnfmT, SGeneralClientChannelT, \ + SMSG_PROTO_BINARY, SMsgHeadT, SPlatform_IsNegEpipe, SPlatform_IsNegEtimeout, cast, \ + eOesBuySellTypeT, eOesMarketIdT, eOesMsgTypeT, eOesOrdStatusT, eOesOrdTypeShT, eOesOrdTypeSzT from vnpy.gateway.oes.error_code import error_to_str from vnpy.trader.constant import Direction, Exchange, Offset, PriceType, Product, Status @@ -671,8 +679,8 @@ class OesTdApi: pass return - def schedule_query_order(self, internal_order: InternalOrder)->Thread: - th = Thread(target=self.query_order, args=(internal_order, )) + def schedule_query_order(self, internal_order: InternalOrder) -> Thread: + th = Thread(target=self.query_order, args=(internal_order,)) th.start() return th @@ -761,4 +769,3 @@ class OesTdApi: vt_order.traded = data.cumQty self.gateway.on_order(vt_order) return 1 -