finance_query/models/economic/catalog.rs
1//! Discovery models for the macro-economic series universe.
2//!
3//! Served through the [`Capability::ECONOMIC`](crate::Capability::ECONOMIC)
4//! route; FRED is currently the only provider. These answer "which series
5//! exist" — [`EconomicSeries`](super::EconomicSeries) answers "what does this
6//! series say", and needs an id you already know.
7
8use serde::{Deserialize, Serialize};
9
10/// A series matching a catalog search.
11#[derive(Debug, Clone, Default, Serialize, Deserialize)]
12#[non_exhaustive]
13pub struct EconomicSeriesMatch {
14 /// Series identifier (e.g. `"GDPC1"`).
15 pub id: String,
16 /// Human-readable title.
17 pub title: Option<String>,
18 /// Reporting frequency (e.g. `"Quarterly"`).
19 pub frequency: Option<String>,
20 /// Unit of measurement (e.g. `"Billions of Chained 2017 Dollars"`).
21 pub units: Option<String>,
22 /// Seasonal adjustment description.
23 pub seasonal_adjustment: Option<String>,
24 /// Date of the earliest observation (`YYYY-MM-DD`).
25 pub observation_start: Option<String>,
26 /// Date of the latest observation (`YYYY-MM-DD`).
27 pub observation_end: Option<String>,
28 /// Provider popularity score, useful for ranking equally-relevant matches.
29 pub popularity: Option<i64>,
30 /// Provider notes about the series.
31 pub notes: Option<String>,
32}
33
34/// A node in the provider's series category tree.
35#[derive(Debug, Clone, Default, Serialize, Deserialize)]
36#[non_exhaustive]
37pub struct EconomicCategory {
38 /// Category identifier.
39 pub id: i64,
40 /// Category name.
41 pub name: Option<String>,
42 /// Parent category identifier; the root category is its own parent.
43 pub parent_id: Option<i64>,
44}
45
46/// A publication that releases economic series on a schedule.
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48#[non_exhaustive]
49pub struct EconomicRelease {
50 /// Release identifier.
51 pub id: i64,
52 /// Release name (e.g. `"Employment Situation"`).
53 pub name: Option<String>,
54 /// Whether the release is accompanied by a press release.
55 pub press_release: Option<bool>,
56 /// Link to the release on the publisher's site.
57 pub link: Option<String>,
58}