Struct PyFixedRateBond
pub struct PyFixedRateBond {
pub(crate) inner: FixedRateBond,
}Expand description
A fixed-rate bullet bond — the underlying a callable, a forward and a total-return swap are written on. Not an instrument: the core values a plain bond only through the products written on it.
Fields§
§inner: FixedRateBondImplementations§
§impl PyFixedRateBond
impl PyFixedRateBond
§impl PyFixedRateBond
impl PyFixedRateBond
fn with_first_coupon(&self, first_coupon: NaiveDate) -> PyResult<Self>
fn with_first_coupon(&self, first_coupon: NaiveDate) -> PyResult<Self>
This bond with its first coupon on first_coupon: a long first period
where it falls more than a period after issue, accruing by the ICMA
split under ACT/ACT ICMA.
fn with_penultimate_coupon(&self, penultimate: NaiveDate) -> PyResult<Self>
fn with_penultimate_coupon(&self, penultimate: NaiveDate) -> PyResult<Self>
This bond with its last regular coupon on penultimate: the grid
anchored there and a short or long final period to maturity, accruing
by the ICMA split (notional periods forward from penultimate) under
ACT/ACT ICMA.
fn with_end_of_month(&self, end_of_month: bool) -> Self
fn with_end_of_month(&self, end_of_month: bool) -> Self
This bond with its coupon grid rolled on the calendar end of the month, which takes effect only when the maturity is a month end.
fn __repr__(&self) -> String
fn __repr__(&self) -> String
The call that built this bond, with typed spellings, so the repr reads
back: fixed_rate_bond("USD", datetime.date(2025, 5, 15), …, frequency=Frequency.SemiAnnual, day_count=DayCountFraction.ActActIcma).
fn with_ex_div(&self, days: u16, day_type: Named<ExDivDayType>) -> Self
fn with_ex_div(&self, days: u16, day_type: Named<ExDivDayType>) -> Self
This bond trading ex-dividend days before each coupon, counted in
day_type days (Business on the currency’s settlement calendar, or
Calendar): a buyer settling strictly after a coupon’s ex-dividend
date forgoes it, and accrued turns negative. Settlement on the
ex-dividend date is still cum-dividend.
fn ex_div_date(&self, coupon_date: NaiveDate) -> Option<NaiveDate>
fn ex_div_date(&self, coupon_date: NaiveDate) -> Option<NaiveDate>
The ex-dividend date of the coupon paying on coupon_date, or None
for a bond with no ex-dividend rule.
fn forgone_coupon_date(&self, settlement: NaiveDate) -> Option<NaiveDate>
fn forgone_coupon_date(&self, settlement: NaiveDate) -> Option<NaiveDate>
The coupon date a buyer settling on settlement forgoes, or None
when the bond trades cum-dividend then.
fn is_ex_div(&self, settlement: NaiveDate) -> bool
fn is_ex_div(&self, settlement: NaiveDate) -> bool
Whether the bond trades ex-dividend at settlement.
pub(crate) fn instrument(&self) -> PyInstrument
pub(crate) fn instrument(&self) -> PyInstrument
This bond as an instrument — the callable with an empty exercise
schedule — so a bullet books, values and tables without naming the
callable. callable_bond(bond, []) is the same instrument.
fn issued_by(&self, issuer: &str) -> PyResult<PyInstrument>
fn issued_by(&self, issuer: &str) -> PyResult<PyInstrument>
This bond as an instrument valued risky on issuer’s credit —
survival-weighted flows plus recovery of face; callable_bond(bond, [], issuer=) is the same.
fn npv(&self, py: Python<'_>, market: &PyMarket) -> PyResult<f64>
fn npv(&self, py: Python<'_>, market: &PyMarket) -> PyResult<f64>
The bond’s value against market, through instrument:
a bullet reaches a curve without composing a product around it.
fn cashflow_records(
&self,
py: Python<'_>,
market: &PyMarket,
) -> PyResult<PyRecords>
fn cashflow_records( &self, py: Python<'_>, market: &PyMarket, ) -> PyResult<PyRecords>
The bond’s cashflow table against market, through its instrument.
pub(crate) fn with_payment_calendar(
&self,
calendar: &PyCalendar,
business_day_convention: Named<BusinessDayConvention>,
) -> Self
pub(crate) fn with_payment_calendar( &self, calendar: &PyCalendar, business_day_convention: Named<BusinessDayConvention>, ) -> Self
This bond paying on calendar under business_day_convention — the payment
calendar and payment convention, both separate from the accrual
schedule.
The accrual does not move: every period still accrues over its unadjusted boundaries, which is what keeps the clean price continuous across a coupon date. Only the date each flow is paid and discounted on rolls, which is the street’s bond.
pub(crate) fn with_settlement_lag(
&self,
days: i32,
calendar: &PyCalendar,
) -> Self
pub(crate) fn with_settlement_lag( &self, days: i32, calendar: &PyCalendar, ) -> Self
This bond settling days business days on calendar after it trades,
bonds.z_spread reads it.
pub(crate) fn settlement_date(&self, trade_date: NaiveDate) -> NaiveDate
pub(crate) fn settlement_date(&self, trade_date: NaiveDate) -> NaiveDate
The date a trade on trade_date settles on: the settlement lag walked
from it, never before issue.
pub(crate) fn with_accrual_adjustment(
&self,
calendar: &PyCalendar,
business_day_convention: Named<BusinessDayConvention>,
) -> Self
pub(crate) fn with_accrual_adjustment( &self, calendar: &PyCalendar, business_day_convention: Named<BusinessDayConvention>, ) -> Self
This bond accruing over boundaries rolled on calendar under
business_day_convention — issue, every coupon date and maturity. Opt-in: the
default accrues unadjusted. Kept on the bond, so a schedule built
afterwards rolls too; set it before with_amortisation.
pub(crate) fn payment_date(&self, accrual_end: NaiveDate) -> NaiveDate
pub(crate) fn payment_date(&self, accrual_end: NaiveDate) -> NaiveDate
The date an accrual ending on accrual_end is paid.
pub(crate) fn with_amortisation(&self, outstanding: Vec<f64>) -> PyResult<Self>
pub(crate) fn with_amortisation(&self, outstanding: Vec<f64>) -> PyResult<Self>
This bond with a notional profile: one fraction of the original face
per coupon period, starting at 1, positive and never rising. Every
price and flow stays per 100 of the original face; per_current_face
restates one as the market’s per-current-face quote.
pub(crate) fn is_amortising(&self) -> bool
pub(crate) fn is_amortising(&self) -> bool
Whether any principal is repaid before maturity.
pub(crate) fn outstanding_fraction(&self, date: NaiveDate) -> f64
pub(crate) fn outstanding_fraction(&self, date: NaiveDate) -> f64
The fraction of the original face alive on date.
pub(crate) fn current_face(&self, date: NaiveDate) -> f64
pub(crate) fn current_face(&self, date: NaiveDate) -> f64
The face alive on date.
pub(crate) fn per_current_face(
&self,
amount: f64,
date: NaiveDate,
) -> PyResult<f64>
pub(crate) fn per_current_face( &self, amount: f64, date: NaiveDate, ) -> PyResult<f64>
An amount per 100 of the original face restated per 100 of the face
alive on date — the market’s quote for an amortiser, the identity for
a bullet. Refused at or after maturity, when nothing is alive.
pub(crate) fn per_original_face(&self, amount: f64, date: NaiveDate) -> f64
pub(crate) fn per_original_face(&self, amount: f64, date: NaiveDate) -> f64
The inverse: an amount per 100 of the face alive on date restated
per 100 of the original face, which the pricing methods take.
fn flows(
&self,
settlement: NaiveDate,
day_count: Option<Named<DayCountFraction>>,
) -> PyRecords
fn flows( &self, settlement: NaiveDate, day_count: Option<Named<DayCountFraction>>, ) -> PyRecords
The flows still to pay after settlement, per 100 face, as a table:
each flow’s accrual_end (the period that earned it), payment_date,
time from settlement — on the bond’s own axis, in its periods under
ACT/ACT ICMA, or on day_count where one is named — and amount
(coupons and the redemption, a forgone coupon removed).
pub(crate) fn accrued(&self, settlement: NaiveDate) -> f64
pub(crate) fn accrued(&self, settlement: NaiveDate) -> f64
The coupon accrued per 100 of face at settlement.
pub(crate) fn price(
&self,
yield_: f64,
settlement: NaiveDate,
price_basis: Named<PriceBasis>,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> f64
pub(crate) fn price( &self, yield_: f64, settlement: NaiveDate, price_basis: Named<PriceBasis>, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> f64
The price per 100 face at yield_, on a named price basis and under a
named yield convention.
basis is "clean" or "dirty". It defaults to clean, which is
what a market means by a bond’s price; the all-in figure is
basis="dirty" and differs by the accrued interest.
yield_convention names either a compounding basis — reaching the
ordinary pricing body — or one of the two conventions that are not that
body, "ise" and "jgb". The two axes are independent: every
convention serves both bases.
pub(crate) fn yield_(
&self,
price: f64,
settlement: NaiveDate,
price_basis: Named<PriceBasis>,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn yield_( &self, price: f64, settlement: NaiveDate, price_basis: Named<PriceBasis>, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
The yield price implies, read on a named price basis and under a named
yield convention — the inverse of price.
Spelled with a trailing underscore because yield is a Python keyword.
pub(crate) fn yield_moments(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<PyYieldMoments>
pub(crate) fn yield_moments( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<PyYieldMoments>
Modified duration at yield_: −P′/P.
The price and its first two yield derivatives at yield_, from one
second-order pricing pass; every yield-space measure is a reading of
the three.
pub(crate) fn modified_duration(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn modified_duration( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
The modified duration at yield_: the price’s relative sensitivity to
the yield, −(1/P)·dP/dy, under the named yield convention.
pub(crate) fn macaulay_duration(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn macaulay_duration( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
Macaulay duration at yield_: the PV-weighted mean time to the bond’s
remaining flows.
pub(crate) fn convexity(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn convexity( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
Convexity at yield_: P″/P.
pub(crate) fn dv01(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn dv01( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
DV01 per 100 face at yield_.
pub(crate) fn money_dv01(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn money_dv01( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
DV01 in money at the bond’s own face.
pub(crate) fn money_duration(
&self,
yield_: f64,
settlement: NaiveDate,
yield_convention: Named<YieldQuoteConvention>,
day_count: Option<Named<DayCountFraction>>,
) -> PyResult<f64>
pub(crate) fn money_duration( &self, yield_: f64, settlement: NaiveDate, yield_convention: Named<YieldQuoteConvention>, day_count: Option<Named<DayCountFraction>>, ) -> PyResult<f64>
Money duration at the bond’s own face: modified duration times the money price.
Trait Implementations§
§impl Clone for PyFixedRateBond
impl Clone for PyFixedRateBond
§fn clone(&self) -> PyFixedRateBond
fn clone(&self) -> PyFixedRateBond
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl DerefToPyAny for PyFixedRateBond
§impl IntoPy<Py<PyAny>> for PyFixedRateBond
impl IntoPy<Py<PyAny>> for PyFixedRateBond
§impl PyClass for PyFixedRateBond
impl PyClass for PyFixedRateBond
§impl PyClassImpl for PyFixedRateBond
impl PyClassImpl for PyFixedRateBond
§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<PyFixedRateBond>
type ThreadChecker = SendablePyClass<PyFixedRateBond>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyFixedRateBond
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyFixedRateBond
§impl PyMethods<PyFixedRateBond> for PyClassImplCollector<PyFixedRateBond>
impl PyMethods<PyFixedRateBond> for PyClassImplCollector<PyFixedRateBond>
fn py_methods(self) -> &'static PyClassItems
§impl PyTypeInfo for PyFixedRateBond
impl PyTypeInfo for PyFixedRateBond
§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.