diff --git a/backend/live_executor.py b/backend/live_executor.py index f57c5d0..1ca2975 100644 --- a/backend/live_executor.py +++ b/backend/live_executor.py @@ -206,6 +206,13 @@ async def place_stop_order(session: aiohttp.ClientSession, symbol: str, side: st "reduceOnly": "true", } + # 测试网不支持STOP_MARKET/TAKE_PROFIT_MARKET,降级为STOP/TAKE_PROFIT(限价单) + if TRADE_ENV == "testnet" and order_type in ("STOP_MARKET", "TAKE_PROFIT_MARKET"): + fallback_type = "STOP" if "STOP" in order_type else "TAKE_PROFIT" + params["type"] = fallback_type + params["price"] = price_str # 限价单需要price + params["timeInForce"] = "GTC" + data, status = await binance_request(session, "POST", "/fapi/v1/order", params) if status == 200: logger.info(f"[{symbol}] 📌 挂{order_type} {side} @ {price_str} qty={qty_str} | orderId={data.get('orderId')}")