From 4fadcd901646ed6fdd951b6d3d9e87cfc06fc61f Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 10 Jun 2019 13:25:06 +0800 Subject: [PATCH] [Mod] add comment for round_to --- vnpy/app/cta_strategy/engine.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vnpy/app/cta_strategy/engine.py b/vnpy/app/cta_strategy/engine.py index 98b52bfe..ff2e8ef9 100644 --- a/vnpy/app/cta_strategy/engine.py +++ b/vnpy/app/cta_strategy/engine.py @@ -36,7 +36,7 @@ from vnpy.trader.constant import ( Offset, Status ) -from vnpy.trader.utility import load_json, save_json, extract_vt_symbol,round_to +from vnpy.trader.utility import load_json, save_json, extract_vt_symbol, round_to from vnpy.trader.database import database_manager from vnpy.trader.rqdata import rqdata_client @@ -464,8 +464,11 @@ class CtaEngine(BaseEngine): if not contract: self.write_log(f"委托失败,找不到合约:{strategy.vt_symbol}", strategy) return "" - price = round_to(price,contract.pricetick) - volume = round_to(volume,contract.min_volume) + + # Round order price and volume to nearest incremental value + price = round_to(price, contract.pricetick) + volume = round_to(volume, contract.min_volume) + if stop: if contract.stop_supported: return self.send_server_stop_order(strategy, contract, direction, offset, price, volume, lock)