CyberPunkMetalHead / Binance-volatility-trading-bot

This is a fully functioning Binance trading bot that measures the volatility of every coin on Binance and places trades with the highest gaining coins If you like this project consider donating though the Brave browser to allow me to continuously improve the script.
MIT License
3.39k stars 774 forks source link

Telegram notifications #222

Open dapytt opened 2 years ago

dapytt commented 2 years ago

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

lordunix commented 2 years ago

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