Skip to main content

Module portfolio

Module portfolio 

Source
Expand description

Portfolio of options on a single underlying: aggregated Greeks and risk-based PnL attribution.

Positions are quantity-weighted (negative quantity = short). All Greeks are additive, so the book’s risk is the weighted sum of per-position Greeks — each computed by that position’s own pricing engine, so a book can mix analytic vanillas, FD Americans and MC barriers.

PnL attribution explains the book’s change in value over a market move (d_spot, d_vol, d_rate, d_time) with a second-order Taylor expansion:

dV =  delta dS  +  1/2 gamma dS^2          (spot)
   +  vega  dv  +  1/2 volga dv^2          (implied vol)
   +  vanna dS dv                          (cross)
   +  theta dt  +  rho dr                  (time, rate)
   +  unexplained

The actual PnL is a full reprice of every position under the shifted market (EquityOption::price_with), so unexplained is a true residual — third-order terms and any cross terms not in the expansion.

Structs§

EquityPortfolio
A book of option positions on the same underlying.
MarketMove
A market move to attribute PnL over. All fields default to zero, so a scenario can set only what moves, e.g. MarketMove { d_spot: 2.0, d_time: 1.0 / 365.0, ..Default::default() }.
PnlAttribution
Risk-based PnL explain for one market move.
PortfolioGreeks
Quantity-weighted sums of the per-position Greeks.
Position
A signed position in one option: quantity contracts (negative = short).