forked from kodorvan/stcs
Fixed
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import logging.config
|
||||
|
||||
from app.bybit import get_bybit_client
|
||||
from app.bybit.get_functions.get_positions import get_active_positions_by_symbol
|
||||
from app.bybit.logger_bybit.logger_bybit import LOGGING_CONFIG
|
||||
|
||||
logging.config.dictConfig(LOGGING_CONFIG)
|
||||
@@ -13,6 +12,7 @@ async def set_tp_sl_for_position(
|
||||
symbol: str,
|
||||
take_profit_price: float,
|
||||
stop_loss_price: float,
|
||||
position_idx: int,
|
||||
) -> bool:
|
||||
"""
|
||||
Set take profit and stop loss for a symbol.
|
||||
@@ -20,14 +20,11 @@ async def set_tp_sl_for_position(
|
||||
:param symbol: Symbol to set take profit and stop loss for
|
||||
:param take_profit_price: Take profit price
|
||||
:param stop_loss_price: Stop loss price
|
||||
:param position_idx: Position index
|
||||
:return: bool
|
||||
"""
|
||||
try:
|
||||
client = await get_bybit_client(tg_id)
|
||||
user_positions = await get_active_positions_by_symbol(
|
||||
tg_id=tg_id, symbol=symbol
|
||||
)
|
||||
position_idx = user_positions.get("positionIdx")
|
||||
resp = client.set_trading_stop(
|
||||
category="linear",
|
||||
symbol=symbol,
|
||||
|
||||
Reference in New Issue
Block a user