This is no longer mantained. Please see https://github.com/iuriguilherme/cryptoforexbot for the same project updated. The bot address is the same: https://t.me/cryptoforexbot
This is a Python Telegram bot to convert values between crypto and fiat currencies.
The intended implementation resides at @criptoforexbot.
You can use the bot @criptoforexbot on Telegram.
There is a telegram group if you are interested in following or helping the development: https://t.me/joinchat/AAAAAA5gJhDL8TwBpxo5yw disable notifications, this group gets a LOT of messages
Currently available commands:
Display a (helpfully) helpful information, as a guide for usage;
Display information about the bot, link to the source code and the development group;
Convert values from one currency to another.
Example: /conv 0.003 BTC BRL
Display price information for a currency.
Example: /price ETH
Lists current available currencies that can be used with the other commands.
Send feedback to the development team.
Example: /feedback This bot doesn't work!
If you want to make your own bot based on this one, then:
First get a token from @BotFather on Telegram. See the bot faq for reference.
Do not just clone the main branch. I commit everything. Use the stable branch:
$ git clone -b stable https://github.com/desci/tg-cryptoforexbot.git
$ cd tg-cryptoforexbot
This has been tested with Python 2.7.11
If you don't have Python, install it!
We use Telepot, so you have to install it.
Try pip install telepot
. Or you can try pip install -r requirements.txt
from cryptoforexbot's directory.
Enter the directory cryptoforexbot.
Rename the file cryptoforexbot.cfg.example
to cryptoforexbot.cfg
.
Edit that file, changing the value token
in the [botfather]
section to the one @BotFather told you.
Go back to the top directory.
If on UNIX, run with ./start.py
On any platform, run with python start.py
To stop, send a KeyboardInterrupt (CTRL+C).
If you don't know what is your telegram id, make sure you leave the debugging logs on and send a private message to your bot.
You should see something like this:
[2017-05-09 13:37:26.113188] RCV: Received "hi" from 123456789
Where 123456789
is your telegram id. Make sure you put that in the configuration file, in the [admin]
section - the file is cryptoforexbot/cryptoforexbot.cfg
as explained above, see Configuring.
Also, you may configure a group admin id, which looks like -123456789
. This will help with debug logging and it's where the user feedback is sent.
The following additional admin commands are available:
Like /help
, but for admin commands.
When the bot is successfully acknowledging you as an admin, send the /admin
command to get help on how to manage the database.
Using a local database to store values is important because querying external APIs everytime an user make a request would overhead the APIs, also they could be temporary unreachable because of network lag.
database not yet implemented, see roadmap below
Send a message (from the bot) to any telegram user or group.
Usage: /send <id> <message>
Command which can be used for debbuging purposes, defined at cryptoforexbot/admin_commands.py
and freely hackable.
If you are running the bot on a Linux server (or other systemd capable), use the following systemd service file for a daemon:
[Unit]
Description=tg-cryptoforexbot daemon
After=network.target nss-lookup.target
[Service]
Type=simple
ExecStart=/usr/bin/python2.7 /home/user/tg-cryptoforexbot/start.py
WorkingDirectory=/home/user/tg-cryptoforexbot/
Restart=on-failure
[Install]
WantedBy=multi-user.target
On a Debian system, this should reside at /lib/systemd/system/tg-cryptoforexbot.service
.
Enable the service and start:
# systemctl daemon-reload
# systemctl enable tg-cryptoforexbot.service
# systemctl -l start tg-cryptoforexbot.service
To see if it's working:
# systemctl -l status tg-cryptoforexbot.service
To stop:
# systemctl stop tg-cryptoforexbot.service
Or restart:
# systemctl -l restart tg-cryptoforexbot.service
You can also put a watchdog cronjob to make sure it will restart on failure:
# crontab -e
Add a line like this in the crontab:
*/10 * * * * /usr/lib/systemctl is-active tg-cryptoforexbot.service || /usr/lib/systemctl start tg-cryptoforexbot.service
This would check every 10 minutes if the bot is running and start it in case it wasn't.
- Add as many currencies as possible;
- All coinmarketcap currencies have been added.
- Use as many external websites API as possible, in case some of them gets rate limit or suffer downtime;
- Currently using only coinmarketcap.com
- Use sqlite or other database to store coin information and values;
- Use inline commmands;
- Translations;
This bot relies on external services, for instance on Coin Market Cap and International Monetary Fund for current values fetching. This is so as to provide a convenient way to convert to the latest prices of currencies. However, I am not responsible for the accuratness of the values provided by those external services. In your ideal world, we would have only descentralized currencies directly manipulated by the market. Which is not our reality as of now.
This bot is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use at your own risk.
If you ever complain to me that you lost money because you saw a wrong value, I will laugh at you. That said, major finance websites which charges you lots of money annualy for "secure and trusted" market data use the very same methods that are being used here.
So what they are charging for? They are charging you because they will be nice and won't say "-we will laugh at you" like I do. They would treat you as a customer, and not as an user like I do. So you're really paying to be pampered and feel special. Also they spend much money so they don't have one milisecond of downtime, and if they ever do, theorectically you may sue them.
If you think this bot is useful and should stay online and available, consider donating. This would help me pay the internet bill and/or the hosting service, and therefore would help mantain the service available.
Copyleft 2017 Desobediente Civil
This is GPL software. Which basically means that if you modify the source code, you need to distribute the modified version WITH the modified source code and with the same license.
See the file LICENSE.md which should be distributed with this software.
Logo found in subdirectory assets/ uses the orange bitcoin symbol which is available in the public domain, as well as an edited graphic chart image obtained from http://www.netpicks.com/forex-trading-2/forex-trading-charts/. Both the scalable vector and the exported PNG image are licensed under CC0. See the file ASSETS-LICENSE.txt.