diff --git a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py index a7818450..c0bb5c6d 100644 --- a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py +++ b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py @@ -568,8 +568,12 @@ class BacktestingEngine(object): def saveSyncData(self, strategy): """保存同步数据(无效)""" pass - - + + #---------------------------------------------------------------------- + def getPriceTick(self, strategy): + """获取最小价格变动""" + return self.priceTick + #------------------------------------------------ # 结果计算相关 #------------------------------------------------ diff --git a/vnpy/trader/app/ctaStrategy/ctaEngine.py b/vnpy/trader/app/ctaStrategy/ctaEngine.py index 1e575e21..ba25d273 100644 --- a/vnpy/trader/app/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/app/ctaStrategy/ctaEngine.py @@ -643,3 +643,12 @@ class CtaEngine(object): else: self.cancelOrder(orderID) + #---------------------------------------------------------------------- + def getPriceTick(self, strategy): + """获取最小价格变动""" + contract = self.mainEngine.getContract(strategy.vtSymbol) + if contract: + return contract.priceTick + return 0 + + \ No newline at end of file diff --git a/vnpy/trader/app/ctaStrategy/ctaTemplate.py b/vnpy/trader/app/ctaStrategy/ctaTemplate.py index e050f4d0..5f829d0f 100644 --- a/vnpy/trader/app/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/app/ctaStrategy/ctaTemplate.py @@ -195,6 +195,12 @@ class CtaTemplate(object): if self.trading: self.ctaEngine.saveSyncData(self) + #---------------------------------------------------------------------- + def getPriceTick(self): + """查询最小价格变动""" + return self.ctaEngine.getPriceTick(self) + + ######################################################################## class TargetPosTemplate(CtaTemplate):