Crates.io | frankfurter_cli |
lib.rs | frankfurter_cli |
version | |
source | src |
created_at | 2024-11-03 18:14:24.027761 |
updated_at | 2024-12-10 23:32:15.167272 |
description | CLI wrapper around the Frankfurter API |
homepage | |
repository | https://github.com/rolv-apneseth/frankfurters |
max_upload_size | |
id | 1434038 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Rust library and CLI to interface with any Frankfurter API.
Frankfurter is a free, open source and self-hostable currency exchange rate API. It is based on data sets published by the European Central Bank.
Frankfurte-rs (Frankfurters) is available as both an executable (frs
) and a Rust library,
with the hope of providing safe and correct bindings for the API.
[!NOTE] While the Frankfurter API works well most of the time, there are some edge cases and the returned errors are not exactly informative. If you run into any problems while using these bindings, please open an issue with the details of the error encountered.
Install with cargo add lib_frankfurter
or simply add lib_frankfurter
your Cargo.toml
.
Then, check out the this example to see basic usage.
cargo install frankfurter_cli
paru -S frs
# List the latest supported currencies
frs currencies
# Get the latest exchange rates, converting from the EUR
frs convert
# Get exchange rates from 01/01/2024 (or the closest available date with data), converting from the USD to PHP and NOK
frs convert USD -d 2024-01-01
# Get exchange rates over a time period from 01/01/2024 to the present date, converting from EUR to AUD
frs period EUR 2024-01-01 -t AUD
# Get exchange rates over a time period from 01/01/2024 to the 10/01/2024, converting from GBP to EUR and USD
frs period GBP -t EUR,USD 2024-01-01 2024-01-10
All options will print results in a table, but also accept the following options if you want the results in a different format:
--raw
: prints values only separated by tabs, useful for piping the data to different commands--json
: prints the full JSON
response from the serverView the full usage with frs --help
.
A public, free-to-use version of the API is available here, and will be used by default. However, this repo comes with a docker-compose.yml for easy and convenient self-hosting of the Frankfurter
API.
To set up and use a self-hosted version of the API, follow these steps:
docker-compose.yml
file to your systemdocker compose up -d --wait
to start up the Frankfurter
API, which includes a SQLite
database, locally using Docker--url
flag or the FRANKFURTER_URL
environment variable:
frs --url http://localhost:8080
FRANKFURTER_URL="http://localhost:8080 frs
Contributions of any kind are welcome. Feel free to fork the repo, follow the suggested workflow below, commit your changes and open a pull request.
This project uses just, but if you wish to avoid installing that, you can find the individual commands in the justfile.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as in LICENSE, without any additional terms or conditions.
just develop
to run the tests every time you make a change, or just test
to run them once.
cargo run -- -d {args here}
.just format
Frankfurter
.