rateslib/enums/parameters.rs
1use serde::{Deserialize, Serialize};
2
3/// Specifier for date adjustment rules.
4#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
5pub enum FloatFixingMethod {
6 /// RFR periods are settled with cashflow dates determined (separately as part of a Schedule) with a lag.
7 RFRPaymentDelay {},
8 /// RFR fixings and associated DCFs use values taken from 'n' business days prior.
9 RFRObservationShift(i32),
10 /// The final 'n' RFR fixings' values are taken as the most recent published value.
11 RFRLockout(i32),
12 /// RFR fixings use values taken from 'n' business days prior (no DCF shift).
13 RFRLookback(i32),
14 /// Uses arithmetic averaging instead compounding on the RFRPaymentDelay method.
15 RFRPaymentDelayAverage {},
16 /// Uses arithmetic averaging instead compounding on the RFRObservationShift method.
17 RFRObservationShiftAverage(i32),
18 /// Uses arithmetic averaging instead compounding on the RFRLockout method.
19 RFRLockoutAverage(i32),
20 /// Uses arithmetic averaging instead compounding on the RFRLookback method.
21 RFRLookbackAverage(i32),
22 /// Uses a tenor IBOR type rate calculation with the fixing lagged by 'n' business days.
23 IBOR(i32),
24}
25
26impl FloatFixingMethod {
27 /// Return a fixing lag parameter associated with the variant.
28 pub fn method_param(&self) -> i32 {
29 match self {
30 FloatFixingMethod::RFRPaymentDelay {}
31 | FloatFixingMethod::RFRPaymentDelayAverage {} => 0_i32,
32 FloatFixingMethod::RFRObservationShift(param)
33 | FloatFixingMethod::RFRObservationShiftAverage(param)
34 | FloatFixingMethod::RFRLookback(param)
35 | FloatFixingMethod::RFRLookbackAverage(param)
36 | FloatFixingMethod::RFRLockout(param)
37 | FloatFixingMethod::RFRLockoutAverage(param)
38 | FloatFixingMethod::IBOR(param) => *param,
39 }
40 }
41}