[Add] OesGateway: Added option to set customize IP and MAC

[Fix] fixed: OesGateway cann't connect to ord channel
This commit is contained in:
nanoric 2019-06-03 14:40:19 +08:00
parent 3b18570254
commit d007e44893
2 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,8 @@ class OesGateway(BaseGateway):
"username": "", "username": "",
"password": "", "password": "",
"hdd_serial": "", "hdd_serial": "",
"customize_ip": "",
"customize_mac": "",
} }
exchanges = list(EXCHANGE_VT2OES.keys()) exchanges = list(EXCHANGE_VT2OES.keys())
@ -90,6 +92,8 @@ class OesGateway(BaseGateway):
self.td_api.rpt_server = setting['td_rpt_server'] self.td_api.rpt_server = setting['td_rpt_server']
self.td_api.qry_server = setting['td_qry_server'] self.td_api.qry_server = setting['td_qry_server']
self.td_api.hdd_serial = setting['hdd_serial'] 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=( Thread(target=self._connect_td_sync, args=(
config_path, username, password)).start() config_path, username, password)).start()

View File

@ -17,7 +17,8 @@ from vnpy.api.oes.vnoes import OesApiClientEnvT, OesApiSubscribeInfoT, OesApi_De
OesQryOptionFilterT, OesQryOrdFilterT, OesQryStkHoldingFilterT, OesQryStockFilterT, \ OesQryOptionFilterT, OesQryOrdFilterT, OesQryStkHoldingFilterT, OesQryStockFilterT, \
OesRspMsgBodyT, OesStockBaseInfoT, OesTrdCnfmT, SGeneralClientChannelT, SMSG_PROTO_BINARY, \ OesRspMsgBodyT, OesStockBaseInfoT, OesTrdCnfmT, SGeneralClientChannelT, SMSG_PROTO_BINARY, \
SMsgHeadT, cast, eOesBuySellTypeT, eOesMarketIdT, eOesMsgTypeT, \ 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.error_code import error_to_str
from vnpy.gateway.oes.utils import create_remote_config, is_disconnected from vnpy.gateway.oes.utils import create_remote_config, is_disconnected
from vnpy.trader.constant import Direction, Exchange, Offset, OrderType, Product, Status from vnpy.trader.constant import Direction, Exchange, Offset, OrderType, Product, Status
@ -310,6 +311,8 @@ class OesTdApi:
self.username: str = '' self.username: str = ''
self.password: str = '' self.password: str = ''
self.hdd_serial: str = '' self.hdd_serial: str = ''
self.customize_ip: str = ''
self.customize_mac: str = ''
self.gateway = gateway self.gateway = gateway
@ -332,6 +335,8 @@ class OesTdApi:
""" """
OesApi_InitLogger(self.config_path, 'log') OesApi_InitLogger(self.config_path, 'log')
OesApi_SetCustomizedIpAndMac(self.customize_ip, self.customize_mac)
OesApi_SetCustomizedDriverId(self.hdd_serial) OesApi_SetCustomizedDriverId(self.hdd_serial)
if not self._connect_ord_channel(): if not self._connect_ord_channel():