forked from kodorvan/stcs
Fixed the function of setting TP and SL
This commit is contained in:
@@ -25,11 +25,13 @@ async def set_tp_sl_for_position(
|
||||
"""
|
||||
try:
|
||||
client = await get_bybit_client(tg_id)
|
||||
take_profit = round(take_profit_price, 6) if take_profit_price is not None else None
|
||||
stop_loss = round(stop_loss_price, 6) if stop_loss_price is not None else None
|
||||
resp = client.set_trading_stop(
|
||||
category="linear",
|
||||
symbol=symbol,
|
||||
takeProfit=str(round(take_profit_price, 5)),
|
||||
stopLoss=str(round(stop_loss_price, 5)),
|
||||
takeProfit=str(take_profit) if take_profit is not None else None,
|
||||
stopLoss=str(stop_loss) if stop_loss is not None else None,
|
||||
positionIdx=position_idx,
|
||||
tpslMode="Full",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user