[Mod]connect dialog use chinese for setting key
This commit is contained in:
parent
e296a8098c
commit
4a309ac199
@ -67,12 +67,12 @@ class BitmexGateway(BaseGateway):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
default_setting = {
|
default_setting = {
|
||||||
"key": "",
|
"ID": "",
|
||||||
"secret": "",
|
"Secret": "",
|
||||||
"session_number": 3,
|
"会话数": 3,
|
||||||
"server": ["REAL", "TESTNET"],
|
"服务器": ["REAL", "TESTNET"],
|
||||||
"proxy_host": "127.0.0.1",
|
"代理地址": "127.0.0.1",
|
||||||
"proxy_port": 1080,
|
"代理端口": 1080,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, event_engine):
|
def __init__(self, event_engine):
|
||||||
@ -84,12 +84,12 @@ class BitmexGateway(BaseGateway):
|
|||||||
|
|
||||||
def connect(self, setting: dict):
|
def connect(self, setting: dict):
|
||||||
""""""
|
""""""
|
||||||
key = setting["key"]
|
key = setting["ID"]
|
||||||
secret = setting["secret"]
|
secret = setting["Secret"]
|
||||||
session_number = setting["session_number"]
|
session_number = setting["会话数"]
|
||||||
server = setting["server"]
|
server = setting["服务器"]
|
||||||
proxy_host = setting["proxy_host"]
|
proxy_host = setting["代理地址"]
|
||||||
proxy_port = setting["proxy_port"]
|
proxy_port = setting["代理端口"]
|
||||||
|
|
||||||
self.rest_api.connect(key, secret, session_number,
|
self.rest_api.connect(key, secret, session_number,
|
||||||
server, proxy_host, proxy_port)
|
server, proxy_host, proxy_port)
|
||||||
|
@ -125,13 +125,13 @@ class CtpGateway(BaseGateway):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
default_setting = {
|
default_setting = {
|
||||||
"userid": "",
|
"用户名": "",
|
||||||
"password": "",
|
"密码": "",
|
||||||
"brokerid": "",
|
"经纪商代码": 0,
|
||||||
"td_address": "",
|
"交易服务器": "",
|
||||||
"md_address": "",
|
"行情服务器": "",
|
||||||
"auth_code": "",
|
"产品名称": "",
|
||||||
"product_info": ""
|
"授权编码": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, event_engine):
|
def __init__(self, event_engine):
|
||||||
@ -143,13 +143,13 @@ class CtpGateway(BaseGateway):
|
|||||||
|
|
||||||
def connect(self, setting: dict):
|
def connect(self, setting: dict):
|
||||||
""""""
|
""""""
|
||||||
userid = setting["userid"]
|
userid = setting["用户名"]
|
||||||
password = setting["password"]
|
password = setting["密码"]
|
||||||
brokerid = setting["brokerid"]
|
brokerid = setting["经纪商代码"]
|
||||||
td_address = setting["td_address"]
|
td_address = setting["交易服务器"]
|
||||||
md_address = setting["md_address"]
|
md_address = setting["行情服务器"]
|
||||||
auth_code = setting["auth_code"]
|
product_info = setting["产品名称"]
|
||||||
product_info = setting["product_info"]
|
auth_code = setting["授权编码"]
|
||||||
|
|
||||||
if not td_address.startswith("tcp://"):
|
if not td_address.startswith("tcp://"):
|
||||||
td_address = "tcp://" + td_address
|
td_address = "tcp://" + td_address
|
||||||
|
@ -79,11 +79,11 @@ class FutuGateway(BaseGateway):
|
|||||||
""""""
|
""""""
|
||||||
|
|
||||||
default_setting = {
|
default_setting = {
|
||||||
"password": "",
|
"密码": "",
|
||||||
"host": "127.0.0.1",
|
"地址": "127.0.0.1",
|
||||||
"port": 11111,
|
"端口": 11111,
|
||||||
"market": ["HK", "US"],
|
"市场": ["HK", "US"],
|
||||||
"env": [TrdEnv.REAL, TrdEnv.SIMULATE],
|
"环境": [TrdEnv.REAL, TrdEnv.SIMULATE],
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, event_engine):
|
def __init__(self, event_engine):
|
||||||
@ -112,11 +112,11 @@ class FutuGateway(BaseGateway):
|
|||||||
|
|
||||||
def connect(self, setting: dict):
|
def connect(self, setting: dict):
|
||||||
""""""
|
""""""
|
||||||
self.host = setting["host"]
|
self.host = setting["地址"]
|
||||||
self.port = setting["port"]
|
self.port = setting["端口"]
|
||||||
self.market = setting["market"]
|
self.market = setting["市场"]
|
||||||
self.password = setting["password"]
|
self.password = setting["密码"]
|
||||||
self.env = setting["env"]
|
self.env = setting["环境"]
|
||||||
|
|
||||||
self.connect_quote()
|
self.connect_quote()
|
||||||
self.connect_trade()
|
self.connect_trade()
|
||||||
|
@ -110,7 +110,11 @@ ACCOUNTFIELD_IB2VT = {
|
|||||||
class IbGateway(BaseGateway):
|
class IbGateway(BaseGateway):
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
default_setting = {"host": "127.0.0.1", "port": 7497, "clientid": 1}
|
default_setting = {
|
||||||
|
"TWS地址": "127.0.0.1",
|
||||||
|
"TWS端口": 7497,
|
||||||
|
"客户号": 1
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, event_engine):
|
def __init__(self, event_engine):
|
||||||
""""""
|
""""""
|
||||||
@ -122,7 +126,11 @@ class IbGateway(BaseGateway):
|
|||||||
"""
|
"""
|
||||||
Start gateway connection.
|
Start gateway connection.
|
||||||
"""
|
"""
|
||||||
self.api.connect(setting)
|
host = setting["TWS地址"]
|
||||||
|
port = setting["TWS端口"]
|
||||||
|
clientid = setting["客户号"]
|
||||||
|
|
||||||
|
self.api.connect(host, port, clientid)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
@ -490,21 +498,17 @@ class IbApi(EWrapper):
|
|||||||
for account_code in accountsList.split(","):
|
for account_code in accountsList.split(","):
|
||||||
self.client.reqAccountUpdates(True, account_code)
|
self.client.reqAccountUpdates(True, account_code)
|
||||||
|
|
||||||
def connect(self, setting: dict):
|
def connect(self, host: str, port: int, clientid: int):
|
||||||
"""
|
"""
|
||||||
Connect to TWS.
|
Connect to TWS.
|
||||||
"""
|
"""
|
||||||
if self.status:
|
if self.status:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.clientid = setting["clientid"]
|
self.clientid = clientid
|
||||||
|
self.client.connect(host, port, clientid)
|
||||||
self.client.connect(
|
|
||||||
setting["host"], setting["port"], setting["clientid"])
|
|
||||||
|
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
# n = self.client.reqCurrentTime()
|
|
||||||
self.client.reqCurrentTime()
|
self.client.reqCurrentTime()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user