pub struct Market { /* private fields */ }Expand description
A market snapshot: valuation date plus a typed store of market data, shared across a book. See the module docs for the design.
Implementations§
Source§impl Market
impl Market
pub fn new(valuation_date: NaiveDate) -> Self
pub fn valuation_date(&self) -> NaiveDate
Sourcepub fn insert<K: MarketKey>(&mut self, key: K, value: K::Value)
pub fn insert<K: MarketKey>(&mut self, key: K, value: K::Value)
Add or replace the datum at key.
Sourcepub fn with<K: MarketKey>(self, key: K, value: K::Value) -> Self
pub fn with<K: MarketKey>(self, key: K, value: K::Value) -> Self
Chainable insert, for building markets by hand.
Sourcepub fn try_get<K: MarketKey>(&self, key: &K) -> Option<&K::Value>
pub fn try_get<K: MarketKey>(&self, key: &K) -> Option<&K::Value>
The datum at key, or None when absent.
Sourcepub fn get<K: MarketKey>(&self, key: &K) -> Result<&K::Value>
pub fn get<K: MarketKey>(&self, key: &K) -> Result<&K::Value>
The datum at key, or a typed
MissingMarketData error naming
the key (e.g. Spot("ACME")).
pub fn contains<K: MarketKey>(&self, key: &K) -> bool
Sourcepub fn keys<K: MarketKey>(&self) -> impl Iterator<Item = &K>
pub fn keys<K: MarketKey>(&self) -> impl Iterator<Item = &K>
Every key of type K in the store (in no particular order).
pub fn is_empty(&self) -> bool
Source§impl Market
impl Market
Sourcepub fn bumped(&self, shocks: &[Shock]) -> Result<Market>
pub fn bumped(&self, shocks: &[Shock]) -> Result<Market>
Apply a scenario, returning the bumped market. Shocks apply in
order, each to the market produced by the previous one; each
datum performs its own bump (VolSurface::bumped,
YieldCurve::bumped). Spot/vol shocks honour the underlying
filter; rate shocks hit every discount curve; time shocks advance
the valuation date and must be absolute (in days).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Market
impl !UnwindSafe for Market
impl Freeze for Market
impl Send for Market
impl Sync for Market
impl Unpin for Market
impl UnsafeUnpin for Market
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more