[Add]CTA模块新增getPriceTick函数
This commit is contained in:
parent
4e7c193866
commit
28627b1cd4
@ -568,8 +568,12 @@ class BacktestingEngine(object):
|
|||||||
def saveSyncData(self, strategy):
|
def saveSyncData(self, strategy):
|
||||||
"""保存同步数据(无效)"""
|
"""保存同步数据(无效)"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
def getPriceTick(self, strategy):
|
||||||
|
"""获取最小价格变动"""
|
||||||
|
return self.priceTick
|
||||||
|
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
# 结果计算相关
|
# 结果计算相关
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user