Skip to content

BUG: Error running cashflows on IRS with a NPV #170

@dwbhappy

Description

@dwbhappy
from rateslib import * 

par_curve = Curve( 
    nodes={
        dt (2022, 1, 1): 1.0, 
        dt (2023, 1, 1): 1.0, 
        dt (2024, 1, 1): 1.0,
        dt (2025, 1, 1): 1.0,
    },
    id="curve",
)
par_instruments = [
    IRS(dt(2022, 1, 1), "1Y", "A", curves="curve"),
    IRS(dt(2022, 1, 1), "2Y", "A", curves="curve"),
    IRS(dt(2022, 1, 1), "3Y", "A", curves="curve")
]

par_solver = Solver (
    curves=[par_curve],
    instruments=par_instruments,
    s=[1.21, 1.635, 1.99],
    id="par_solver",
    instrument_labels=["1Y", "2Y", "3Y"]
)

T_irs = IRS(
    effective=dt (2020, 12, 15),
    termination=dt (2037, 12, 15),
    notional=-600e6,
    frequency="A",
    leg2_frequency="A",
    fixed_rate=4.5,
    curves="curve"
)
    
print(T_irs.npv (solver=par_solver))
T_irs.cashflows (solver=par_solver)

File ~\anaconda3\Lib\site-packages\rateslib\periods.py:1090, in FloatPeriod._rfr_rate_from_df_curve(self, curve)
1088 def _rfr_rate_from_df_curve(self, curve: Curve):
1089 if self.fixing_method == "rfr_payment_delay" and not self._is_inefficient:
-> 1090 return curve.rate(self.start, self.end) + self.float_spread / 100
1092 elif self.fixing_method == "rfr_observation_shift" and not self._is_inefficient:
1093 start = add_tenor(self.start, f"-{self.method_param}b", "P", curve.calendar)

TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions