[Add]CTA模块新增getPriceTick函数

This commit is contained in:
vn.py 2018-05-12 17:40:51 +08:00
parent 4e7c193866
commit 28627b1cd4
3 changed files with 21 additions and 2 deletions

View File

@ -568,8 +568,12 @@ class BacktestingEngine(object):
def saveSyncData(self, strategy): def saveSyncData(self, strategy):
"""保存同步数据(无效)""" """保存同步数据(无效)"""
pass pass
#----------------------------------------------------------------------
def getPriceTick(self, strategy):
"""获取最小价格变动"""
return self.priceTick
#------------------------------------------------ #------------------------------------------------
# 结果计算相关 # 结果计算相关
#------------------------------------------------ #------------------------------------------------

View File

@ -643,3 +643,12 @@ class CtaEngine(object):
else: else:
self.cancelOrder(orderID) self.cancelOrder(orderID)
#----------------------------------------------------------------------
def getPriceTick(self, strategy):
"""获取最小价格变动"""
contract = self.mainEngine.getContract(strategy.vtSymbol)
if contract:
return contract.priceTick
return 0

View File

@ -195,6 +195,12 @@ class CtaTemplate(object):
if self.trading: if self.trading:
self.ctaEngine.saveSyncData(self) self.ctaEngine.saveSyncData(self)
#----------------------------------------------------------------------
def getPriceTick(self):
"""查询最小价格变动"""
return self.ctaEngine.getPriceTick(self)
######################################################################## ########################################################################
class TargetPosTemplate(CtaTemplate): class TargetPosTemplate(CtaTemplate):