From d007e44893df3f35b56a2beb773774f321ddadc5 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 3 Jun 2019 14:40:19 +0800 Subject: [PATCH] [Add] OesGateway: Added option to set customize IP and MAC [Fix] fixed: OesGateway cann't connect to ord channel --- vnpy/gateway/oes/oes_gateway.py | 4 ++++ vnpy/gateway/oes/oes_td.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vnpy/gateway/oes/oes_gateway.py b/vnpy/gateway/oes/oes_gateway.py index 14afc678..fd763782 100644 --- a/vnpy/gateway/oes/oes_gateway.py +++ b/vnpy/gateway/oes/oes_gateway.py @@ -37,6 +37,8 @@ class OesGateway(BaseGateway): "username": "", "password": "", "hdd_serial": "", + "customize_ip": "", + "customize_mac": "", } exchanges = list(EXCHANGE_VT2OES.keys()) @@ -90,6 +92,8 @@ class OesGateway(BaseGateway): self.td_api.rpt_server = setting['td_rpt_server'] self.td_api.qry_server = setting['td_qry_server'] self.td_api.hdd_serial = setting['hdd_serial'] + self.td_api.customize_ip = setting['customize_ip'] + self.td_api.customize_mac = setting['customize_mac'] Thread(target=self._connect_td_sync, args=( config_path, username, password)).start() diff --git a/vnpy/gateway/oes/oes_td.py b/vnpy/gateway/oes/oes_td.py index 151a2015..7a206db4 100644 --- a/vnpy/gateway/oes/oes_td.py +++ b/vnpy/gateway/oes/oes_td.py @@ -17,7 +17,8 @@ from vnpy.api.oes.vnoes import OesApiClientEnvT, OesApiSubscribeInfoT, OesApi_De OesQryOptionFilterT, OesQryOrdFilterT, OesQryStkHoldingFilterT, OesQryStockFilterT, \ OesRspMsgBodyT, OesStockBaseInfoT, OesTrdCnfmT, SGeneralClientChannelT, SMSG_PROTO_BINARY, \ SMsgHeadT, cast, eOesBuySellTypeT, eOesMarketIdT, eOesMsgTypeT, \ - eOesOrdStatusT, eOesOrdTypeShT, eOesOrdTypeSzT, eOesSubscribeReportTypeT + eOesOrdStatusT, eOesOrdTypeShT, eOesOrdTypeSzT, eOesSubscribeReportTypeT, \ + OesApi_SetCustomizedIpAndMac 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 @@ -310,6 +311,8 @@ class OesTdApi: self.username: str = '' self.password: str = '' self.hdd_serial: str = '' + self.customize_ip: str = '' + self.customize_mac: str = '' self.gateway = gateway @@ -332,6 +335,8 @@ class OesTdApi: """ OesApi_InitLogger(self.config_path, 'log') + OesApi_SetCustomizedIpAndMac(self.customize_ip, self.customize_mac) + OesApi_SetCustomizedDriverId(self.hdd_serial) if not self._connect_ord_channel():