修改套利回测的计算bug,增加每日净值的结果导出。(暂不支持结算价的净值记过计算)
This commit is contained in:
parent
fa572b40ba
commit
3e033a9aff
@ -155,7 +155,6 @@ class BacktestingEngine(object):
|
|||||||
|
|
||||||
return self.capital, self.avaliable, self.percent, self.percentLimit
|
return self.capital, self.avaliable, self.percent, self.percentLimit
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def setStartDate(self, startDate='20100416', initDays=10):
|
def setStartDate(self, startDate='20100416', initDays=10):
|
||||||
"""设置回测的启动日期"""
|
"""设置回测的启动日期"""
|
||||||
@ -1388,12 +1387,14 @@ class BacktestingEngine(object):
|
|||||||
"""
|
"""
|
||||||
self.strategy = strategyClass(self, setting)
|
self.strategy = strategyClass(self, setting)
|
||||||
self.strategy.name = self.strategy.className
|
self.strategy.name = self.strategy.className
|
||||||
|
self.strategy.onInit()
|
||||||
|
self.strategy.onStart()
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def sendOrder(self, vtSymbol, orderType, price, volume, strategy):
|
def sendOrder(self, vtSymbol, orderType, price, volume, strategy):
|
||||||
"""发单"""
|
"""发单"""
|
||||||
|
|
||||||
self.writeCtaLog(u'{0},{1},{2}@{3}'.format(vtSymbol,orderType,price,volume))
|
self.writeCtaLog(u'{0},{1},{2}@{3}'.format(vtSymbol, orderType, price, volume))
|
||||||
self.limitOrderCount += 1
|
self.limitOrderCount += 1
|
||||||
orderID = str(self.limitOrderCount)
|
orderID = str(self.limitOrderCount)
|
||||||
|
|
||||||
@ -1458,8 +1459,6 @@ class BacktestingEngine(object):
|
|||||||
order.cancelTime = str(self.dt)
|
order.cancelTime = str(self.dt)
|
||||||
del self.workingLimitOrderDict[vtOrderID]
|
del self.workingLimitOrderDict[vtOrderID]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def sendStopOrder(self, vtSymbol, orderType, price, volume, strategy):
|
def sendStopOrder(self, vtSymbol, orderType, price, volume, strategy):
|
||||||
"""发停止单(本地实现)"""
|
"""发停止单(本地实现)"""
|
||||||
|
Loading…
Reference in New Issue
Block a user