1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! The [Thaler API](https://thaler.sh/developers) from Rust: financial data
//! from SEC filings, with the source filing for every value.
//!
//! ```no_run
//! use thaler::{Client, MetricPeriod};
//!
//! # async fn example() -> Result<(), thaler::Error> {
//! let client = Client::from_env()?; // THALER_API_KEY, or Client::new("thaler_…")
//! let rows = client
//! .metrics("AAPL")
//! .period(MetricPeriod::Annual)
//! .keys(["revenue", "net_income"])
//! .send()
//! .await?;
//! for row in &rows.data {
//! println!("{:?} {} {}", row.fiscal_year, row.metric_key, row.value);
//! }
//! println!("{} left this month", rows.rate_limit.and_then(|l| l.month).and_then(|m| m.remaining).unwrap_or(0));
//! # Ok(())
//! # }
//! ```
//!
//! Every figure is a [`Decimal`] (a decimal string, exact to the digit as
//! filed), every day a [`chrono::NaiveDate`], and every answer a
//! [`Response`] carrying the request ID and the account's limits beside
//! its `data`. The client keeps at most four requests in flight, waits when
//! the minute's limit is spent, retries a 429 after its `Retry-After` and a
//! 500, 502, 503 or 504 after a growing pause, and returns a typed [`Error`]
//! for the rest.
//!
//! The types in [`types`] are generated from the API's OpenAPI document;
//! [`API_VERSION`] names the document they came from.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use *;
/// The crate's version, as the User-Agent announces it.
pub const VERSION: &str = env!;