ecb-rates/README.md

93 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2025-01-07 17:01:22 +01:00
# ECB Rates
2025-01-09 16:16:26 +01:00
<p style="text-align: center">
2025-01-09 16:15:03 +01:00
<img
src="images/Logo_European_Central_Bank.svg"
width="200"
alt="European Central Bank Logo"
2025-01-09 16:16:26 +01:00
align="left"
2025-01-09 16:15:03 +01:00
/>
2025-01-09 16:31:33 +01:00
A CLI utility to fetch exchange reates from the European Central Bank.
2025-01-09 16:16:26 +01:00
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</p>
2025-01-07 17:01:22 +01:00
## Install
2025-01-09 17:16:12 +01:00
### Binary
If you're on Debian Linux, then just go over to the releases, and install the latest *.deb* package with `dpkg`
### Source
2025-01-07 17:01:22 +01:00
First, make sure that you have the rust toolchain installed. If not, then go to [rustup](https://rustup.rs) to install it.
2025-01-09 16:03:08 +01:00
Now, run the following cargo command:
2025-01-07 17:01:22 +01:00
```sh
2025-01-09 17:29:35 +01:00
cargo install ecb-rates
2025-01-07 17:01:22 +01:00
```
Congratulations! Now the cli binary `ecb-rates` will be in your cargo bin folder.
## Features
2025-01-09 16:00:11 +01:00
#### Fetch as many days as you want
It will fetch any of the following api nodes, and reduce them for you.
2025-01-09 14:11:46 +01:00
- Last available day.
- Last 90 days
- Since the dawn of the *EUR*
#### Display select currencies
- as an ASCII table
- in JSON prettified
- in JSON minified
#### Cache
It features an extensive cache, which will [calculate hollidays](src/holiday.rs) in order to know whether to invalidate it or not.
2025-01-07 17:01:22 +01:00
2025-01-09 16:00:11 +01:00
#### Show the rates in your way
Change the rates for the perspective of any currency with the `--perspective` or `-p` flag.
Flip it from `EUR to ALL` to `ALL to EUR` with the `--invert` or `-i` flag. It will work as expected with the *perspective* option.
#### Fast
It wouldn't be a rust project without being *BLAZINGLY FAST*! When the cache is valid a single day will on my computer be shown in 3 ms. When the cache isn't being used it will be ~90ms. The cache speed will largely depend on your drive, the latter will depend on your network speed. Both options are fast enought to be in a `.bashrc` or `.zshrc`
2025-01-09 15:06:00 +01:00
### Examples
2025-01-07 17:01:22 +01:00
2025-01-09 15:06:00 +01:00
#### Show the original data from ECB
2025-01-09 16:00:11 +01:00
2025-01-09 16:31:33 +01:00
![eur-to-all](images/eur-to-all.png)
2025-01-07 17:01:22 +01:00
2025-01-09 15:06:00 +01:00
#### ...with only select currencies
2025-01-09 16:31:33 +01:00
![eur-to-all](images/eur-to-all-select.png)
2025-01-09 15:06:00 +01:00
#### Put the exchange rate in the perspective of any currency
2025-01-09 16:31:33 +01:00
![usd-to-all](images/usd-to-all.png)
2025-01-09 15:06:00 +01:00
#### Flip it
2025-01-09 16:31:33 +01:00
![all-to-usd](images/all-to-usd.png)
2025-01-07 17:01:22 +01:00
2025-01-09 16:00:11 +01:00
#### Show multiple days
2025-01-09 16:31:33 +01:00
![eur-to-all-multiple-days](images/eur-to-all-multiple-days.png)
2025-01-09 16:00:11 +01:00
2025-01-07 17:01:22 +01:00
## Acknowledgment
2025-01-09 16:00:11 +01:00
The data is (obviously) provided by the [European Central Bank](https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html)