Get a Telegram message and withdraw money from TransferWise account with favorable exchange rate
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
- Go to @BotFather and create
/newbot
(for exampleTWERTB_bot
) - You will receive a token like
111111111:ABCDE
, remember it - Then go to @MyTelegramID_bot and
/start
it - You will receive your Telegram ID like
123456789
, also remember it
TOKEN='111111111:ABCDE'
ID='123456789'
$ python3 twertb/ -e EUR RUB -t $TOKEN -i $ID
1 EUR = 69.66249 RUB
Message sent to Telegram
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
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
Just enable daily Cron Job in GitHub Actions settings and get exchange rate every day.