This commit is contained in:
aaron 2026-03-30 21:02:55 +08:00
parent 3a61910461
commit 32f223c74e

View File

@ -475,15 +475,22 @@ class BitgetTradingAPI:
if stop_loss:
sl_side = 'sell' if pos_side == 'long' else 'buy'
try:
# 使用普通的 create_order 创建止损市价单
if self.use_unified_account:
# UTA 模式:用 stopLossPrice 触发策略订单路由
# CCXT 通过 stopLossPrice 判断是否走 privateUtaPostV3TradePlaceStrategyOrder
sl_params = {
'stopPrice': stop_loss,
'triggerBy': 'mark_price',
'stopLossPrice': stop_loss,
'hedged': True,
'reduceOnly': True,
'marginCoin': 'USDT',
}
sl_order = self.exchange.create_order(
symbol=ccxt_symbol,
type='market',
side=sl_side,
amount=btc_amount,
params=self._with_account_mode_params(sl_params),
)
else:
sl_params = {
'stopPrice': stop_loss,
@ -492,14 +499,14 @@ class BitgetTradingAPI:
'marginCoin': 'USDT',
'reduceOnly': True,
}
sl_order = self.exchange.create_order(
symbol=ccxt_symbol,
type='stop_market',
side=sl_side,
amount=btc_amount,
price=None,
params=self._with_account_mode_params(sl_params),
)
sl_order = self.exchange.create_order(
symbol=ccxt_symbol,
type='stop_market',
side=sl_side,
amount=btc_amount,
price=None,
params=sl_params,
)
orders_created.append(('止损', sl_order))
logger.info(f"✅ 止损单已下: {sl_side} {btc_amount} BTC @ ${stop_loss}")
except Exception as e: