Skip to main content

BondFuture

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: NaiveDate

The 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

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

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

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

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>

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>

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

§

fn clone(&self) -> BondFuture

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for BondFuture

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for BondFuture

§

fn eq(&self, other: &BondFuture) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for BondFuture

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.