1use chrono::{NaiveDate, NaiveDateTime};
4use serde::{Deserialize, Serialize};
5
6#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
8#[serde(rename_all = "camelCase")]
9pub struct AnalystEstimate {
10 #[serde(deserialize_with = "super::non_empty_string")]
11 pub symbol: String,
12 pub date: NaiveDate,
13 pub revenue_low: Option<f64>,
14 pub revenue_high: Option<f64>,
15 pub revenue_avg: Option<f64>,
16 pub ebitda_low: Option<f64>,
17 pub ebitda_high: Option<f64>,
18 pub ebitda_avg: Option<f64>,
19 pub ebit_low: Option<f64>,
20 pub ebit_high: Option<f64>,
21 pub ebit_avg: Option<f64>,
22 pub net_income_low: Option<f64>,
23 pub net_income_high: Option<f64>,
24 pub net_income_avg: Option<f64>,
25 pub sga_expense_low: Option<f64>,
26 pub sga_expense_high: Option<f64>,
27 pub sga_expense_avg: Option<f64>,
28 pub eps_avg: Option<f64>,
29 pub eps_high: Option<f64>,
30 pub eps_low: Option<f64>,
31 pub num_analysts_revenue: Option<u32>,
32 pub num_analysts_eps: Option<u32>,
33}
34
35#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
37#[serde(rename_all = "camelCase")]
38pub struct PriceTargetConsensus {
39 #[serde(deserialize_with = "super::non_empty_string")]
40 pub symbol: String,
41 pub target_high: Option<f64>,
42 pub target_low: Option<f64>,
43 pub target_consensus: Option<f64>,
44 pub target_median: Option<f64>,
45}
46
47#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
49#[serde(rename_all = "camelCase")]
50pub struct RatingSnapshot {
51 #[serde(deserialize_with = "super::non_empty_string")]
52 pub symbol: String,
53 pub rating: String,
54 pub overall_score: Option<u8>,
55 pub discounted_cash_flow_score: Option<u8>,
56 pub return_on_equity_score: Option<u8>,
57 pub return_on_assets_score: Option<u8>,
58 pub debt_to_equity_score: Option<u8>,
59 pub price_to_earnings_score: Option<u8>,
60 pub price_to_book_score: Option<u8>,
61}
62
63#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
65pub struct DiscountedCashFlow {
66 #[serde(deserialize_with = "super::non_empty_string")]
67 pub symbol: String,
68 pub date: NaiveDate,
69 pub dcf: f64,
70 #[serde(rename = "Stock Price")]
71 pub stock_price: Option<f64>,
72}
73
74#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
76#[serde(rename_all = "camelCase")]
77pub struct EtfHolding {
78 #[serde(deserialize_with = "super::non_empty_string")]
79 pub symbol: String,
80 pub asset: String,
82 pub name: String,
83 pub isin: Option<String>,
84 pub security_cusip: Option<String>,
85 pub shares_number: Option<f64>,
86 pub weight_percentage: f64,
87 pub market_value: Option<f64>,
88 #[serde(default, with = "super::optional_timestamp")]
89 pub updated_at: Option<NaiveDateTime>,
90}
91
92#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
94pub struct TreasuryRate {
95 pub date: NaiveDate,
96 pub month1: Option<f64>,
97 pub month2: Option<f64>,
98 pub month3: Option<f64>,
99 pub month6: Option<f64>,
100 pub year1: Option<f64>,
101 pub year2: Option<f64>,
102 pub year3: Option<f64>,
103 pub year5: Option<f64>,
104 pub year7: Option<f64>,
105 pub year10: Option<f64>,
106 pub year20: Option<f64>,
107 pub year30: Option<f64>,
108}
109
110#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
112pub struct EconomicIndicator {
113 #[serde(deserialize_with = "super::non_empty_string")]
114 pub name: String,
115 pub date: NaiveDate,
116 pub value: f64,
117}
118
119#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
121#[serde(rename_all = "camelCase")]
122pub struct EconomicEvent {
123 #[serde(with = "super::timestamp")]
124 pub date: NaiveDateTime,
125 pub country: String,
126 #[serde(deserialize_with = "super::non_empty_string")]
127 pub event: String,
128 pub currency: Option<String>,
129 pub previous: Option<f64>,
130 pub estimate: Option<f64>,
131 pub actual: Option<f64>,
132 pub change: Option<f64>,
133 pub impact: Option<String>,
134 pub change_percentage: Option<f64>,
135 pub unit: Option<String>,
136}
137
138#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
140#[serde(rename_all = "camelCase")]
141pub struct SectorPerformance {
142 pub date: NaiveDate,
143 #[serde(deserialize_with = "super::non_empty_string")]
144 pub sector: String,
145 pub exchange: String,
146 pub average_change: f64,
147}
148
149#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
151#[serde(rename_all = "camelCase")]
152pub struct IndustryPerformance {
153 pub date: NaiveDate,
154 #[serde(deserialize_with = "super::non_empty_string")]
155 pub industry: String,
156 pub exchange: String,
157 pub average_change: f64,
158}
159
160#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
162#[serde(rename_all = "camelCase")]
163pub struct MarketMover {
164 #[serde(deserialize_with = "super::non_empty_string")]
165 pub symbol: String,
166 pub name: String,
167 pub price: f64,
168 pub change: Option<f64>,
169 pub changes_percentage: Option<f64>,
170 pub exchange: Option<String>,
171}