Skip to content
/ twertb Public

Get a Telegram message and withdraw money from TransferWise account with favorable exchange rate

Notifications You must be signed in to change notification settings

Amet13/twertb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TransferWise Exchange Rate Telegram Bot

Actions Status License

Get a Telegram message and withdraw money from TransferWise account with favorable exchange rate

Usage

Clone repo and get help:

$ git clone https://github.com/Amet13/twertb
$ python3 twertb/ -h
usage: [-h] [-u] [-e SOURCE TARGET] [-a ALERT] [-p] [-t TG_TOKEN] [-i TG_ID]

optional arguments:
  -h, --help            show this help message and exit
  -u, --update          update currency rates
  -e SOURCE TARGET, --exchange SOURCE TARGET
                        source and target currency for exchange
  -a ALERT, --alert ALERT
                        alert when 1 SOURCE goes above X TARGET
  -p, --print           print available currencies
  -t TG_TOKEN, --token TG_TOKEN
                        telegram token
  -i TG_ID, --id TG_ID  telegram id

Get last currency database and get exchange rate for EUR/USD:

$ python3 twertb/ -e EUR USD -u
Currency database updated (2017-12-01 13:49:58)
1 EUR = 1.189 USD

Get exchange rate for GBP/RUB without updating database:

$ python3 twertb/ -e GBP RUB
1 GBP = 79.14778 RUB

Show available currencies (for example grep by A end E):

$ python3 twertb/ -p | egrep '^A|^E'
Available currencies:
AED: United Arabian Emirates
AUD: Australia
EUR: Europe
AFN: Afghanistan
ARS: Argentina
EGP: Egypt
ETB: Ethiopia

Send exchange rates message to Telegram

  1. Go to @BotFather and create /newbot (for example TWERTB_bot)
  2. You will receive a token like 111111111:ABCDE, remember it
  3. Then go to @MyTelegramID_bot and /start it
  4. You will receive your Telegram ID like 123456789, also remember it

Run script with your token and ID

TOKEN='111111111:ABCDE'
ID='123456789'
$ python3 twertb/ -e EUR RUB -t $TOKEN -i $ID
1 EUR = 69.66249 RUB
Message sent to Telegram

Autoupdate currencies

Add to cron a job for updating a currencies database (for example every two hours):

$ crontab -e
* */2 * * * /usr/bin/python3 /path/to/twertb/ -u &> /dev/null

Get a Telegram message when exchange rate is favorable

Add to cron task for every 10 minutes checks and get alert when 1 EUR > 70 RUB:

$ crontab -e
*/10 * * * * /usr/bin/python3 /path/to/twertb/ -e EUR RUB -u -a 70 -t $TOKEN -i $ID &> /dev/null

Serverless bot usage via GitHub

Just enable daily Cron Job in GitHub Actions settings and get exchange rate every day.

About

Get a Telegram message and withdraw money from TransferWise account with favorable exchange rate

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages