From 8b27eaa4946031bcf095973680a8d0c9d67a4f99 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 14 Feb 2018 21:29:05 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=E5=A2=9E=E5=8A=A0DataEngine=E7=9A=84?= =?UTF-8?q?=E6=88=90=E4=BA=A4=E6=95=B0=E6=8D=AE=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/ctaStrategy/ctaHistoryData.py | 5 +++-- vnpy/trader/vtEngine.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/app/ctaStrategy/ctaHistoryData.py b/vnpy/trader/app/ctaStrategy/ctaHistoryData.py index ee5f0872..ea92e3b5 100644 --- a/vnpy/trader/app/ctaStrategy/ctaHistoryData.py +++ b/vnpy/trader/app/ctaStrategy/ctaHistoryData.py @@ -7,6 +7,7 @@ 3. 增加从通达信导出的历史数据载入到MongoDB中的函数 """ +import csv from datetime import datetime, timedelta from time import time @@ -208,10 +209,10 @@ def loadTdxCsv(fileName, dbName, symbol): print bar.date, bar.time print u'插入完毕,耗时:%s' % (time()-start) + +#---------------------------------------------------------------------- def loadOKEXCsv(fileName, dbName, symbol): """将OKEX导出的csv格式的历史分钟数据插入到Mongo数据库中""" - import csv - start = time() print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol) diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py index 2681e0c7..ad0745dc 100644 --- a/vnpy/trader/vtEngine.py +++ b/vnpy/trader/vtEngine.py @@ -454,6 +454,8 @@ class DataEngine(object): def processTradeEvent(self, event): """处理成交事件""" trade = event.dict_['data'] + + self.tradeDict[trade.vtTradeID] = trade # 更新到持仓细节中 detail = self.getPositionDetail(trade.vtSymbol)