尝试获取用户目录下的 hosts.py 作为通达信服务器配置

This commit is contained in:
fasiondog 2024-01-27 22:01:17 +08:00
parent 7dafe8fe83
commit a8462b1982

View File

@ -27,24 +27,20 @@ from concurrent import futures
from pytdx.hq import TdxHq_API
from pytdx.config.hosts import hq_hosts
# hq_hosts = [
# ('上海双线主站1', '47.103.48.45', 7709),
# ('上海双线主站2', '47.103.86.229', 7709),
# ('上海双线主站3', '47.103.88.146', 7709),
# ('上海电信主站z1', '180.153.18.170', 7709),
# ('上海电信主站z2', '180.153.18.171', 7709),
# ('上海电信主站z3', '180.153.39.51', 7709),
# ('上海电信主站z4', '58.34.106.207', 7709),
# ('上海移动主站z1', '120.253.221.207', 7709),
# ('上海电信主站z80', '180.153.18.172', 7709),
# ('深圳双线主站1', '120.79.60.82', 7709),
# ('深圳双线主站2', '47.112.129.66', 7709),
# ('北京双线主站1', '39.98.234.173', 7709),
# ('北京双线主站2', '39.98.198.249', 7709),
# ('北京双线主站3', '39.100.68.59', 7709),
# ('北京联通主站z1', '202.108.254.67', 7709),
# ('北京移动主站z1', '111.13.112.206', 7709),
# ]
try:
# Try to get the hosts configuration in the user directory
import os
import sys
import importlib
config_path = "{}/.hikyuu".format(os.path.expanduser('~'))
host_file = f"{config_path}/hosts.py"
if os.path.exists(host_file):
if config_path not in sys.path:
sys.path.append(config_path)
tmp = importlib.import_module(f'hosts')
hq_hosts = tmp.hq_hosts
except:
pass
def to_pytdx_market(market):