Metadata-Version: 2.1
Name: local_forex
Version: 0.1.0
Summary: A package for maintaining and interacting with a local forex database.
Author: porkyc
Project-URL: Homepage, https://github.com/porkyc/local_forex
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# local-forex
A free python package to help get you 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

## Example conversion
```python
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).
```python
online_rates = fx.fetch_boc_rates()
fx.update_from_boc_rates(online_rates)
fx.save_rates_to_file()
```
