diff --git a/app/services/Bybit/config.py b/app/services/Bybit/config.py
deleted file mode 100644
index 1153414..0000000
--- a/app/services/Bybit/config.py
+++ /dev/null
@@ -1,9 +0,0 @@
-API_KEY=''
-API_SECRET=''
-SYMBOL=''
-
-'''
-API_KEY = 'o5854uk3qBD4lySnjv'
-SECRET_KEY = 'aMFPbs0AKyOSLTgXyrqCfREDi7byjnsOd0Kj'
-SYMBOL = "SHIB1000USDT"
-'''
\ No newline at end of file
diff --git a/app/services/Bybit/functions/Futures.py b/app/services/Bybit/functions/Futures.py
index b116213..25e60a2 100644
--- a/app/services/Bybit/functions/Futures.py
+++ b/app/services/Bybit/functions/Futures.py
@@ -71,7 +71,7 @@ async def contract_long(tg_id, message, margin_mode):
setMarginMode=margin_mode # margin_type
)
- martingale_factor = float(data_main_stgs['martingale_factor']) # Исправлено: было maximal_quantity
+ martingale_factor = float(data_main_stgs['martingale_factor'])
max_martingale_steps = int(data_main_stgs['maximal_quantity'])
starting_quantity = float(data_main_stgs['starting_quantity'])
max_risk_percent = float(data_risk_management_stgs['max_risk_deal'])
@@ -172,23 +172,7 @@ async def contract_long(tg_id, message, margin_mode):
orderLinkId=f"deal_{SYMBOL}_{time.time()}"
)
- await info_access_open_deal(message, SYMBOL, data_main_stgs['trading_mode'], margin_mode, data_main_stgs['size_leverage'], next_quantity)
-
- print(f'''
- =====================
- ===================
- ===================
- ===================
- =================
-
- {r}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
+ await info_access_open_deal(message, SYMBOL, data_main_stgs['trading_mode'], margin_mode, data_main_stgs['size_leverage'], next_quantity)
except exceptions.InvalidRequestError as e:
await message.answer('Недостаточно баланса')
@@ -225,7 +209,7 @@ async def contract_short(tg_id, message, margin_mode):
setMarginMode=margin_mode # margin_type
)
- martingale_factor = float(data_main_stgs['martingale_factor']) # Исправлено: было maximal_quantity
+ martingale_factor = float(data_main_stgs['martingale_factor'])
max_martingale_steps = int(data_main_stgs['maximal_quantity'])
starting_quantity = float(data_main_stgs['starting_quantity'])
max_risk_percent = float(data_risk_management_stgs['max_risk_deal'])
@@ -251,47 +235,17 @@ async def contract_short(tg_id, message, margin_mode):
realised_pnl = float(position['unrealisedPnl'])
- if realised_pnl > 0:
- print(f'''
- =====================
- =====Сделка=========
- ===уСПЕШНЕАЯ================
- ===================
- =================
-
- {realised_pnl}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
+ if realised_pnl > 0: # Прибыльная сделка
starting_quantity = next_quantity
current_martingale_step = 0
elif not realised_pnl:
next_quantity = starting_quantity
current_martingale_step += 1
- else:
+ else: # Убыточная сделка
current_martingale_step += 1
next_quantity = last_quantity * martingale_factor
starting_quantity = next_quantity
- print(f'''
- ======СДЕЛКА===============
- =====УБЫТОЧНАЯ==============
- ===================
- ===================
- =================
-
- {realised_pnl}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
except Exception as e:
print("Не получены позиции")
next_quantity = starting_quantity
@@ -324,23 +278,7 @@ async def contract_short(tg_id, message, margin_mode):
orderLinkId=f"deal_{SYMBOL}_{time.time()}"
)
- await info_access_open_deal(message, SYMBOL, data_main_stgs['trading_mode'], margin_mode, data_main_stgs['size_leverage'], next_quantity)
-
- print(f'''
- =====================
- ===================
- ===================
- ===================
- =================
-
- {r}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
+ await info_access_open_deal(message, SYMBOL, data_main_stgs['trading_mode'], margin_mode, data_main_stgs['size_leverage'], next_quantity)
except exceptions.InvalidRequestError as e:
await message.answer('Недостаточно баланса')
diff --git a/app/services/Bybit/functions/balance.py b/app/services/Bybit/functions/balance.py
index a9c4eb2..f0518f1 100644
--- a/app/services/Bybit/functions/balance.py
+++ b/app/services/Bybit/functions/balance.py
@@ -16,23 +16,7 @@ async def get_balance(tg_id, message):
try:
balance = client.get_wallet_balance(accountType='UNIFIED', coin='USDT')['result']['list'][0]['coin'][0]['walletBalance']
- print(f'''
- =====================
- =====BALANCE=========
- ======USDT=============
- ===================
- =================
-
- {balance}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
-
return balance
except Exception as e:
- await message.answer('Баланс не был получен')
+ await message.answer('Баланс не был получен, подключите платформу')
return 0
\ No newline at end of file
diff --git a/app/services/Bybit/functions/func_min_qty.py b/app/services/Bybit/functions/func_min_qty.py
index 2275894..0544b64 100644
--- a/app/services/Bybit/functions/func_min_qty.py
+++ b/app/services/Bybit/functions/func_min_qty.py
@@ -18,20 +18,4 @@ async def get_min_qty(tg_id, message):
price = await price_s.get_price(tg_id, message)
min_qty = int(5 / price * 1.1)
- print(f'''
- =====================
- =====MIN=========
- =====QTY==============
- ===================
- =================
-
- {min_qty}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
-
return min_qty
\ No newline at end of file
diff --git a/app/services/Bybit/functions/functions.py b/app/services/Bybit/functions/functions.py
index 8aae247..87aca78 100644
--- a/app/services/Bybit/functions/functions.py
+++ b/app/services/Bybit/functions/functions.py
@@ -94,10 +94,8 @@ async def make_deal_bybit (callback: CallbackQuery):
else:
match trade_mode:
case 'Long':
- print('====================================LONG=========================================')
await Futures.contract_long(callback.from_user.id, callback.message, margin_mode)
case 'Short':
- print('====================================SHORT=========================================')
await Futures.contract_short(callback.from_user.id, callback.message, margin_mode)
case 'Switch':
await callback.message.edit_text('Режим Switch пока недоступен')
diff --git a/app/services/Bybit/functions/price_symbol.py b/app/services/Bybit/functions/price_symbol.py
index 0921aa4..8971a66 100644
--- a/app/services/Bybit/functions/price_symbol.py
+++ b/app/services/Bybit/functions/price_symbol.py
@@ -18,22 +18,6 @@ async def get_price(tg_id, message):
try:
price = float(client.get_tickers(category='linear', symbol=SYMBOL).get('result').get('list')[0].get('ask1Price'))
- print(f'''
- =====================
- =====PRICE=========
- ===================
- ===================
- =================
-
- {price}
-
- ===============
- ===============
- =============
- ===============
- ==============
- ''')
-
return price
except exceptions.InvalidRequestError as e:
await message.answer('Неверно указана торговая пара')
diff --git a/app/telegram/Keyboards/inline_keyboards.py b/app/telegram/Keyboards/inline_keyboards.py
index 826568c..5ca4fd6 100644
--- a/app/telegram/Keyboards/inline_keyboards.py
+++ b/app/telegram/Keyboards/inline_keyboards.py
@@ -1,12 +1,12 @@
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
start_markup = InlineKeyboardMarkup(inline_keyboard=[
- [InlineKeyboardButton(text="Торговать", callback_data="callback_profile")]
+ [InlineKeyboardButton(text="🔥 Начать торговлю", callback_data="clb_start_chatbot_message")]
])
settings_markup = InlineKeyboardMarkup(inline_keyboard=[
[InlineKeyboardButton(text="Настройки", callback_data='clb_settings_message')],
- [InlineKeyboardButton(text="Начать торговлю", callback_data='clb_start_trading')]
+ [InlineKeyboardButton(text="Запуск", callback_data='clb_start_trading')]
])
back_btn_profile = [InlineKeyboardButton(text="Назад", callback_data='callback_profile')]
diff --git a/app/telegram/functions/functions.py b/app/telegram/functions/functions.py
index 290dfcf..1a7d761 100644
--- a/app/telegram/functions/functions.py
+++ b/app/telegram/functions/functions.py
@@ -2,35 +2,36 @@
import app.telegram.Keyboards.reply_keyboards as reply_markup
async def start_message(message):
- await message.answer(f""" Привет {message.from_user.username}! 👋
+ username = ''
+
+ if message.from_user.first_name == None:
+ username = message.from_user.last_name
+ elif message.from_user.last_name == None:
+ username = message.from_user.first_name
+ else:
+ username = f'{message.from_user.first_name} {message.from_user.last_name}'
+ await message.answer(f""" Привет {username}! 👋
-Добро пожаловать в бот по трейдингу на Bibyt — вашего надежного помощника для анализа рынка и принятия взвешенных решений. Здесь вы получите:
+Добро пожаловать в чат-робот по трейдингу на Bybit — вашего надежного помощника для анализа рынка и принятия взвешенных решений.
+Здесь вы получите:
📊 Анализ текущих трендов
📈 Инструменты для прогнозирования и оценки рисков
⚡️ Сигналы и рекомендации по сделкам
🔔 Уведомления о важных изменениях и новостях
-Просто отправляйте интересующий вас инструмент или команду, и бот быстро предоставит актуальную информацию и аналитику.
-
-Начнем торговать умно и эффективно вместе! 🚀
-
""", parse_mode='html', reply_markup=inline_markup.start_markup)
async def profile_message(username, message):
- await message.answer(f""" {username}
+ await message.answer(f""" @{username}
Баланс
⭐️ 0
-О себе
-🚀 Профессиональный трейдер на платформе Bibyt с авторской стратегией и аналитикой в реальном времени.
-📊 Постоянно улучшаю навыки и адаптируюсь к рыночным изменениям, чтобы максимально увеличить прибыль.
-🔥 Всегда в поиске новых возможностей для роста и стабильного успеха!
""", parse_mode='html', reply_markup=inline_markup.settings_markup)
async def check_profile_message(message):
- await message.answer(f'Добро пожаловать {message.from_user.username}!', reply_markup=reply_markup.base_buttons_markup)
+ await message.answer(f'Добро пожаловать {message.from_user.first_name} {message.from_user.last_name}!', reply_markup=reply_markup.base_buttons_markup)
async def settings_message(message):
await message.edit_text("Выберите что настроить", reply_markup=inline_markup.special_settings_markup)
\ No newline at end of file
diff --git a/app/telegram/handlers/handlers.py b/app/telegram/handlers/handlers.py
index 1ad2f4e..b56cd4e 100644
--- a/app/telegram/handlers/handlers.py
+++ b/app/telegram/handlers/handlers.py
@@ -37,7 +37,7 @@ async def settings_msg(message: Message):
if user:
await func.settings_message(message)
-@router.callback_query(F.data == "callback_profile")
+@router.callback_query(F.data == "clb_start_chatbot_message")
async def clb_func_reg (callback: CallbackQuery):
user = await rq.check_user(callback.from_user.id)
@@ -53,11 +53,20 @@ async def clb_func_reg (callback: CallbackQuery):
await func_condition_settings.reg_new_user_default_condition_settings(callback.from_user.id, callback.message)
await func_additional_settings.reg_new_user_default_additional_settings(callback.from_user.id, callback.message)
- await callback.message.answer(f'Регистрация прошла успешно, здравствуйте {callback.from_user.username}!', reply_markup=reply_markup.base_buttons_markup)
+ await callback.message.answer(f'Регистрация прошла успешно, перейдите в профиль нажав на кнопку!', reply_markup=reply_markup.base_buttons_markup)
await func.profile_message(callback.from_user.username, callback.message)
- await callback.answer()
+ await callback.answer()
+
+@router.callback_query(F.data == "callback_profile")
+async def clb_profile_message (callback: CallbackQuery):
+ user = await rq.check_user(callback.from_user.id)
+
+ if user:
+ await func.profile_message(callback.from_user.username, callback.message)
+
+ await callback.answer()
# Настройки торговли
@router.callback_query(F.data == "clb_settings_message")