Crates.io | awattar-api |
lib.rs | awattar-api |
version | 0.2.0 |
source | src |
created_at | 2022-08-08 19:17:45.389105 |
updated_at | 2022-10-20 18:23:58.632809 |
description | API client for the awattar price API |
homepage | |
repository | https://github.com/markus-k/awattar-api-rs |
max_upload_size | |
id | 641005 |
size | 44,660 |
awattar-api
– Rust client for the awattar price APIThis crates is an API client for the awattar price API.
The API of this crate is currently not considered stable and is likely to change in future releases.
For a full example have a look at the examples/
-directory.
Add awattar-api
to you dependencies:
[dependencies]
awattar-api = "0.2.0"
Querying prices is simple:
use awattar_api::*;
use chrono::Utc;
#[tokio::main]
async fn main() {
let date = Utc::today().naive_local();
let prices = PriceData::query_date(AwattarZone::Germany, date)
.await
.unwrap();
for slot in prices.slots_iter() {
println!(
"{} - {}: {:.02} €/kWh",
slot.start(),
slot.end(),
slot.price_cents_per_mwh() as f32 / 100_000.00
);
}
}
This crate is licensed under the MIT license.