Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/rateslib/instruments/components/bonds/bill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 3 additions & 0 deletions python/rateslib/instruments/components/bonds/bond_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
Any,
Curves_,
DualTypes,
DualTypes_,
FixedRateBond,
FXForwards_,
FXVolOption_,
Solver_,
datetime_,
float_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions python/tests/instruments/test_instruments_bonds_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down
28 changes: 15 additions & 13 deletions python/tests/instruments/test_instruments_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# XCS,
# ZCIS,
# ZCS,
Bill,
# Bill,
# FixedRateBond,
FloatRateNote,
# Fly,
Expand All @@ -34,7 +34,7 @@
FXStraddle,
FXStrangle,
# FXSwap,
IndexFixedRateBond,
# IndexFixedRateBond,
# Portfolio,
# Spread,
# STIRFuture,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
Loading