A package for maintaining and interacting with a local forex database.
Project description
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
- ~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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
local_forex-0.1.5.tar.gz
(172.0 kB
view hashes)
Built Distribution
local_forex-0.1.5-py3-none-any.whl
(187.8 kB
view hashes)
Close
Hashes for local_forex-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 721bf2a93a211b55b87bf1cda32b27a06e665e9cf9fc3e41cc968eefa93ec53e |
|
MD5 | bbdc1b5c9a5cb9b13d1f478d58b2a277 |
|
BLAKE2b-256 | 0833600f5ab169069b08d997b48abf97b672097729e96175c7d77caff0995877 |