local-forex
A free python package to help get started in building and interacting with a local database of currency exchange rates.
Dictionary based currency exchange rate package
- Rates provided by Bank of Canada. Includes function for fetching and saving latest rates using BoC API
- Offline JSON historical database reduces reliance on external API availability (records to 2017-01-03, TODO: extend historical records)
- ~24 modern currencies supported
Installation
pip install local-forex
cd local-forex
pip install -r requirements.txt
Example conversion
import local_forex
fx = local_forex.ForexRates()
# Example conversion rate query for USD/EUR on December 02, 2020
from datetime import datetime
rate = local_forex.get_conversion_rate(base="USD", quote="EUR", date=datetime(2020,12,02))
Backfilling rates
- backfill.py is included for convenience. Run Mon-Fri after 16:30EST to update database daily (e.g. Launchd on MacOS).
online_rates = fx.fetch_boc_rates()
fx.update_from_boc_rates(online_rates)
fx.save_rates_to_file()
Metadata
Release files for local-forex 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| local_forex-0.1.9.tar.gz | 177.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| local_forex-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 370.4 kB
Release files / local_forex-0.1.9.tar.gz
| Download URL | local_forex-0.1.9.tar.gz |
|---|---|
| Size | 177.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
337c7fd209eadfbca9e5749142a9a569033e11294605d4ebdc10ac1f0c6d7163
|
|
BLAKE2b-256 checksum How to use checksums |
53f697d9574a11a838f0d498e61d967f42aeef3395150c9a22c9899ae3ac2784
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / local_forex-0.1.9-py3-none-any.whl
| Download URL | local_forex-0.1.9-py3-none-any.whl |
|---|---|
| Size | 193.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c29f3a1881049b4fdb2c891d045da93721a47799e1b3235fb48029d0115d39a
|
|
BLAKE2b-256 checksum How to use checksums |
4bec12a15977e3da4668a1ef6b9aa40cd86e66a76643ee34640453c5284bbcf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|