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: