The database has been converted to SQLite

This commit is contained in:
algizn97
2025-10-12 12:34:32 +05:00
parent 458b34fcec
commit 8251938b2f
38 changed files with 33 additions and 1317 deletions

View File

@@ -280,10 +280,6 @@ async def open_positions(
price_for_cals = trigger_price if po_trigger_price is not None else price_symbol
tp_multiplier = 1 + (take_profit_percent / 100)
if commission_fee_percent > 0:
tp_multiplier += commission_fee_percent
if margin_type == "ISOLATED_MARGIN":
liq_long, liq_short = await get_liquidation_price(
tg_id=tg_id,
@@ -306,21 +302,15 @@ async def open_positions(
stop_loss_price = None
else:
if side == "Buy":
take_profit_price = price_for_cals * tp_multiplier
stop_loss_price = price_for_cals * (1 - stop_loss_percent / 100)
take_profit_price = price_for_cals * (1 + take_profit_percent / 100) + commission_fee_percent
stop_loss_price = price_for_cals * (1 - stop_loss_percent / 100) - commission_fee_percent
else:
take_profit_price = price_for_cals * (
1 - (take_profit_percent / 100) - commission_fee_percent
)
stop_loss_price = trigger_price * (1 + stop_loss_percent / 100)
take_profit_price = price_for_cals * (1 - take_profit_percent / 100) - commission_fee_percent
stop_loss_price = price_for_cals * (1 + stop_loss_percent / 100) + commission_fee_percent
take_profit_price = max(take_profit_price, 0)
stop_loss_price = max(stop_loss_price, 0)
logger.info("Take profit price: %s", take_profit_price)
logger.info("Stop loss price: %s", stop_loss_price)
logger.info("Commission fee percent: %s", commission_fee_percent)
# Place order
order_params = {
"category": "linear",

View File

@@ -155,7 +155,7 @@ class TelegramMessageHandler:
tg_id=tg_id, symbol=symbol, fee=0
)
await rq.set_order_quantity(
tg_id=message.from_user.id, order_quantity=base_quantity
tg_id=tg_id, order_quantity=base_quantity
)
else:
open_order_text = "\n❗️ Сделка закрылась в минус, открываю новую сделку с увеличенной ставкой.\n"