Struct BondFuture
pub struct BondFuture {
pub delivery: NaiveDate,
pub basket: Vec<(String, f64)>,
pub repo_day_count: Option<DayCountFraction>,
}Expand description
A bond future: a delivery date and the deliverable basket with its exchange-published conversion factors.
Fields§
§delivery: NaiveDateThe delivery date the basket forwards to.
basket: Vec<(String, f64)>(ISIN, conversion factor) deliverables, in basket order.
repo_day_count: Option<DayCountFraction>The day count the implied repo is quoted on; None takes each
deliverable currency’s money-market basis
(ACT/360 for USD, EUR, CHF, SEK, NOK and DKK, ACT/365F otherwise).
Implementations§
§impl BondFuture
impl BondFuture
pub fn new(
delivery: NaiveDate,
basket: Vec<(String, f64)>,
) -> Result<Self, BondFutureError>
pub fn new( delivery: NaiveDate, basket: Vec<(String, f64)>, ) -> Result<Self, BondFutureError>
A future from its delivery date and (ISIN, conversion factor)
basket.
§Errors
BondFutureError::EmptyBasket with no deliverables;
BondFutureError::NonPositiveConversionFactor for a factor that is
not finite and strictly positive.
pub fn with_repo_day_count(self, day_count: DayCountFraction) -> Self
pub fn with_repo_day_count(self, day_count: DayCountFraction) -> Self
The future with its implied repo quoted on day_count for every
deliverable, in place of each currency’s money-market basis.
pub(crate) fn repo_day_count_for(&self, currency: Currency) -> DayCountFraction
pub(crate) fn repo_day_count_for(&self, currency: Currency) -> DayCountFraction
The day count a deliverable in currency quotes its implied repo on:
the future’s stated one, else the currency’s money-market basis —
ACT/360 for USD, EUR, CHF, SEK, NOK and DKK, ACT/365F otherwise.
§impl BondFuture
impl BondFuture
pub fn analyze(
&self,
market: &MarketContext,
securities: &Securities,
futures_price: f64,
) -> Result<BondFutureAnalysis, BondFutureError>
pub fn analyze( &self, market: &MarketContext, securities: &Securities, futures_price: f64, ) -> Result<BondFutureAnalysis, BondFutureError>
The basket at a quoted futures_price (per 100): every deliverable
resolved through securities into a Deliverable — key its ISIN,
the group tier its static’s repo group — then analysed by
BondFuture::analyze_resolved.
§Errors
BondFutureError for an unregistered or non-fixed deliverable, and
whatever the analytics raise.
pub fn resolve_basket(
&self,
securities: &Securities,
) -> Result<Vec<Deliverable>, BondFutureError>
pub fn resolve_basket( &self, securities: &Securities, ) -> Result<Vec<Deliverable>, BondFutureError>
Every basket ISIN resolved through the security master into a
Deliverable — key the ISIN, the repo group the static’s.
This is the seam a position resolves across at construction, so that
pricing a booked future consults no security master and the pricing view
need carry none. BondFuture::analyze resolves across it per call.
§Errors
BondFutureError::UnknownDeliverable for an ISIN the master does not
hold; BondFutureError::NotFixedCoupon for a deliverable that is not
a fixed-coupon bond.
pub fn analyze_resolved(
&self,
market: &MarketContext,
deliverables: &[Deliverable],
futures_price: f64,
) -> Result<BondFutureAnalysis, BondFutureError>
pub fn analyze_resolved( &self, market: &MarketContext, deliverables: &[Deliverable], futures_price: f64, ) -> Result<BondFutureAnalysis, BondFutureError>
The basket at a quoted futures_price (per 100) over deliverables
already resolved to their bonds: each priced spot on its currency’s
discount curve and carried to delivery on its repo curve — keyed by
its own key, then its repo group, then its currency, else the
discount curve, the tier recorded on the row — with gross and net
basis, implied repo, the minimum-net-basis CTD and the theoretical
price off its forward.
Passive analytics: the market is read without derivatives.
§Errors
BondFutureError::EmptyBasket with no deliverables,
BondFutureError::DeliveryNotAfterValuation for a delivery on or
before the valuation date, or BondFutureError::Pricing for a curve
that will not resolve or answer.
Trait Implementations§
§impl Clone for BondFuture
impl Clone for BondFuture
§fn clone(&self) -> BondFuture
fn clone(&self) -> BondFuture
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more