finance_query/adapters/polygon/
economy.rs1use serde::{Deserialize, Serialize};
4
5use crate::error::Result;
6
7use super::build_client;
8use super::models::PaginatedResponse;
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
12#[non_exhaustive]
13pub struct EconomicDataPoint {
14 pub date: Option<String>,
16 pub value: Option<f64>,
18 pub period: Option<String>,
20}
21
22pub async fn inflation(params: &[(&str, &str)]) -> Result<PaginatedResponse<EconomicDataPoint>> {
24 let client = build_client()?;
25 client.get("/v1/indicators/economy/inflation", params).await
26}
27
28pub async fn inflation_expectations(
30 params: &[(&str, &str)],
31) -> Result<PaginatedResponse<EconomicDataPoint>> {
32 let client = build_client()?;
33 client
34 .get("/v1/indicators/economy/inflation-expectations", params)
35 .await
36}
37
38pub async fn labor_market(params: &[(&str, &str)]) -> Result<PaginatedResponse<EconomicDataPoint>> {
40 let client = build_client()?;
41 client
42 .get("/v1/indicators/economy/labor-market", params)
43 .await
44}
45
46pub async fn treasury_yields(
48 params: &[(&str, &str)],
49) -> Result<PaginatedResponse<EconomicDataPoint>> {
50 let client = build_client()?;
51 client
52 .get("/v1/indicators/economy/treasury-yields", params)
53 .await
54}