From 959a83d011f4fd7d7b725678023a54d63b0c1aa3 Mon Sep 17 00:00:00 2001 From: zhiyong Date: Mon, 12 May 2025 14:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B8=82=E4=BB=B7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/real/xt_trader.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/real/xt_trader.py b/src/real/xt_trader.py index 1f6fe92..ff8911a 100644 --- a/src/real/xt_trader.py +++ b/src/real/xt_trader.py @@ -310,7 +310,13 @@ class XtTrader(BaseTrader): return {"error": self.connection_error_message or "交易系统连接失败"} # 确定价格类型 - price_type = xtconstant.MARKET_BEST if order_type == 'market' else xtconstant.FIX_PRICE + if order_type == 'limit': + price_type = xtconstant.FIX_PRICE + else: + if code.endswith('.SH'): + price_type = xtconstant.MARKET_SH_CONVERT_5_CANCEL + else: + price_type = xtconstant.MARKET_SZ_CONVERT_5_CANCEL # 如果是市价单,价格可以设为0 if price_type != xtconstant.FIX_PRICE: @@ -326,7 +332,13 @@ class XtTrader(BaseTrader): return {"error": self.connection_error_message or "交易系统连接失败"} # 确定价格类型 - price_type = xtconstant.MARKET_BEST if order_type == 'market' else xtconstant.FIX_PRICE + if order_type == 'limit': + price_type = xtconstant.FIX_PRICE + else: + if code.endswith('.SH'): + price_type = xtconstant.MARKET_SH_CONVERT_5_CANCEL + else: + price_type = xtconstant.MARKET_SZ_CONVERT_5_CANCEL # 如果是市价单,价格可以设为0 if price_type != xtconstant.FIX_PRICE: