Skip to main content

RollConvention

Enum RollConvention 

pub enum RollConvention {
    DayOfMonth(u8),
    Eom,
    Imm,
    ImmTwentieth,
    Frn,
    None,
}
Expand description

How period boundary dates are rolled within the month (FpML RollConventionEnum). Only the variants needed by the current substrate are modelled; the IMM / FRN families compute their roll dates structurally.

Variants§

§

DayOfMonth(u8)

Roll on a fixed day of the month (1–30).

§

Eom

Roll on the last day of the month.

§

Imm

IMM dates (third Wednesday of the cycle month).

§

ImmTwentieth

Twentieth of the IMM cycle month (the standard CDS coupon roll). A domain term — FpML’s RollConventionEnum has no native code for it.

§

Frn

FRN convention, read here as the third of the month.

This reading is this crate’s own and is narrower than the name suggests. FpML’s RollConventionEnum reads FRN as ISDA 2000 §4.11(g), a rule about where a period end falls given the previous boundary and the frequency — which RollConvention::apply, one date snapped inside its own month, has no arguments to express. A caller wanting §4.11(g) will not get it from this variant.

No shipped template selects it. It is reachable by name — from Rust, and as roll="FRN" from Python — so a caller who selects it deliberately gets a day-of-month-3 roll, which is what this says and all it says.

§

None

No roll convention.

Implementations§

§

impl RollConvention

pub fn apply(self, date: NaiveDate) -> NaiveDate

Snaps date to the day of the month this convention names, staying within date’s own month.

This is the whole of a roll: the day-of-month choice, applied to one date. It is the operation schedule generation applies to each interior boundary, exposed so that a caller can snap a date without generating a schedule — there is one implementation, so a roll cannot mean one thing inside a schedule and another in a caller’s hands.

A day-of-month roll clamps into short months (day 31 in February lands on the 28th or 29th), so the result never leaves date’s month. Only RollConvention::None returns date unchanged: it is the convention that names no snap, and it is the sole identity.

Every snap is idempotent — a date the convention already names is returned unchanged — which is what lets a generated interior boundary be a fixed point of the operation a caller would apply to it.

§Panics

Never: every day this constructs is clamped to the month’s own length before it is built, the twentieth and the third exist in every month, and every month holds a third Wednesday.

§

impl RollConvention

pub fn code(self) -> String

The roll code. Returns an owned String to carry the parametrised day-of-month variant (e.g. "15").

§

impl RollConvention

pub const ACCEPTED: &'static [&'static str]

Every spelling this vocabulary accepts, canonical forms first.

pub(crate) fn recognize(s: &str) -> Option<Self>

The value s spells, or None — the parse without its error, so probing a spelling that is not this vocabulary’s allocates nothing.

Trait Implementations§

§

impl Clone for RollConvention

§

fn clone(&self) -> RollConvention

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 Copy for RollConvention

§

impl Debug for RollConvention

§

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

Formats the value using the given formatter. Read more
§

impl Eq for RollConvention

§

impl FromStr for RollConvention

§

type Err = VocabularyParseError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for RollConvention

§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for RollConvention

§

fn eq(&self, other: &RollConvention) -> 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 RollConvention

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.