diff --git a/vnpy/gateway/bitmex/bitmex_gateway.py b/vnpy/gateway/bitmex/bitmex_gateway.py index 3c3e6879..11579c4b 100644 --- a/vnpy/gateway/bitmex/bitmex_gateway.py +++ b/vnpy/gateway/bitmex/bitmex_gateway.py @@ -71,8 +71,8 @@ class BitmexGateway(BaseGateway): "Secret": "", "会话数": 3, "服务器": ["REAL", "TESTNET"], - "代理地址": "127.0.0.1", - "代理端口": 1080, + "代理地址": "", + "代理端口": "", } def __init__(self, event_engine): @@ -91,6 +91,11 @@ class BitmexGateway(BaseGateway): proxy_host = setting["代理地址"] proxy_port = setting["代理端口"] + if proxy_port.isdigit(): + proxy_port = int(proxy_port) + else: + proxy_port = 0 + self.rest_api.connect(key, secret, session_number, server, proxy_host, proxy_port) diff --git a/vnpy/gateway/huobi/huobi_gateway.py b/vnpy/gateway/huobi/huobi_gateway.py index 2123fc2b..474e6f69 100644 --- a/vnpy/gateway/huobi/huobi_gateway.py +++ b/vnpy/gateway/huobi/huobi_gateway.py @@ -73,8 +73,8 @@ class HuobiGateway(BaseGateway): "API Key": "", "Secret Key": "", "会话数": 3, - "代理地址": "127.0.0.1", - "代理端口": 1080, + "代理地址": "", + "代理端口": "", } def __init__(self, event_engine): @@ -95,6 +95,11 @@ class HuobiGateway(BaseGateway): proxy_host = setting["代理地址"] proxy_port = setting["代理端口"] + if proxy_port.isdigit(): + proxy_port = int(proxy_port) + else: + proxy_port = 0 + self.rest_api.connect(key, secret, session_number, proxy_host, proxy_port) self.trade_ws_api.connect(key, secret, proxy_host, proxy_port) diff --git a/vnpy/gateway/okex/okex_gateway.py b/vnpy/gateway/okex/okex_gateway.py index 4a1b2a93..ded30c13 100644 --- a/vnpy/gateway/okex/okex_gateway.py +++ b/vnpy/gateway/okex/okex_gateway.py @@ -74,8 +74,8 @@ class OkexGateway(BaseGateway): "Secret Key": "", "Passphrase": "", "会话数": 3, - "代理地址": "127.0.0.1", - "代理端口": 1080, + "代理地址": "", + "代理端口": "", } def __init__(self, event_engine): @@ -94,9 +94,13 @@ class OkexGateway(BaseGateway): proxy_host = setting["代理地址"] proxy_port = setting["代理端口"] + if proxy_port.isdigit(): + proxy_port = int(proxy_port) + else: + proxy_port = 0 + self.rest_api.connect(key, secret, passphrase, session_number, proxy_host, proxy_port) - self.ws_api.connect(key, secret, passphrase, proxy_host, proxy_port) def subscribe(self, req: SubscribeRequest):