Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Telegram Python bot for crypto/fiat currencies value conversion

License

GPL-3.0, CC0-1.0 licenses found

Licenses found

GPL-3.0
LICENSE.md
CC0-1.0
ASSETS-LICENSE.txt
NotificationsYou must be signed in to change notification settings

iuriguilherme/tg-cryptoforexbot

Repository files navigation

Archiving notice

This is no longer mantained. Please seehttps://github.com/iuriguilherme/cryptoforexbot for the same project updated. The bot address is the same:https://t.me/cryptoforexbot

What

This is aPythonTelegram bot to convert values betweencrypto andfiat currencies.
The intended implementation resides at@criptoforexbot.

Usage

You can use the bot@criptoforexbot onTelegram.

There is a telegram group if you are interested in following or helping the development:https://t.me/joinchat/AAAAAA5gJhDL8TwBpxo5ywdisable notifications, this group gets a LOT of messages

Commands

Currently available commands:

/help

Display a (helpfully) helpful information, as a guide for usage;

/info

Display information about the bot, link to the source code and the development group;

/conv

Convert values from one currency to another.

Example:/conv 0.003 BTC BRL

/price

Display price information for a currency.

Example:/price ETH

/list

Lists current available currencies that can be used with the other commands.

/feedback

Send feedback to the development team.

Example:/feedback This bot doesn't work!


Make your own

If you want to make your own bot based on this one, then:

Register as a Telegram Bot

First get a token from@BotFather on Telegram. See thebot faq for reference.

Get the working code

Do not just clone the main branch. I commit everything. Use thestable branch:

$ git clone -b stable https://github.com/desci/tg-cryptoforexbot.git$cd tg-cryptoforexbot

Dependencies

This has been tested with Python 2.7.11
If you don't have Python,install it!

We useTelepot, so you have to install it.
Trypip install telepot. Or you can trypip install -r requirements.txt fromcryptoforexbot's directory.

Configuring

Enter the directorycryptoforexbot.
Rename the filecryptoforexbot.cfg.example tocryptoforexbot.cfg.
Edit that file, changing the valuetoken in the[botfather] section to the one@BotFather told you.

Running

Go back to the top directory.
If on UNIX, run with./start.py
On any platform, run withpython start.py
To stop, send aKeyboardInterrupt (CTRL+C).

Admin

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

Where123456789 is your telegram id. Make sure you put that in the configuration file, in the[admin] section - the file iscryptoforexbot/cryptoforexbot.cfg as explained above, seeConfiguring.

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.

Admin commands

The following additional admin commands are available:

/admin

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

Send a message (from the bot) to any telegram user or group.

Usage:/send <id> <message>

/debug

Command which can be used for debbuging purposes, defined atcryptoforexbot/admin_commands.py and freely hackable.

Systemd

If you are running the bot on a Linux server (or other systemd capable), use the followingsystemd service file for a daemon:

[Unit]Description=tg-cryptoforexbot daemonAfter=network.target nss-lookup.target[Service]Type=simpleExecStart=/usr/bin/python2.7 /home/user/tg-cryptoforexbot/start.pyWorkingDirectory=/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

Crontab

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.

Roadmap

TODO

  • 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;

Disclaimer

This bot relies on external services, for instance onCoin Market CapandInternational 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 amnot 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 thevery 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.

License

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 fileLICENSE.md which should be distributed with this software.

Assets

Logo found in subdirectoryassets/ uses theorange bitcoin symbol which is available in the public domain, as well as an edited graphic chart image obtained fromhttp://www.netpicks.com/forex-trading-2/forex-trading-charts/. Both the scalable vector and the exported PNG image are licensed under CC0. See the fileASSETS-LICENSE.txt.


[8]ページ先頭

©2009-2025 Movatter.jp