From 6e4aa7eb8c5e9b541ac86862c7df111d0bd8771a Mon Sep 17 00:00:00 2001 From: WOLF Date: Thu, 28 May 2015 10:09:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86vn.strategy?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +++++- vn.strategy/strategydemo/demoStrategy.py | 7 ++----- vn.strategy/strategydemo/strategyEngine.py | 6 +----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 5822aacd..3a0d5e11 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,8 @@ Release/ *.opensdf # 本地持久化文件 -*.vn \ No newline at end of file +*.vn + +# word文档 +*.doc +*.docx \ No newline at end of file diff --git a/vn.strategy/strategydemo/demoStrategy.py b/vn.strategy/strategydemo/demoStrategy.py index d2d8fba4..247de73d 100644 --- a/vn.strategy/strategydemo/demoStrategy.py +++ b/vn.strategy/strategydemo/demoStrategy.py @@ -234,14 +234,11 @@ class SimpleEmaStrategy(StrategyTemplate): self.short(self.currentTick.lowerLimit, 1) # 记录日志 - log = self.name + u'当前时间:' + str(time) + \ + log = self.name + u',K线时间:' + str(time) + '\n' + \ u',快速EMA:' + str(self.fastEMA) + u',慢速EMA:' + \ str(self.slowEMA) self.engine.writeLog(log) - print 'onBar', o, h, l, c, time - print 'fastEMA:', self.fastEMA, '|slowEMA:', self.slowEMA - #---------------------------------------------------------------------- def strToTime(self, t, ms): """从字符串时间转化为time格式的时间""" @@ -278,7 +275,7 @@ def main(): me.login(userid, password, brokerid, mdAddress, tdAddress) # 等待10秒钟(初始化合约数据等) - sleep(10) + sleep(5) # 创建策略引擎对象 se = StrategyEngine(me.ee, me) diff --git a/vn.strategy/strategydemo/strategyEngine.py b/vn.strategy/strategydemo/strategyEngine.py index 78c778c2..9ef0b346 100644 --- a/vn.strategy/strategydemo/strategyEngine.py +++ b/vn.strategy/strategydemo/strategyEngine.py @@ -360,10 +360,8 @@ class StrategyEngine(object): #---------------------------------------------------------------------- def __updateTrade(self, event): """成交更新""" - print 'updateTrade' data = event.dict_['data'] orderRef = data['OrderRef'] - print 'trade:', orderRef if orderRef in self.__dictOrderRefStrategy: @@ -405,8 +403,6 @@ class StrategyEngine(object): offset) self.__dictOrderRefStrategy[ref] = strategy - print 'ref:', ref - print 'strategy:', strategy.name return ref @@ -585,7 +581,7 @@ class StrategyTemplate(object): return None #---------------------------------------------------------------------- - def cover(self, price, volume, StopOrder=False): + def cover(self, price, volume, stopOrder=False): """买入平仓""" if self.trading: if stopOrder: