1
This commit is contained in:
parent
3a61910461
commit
32f223c74e
@ -475,15 +475,22 @@ class BitgetTradingAPI:
|
|||||||
if stop_loss:
|
if stop_loss:
|
||||||
sl_side = 'sell' if pos_side == 'long' else 'buy'
|
sl_side = 'sell' if pos_side == 'long' else 'buy'
|
||||||
try:
|
try:
|
||||||
# 使用普通的 create_order 创建止损市价单
|
|
||||||
if self.use_unified_account:
|
if self.use_unified_account:
|
||||||
|
# UTA 模式:用 stopLossPrice 触发策略订单路由
|
||||||
|
# CCXT 通过 stopLossPrice 判断是否走 privateUtaPostV3TradePlaceStrategyOrder
|
||||||
sl_params = {
|
sl_params = {
|
||||||
'stopPrice': stop_loss,
|
'stopLossPrice': stop_loss,
|
||||||
'triggerBy': 'mark_price',
|
|
||||||
'hedged': True,
|
'hedged': True,
|
||||||
'reduceOnly': True,
|
'reduceOnly': True,
|
||||||
'marginCoin': 'USDT',
|
'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:
|
else:
|
||||||
sl_params = {
|
sl_params = {
|
||||||
'stopPrice': stop_loss,
|
'stopPrice': stop_loss,
|
||||||
@ -498,7 +505,7 @@ class BitgetTradingAPI:
|
|||||||
side=sl_side,
|
side=sl_side,
|
||||||
amount=btc_amount,
|
amount=btc_amount,
|
||||||
price=None,
|
price=None,
|
||||||
params=self._with_account_mode_params(sl_params),
|
params=sl_params,
|
||||||
)
|
)
|
||||||
orders_created.append(('止损', sl_order))
|
orders_created.append(('止损', sl_order))
|
||||||
logger.info(f"✅ 止损单已下: {sl_side} {btc_amount} BTC @ ${stop_loss}")
|
logger.info(f"✅ 止损单已下: {sl_side} {btc_amount} BTC @ ${stop_loss}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user