diff --git a/python/rateslib/instruments/components/bonds/bill.py b/python/rateslib/instruments/components/bonds/bill.py index f9808eb1..0cddee03 100644 --- a/python/rateslib/instruments/components/bonds/bill.py +++ b/python/rateslib/instruments/components/bonds/bill.py @@ -6,11 +6,11 @@ from rateslib.dual import Variable, gradient from rateslib.dual.utils import _dual_float, _to_number from rateslib.enums.generics import NoInput, _drb -from rateslib.instruments.components.bonds.fixed_rate_bond import FixedRateBond from rateslib.instruments.components.bonds.conventions import ( BillCalcMode, _get_bill_calc_mode, ) +from rateslib.instruments.components.bonds.fixed_rate_bond import FixedRateBond from rateslib.instruments.components.bonds.protocols import _BaseBondInstrument from rateslib.instruments.components.protocols.kwargs import _convert_to_schedule_kwargs, _KWArgs from rateslib.instruments.components.protocols.pricing import ( diff --git a/python/rateslib/instruments/components/bonds/bond_future.py b/python/rateslib/instruments/components/bonds/bond_future.py index 8140283f..e78e7c2c 100644 --- a/python/rateslib/instruments/components/bonds/bond_future.py +++ b/python/rateslib/instruments/components/bonds/bond_future.py @@ -23,7 +23,10 @@ Any, Curves_, DualTypes, + DualTypes_, FixedRateBond, + FXForwards_, + FXVolOption_, Solver_, datetime_, float_, diff --git a/python/rateslib/instruments/components/bonds/index_fixed_rate_bond.py b/python/rateslib/instruments/components/bonds/index_fixed_rate_bond.py index 17b02190..4e543f5e 100644 --- a/python/rateslib/instruments/components/bonds/index_fixed_rate_bond.py +++ b/python/rateslib/instruments/components/bonds/index_fixed_rate_bond.py @@ -347,7 +347,7 @@ def index_ratio(self, settlement: datetime, index_curve: _BaseCurve_ = NoInput(0 Returns ------- float, Dual, Dual2, Variable - """ + """ # noqa: E501 left_index = self.leg1._period_index(settlement) period_index_params = self.leg1._regular_periods[left_index].index_params diff --git a/python/tests/instruments/test_instruments_bonds_legacy.py b/python/tests/instruments/test_instruments_bonds_legacy.py index 20675eb6..a9357e11 100644 --- a/python/tests/instruments/test_instruments_bonds_legacy.py +++ b/python/tests/instruments/test_instruments_bonds_legacy.py @@ -24,7 +24,7 @@ FixedRateBond, IndexFixedRateBond, ) -from rateslib.instruments.components.bonds.conventions import BondCalcMode +from rateslib.instruments.components.bonds.conventions import US_GBB, BondCalcMode from rateslib.scheduling import dcf, get_calendar from rateslib.solver import Solver @@ -2575,8 +2575,6 @@ def test_bill_rate(self) -> None: assert abs(result - expected) < 1e-6 def test_bill_default_calc_mode(self) -> None: - from rateslib.instruments.components.bonds.conventions import US_GBB - bill = Bill( effective=dt(2004, 1, 22), termination=dt(2004, 2, 19), diff --git a/python/tests/instruments/test_instruments_legacy.py b/python/tests/instruments/test_instruments_legacy.py index e195bfa8..0821aa31 100644 --- a/python/tests/instruments/test_instruments_legacy.py +++ b/python/tests/instruments/test_instruments_legacy.py @@ -22,7 +22,7 @@ # XCS, # ZCIS, # ZCS, - Bill, + # Bill, # FixedRateBond, FloatRateNote, # Fly, @@ -34,7 +34,7 @@ FXStraddle, FXStrangle, # FXSwap, - IndexFixedRateBond, + # IndexFixedRateBond, # Portfolio, # Spread, # STIRFuture, @@ -51,16 +51,19 @@ XCS, ZCIS, ZCS, + Bill, FixedRateBond, Fly, FXForward, FXSwap, FXVolValue, + IndexFixedRateBond, Portfolio, Spread, STIRFuture, Value, ) +from rateslib.instruments.components.bonds.conventions import US_GB from rateslib.instruments.components.protocols.kwargs import ( _KWArgs, ) @@ -5106,13 +5109,12 @@ def test_indexfixedratebond(self) -> None: calc_mode="ust", fixed_rate=2.0, ) - from rateslib.instruments.bonds.conventions import US_GB - assert bond.calc_mode.kwargs == US_GB.kwargs - assert bond.kwargs["convention"] == "actacticma" - assert bond.kwargs["currency"] == "gbp" - assert bond.kwargs["fixed_rate"] == 2.0 - assert bond.kwargs["ex_div"] == 7 + assert bond.kwargs.leg1["convention"] == "actacticma" + assert bond.kwargs.leg1["currency"] == "gbp" + assert bond.kwargs.leg1["fixed_rate"] == 2.0 + assert bond.kwargs.leg1["schedule"].payment_adjuster3 == Adjuster.BusDaysLagSettle(-7) + assert bond.kwargs.meta["calc_mode"] == US_GB def test_bill(self) -> None: bill = Bill( @@ -5121,12 +5123,12 @@ def test_bill(self) -> None: spec="us_gbb", convention="act365f", ) - from rateslib.instruments.bonds.conventions import US_GBB + from rateslib.instruments.components.bonds.conventions import US_GBB - assert bill.calc_mode.kwargs == US_GBB.kwargs - assert bill.kwargs["convention"] == "act365f" - assert bill.kwargs["currency"] == "usd" - assert bill.kwargs["fixed_rate"] == 0.0 + assert bill.kwargs.meta["calc_mode"] == US_GBB + assert bill.kwargs.leg1["convention"] == "act365f" + assert bill.kwargs.leg1["currency"] == "usd" + assert bill.kwargs.leg1["fixed_rate"] == 0.0 def test_fra(self) -> None: from rateslib.enums.parameters import FloatFixingMethod