[Fix] add ssl support for ctp_gateway/ctptest_gateway, close #1997

This commit is contained in:
vn.py 2019-09-30 11:46:35 +08:00
parent 142253c621
commit ad38cd2215
2 changed files with 18 additions and 4 deletions

View File

@ -155,9 +155,16 @@ class CtpGateway(BaseGateway):
auth_code = setting["授权编码"]
product_info = setting["产品信息"]
if not td_address.startswith("tcp://"):
if (
(not td_address.startswith("tcp://")) and
(not td_address.startswith("ssl://"))
):
td_address = "tcp://" + td_address
if not md_address.startswith("tcp://"):
if (
(not md_address.startswith("tcp://")) and
(not md_address.startswith("ssl://"))
):
md_address = "tcp://" + md_address
self.td_api.connect(td_address, userid, password, brokerid, auth_code, appid, product_info)

View File

@ -155,9 +155,16 @@ class CtptestGateway(BaseGateway):
auth_code = setting["授权编码"]
product_info = setting["产品信息"]
if not td_address.startswith("tcp://"):
if (
(not td_address.startswith("tcp://")) and
(not td_address.startswith("ssl://"))
):
td_address = "tcp://" + td_address
if not md_address.startswith("tcp://"):
if (
(not md_address.startswith("tcp://")) and
(not md_address.startswith("ssl://"))
):
md_address = "tcp://" + md_address
self.td_api.connect(td_address, userid, password, brokerid, auth_code, appid, product_info)