pub struct EquityPortfolio {
pub positions: Vec<Position>,
}Expand description
A book of option positions on the same underlying.
Fields§
§positions: Vec<Position>Implementations§
Source§impl EquityPortfolio
impl EquityPortfolio
Sourcepub fn snapshot_market(&self) -> Market
pub fn snapshot_market(&self) -> Market
Snapshot the market embedded in a book into a typed Market:
valuation date and discount curve from the first position, one
spot/vol entry per underlying (first position on each symbol wins).
Sourcepub fn npv_in(&self, market: &Market) -> Result<f64, RustyQLibError>
pub fn npv_in(&self, market: &Market) -> Result<f64, RustyQLibError>
Book value under a typed market snapshot (quantity-weighted).
Sourcepub fn position_values_in(
&self,
market: &Market,
) -> Result<Vec<f64>, RustyQLibError>
pub fn position_values_in( &self, market: &Market, ) -> Result<Vec<f64>, RustyQLibError>
Per-position values under a typed market snapshot, in book order.
Source§impl EquityPortfolio
impl EquityPortfolio
pub fn new() -> Self
Sourcepub fn add(&mut self, option: EquityOption, quantity: f64) -> &mut Self
pub fn add(&mut self, option: EquityOption, quantity: f64) -> &mut Self
Add quantity contracts of option (negative = short). All
positions must share one underlying; the first position pins the
symbol and a mismatch panics — this book aggregates risk against a
single spot.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn greeks(&self) -> PortfolioGreeks
pub fn greeks(&self) -> PortfolioGreeks
Aggregated Greeks, each position computed by its own engine.
Sourcepub fn pnl_attribution(&self, m: &MarketMove) -> PnlAttribution
pub fn pnl_attribution(&self, m: &MarketMove) -> PnlAttribution
Explain the book’s PnL over m with second-order Greeks; actual is
a full reprice of every position under the shifted market.