[Mod] add comment for round_to

This commit is contained in:
vn.py 2019-06-10 13:25:06 +08:00
parent 2cfb18b7bb
commit 4fadcd9016

View File

@ -464,8 +464,11 @@ class CtaEngine(BaseEngine):
if not contract: if not contract:
self.write_log(f"委托失败,找不到合约:{strategy.vt_symbol}", strategy) self.write_log(f"委托失败,找不到合约:{strategy.vt_symbol}", strategy)
return "" return ""
# Round order price and volume to nearest incremental value
price = round_to(price, contract.pricetick) price = round_to(price, contract.pricetick)
volume = round_to(volume, contract.min_volume) volume = round_to(volume, contract.min_volume)
if stop: if stop:
if contract.stop_supported: if contract.stop_supported:
return self.send_server_stop_order(strategy, contract, direction, offset, price, volume, lock) return self.send_server_stop_order(strategy, contract, direction, offset, price, volume, lock)