Simple Telegram Crypto Chart Bot using Coingecko.
Coins such as Doge, Shib and Hoge triggered a meme coin craze lasting for months. Every meme coin needs a community to create and maintain hype and crypto trade bot such community is best kept thriving via Telegram groups. Telegram is well known for the useful bots you can interact with such as Captcha bots, Rose and kucoin many more. An integral part of every (meme?)coin group is the ability to view an up-to-date chart without leaving the chat. Today, we will learn how to bootstrap such a chart bot for your crypto project.
Goal: typing /chart into the chat will display the following:
Pulling price information from Coingecko.
We will pull current coin information from Coingecko and use Python for the purpose. Referencing their free api it's easy to pull 15-min point price info for the past 24hrs for a coin. I will use LunaDoge coin in this tutorial, so the code and url will look like this:
Bootstrapping a Python Telegram project.
Now that we know how to pull prices let's create and connect to our new Telegram bot. First we need to create a Telegram bot:
Open Telegram, then search @botfather Type /newbot command Type in a name, for example "LOGE Chart Bot" Type in a unique username, for example "loge_chart_bot". It must end in "bot" Save the API token.
Once we have the token we are ready to connect to our price bot from Python using python-telegram-bo t. First install the packages:
Then add the needed skeleton:
The flow begins inside chart function where we first fetch price, plot it on a chart, save it to a file images/fig1.png then send it as a response image into the chat. Now as we have the basic template, kucoin trading bot let's fetch the price then save it to a chart image file:
This is the updated save_chart function. We first fetch the prices from Coingecko API for When you have any issues with regards to in which and also how to use
crypto trade bot, you possibly can email us with our own web-site. the past 24 hrs, then make sure we format the UTC timestamps to a readable hour:minute:second format:
then create a panda dataframe to store the data points.
After we have our dataframe you will notice we access images/background.jpg file. This is the background image we use for our chart:
The lines that follow are chart initialization and configuration such as line color and width, background image position, labels, etc. which you can read more about in plotly docs .
Once we are happy with the way our chart looks, we save it to a file.
This is the file we send to the Telegram chat for Kucoin people to see.
Testing our chart.
Now it's time to test our chart in Telegram. Start the python server.
then open a chat with your Telegram bot and type /chart.
And crypto bot here we go! We have a simple chart bot to tell our user what the current price is without having to leave the chat!
Source: Simple Telegram Crypto Chart Bot using Coingecko | by Alexander Vitanov | Medium (http://binancecryptocurrency-exchanges.uniteltu.gq/?qa=7473&qa_1=simple-telegram-crypto-coingecko-alexander-vitanov-medium)
Bybit cryptocurrencyexchanges - cashback 20% - Registration (https://www.bybit.com/register?affiliate_id=16906&group_id=0&group_type=1)
Binance cryptocurrencyexchanges - Registration - cashback 10% (https://www.binance.com/en/register?ref=V2WQ1AZO)
KoCoin Cryptocurrency Exchange - cashback 20% (https://www.kucoin.com/r/af/rP6AK1G)