diff --git a/vnpy/trader/ctaStrategy/ctaBacktesting.py b/vnpy/trader/ctaStrategy/ctaBacktesting.py index 80552a10..5b67f875 100644 --- a/vnpy/trader/ctaStrategy/ctaBacktesting.py +++ b/vnpy/trader/ctaStrategy/ctaBacktesting.py @@ -13,10 +13,11 @@ import multiprocessing import pymongo from vnpy.trader.vtGlobal import globalSetting -from ctaBase import * from vnpy.trader.vtConstant import * from vnpy.trader.vtGateway import VtOrderData, VtTradeData +from vnpy.trader.ctaStrategy.ctaBase import * + ######################################################################## class BacktestingEngine(object): diff --git a/vnpy/trader/ctaStrategy/ctaBase.py b/vnpy/trader/ctaStrategy/ctaBase.py index 981071b2..f00a8374 100644 --- a/vnpy/trader/ctaStrategy/ctaBase.py +++ b/vnpy/trader/ctaStrategy/ctaBase.py @@ -6,12 +6,6 @@ from __future__ import division - -# 把vn.trader根目录添加到python环境变量中 -import sys -sys.path.append('..') - - # 常量定义 # CTA引擎中涉及到的交易方向类型 CTAORDER_BUY = u'买开' diff --git a/vnpy/trader/ctaStrategy/ctaEngine.py b/vnpy/trader/ctaStrategy/ctaEngine.py index addd3101..fb244eec 100644 --- a/vnpy/trader/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/ctaStrategy/ctaEngine.py @@ -24,13 +24,14 @@ import traceback from collections import OrderedDict from datetime import datetime, timedelta -from ctaBase import * -from strategy import STRATEGY_CLASS -from vnpy.event import * +from vnpy.event import Event from vnpy.trader.vtEvent import * -from vtConstant import * -from vtGateway import VtSubscribeReq, VtOrderReq, VtCancelOrderReq, VtLogData -from vtFunction import todayDate +from vnpy.trader.vtConstant import * +from vnpy.trader.vtGateway import VtSubscribeReq, VtOrderReq, VtCancelOrderReq, VtLogData +from vnpy.trader.vtFunction import todayDate + +from vnpy.trader.ctaStrategy.ctaBase import * +from vnpy.trader.ctaStrategy.strategy import STRATEGY_CLASS ######################################################################## diff --git a/vnpy/trader/ctaStrategy/ctaHistoryData.py b/vnpy/trader/ctaStrategy/ctaHistoryData.py index 461575af..5e478159 100644 --- a/vnpy/trader/ctaStrategy/ctaHistoryData.py +++ b/vnpy/trader/ctaStrategy/ctaHistoryData.py @@ -8,14 +8,16 @@ """ from datetime import datetime, timedelta -import pymongo from time import time from multiprocessing.pool import ThreadPool +import pymongo + from vnpy.trader.vtGlobal import globalSetting -from ctaBase import * -from vtConstant import * -from datayesClient import DatayesClient +from vnpy.trader.vtConstant import * + +from vnpy.trader.ctaStrategy.ctaBase import * +from vnpy.trader.ctaStrategy.datayesClient import DatayesClient # 以下为vn.trader和通联数据规定的交易所代码映射 diff --git a/vnpy/trader/ctaStrategy/ctaTemplate.py b/vnpy/trader/ctaStrategy/ctaTemplate.py index dd2b1adc..40114f66 100644 --- a/vnpy/trader/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/ctaStrategy/ctaTemplate.py @@ -4,9 +4,9 @@ 本文件包含了CTA引擎中的策略开发用模板,开发策略时需要继承CtaTemplate类。 ''' -from ctaBase import * from vnpy.trader.vtConstant import * +from vnpy.trader.ctaStrategy.ctaBase import * ######################################################################## class CtaTemplate(object): diff --git a/vnpy/trader/ctaStrategy/strategy/strategyAtrRsi.py b/vnpy/trader/ctaStrategy/strategy/strategyAtrRsi.py index b9080b34..a81bc28d 100644 --- a/vnpy/trader/ctaStrategy/strategy/strategyAtrRsi.py +++ b/vnpy/trader/ctaStrategy/strategy/strategyAtrRsi.py @@ -239,7 +239,7 @@ class AtrRsiStrategy(CtaTemplate): if __name__ == '__main__': # 提供直接双击回测的功能 # 导入PyQt4的包是为了保证matplotlib使用PyQt4而不是PySide,防止初始化出错 - from ctaBacktesting import * + from vnpy.trader.ctaStrategy.ctaBacktesting import * from PyQt4 import QtCore, QtGui # 创建回测引擎 diff --git a/vnpy/trader/ctaStrategy/uiCtaWidget.py b/vnpy/trader/ctaStrategy/uiCtaWidget.py index 0964c857..8032aff6 100644 --- a/vnpy/trader/ctaStrategy/uiCtaWidget.py +++ b/vnpy/trader/ctaStrategy/uiCtaWidget.py @@ -6,8 +6,9 @@ CTA模块相关的GUI控制组件 from vnpy.event import Event -from uiBasicWidget import QtGui, QtCore, QtWidgets, BasicCell -from language import text +from vnpy.trader.uiBasicWidget import QtGui, QtCore, QtWidgets, BasicCell + +from vnpy.trader.ctaStrategy.language import text ######################################################################## diff --git a/vnpy/trader/dataRecorder/drBase.py b/vnpy/trader/dataRecorder/drBase.py index 85581d96..697bdfcf 100644 --- a/vnpy/trader/dataRecorder/drBase.py +++ b/vnpy/trader/dataRecorder/drBase.py @@ -20,7 +20,7 @@ MINUTE_DB_NAME = 'VnTrader_1Min_Db' # CTA引擎中涉及的数据类定义 -from vtConstant import EMPTY_UNICODE, EMPTY_STRING, EMPTY_FLOAT, EMPTY_INT +from vnpy.trader.vtConstant import EMPTY_UNICODE, EMPTY_STRING, EMPTY_FLOAT, EMPTY_INT ######################################################################## diff --git a/vnpy/trader/dataRecorder/drEngine.py b/vnpy/trader/dataRecorder/drEngine.py index 30a2b5dd..7fa89fcf 100644 --- a/vnpy/trader/dataRecorder/drEngine.py +++ b/vnpy/trader/dataRecorder/drEngine.py @@ -14,12 +14,13 @@ from datetime import datetime, timedelta from Queue import Queue from threading import Thread -from vnpy.event import * +from vnpy.event import Event from vnpy.trader.vtEvent import * -from vtGateway import VtSubscribeReq, VtLogData -from drBase import * -from vtFunction import todayDate -from language import text +from vnpy.trader.vtFunction import todayDate +from vnpy.trader.vtGateway import VtSubscribeReq, VtLogData + +from vnpy.trader.dataRecorder.drBase import * +from vnpy.trader.dataRecorder.language import text ######################################################################## diff --git a/vnpy/trader/dataRecorder/uiDrWidget.py b/vnpy/trader/dataRecorder/uiDrWidget.py index fbbcc202..114d7ea9 100644 --- a/vnpy/trader/dataRecorder/uiDrWidget.py +++ b/vnpy/trader/dataRecorder/uiDrWidget.py @@ -6,9 +6,9 @@ import json -from uiBasicWidget import QtWidgets, QtGui, QtCore -from vnpy.event import * -from language import text +from vnpy.event import Event +from vnpy.trader.uiBasicWidget import QtWidgets, QtGui, QtCore +from vnpy.trader.dataRecorder.language import text ######################################################################## diff --git a/vnpy/trader/gateway/cshshlpGateway/__init__.py b/vnpy/trader/gateway/cshshlpGateway/__init__.py index c65bbbd4..f61aa8e9 100644 --- a/vnpy/trader/gateway/cshshlpGateway/__init__.py +++ b/vnpy/trader/gateway/cshshlpGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from cshshlpGateway import CshshlpGateway as gateway gatewayName = 'CSHSHLP' diff --git a/vnpy/trader/gateway/ctpGateway/__init__.py b/vnpy/trader/gateway/ctpGateway/__init__.py index 79b58adf..7611d3ce 100644 --- a/vnpy/trader/gateway/ctpGateway/__init__.py +++ b/vnpy/trader/gateway/ctpGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from ctpGateway import CtpGateway as gateway gatewayName = 'CTP' diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index e3d580e2..55aa86c3 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -15,7 +15,7 @@ from datetime import datetime from vnpy.api.ctp import MdApi, TdApi, defineDict from vnpy.trader.vtGateway import * -from language import text +from vnpy.trader.gateway.ctpGateway.language import text # 以下为一些VT类型和CTP类型的映射字典 @@ -1458,29 +1458,3 @@ class CtpTdApi(TdApi): log.gatewayName = self.gatewayName log.logContent = content self.gateway.onLog(log) - - -#---------------------------------------------------------------------- -def test(): - """测试""" - from PyQt4 import QtCore - import sys - - def print_log(event): - log = event.dict_['data'] - print ':'.join([log.logTime, log.logContent]) - - app = QtCore.QCoreApplication(sys.argv) - - eventEngine = EventEngine() - eventEngine.register(EVENT_LOG, print_log) - eventEngine.start() - - gateway = CtpGateway(eventEngine) - gateway.connect() - - sys.exit(app.exec_()) - - -if __name__ == '__main__': - test() \ No newline at end of file diff --git a/vnpy/trader/gateway/femasGateway/__init__.py b/vnpy/trader/gateway/femasGateway/__init__.py index 2a6b12c8..7667deba 100644 --- a/vnpy/trader/gateway/femasGateway/__init__.py +++ b/vnpy/trader/gateway/femasGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from femasGateway import FemasGateway as gateway gatewayName = 'FEMAS' diff --git a/vnpy/trader/gateway/femasGateway/femasGateway.py b/vnpy/trader/gateway/femasGateway/femasGateway.py index 8b9c35cb..f5fdcbc3 100644 --- a/vnpy/trader/gateway/femasGateway/femasGateway.py +++ b/vnpy/trader/gateway/femasGateway/femasGateway.py @@ -11,7 +11,7 @@ import os import json from vnpy.api.femas import MdApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和CTP类型的映射字典 # 价格类型映射 @@ -947,35 +947,4 @@ class FemasTdApi(TdApi): #---------------------------------------------------------------------- def onRspQryInvestorMargin(self, data, error, n, last): """""" - pass - - -#---------------------------------------------------------------------- -def test(): - """测试""" - from PyQt4 import QtCore - import sys - - def print_log(event): - log = event.dict_['data'] - print ':'.join([log.logTime, log.logContent]) - - app = QtCore.QCoreApplication(sys.argv) - - eventEngine = EventEngine() - eventEngine.register(EVENT_LOG, print_log) - eventEngine.start() - - gateway = FemasGateway(eventEngine) - gateway.connect() - - sys.exit(app.exec_()) - -#---------------------------------------------------------------------- -def generateStrLocalID(localID): - """把整数的本地委托号转化为字符串""" - return str(localID).rjust(12, '0') - - -if __name__ == '__main__': - test() \ No newline at end of file + pass \ No newline at end of file diff --git a/vnpy/trader/gateway/huobiGateway/__init__.py b/vnpy/trader/gateway/huobiGateway/__init__.py index 2876dbfa..72f61805 100644 --- a/vnpy/trader/gateway/huobiGateway/__init__.py +++ b/vnpy/trader/gateway/huobiGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from huobiGateway import HuobiGateway as gateway gatewayName = 'HUOBI' diff --git a/vnpy/trader/gateway/huobiGateway/huobiGateway.py b/vnpy/trader/gateway/huobiGateway/huobiGateway.py index 878ec54b..d84fee10 100644 --- a/vnpy/trader/gateway/huobiGateway/huobiGateway.py +++ b/vnpy/trader/gateway/huobiGateway/huobiGateway.py @@ -14,7 +14,7 @@ from Queue import Queue from threading import Thread from vnpy.api.huobi import vnhuobi -from vtGateway import * +from vnpy.trader.vtGateway import * SYMBOL_BTCCNY = 'BTCCNY' diff --git a/vnpy/trader/gateway/ibGateway/__init__.py b/vnpy/trader/gateway/ibGateway/__init__.py index 446a4dea..a30f33cf 100644 --- a/vnpy/trader/gateway/ibGateway/__init__.py +++ b/vnpy/trader/gateway/ibGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from ibGateway import IbGateway as gateway gatewayName = 'IB' diff --git a/vnpy/trader/gateway/ibGateway/ibGateway.py b/vnpy/trader/gateway/ibGateway/ibGateway.py index 0dbb59b1..880768b0 100644 --- a/vnpy/trader/gateway/ibGateway/ibGateway.py +++ b/vnpy/trader/gateway/ibGateway/ibGateway.py @@ -18,8 +18,8 @@ from datetime import datetime, timedelta from copy import copy from vnpy.api.ib import * -from vtGateway import * -from language import text +from vnpy.trader.vtGateway import * +from vnpy.trader.gateway.ibGateway.language import text # 以下为一些VT类型和CTP类型的映射字典 diff --git a/vnpy/trader/gateway/ksgoldGateway/__init__.py b/vnpy/trader/gateway/ksgoldGateway/__init__.py index 05889e8a..3d2cfeca 100644 --- a/vnpy/trader/gateway/ksgoldGateway/__init__.py +++ b/vnpy/trader/gateway/ksgoldGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from ksgoldGateway import KsgoldGateway as gateway gatewayName = 'KSGOLD' diff --git a/vnpy/trader/gateway/ksgoldGateway/ksgoldGateway.py b/vnpy/trader/gateway/ksgoldGateway/ksgoldGateway.py index b245b0c6..80f22f91 100644 --- a/vnpy/trader/gateway/ksgoldGateway/ksgoldGateway.py +++ b/vnpy/trader/gateway/ksgoldGateway/ksgoldGateway.py @@ -12,7 +12,7 @@ import json import time from vnpy.api.ksgold import TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下类型映射参考的是原生API里的Constant.h diff --git a/vnpy/trader/gateway/ksotpGateway/__init__.py b/vnpy/trader/gateway/ksotpGateway/__init__.py index 7d7f8e6c..1997ecdb 100644 --- a/vnpy/trader/gateway/ksotpGateway/__init__.py +++ b/vnpy/trader/gateway/ksotpGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from ksotpGateway import KsotpGateway as gateway gatewayName = 'KSOTP' diff --git a/vnpy/trader/gateway/ksotpGateway/ksotpGateway.py b/vnpy/trader/gateway/ksotpGateway/ksotpGateway.py index e90c5a63..eca058de 100644 --- a/vnpy/trader/gateway/ksotpGateway/ksotpGateway.py +++ b/vnpy/trader/gateway/ksotpGateway/ksotpGateway.py @@ -9,7 +9,7 @@ import os import json from vnpy.api.ksotp import MdApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和CTP类型的映射字典 # 价格类型映射 @@ -1810,32 +1810,3 @@ class KsotpTdApi(TdApi): """""" pass - - - - - -#---------------------------------------------------------------------- -def test(): - """测试""" - from PyQt4 import QtCore - import sys - - def print_log(event): - log = event.dict_['data'] - print ':'.join([log.logTime, log.logContent]) - - app = QtCore.QCoreApplication(sys.argv) - - eventEngine = EventEngine() - eventEngine.register(EVENT_LOG, print_log) - eventEngine.start() - - gateway = KsotpGateway(eventEngine) - gateway.connect() - - sys.exit(app.exec_()) - - -if __name__ == '__main__': - test() \ No newline at end of file diff --git a/vnpy/trader/gateway/lhangGateway/__init__.py b/vnpy/trader/gateway/lhangGateway/__init__.py index 2c73b60e..f7e46d31 100644 --- a/vnpy/trader/gateway/lhangGateway/__init__.py +++ b/vnpy/trader/gateway/lhangGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from lhangGateway import LhangGateway as gateway gatewayName = 'LHANG' diff --git a/vnpy/trader/gateway/lhangGateway/lhangGateway.py b/vnpy/trader/gateway/lhangGateway/lhangGateway.py index 18bf1d90..d8d250b8 100644 --- a/vnpy/trader/gateway/lhangGateway/lhangGateway.py +++ b/vnpy/trader/gateway/lhangGateway/lhangGateway.py @@ -11,7 +11,7 @@ from datetime import datetime from time import sleep from vnpy.api.lhang import LhangApi -from vtGateway import * +from vnpy.trader.vtGateway import * SYMBOL_BTCCNY = 'BTCCNY' diff --git a/vnpy/trader/gateway/ltsGateway/__init__.py b/vnpy/trader/gateway/ltsGateway/__init__.py index a641bea7..78a0ad1f 100644 --- a/vnpy/trader/gateway/ltsGateway/__init__.py +++ b/vnpy/trader/gateway/ltsGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from ltsGateway import LtsGateway as gateway gatewayName = 'LTS' diff --git a/vnpy/trader/gateway/ltsGateway/ltsGateway.py b/vnpy/trader/gateway/ltsGateway/ltsGateway.py index d1f2953c..89882951 100644 --- a/vnpy/trader/gateway/ltsGateway/ltsGateway.py +++ b/vnpy/trader/gateway/ltsGateway/ltsGateway.py @@ -8,7 +8,7 @@ import os import json from vnpy.api.lts import MdApi, QryApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和LTS类型的映射字典 diff --git a/vnpy/trader/gateway/oandaGateway/__init__.py b/vnpy/trader/gateway/oandaGateway/__init__.py index 930fa53e..f1b72302 100644 --- a/vnpy/trader/gateway/oandaGateway/__init__.py +++ b/vnpy/trader/gateway/oandaGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from oandaGateway import OandaGateway as gateway gatewayName = 'OANDA' diff --git a/vnpy/trader/gateway/oandaGateway/oandaGateway.py b/vnpy/trader/gateway/oandaGateway/oandaGateway.py index 03bc35c9..f4e52bac 100644 --- a/vnpy/trader/gateway/oandaGateway/oandaGateway.py +++ b/vnpy/trader/gateway/oandaGateway/oandaGateway.py @@ -25,7 +25,7 @@ import json import datetime from vnpy.api.oanda import OandaApi -from vtGateway import * +from vnpy.trader.vtGateway import * # 价格类型映射 priceTypeMap = {} diff --git a/vnpy/trader/gateway/okcoinGateway/__init__.py b/vnpy/trader/gateway/okcoinGateway/__init__.py index 5d907ab7..b3cc11ce 100644 --- a/vnpy/trader/gateway/okcoinGateway/__init__.py +++ b/vnpy/trader/gateway/okcoinGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from okcoinGateway import OkcoinGateway as gateway gatewayName = 'OKCOIN' diff --git a/vnpy/trader/gateway/okcoinGateway/okcoinGateway.py b/vnpy/trader/gateway/okcoinGateway/okcoinGateway.py index 47da399c..2791c49f 100644 --- a/vnpy/trader/gateway/okcoinGateway/okcoinGateway.py +++ b/vnpy/trader/gateway/okcoinGateway/okcoinGateway.py @@ -17,7 +17,7 @@ from Queue import Queue from threading import Thread from vnpy.api.okcoin import vnokcoin -from vtGateway import * +from vnpy.trader.vtGateway import * # 价格类型映射 priceTypeMap = {} diff --git a/vnpy/trader/gateway/qdpGateway/__init__.py b/vnpy/trader/gateway/qdpGateway/__init__.py index 87b2373b..39634486 100644 --- a/vnpy/trader/gateway/qdpGateway/__init__.py +++ b/vnpy/trader/gateway/qdpGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from qdpGateway import QdpGateway as gateway gatewayName = 'QDP' diff --git a/vnpy/trader/gateway/qdpGateway/qdpGateway.py b/vnpy/trader/gateway/qdpGateway/qdpGateway.py index 6ee3086f..fe00f708 100644 --- a/vnpy/trader/gateway/qdpGateway/qdpGateway.py +++ b/vnpy/trader/gateway/qdpGateway/qdpGateway.py @@ -14,7 +14,7 @@ import datetime from copy import copy from vnpy.api.qdp import MdApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和QDP类型的映射字典 diff --git a/vnpy/trader/gateway/sgitGateway/__init__.py b/vnpy/trader/gateway/sgitGateway/__init__.py index 33711d21..ec447058 100644 --- a/vnpy/trader/gateway/sgitGateway/__init__.py +++ b/vnpy/trader/gateway/sgitGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from sgitGateway import SgitGateway as gateway gatewayName = 'SGIT' diff --git a/vnpy/trader/gateway/sgitGateway/sgitGateway.py b/vnpy/trader/gateway/sgitGateway/sgitGateway.py index 248467d4..35129f74 100644 --- a/vnpy/trader/gateway/sgitGateway/sgitGateway.py +++ b/vnpy/trader/gateway/sgitGateway/sgitGateway.py @@ -14,7 +14,7 @@ from copy import copy from datetime import datetime from vnpy.api.sgit import MdApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和SGIT类型的映射字典 @@ -1410,30 +1410,4 @@ class PositionBuffer(object): #---------------------------------------------------------------------- def getPos(self): """获取当前的持仓数据""" - return copy(self.pos) - - -#---------------------------------------------------------------------- -def test(): - """测试""" - from PyQt4 import QtCore - import sys - - def print_log(event): - log = event.dict_['data'] - print ':'.join([log.logTime, log.logContent]) - - app = QtCore.QCoreApplication(sys.argv) - - eventEngine = EventEngine() - eventEngine.register(EVENT_LOG, print_log) - eventEngine.start() - - gateway = SgitGateway(eventEngine) - gateway.connect() - - sys.exit(app.exec_()) - - -if __name__ == '__main__': - test() \ No newline at end of file + return copy(self.pos) \ No newline at end of file diff --git a/vnpy/trader/gateway/shzdGateway/__init__.py b/vnpy/trader/gateway/shzdGateway/__init__.py index d4f2d684..6650ba8c 100644 --- a/vnpy/trader/gateway/shzdGateway/__init__.py +++ b/vnpy/trader/gateway/shzdGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from shzdGateway import ShzdGateway as gateway gatewayName = 'SHZD' diff --git a/vnpy/trader/gateway/shzdGateway/shzdGateway.py b/vnpy/trader/gateway/shzdGateway/shzdGateway.py index 8649fb69..02b22041 100644 --- a/vnpy/trader/gateway/shzdGateway/shzdGateway.py +++ b/vnpy/trader/gateway/shzdGateway/shzdGateway.py @@ -16,7 +16,7 @@ from copy import copy from datetime import datetime from vnpy.api.shzd import ShzdApi -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和SHZD类型的映射字典 diff --git a/vnpy/trader/gateway/windGateway/__init__.py b/vnpy/trader/gateway/windGateway/__init__.py index 359d510a..550df75a 100644 --- a/vnpy/trader/gateway/windGateway/__init__.py +++ b/vnpy/trader/gateway/windGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from windGateway import WindGateway as gateway gatewayName = 'WIND' diff --git a/vnpy/trader/gateway/windGateway/windGateway.py b/vnpy/trader/gateway/windGateway/windGateway.py index 53d90653..30c5d4bd 100644 --- a/vnpy/trader/gateway/windGateway/windGateway.py +++ b/vnpy/trader/gateway/windGateway/windGateway.py @@ -11,7 +11,7 @@ try: except ImportError: print u'请先安装WindPy接口' -from vtGateway import * +from vnpy.trader.vtGateway import * # 交易所类型映射 exchangeMap = {} diff --git a/vnpy/trader/gateway/xspeedGateway/__init__.py b/vnpy/trader/gateway/xspeedGateway/__init__.py index a5e55506..3443792a 100644 --- a/vnpy/trader/gateway/xspeedGateway/__init__.py +++ b/vnpy/trader/gateway/xspeedGateway/__init__.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -import vtConstant +from vnpy.trader import vtConstant from xspeedGateway import XspeedGateway as gateway gatewayName = 'XSPEED' diff --git a/vnpy/trader/gateway/xspeedGateway/xspeedGateway.py b/vnpy/trader/gateway/xspeedGateway/xspeedGateway.py index 65ea4307..ae913eab 100644 --- a/vnpy/trader/gateway/xspeedGateway/xspeedGateway.py +++ b/vnpy/trader/gateway/xspeedGateway/xspeedGateway.py @@ -10,7 +10,7 @@ import time from copy import copy from vnpy.api.xspeed import MdApi, TdApi, defineDict -from vtGateway import * +from vnpy.trader.vtGateway import * # 以下为一些VT类型和XSPEED类型的映射字典 # 价格类型映射 diff --git a/vnpy/trader/riskManager/rmEngine.py b/vnpy/trader/riskManager/rmEngine.py index a2441931..3f5fd118 100644 --- a/vnpy/trader/riskManager/rmEngine.py +++ b/vnpy/trader/riskManager/rmEngine.py @@ -11,10 +11,10 @@ import json import os import platform -from vnpy.event import * +from vnpy.event import Event from vnpy.trader.vtEvent import * -from vtConstant import * -from vtGateway import VtLogData +from vnpy.trader.vtConstant import * +from vnpy.trader.vtGateway import VtLogData ######################################################################## diff --git a/vnpy/trader/riskManager/uiRmWidget.py b/vnpy/trader/riskManager/uiRmWidget.py index ade41c09..c10559e0 100644 --- a/vnpy/trader/riskManager/uiRmWidget.py +++ b/vnpy/trader/riskManager/uiRmWidget.py @@ -5,9 +5,10 @@ ''' -from uiBasicWidget import QtGui, QtWidgets, QtCore -from vnpy.event import * -from language import text +from vnpy.event import Event + +from vnpy.trader.uiBasicWidget import QtGui, QtWidgets, QtCore +from vnpy.trader.riskManager.language import text ######################################################################## diff --git a/vnpy/trader/uiBasicWidget.py b/vnpy/trader/uiBasicWidget.py index 6f02f910..e04c39de 100644 --- a/vnpy/trader/uiBasicWidget.py +++ b/vnpy/trader/uiBasicWidget.py @@ -5,14 +5,13 @@ import csv import os from collections import OrderedDict -#from PyQt4 import QtGui, QtCore from qtpy import QtWidgets, QtGui, QtCore from vnpy.event import * from vnpy.trader.vtEvent import * -from vtFunction import * -from vtGateway import * -import vtText +from vnpy.trader.vtFunction import * +from vnpy.trader.vtGateway import * +from vnpy.trader import vtText as vtText COLOR_RED = QtGui.QColor('red') diff --git a/vnpy/trader/uiMainWindow.py b/vnpy/trader/uiMainWindow.py index e7a6bf95..1abc5c50 100644 --- a/vnpy/trader/uiMainWindow.py +++ b/vnpy/trader/uiMainWindow.py @@ -2,11 +2,11 @@ import psutil -from gateway import GATEWAY_DICT -from uiBasicWidget import * -from ctaStrategy.uiCtaWidget import CtaEngineManager -from dataRecorder.uiDrWidget import DrEngineManager -from riskManager.uiRmWidget import RmEngineManager +from vnpy.trader.gateway import GATEWAY_DICT +from vnpy.trader.uiBasicWidget import * +from vnpy.trader.ctaStrategy.uiCtaWidget import CtaEngineManager +from vnpy.trader.dataRecorder.uiDrWidget import DrEngineManager +from vnpy.trader.riskManager.uiRmWidget import RmEngineManager ######################################################################## diff --git a/vnpy/trader/vtClient.py b/vnpy/trader/vtClient.py index 65672293..a3e9f25d 100644 --- a/vnpy/trader/vtClient.py +++ b/vnpy/trader/vtClient.py @@ -11,9 +11,9 @@ from uiMainWindow import * from vnpy.event import EventEngine from vnpy.rpc import RpcClient -from ctaStrategy.ctaEngine import CtaEngine -from dataRecorder.drEngine import DrEngine -from riskManager.rmEngine import RmEngine +from vnpy.trader.ctaStrategy.ctaEngine import CtaEngine +from vnpy.trader.dataRecorder.drEngine import DrEngine +from vnpy.trader.riskManager.rmEngine import RmEngine diff --git a/vnpy/trader/vtConstant.py b/vnpy/trader/vtConstant.py index 266dd0d9..be0269ef 100644 --- a/vnpy/trader/vtConstant.py +++ b/vnpy/trader/vtConstant.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -from language import constant +from vnpy.trader.language import constant # 将常量定义添加到vtConstant.py的局部字典中 d = locals() diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py index 1d39617b..9f1ad7b2 100644 --- a/vnpy/trader/vtEngine.py +++ b/vnpy/trader/vtEngine.py @@ -7,16 +7,16 @@ from datetime import datetime from pymongo import MongoClient from pymongo.errors import ConnectionFailure -from vnpy.trader.vtGlobal import globalSetting from vnpy.event import * +from vnpy.trader.vtGlobal import globalSetting from vnpy.trader.vtEvent import * -from vtGateway import * -from language import text +from vnpy.trader.vtGateway import * +from vnpy.trader.language import text -from gateway import GATEWAY_DICT -from ctaStrategy.ctaEngine import CtaEngine -from dataRecorder.drEngine import DrEngine -from riskManager.rmEngine import RmEngine +from vnpy.trader.gateway import GATEWAY_DICT +from vnpy.trader.ctaStrategy.ctaEngine import CtaEngine +from vnpy.trader.dataRecorder.drEngine import DrEngine +from vnpy.trader.riskManager.rmEngine import RmEngine ######################################################################## @@ -86,7 +86,7 @@ class MainEngine(object): # 接口连接后自动执行数据库连接的任务 #self.dbConnect() - + #---------------------------------------------------------------------- def subscribe(self, subscribeReq, gatewayName): """订阅特定接口的行情""" @@ -94,7 +94,7 @@ class MainEngine(object): if gateway: gateway.subscribe(subscribeReq) - + #---------------------------------------------------------------------- def sendOrder(self, orderReq, gatewayName): """对特定接口发单""" @@ -116,7 +116,7 @@ class MainEngine(object): if gateway: gateway.cancelOrder(cancelOrderReq) - + #---------------------------------------------------------------------- def qryAccount(self, gatewayName): """查询特定接口的账户""" diff --git a/vnpy/trader/vtGateway.py b/vnpy/trader/vtGateway.py index a22fe3a7..5e63cc67 100644 --- a/vnpy/trader/vtGateway.py +++ b/vnpy/trader/vtGateway.py @@ -3,10 +3,10 @@ import time from vnpy.event import * -from vnpy.trader.vtEvent import * -from vtConstant import * -from vtObject import * +from vnpy.trader.vtEvent import * +from vnpy.trader.vtConstant import * +from vnpy.trader.vtObject import * ######################################################################## diff --git a/vnpy/trader/vtMain.py b/vnpy/trader/vtMain.py index 28313623..61d5a83d 100644 --- a/vnpy/trader/vtMain.py +++ b/vnpy/trader/vtMain.py @@ -4,7 +4,6 @@ import sys import os import platform -#from PyQt4 import QtGui, QtCore from qtpy import QtWidgets, QtGui from vnpy.trader.vtGlobal import globalSetting diff --git a/vnpy/trader/vtObject.py b/vnpy/trader/vtObject.py index 5f118f74..e6f97a96 100644 --- a/vnpy/trader/vtObject.py +++ b/vnpy/trader/vtObject.py @@ -2,7 +2,7 @@ import time -from vtConstant import * +from vnpy.trader.vtConstant import EMPTY_STRING, EMPTY_UNICODE, EMPTY_FLOAT, EMPTY_INT ######################################################################## diff --git a/vnpy/trader/vtServer.py b/vnpy/trader/vtServer.py index faed0253..1290e0df 100644 --- a/vnpy/trader/vtServer.py +++ b/vnpy/trader/vtServer.py @@ -8,7 +8,7 @@ from time import sleep from threading import Thread from vnpy.rpc import RpcServer -from vtEngine import MainEngine +from vnpy.trader.vtEngine import MainEngine ######################################################################## diff --git a/vnpy/trader/vtText.py b/vnpy/trader/vtText.py index d9ea0eea..77863483 100644 --- a/vnpy/trader/vtText.py +++ b/vnpy/trader/vtText.py @@ -1,6 +1,6 @@ # encoding: UTF-8 -from language import text +from vnpy.trader.language import text # 将常量定义添加到vtText.py的局部字典中 d = locals()