diff --git a/examples/VnTrader/run.py b/examples/VnTrader/run.py index e9bf3d04..ab85e27b 100644 --- a/examples/VnTrader/run.py +++ b/examples/VnTrader/run.py @@ -16,8 +16,7 @@ from vnpy.trader.uiQt import createQApp from vnpy.trader.uiMainWindow import MainWindow # 加载底层接口 -from vnpy.trader.gateway import (ctpGateway, oandaGateway, ibGateway, - tkproGateway) +from vnpy.trader.gateway import (ctpGateway, oandaGateway, ibGateway) if system == 'Windows': from vnpy.trader.gateway import (femasGateway, xspeedGateway, @@ -44,7 +43,6 @@ def main(): # 添加交易接口 me.addGateway(ctpGateway) - me.addGateway(tkproGateway) me.addGateway(oandaGateway) me.addGateway(ibGateway) diff --git a/vnpy/trader/app/ctaStrategy/ctaTemplate.py b/vnpy/trader/app/ctaStrategy/ctaTemplate.py index 9b4c2042..8a075d70 100644 --- a/vnpy/trader/app/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/app/ctaStrategy/ctaTemplate.py @@ -323,7 +323,7 @@ class TargetPosTemplate(CtaTemplate): ######################################################################## -class BarManager(object): +class BarGenerator(object): """ K线合成器,支持: 1. 基于Tick合成1分钟K线 diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyAtrRsi.py b/vnpy/trader/app/ctaStrategy/strategy/strategyAtrRsi.py index 9060c850..72380543 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyAtrRsi.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyAtrRsi.py @@ -13,7 +13,7 @@ from vnpy.trader.vtObject import VtBarData from vnpy.trader.vtConstant import EMPTY_STRING from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate, - BarManager, + BarGenerator, ArrayManager) @@ -73,7 +73,7 @@ class AtrRsiStrategy(CtaTemplate): super(AtrRsiStrategy, self).__init__(ctaEngine, setting) # 创建K线合成器对象 - self.bm = BarManager(self.onBar) + self.bg = BarGenerator(self.onBar) self.am = ArrayManager() # 注意策略类中的可变对象属性(通常是list和dict等),在策略初始化时需要重新创建, @@ -112,7 +112,7 @@ class AtrRsiStrategy(CtaTemplate): #---------------------------------------------------------------------- def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" - self.bm.updateTick(tick) + self.bg.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyBollChannel.py b/vnpy/trader/app/ctaStrategy/strategy/strategyBollChannel.py index 5f60b99d..10389bf8 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyBollChannel.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyBollChannel.py @@ -21,7 +21,7 @@ from __future__ import division from vnpy.trader.vtObject import VtBarData from vnpy.trader.vtConstant import EMPTY_STRING from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate, - BarManager, + BarGenerator, ArrayManager) @@ -87,8 +87,8 @@ class BollChannelStrategy(CtaTemplate): """Constructor""" super(BollChannelStrategy, self).__init__(ctaEngine, setting) - self.bm = BarManager(self.onBar, 15, self.onXminBar) # 创建K线合成器对象 - self.bm30 = BarManager(self.onBar, 30, self.on30minBar) + self.bg = BarGenerator(self.onBar, 15, self.onXminBar) # 创建K线合成器对象 + self.bg30 = BarGenerator(self.onBar, 30, self.on30minBar) self.am = ArrayManager() #---------------------------------------------------------------------- @@ -123,12 +123,12 @@ class BollChannelStrategy(CtaTemplate): #---------------------------------------------------------------------- def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" - self.bm.updateTick(tick) + self.bg.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): """收到Bar推送(必须由用户继承实现)""" - self.bm.updateBar(bar) + self.bg.updateBar(bar) #---------------------------------------------------------------------- def onXminBar(self, bar): diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyDoubleMa.py b/vnpy/trader/app/ctaStrategy/strategy/strategyDoubleMa.py index e1080629..74029f4b 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyDoubleMa.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyDoubleMa.py @@ -15,7 +15,7 @@ from __future__ import division from vnpy.trader.vtConstant import EMPTY_STRING, EMPTY_FLOAT from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate, - BarManager, + BarGenerator, ArrayManager) @@ -62,7 +62,7 @@ class DoubleMaStrategy(CtaTemplate): """Constructor""" super(DoubleMaStrategy, self).__init__(ctaEngine, setting) - self.bm = BarManager(self.onBar) + self.bg = BarGenerator(self.onBar) self.am = ArrayManager() # 注意策略类中的可变对象属性(通常是list和dict等),在策略初始化时需要重新创建, @@ -96,7 +96,7 @@ class DoubleMaStrategy(CtaTemplate): #---------------------------------------------------------------------- def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" - self.bm.updateTick(tick) + self.bg.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyDualThrust.py b/vnpy/trader/app/ctaStrategy/strategy/strategyDualThrust.py index 9dec0c6f..472f8876 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyDualThrust.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyDualThrust.py @@ -8,7 +8,7 @@ from datetime import time from vnpy.trader.vtObject import VtBarData from vnpy.trader.vtConstant import EMPTY_STRING -from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate, BarManager +from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate, BarGenerator ######################################################################## @@ -64,7 +64,7 @@ class DualThrustStrategy(CtaTemplate): """Constructor""" super(DualThrustStrategy, self).__init__(ctaEngine, setting) - self.bm = BarManager(self.onBar) + self.bg = BarGenerator(self.onBar) self.barList = [] #---------------------------------------------------------------------- @@ -94,7 +94,7 @@ class DualThrustStrategy(CtaTemplate): #---------------------------------------------------------------------- def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" - self.bm.updateTick(tick) + self.bg.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyKingKeltner.py b/vnpy/trader/app/ctaStrategy/strategy/strategyKingKeltner.py index 3e1ed71b..e70bd5ca 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyKingKeltner.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyKingKeltner.py @@ -15,7 +15,7 @@ from __future__ import division from vnpy.trader.vtObject import VtBarData from vnpy.trader.vtConstant import EMPTY_STRING from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate, - BarManager, + BarGenerator, ArrayManager) @@ -67,7 +67,7 @@ class KkStrategy(CtaTemplate): """Constructor""" super(KkStrategy, self).__init__(ctaEngine, setting) - self.bm = BarManager(self.onBar, 5, self.onFiveBar) # 创建K线合成器对象 + self.bg = BarGenerator(self.onBar, 5, self.onFiveBar) # 创建K线合成器对象 self.am = ArrayManager() self.buyOrderIDList = [] @@ -101,12 +101,12 @@ class KkStrategy(CtaTemplate): #---------------------------------------------------------------------- def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" - self.bm.updateTick(tick) + self.bg.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): """收到Bar推送(必须由用户继承实现)""" - self.bm.updateBar(bar) + self.bg.updateBar(bar) #---------------------------------------------------------------------- def onFiveBar(self, bar): diff --git a/vnpy/trader/app/ctaStrategy/strategy/strategyMultiTimeframe.py b/vnpy/trader/app/ctaStrategy/strategy/strategyMultiTimeframe.py index bcf59b6c..d81f7684 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/strategyMultiTimeframe.py +++ b/vnpy/trader/app/ctaStrategy/strategy/strategyMultiTimeframe.py @@ -7,7 +7,7 @@ from vnpy.trader.vtObject import VtBarData from vnpy.trader.vtConstant import EMPTY_STRING from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate, - BarManager, + BarGenerator, ArrayManager) @@ -67,10 +67,10 @@ class MultiTimeframeStrategy(CtaTemplate): self.rsiShort = 50 - self.rsiSignal # 创建K线合成器对象 - self.bm5 = BarManager(self.onBar, 5, self.on5MinBar) + self.bg5 = BarGenerator(self.onBar, 5, self.on5MinBar) self.am5 = ArrayManager() - self.bm15 = BarManager(self.onBar, 15, self.on15MinBar) + self.bg15 = BarGenerator(self.onBar, 15, self.on15MinBar) self.am15 = ArrayManager() #---------------------------------------------------------------------- @@ -101,16 +101,16 @@ class MultiTimeframeStrategy(CtaTemplate): def onTick(self, tick): """收到行情TICK推送(必须由用户继承实现)""" # 只需要要在一个BM中合成1分钟K线 - self.bm5.updateTick(tick) + self.bg5.updateTick(tick) #---------------------------------------------------------------------- def onBar(self, bar): """收到Bar推送(必须由用户继承实现)""" # 基于15分钟判断趋势过滤,因此先更新 - self.bm15.updateBar(bar) + self.bg15.updateBar(bar) # 基于5分钟判断 - self.bm5.updateBar(bar) + self.bg5.updateBar(bar) #---------------------------------------------------------------------- def on5MinBar(self, bar): diff --git a/vnpy/trader/app/dataRecorder/drEngine.py b/vnpy/trader/app/dataRecorder/drEngine.py index bee7cef9..1f488873 100644 --- a/vnpy/trader/app/dataRecorder/drEngine.py +++ b/vnpy/trader/app/dataRecorder/drEngine.py @@ -19,7 +19,7 @@ from vnpy.event import Event from vnpy.trader.vtEvent import * from vnpy.trader.vtFunction import todayDate, getJsonPath from vnpy.trader.vtObject import VtSubscribeReq, VtLogData, VtBarData, VtTickData -from vnpy.trader.app.ctaStrategy.ctaTemplate import BarManager +from vnpy.trader.app.ctaStrategy.ctaTemplate import BarGenerator from .drBase import * from .language import text @@ -48,7 +48,7 @@ class DrEngine(object): self.tickSymbolSet = set() # K线合成器字典 - self.bmDict = {} + self.bgDict = {} # 配置字典 self.settingDict = OrderedDict() @@ -153,7 +153,7 @@ class DrEngine(object): d['bar'] = True # 创建BarManager对象 - self.bmDict[vtSymbol] = BarManager(self.onBar) + self.bgDict[vtSymbol] = BarGenerator(self.onBar) # 主力合约记录配置 if 'active' in drSetting: @@ -177,7 +177,7 @@ class DrEngine(object): self.onTick(tick) - bm = self.bmDict.get(vtSymbol, None) + bm = self.bgDict.get(vtSymbol, None) if bm: bm.updateTick(tick) diff --git a/vnpy/trader/app/rtdService/__init__.py b/vnpy/trader/app/rtdService/__init__.py index 6048bb5a..c7fcaf0e 100644 --- a/vnpy/trader/app/rtdService/__init__.py +++ b/vnpy/trader/app/rtdService/__init__.py @@ -7,4 +7,4 @@ appName = 'RtdService' appDisplayName = u'RTD服务' appEngine = RtdEngine appWidget = RtdManager -appIco = 'rtd.ico' +appIco = 'rtd.ico' \ No newline at end of file