Binance-volatility-trading-bot icon indicating copy to clipboard operation
Binance-volatility-trading-bot copied to clipboard

Telegram notifications

Open dapytt opened this issue 3 years ago • 1 comments

It would be so cool to have Telegram integration and notifications on this bot too ! :-D

dapytt avatar Dec 07 '21 08:12 dapytt

i made this mod to add telegram notifications

pip install telebot

line 68 head section add

#mod# - telegram push notes buy/sell
import telebot
TELEBOT = True
if TELEBOT:
    TELEBOT_TOKEN = 'your token'
    CHAT_ID = 'your chat id'
    telbot = telebot.TeleBot(TELEBOT_TOKEN)
    telbot.config['api_key'] = TELEBOT_TOKEN

line 343 buy section add after log trade

# Log trade
if LOG_TRADES:
    write_log(f"Buy : {volume[coin]} {coin} - {last_price[coin]['price']}")

#mod# - telegram push notes buy/sell
if TELEBOT:
    telbot.send_message(CHAT_ID, f"Buy : {volume[coin]} {coin} - {last_price[coin]['price']}")

line 489 sell section add after log trade

# Log trade
if LOG_TRADES:
    profit = ((LastPrice - BuyPrice) * coins_sold[coin]['volume'])* (1-(TRADING_FEE*2)) # adjust for trading fee here
    write_log(f"Sell: {coins_sold[coin]['volume']} {coin} - {BuyPrice} - {LastPrice} Profit: {profit:.2f} {PriceChange-(TRADING_FEE*2):.2f}%")
    session_profit=session_profit + (PriceChange-(TRADING_FEE*2))

#mod# - telegram push notes buy/sell
if TELEBOT:
    telbot.send_message(CHAT_ID, f"Sell: {coins_sold[coin]['volume']} {coin} - {BuyPrice} - {LastPrice} Profit: {profit:.2f} {PriceChange-(TRADING_FEE*2):.2f}%")

i hope it helps

lordunix avatar Dec 26 '21 19:12 lordunix