fix: 测试网STOP_MARKET降级为STOP限价单
测试网不支持STOP_MARKET/TAKE_PROFIT_MARKET order type 检测TRADE_ENV=testnet时自动降级: - STOP_MARKET → STOP + price + GTC - TAKE_PROFIT_MARKET → TAKE_PROFIT + price + GTC 实盘(mainnet)不受影响
This commit is contained in:
parent
1bf880cebb
commit
cc1b2c33c1
@ -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')}")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user