add valuation netWorth
This commit is contained in:
parent
4b1989c91a
commit
eb97480820
1 changed files with 12 additions and 0 deletions
|
|
@ -142,6 +142,18 @@ pub const Allocation = struct {
|
||||||
price_ratio: f64 = 1.0,
|
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.
|
/// Compute portfolio summary given positions and current prices.
|
||||||
/// `prices` maps symbol -> current price.
|
/// `prices` maps symbol -> current price.
|
||||||
/// `manual_prices` optionally marks symbols whose price came from manual override (not live API).
|
/// `manual_prices` optionally marks symbols whose price came from manual override (not live API).
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue