Microapp for my friend, an accountant.
Requirements were to find daily, monthly and spot (last day of month) FX rates for selected currencies.
Some currencies are to be found on ECB, but rest must come from elsewhere, because they not listed on ECB unfortunatelly. Those I found on Apilayer exchange rates API & investing.com (using investiny).
To access Apilayer API, one must register to obtain API key.
Screenshot
App uses 1 first party cookie [lax] to save last form checkboxes.
There is no auth impemented, as we dont really need it.
Sentry-like Telegram notifications has been used.
Set env variables (.env
can be used):
APILAYER_API_KEY=... # get your own:)
Alerting via Telegram can be used, if enabled by:
TELEGRAM_ENABLED= # bool, by default 0/false/False
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...
There are several options presented:
1. Run app locally with:
uvicorn main:app --host 0.0.0.0 --port 5000 --reload --workers 1
2. Run locally in Docker via Traefik
docker-compose up
Find running app at localhost:500
3. Deploy locally with deploy.py
python deploy.py
- type (or set env var) "localhost" as
FX_URI
when asked
Find running app at localhost:500
4. Deploy on server with deploy.py
There is no CI, all manually:
- push to repo
- ssh to machine/repo
python deploy.py
- type (or set env var) your desired url as
FX_URI
when asked
Im not sure I wanna accept PR, as its a quick side project.
However, if you really wanna, dont forget to use pre-commit
!
pre-commit install
pre-commit