Skip to main content

EquityPortfolio

Struct EquityPortfolio 

Source
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

Source

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).

Source

pub fn npv_in(&self, market: &Market) -> Result<f64, RustyQLibError>

Book value under a typed market snapshot (quantity-weighted).

Source

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

Source

pub fn new() -> Self

Source

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.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn npv(&self) -> f64

Book value: quantity-weighted sum of position NPVs.

Source

pub fn greeks(&self) -> PortfolioGreeks

Aggregated Greeks, each position computed by its own engine.

Source

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.

Trait Implementations§

Source§

impl Default for EquityPortfolio

Source§

fn default() -> EquityPortfolio

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V