From 4f94988a6e678aeaad5d13dbb0447e232fdc0f57 Mon Sep 17 00:00:00 2001 From: xldistance <819873074@qq.com> Date: Fri, 7 Jun 2019 16:00:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ctaengine=E4=BB=B7=E6=A0=BC=E5=8F=96?= =?UTF-8?q?=E6=95=B4=E5=88=B0=E6=9C=80=E5=B0=8F=E4=BB=B7=E6=A0=BC=E5=8F=98?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ctaengine价格取整到最小价格变动 --- vnpy/app/cta_strategy/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnpy/app/cta_strategy/engine.py b/vnpy/app/cta_strategy/engine.py index e17f49ec..fd3d3c46 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 +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,7 +464,7 @@ class CtaEngine(BaseEngine): if not contract: self.write_log(f"委托失败,找不到合约:{strategy.vt_symbol}", strategy) return "" - + price = round_to(price,contract.pricetick) if stop: if contract.stop_supported: return self.send_server_stop_order(strategy, contract, direction, offset, price, volume, lock) From b79212c4d95bcf7d1d38f48d29d78a53f96c6c44 Mon Sep 17 00:00:00 2001 From: xldistance <819873074@qq.com> Date: Sun, 9 Jun 2019 08:49:27 +0800 Subject: [PATCH 2/2] Update engine.py --- vnpy/app/cta_strategy/engine.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vnpy/app/cta_strategy/engine.py b/vnpy/app/cta_strategy/engine.py index fd3d3c46..98b52bfe 100644 --- a/vnpy/app/cta_strategy/engine.py +++ b/vnpy/app/cta_strategy/engine.py @@ -465,6 +465,7 @@ class CtaEngine(BaseEngine): self.write_log(f"委托失败,找不到合约:{strategy.vt_symbol}", strategy) return "" 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)