Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram notifications #222

Open
dapytt opened this issue Dec 7, 2021 · 1 comment
Open

Telegram notifications #222

dapytt opened this issue Dec 7, 2021 · 1 comment

Comments

@dapytt
Copy link

dapytt commented Dec 7, 2021

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

@lordunix
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants