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