Skip to main content

fmp_rust_sdk/models/
financials.rs

1//! Financial statements and their reporting metadata.
2
3use chrono::{NaiveDate, NaiveDateTime};
4use serde::{Deserialize, Serialize};
5
6/// Reporting identifiers shared by statements, key metrics, ratios, and financial growth.
7/// Filing details are absent when the endpoint does not return them.
8#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
9#[serde(rename_all = "camelCase")]
10pub struct FinancialPeriod {
11    #[serde(deserialize_with = "super::non_empty_string")]
12    pub symbol: String,
13    pub date: NaiveDate,
14    #[serde(deserialize_with = "super::non_empty_string")]
15    pub fiscal_year: String,
16    /// Provider reporting label, such as FY, Q1, Q2, Q3, or Q4.
17    #[serde(deserialize_with = "super::non_empty_string")]
18    pub period: String,
19    #[serde(deserialize_with = "super::non_empty_string")]
20    pub reported_currency: String,
21    pub cik: Option<String>,
22    #[serde(default, deserialize_with = "super::optional_date")]
23    pub filing_date: Option<NaiveDate>,
24    #[serde(default, with = "super::optional_timestamp")]
25    pub accepted_date: Option<NaiveDateTime>,
26}
27
28/// Income statement values from `income-statement` and `income-statement-ttm`.
29#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
30#[serde(rename_all = "camelCase")]
31pub struct IncomeStatement {
32    #[serde(flatten)]
33    pub metadata: FinancialPeriod,
34    pub revenue: Option<f64>,
35    pub cost_of_revenue: Option<f64>,
36    pub gross_profit: Option<f64>,
37    pub research_and_development_expenses: Option<f64>,
38    pub general_and_administrative_expenses: Option<f64>,
39    pub selling_and_marketing_expenses: Option<f64>,
40    pub selling_general_and_administrative_expenses: Option<f64>,
41    pub other_expenses: Option<f64>,
42    pub operating_expenses: Option<f64>,
43    pub cost_and_expenses: Option<f64>,
44    pub net_interest_income: Option<f64>,
45    pub interest_income: Option<f64>,
46    pub interest_expense: Option<f64>,
47    pub depreciation_and_amortization: Option<f64>,
48    pub ebitda: Option<f64>,
49    pub ebit: Option<f64>,
50    pub non_operating_income_excluding_interest: Option<f64>,
51    pub operating_income: Option<f64>,
52    pub total_other_income_expenses_net: Option<f64>,
53    pub income_before_tax: Option<f64>,
54    pub income_tax_expense: Option<f64>,
55    pub net_income_from_continuing_operations: Option<f64>,
56    pub net_income_from_discontinued_operations: Option<f64>,
57    pub other_adjustments_to_net_income: Option<f64>,
58    pub net_income: Option<f64>,
59    pub net_income_deductions: Option<f64>,
60    pub bottom_line_net_income: Option<f64>,
61    pub eps: Option<f64>,
62    pub eps_diluted: Option<f64>,
63    pub weighted_average_shs_out: Option<f64>,
64    pub weighted_average_shs_out_dil: Option<f64>,
65}
66
67/// Balance sheet values from `balance-sheet-statement` and its TTM endpoint.
68#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
69#[serde(rename_all = "camelCase")]
70pub struct BalanceSheetStatement {
71    #[serde(flatten)]
72    pub metadata: FinancialPeriod,
73    pub cash_and_cash_equivalents: Option<f64>,
74    pub short_term_investments: Option<f64>,
75    pub cash_and_short_term_investments: Option<f64>,
76    pub net_receivables: Option<f64>,
77    pub accounts_receivables: Option<f64>,
78    pub other_receivables: Option<f64>,
79    pub inventory: Option<f64>,
80    pub prepaids: Option<f64>,
81    pub other_current_assets: Option<f64>,
82    pub total_current_assets: Option<f64>,
83    pub property_plant_equipment_net: Option<f64>,
84    pub goodwill: Option<f64>,
85    pub intangible_assets: Option<f64>,
86    pub goodwill_and_intangible_assets: Option<f64>,
87    pub long_term_investments: Option<f64>,
88    pub tax_assets: Option<f64>,
89    pub other_non_current_assets: Option<f64>,
90    pub total_non_current_assets: Option<f64>,
91    pub other_assets: Option<f64>,
92    pub total_assets: Option<f64>,
93    pub total_payables: Option<f64>,
94    pub account_payables: Option<f64>,
95    pub other_payables: Option<f64>,
96    pub accrued_expenses: Option<f64>,
97    pub short_term_debt: Option<f64>,
98    pub capital_lease_obligations_current: Option<f64>,
99    pub tax_payables: Option<f64>,
100    pub deferred_revenue: Option<f64>,
101    pub other_current_liabilities: Option<f64>,
102    pub total_current_liabilities: Option<f64>,
103    pub long_term_debt: Option<f64>,
104    pub capital_lease_obligations_non_current: Option<f64>,
105    pub deferred_revenue_non_current: Option<f64>,
106    pub deferred_tax_liabilities_non_current: Option<f64>,
107    pub other_non_current_liabilities: Option<f64>,
108    pub total_non_current_liabilities: Option<f64>,
109    pub other_liabilities: Option<f64>,
110    pub capital_lease_obligations: Option<f64>,
111    pub total_liabilities: Option<f64>,
112    pub treasury_stock: Option<f64>,
113    pub preferred_stock: Option<f64>,
114    pub common_stock: Option<f64>,
115    pub retained_earnings: Option<f64>,
116    pub additional_paid_in_capital: Option<f64>,
117    pub accumulated_other_comprehensive_income_loss: Option<f64>,
118    pub other_total_stockholders_equity: Option<f64>,
119    pub total_stockholders_equity: Option<f64>,
120    pub total_equity: Option<f64>,
121    pub minority_interest: Option<f64>,
122    pub total_liabilities_and_total_equity: Option<f64>,
123    pub total_investments: Option<f64>,
124    pub total_debt: Option<f64>,
125    pub net_debt: Option<f64>,
126}
127
128/// Cash flow values from `cash-flow-statement` and its TTM endpoint.
129#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
130#[serde(rename_all = "camelCase")]
131pub struct CashFlowStatement {
132    #[serde(flatten)]
133    pub metadata: FinancialPeriod,
134    pub net_income: Option<f64>,
135    pub depreciation_and_amortization: Option<f64>,
136    pub deferred_income_tax: Option<f64>,
137    pub stock_based_compensation: Option<f64>,
138    pub change_in_working_capital: Option<f64>,
139    pub accounts_receivables: Option<f64>,
140    pub inventory: Option<f64>,
141    pub accounts_payables: Option<f64>,
142    pub other_working_capital: Option<f64>,
143    pub other_non_cash_items: Option<f64>,
144    pub net_cash_provided_by_operating_activities: Option<f64>,
145    pub investments_in_property_plant_and_equipment: Option<f64>,
146    pub acquisitions_net: Option<f64>,
147    pub purchases_of_investments: Option<f64>,
148    pub sales_maturities_of_investments: Option<f64>,
149    pub other_investing_activities: Option<f64>,
150    pub net_cash_provided_by_investing_activities: Option<f64>,
151    pub net_debt_issuance: Option<f64>,
152    pub long_term_net_debt_issuance: Option<f64>,
153    pub short_term_net_debt_issuance: Option<f64>,
154    pub net_stock_issuance: Option<f64>,
155    pub net_common_stock_issuance: Option<f64>,
156    pub common_stock_issuance: Option<f64>,
157    pub common_stock_repurchased: Option<f64>,
158    pub net_preferred_stock_issuance: Option<f64>,
159    pub net_dividends_paid: Option<f64>,
160    pub common_dividends_paid: Option<f64>,
161    pub preferred_dividends_paid: Option<f64>,
162    pub other_financing_activities: Option<f64>,
163    pub net_cash_provided_by_financing_activities: Option<f64>,
164    pub effect_of_forex_changes_on_cash: Option<f64>,
165    pub net_change_in_cash: Option<f64>,
166    pub cash_at_end_of_period: Option<f64>,
167    pub cash_at_beginning_of_period: Option<f64>,
168    pub operating_cash_flow: Option<f64>,
169    pub capital_expenditure: Option<f64>,
170    pub free_cash_flow: Option<f64>,
171    pub income_taxes_paid: Option<f64>,
172    pub interest_paid: Option<f64>,
173}