ctaengine价格取整到最小价格变动

ctaengine价格取整到最小价格变动
This commit is contained in:
xldistance 2019-06-07 16:00:13 +08:00 committed by GitHub
parent 5d9802b703
commit 4f94988a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ from vnpy.trader.constant import (
Offset, Offset,
Status Status
) )
from vnpy.trader.utility import load_json, save_json, extract_vt_symbol from vnpy.trader.utility import load_json, save_json, extract_vt_symbol,round_to
from vnpy.trader.database import database_manager from vnpy.trader.database import database_manager
from vnpy.trader.rqdata import rqdata_client from vnpy.trader.rqdata import rqdata_client
@ -464,7 +464,7 @@ 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 ""
price = round_to(price,contract.pricetick)
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)