From da63d94d92bc392b7a716fd1ed946390fdcfc48e Mon Sep 17 00:00:00 2001 From: JHM Darbyshire <24256554+attack68@users.noreply.github.com> Date: Sat, 25 Jan 2025 16:12:33 +0100 Subject: [PATCH] ENH: add non-deliverable forward --- python/rateslib/periods/cashflow.py | 2 +- python/tests/test_periods.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/rateslib/periods/cashflow.py b/python/rateslib/periods/cashflow.py index ea16a2f6..1df07a7a 100644 --- a/python/rateslib/periods/cashflow.py +++ b/python/rateslib/periods/cashflow.py @@ -284,7 +284,7 @@ def __init__( fixing_date: datetime, fx_rate: DualTypes_ = NoInput(0), fx_fixing: DualTypes_ = NoInput(0), - reversed: bool = False, + reversed: bool = False, # noqa: A002 ): self.notional = notional self.settlement = settlement diff --git a/python/tests/test_periods.py b/python/tests/test_periods.py index e3800373..73f5386a 100644 --- a/python/tests/test_periods.py +++ b/python/tests/test_periods.py @@ -2845,13 +2845,13 @@ def test_npv(self, fxf_ndf): def test_npv_reversed(self, fxf_ndf): ndf = NonDeliverableCashflow( - notional=1e6*0.18, + notional=1e6 * 0.18, reference_currency="brl", settlement_currency="usd", settlement=dt(2025, 6, 1), fixing_date=dt(2025, 5, 29), - fx_rate=1/0.18, - reversed=True + fx_rate=1 / 0.18, + reversed=True, ) result = ndf.npv(disc_curve=fxf_ndf.curve("usd", "usd"), fx=fxf_ndf) expected = -1e6 * (0.20131018767289705 - 0.18) * 0.9855343095437953