add valuation netWorth
This commit is contained in:
parent
7f8e430b59
commit
b717c9fa3d
1 changed files with 12 additions and 0 deletions
|
|
@ -142,6 +142,18 @@ pub const Allocation = struct {
|
|||
price_ratio: f64 = 1.0,
|
||||
};
|
||||
|
||||
/// Net worth = liquid (stocks + cash + CDs + options) + illiquid assets.
|
||||
///
|
||||
/// Lives here rather than on `Portfolio` because the liquid side needs a
|
||||
/// fully-computed `PortfolioSummary` (current prices, covered-call
|
||||
/// adjustments, non-stock totals). The illiquid side is a simple sum the
|
||||
/// model already exposes. Every display site — CLI `portfolio` command,
|
||||
/// TUI portfolio tab, planned snapshot writer — should call this instead
|
||||
/// of re-summing inline.
|
||||
pub fn netWorth(portfolio: portfolio_mod.Portfolio, summary: PortfolioSummary) f64 {
|
||||
return summary.total_value + portfolio.totalIlliquid();
|
||||
}
|
||||
|
||||
/// Compute portfolio summary given positions and current prices.
|
||||
/// `prices` maps symbol -> current price.
|
||||
/// `manual_prices` optionally marks symbols whose price came from manual override (not live API).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue