The database has been converted to SQLite
This commit is contained in:
@@ -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",
|
||||
|
@@ -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"
|
||||
|
@@ -162,11 +162,9 @@ async def conditions(callback_query: CallbackQuery, state: FSMContext) -> None:
|
||||
)
|
||||
if conditional_settings_data:
|
||||
start_timer = conditional_settings_data.timer_start or 0
|
||||
stop_timer = conditional_settings_data.timer_end or 0
|
||||
await callback_query.message.edit_text(
|
||||
text="Условия торговли:\n\n"
|
||||
f"- Таймер для старта: {start_timer} мин.\n"
|
||||
f"- Таймер для остановки: {stop_timer} мин.\n",
|
||||
f"- Таймер для старта: {start_timer} мин.\n",
|
||||
reply_markup=kbi.conditions,
|
||||
)
|
||||
logger.debug(
|
||||
|
@@ -227,9 +227,6 @@ conditions = InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[
|
||||
InlineKeyboardButton(text="Таймер для старта", callback_data="start_timer"),
|
||||
InlineKeyboardButton(
|
||||
text="Таймер для остановки", callback_data="stop_timer"
|
||||
),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(text="Назад", callback_data="main_settings"),
|
||||
|
Reference in New Issue
Block a user