vnpy/vn.tutorial/tick2trade/vn.trader_t2t/vtPath.py

25 lines
663 B
Python
Raw Normal View History

2016-12-07 11:56:01 +00:00
# encoding: UTF-8
"""
用于vn.trader的运行目录环境设置
"""
import os
import sys
# 将根目录路径添加到环境变量中
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
sys.path.append(ROOT_PATH)
# 将功能模块的目录路径添加到环境变量中
# 若各目录下存在同名文件可能导致异常,请注意测试
MODULE_PATH = {}
MODULE_PATH['CTA'] = os.path.join(ROOT_PATH, 'ctaAlgo')
MODULE_PATH['RM'] = os.path.join(ROOT_PATH, 'riskManager')
MODULE_PATH['DR'] = os.path.join(ROOT_PATH, 'dataRecorder')
# 添加到环境变量中
for path in MODULE_PATH.values():
if path not in sys.path:
sys.path.append(path)