paft_fundamentals/
statements.rs

1//! Financial statements and calendar types under `paft_fundamentals::fundamentals::statements`.
2
3use serde::{Deserialize, Serialize};
4
5use chrono::{DateTime, Utc};
6#[cfg(feature = "dataframe")]
7use df_derive::ToDataFrame;
8#[cfg(feature = "dataframe")]
9use paft_core::dataframe::ToDataFrame;
10use paft_core::domain::{Money, Period};
11
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
14/// Income statement row.
15pub struct IncomeStatementRow {
16    /// Financial period with structured variants and extensible fallback.
17    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
18    pub period: Period,
19    /// Total revenue.
20    pub total_revenue: Option<Money>,
21    /// Gross profit.
22    pub gross_profit: Option<Money>,
23    /// Operating income.
24    pub operating_income: Option<Money>,
25    /// Net income.
26    pub net_income: Option<Money>,
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
31/// Balance sheet row.
32pub struct BalanceSheetRow {
33    /// Financial period with structured variants and extensible fallback.
34    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
35    pub period: Period,
36    /// Total assets.
37    pub total_assets: Option<Money>,
38    /// Total liabilities.
39    pub total_liabilities: Option<Money>,
40    /// Total equity.
41    pub total_equity: Option<Money>,
42    /// Cash and cash equivalents.
43    pub cash: Option<Money>,
44    /// Long-term debt.
45    pub long_term_debt: Option<Money>,
46    /// Shares outstanding.
47    pub shares_outstanding: Option<u64>,
48}
49
50#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
51#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
52/// Cashflow statement row.
53pub struct CashflowRow {
54    /// Financial period with structured variants and extensible fallback.
55    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
56    pub period: Period,
57    /// Operating cashflow.
58    pub operating_cashflow: Option<Money>,
59    /// Capital expenditures.
60    pub capital_expenditures: Option<Money>,
61    /// Free cash flow.
62    pub free_cash_flow: Option<Money>,
63    /// Net income.
64    pub net_income: Option<Money>,
65}
66
67#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
68#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
69/// Corporate calendar entries (earnings/dividends).
70pub struct Calendar {
71    /// Upcoming or historical earnings dates.
72    #[serde(with = "paft_core::serde_helpers::ts_seconds_vec")]
73    pub earnings_dates: Vec<DateTime<Utc>>,
74    /// Ex-dividend date.
75    #[serde(with = "paft_core::serde_helpers::ts_seconds_option")]
76    pub ex_dividend_date: Option<DateTime<Utc>>,
77    /// Dividend payment date.
78    #[serde(with = "paft_core::serde_helpers::ts_seconds_option")]
79    pub dividend_payment_date: Option<DateTime<Utc>>,
80}