fmp_rs/models/
valuation.rs

1//! Models for valuation and DCF endpoints
2
3use serde::{Deserialize, Serialize};
4
5/// DCF (Discounted Cash Flow) valuation model
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct Dcf {
9    /// Stock symbol
10    pub symbol: String,
11    /// DCF valuation date
12    pub date: String,
13    /// Calculated DCF value
14    pub dcf: Option<f64>,
15    /// Stock price at calculation time
16    pub stock_price: Option<f64>,
17}
18
19/// Historical DCF valuation over time
20#[derive(Debug, Clone, Serialize, Deserialize)]
21#[serde(rename_all = "camelCase")]
22pub struct HistoricalDcf {
23    /// Stock symbol
24    pub symbol: String,
25    /// Calculation date
26    pub date: String,
27    /// DCF value
28    pub dcf: Option<f64>,
29    /// Stock price at that date
30    pub stock_price: Option<f64>,
31}
32
33/// Advanced DCF model with detailed assumptions
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(rename_all = "camelCase")]
36pub struct AdvancedDcf {
37    /// Stock symbol
38    pub symbol: String,
39    /// Calculation date
40    pub date: String,
41    /// DCF value
42    pub dcf: Option<f64>,
43    /// Stock price
44    pub stock_price: Option<f64>,
45    /// Revenue growth rate
46    pub revenue_growth: Option<f64>,
47    /// Operating margin
48    pub operating_margin: Option<f64>,
49    /// Tax rate
50    pub tax_rate: Option<f64>,
51    /// WACC (Weighted Average Cost of Capital)
52    pub wacc: Option<f64>,
53    /// Terminal growth rate
54    pub terminal_growth_rate: Option<f64>,
55    /// Free cash flow projections
56    #[serde(default)]
57    pub free_cash_flows: Vec<f64>,
58}
59
60/// Levered DCF (includes debt in valuation)
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(rename_all = "camelCase")]
63pub struct LeveredDcf {
64    /// Stock symbol
65    pub symbol: String,
66    /// Calculation date
67    pub date: String,
68    /// Levered DCF value (equity value)
69    pub levered_dcf: Option<f64>,
70    /// Stock price
71    pub stock_price: Option<f64>,
72    /// Enterprise value
73    pub enterprise_value: Option<f64>,
74    /// Total debt
75    pub total_debt: Option<f64>,
76    /// Cash and equivalents
77    pub cash_and_equivalents: Option<f64>,
78}
79
80/// Company Enterprise Value
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(rename_all = "camelCase")]
83pub struct EnterpriseValue {
84    /// Stock symbol
85    pub symbol: String,
86    /// Date
87    pub date: String,
88    /// Stock price
89    pub stock_price: Option<f64>,
90    /// Number of shares
91    pub number_of_shares: Option<f64>,
92    /// Market capitalization
93    pub market_capitalization: Option<f64>,
94    /// Minus cash and cash equivalents
95    pub minus_cash_and_cash_equivalents: Option<f64>,
96    /// Plus total debt
97    pub add_total_debt: Option<f64>,
98    /// Enterprise value
99    pub enterprise_value: Option<f64>,
100}