Skip to content

Commit 90dfa5b

Browse files
attack68mikelync
andauthored
ENH: add new component Instruments: IRS and CDS (#145) (#1066)
Co-authored-by: Mike Lync <[email protected]> Co-authored-by: JHM Darbyshire (M1) <[email protected]>
1 parent c9c550e commit 90dfa5b

File tree

25 files changed

+8896
-24
lines changed

25 files changed

+8896
-24
lines changed

python/rateslib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __exit__(self, *args) -> None: # type: ignore[no-untyped-def]
207207
"ProxyCurve",
208208
"index_left",
209209
"index_value",
210-
# # fixings.py cannot load due to circular import
210+
# # analytic_fixings.py cannot load due to circular import
211211
# "FXFixing",
212212
# "IBORFixing",
213213
# "IBORStubFixing",

python/rateslib/curves/_parsers.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,56 @@ def _to_six_curve_dict(
390390
disc2=curves,
391391
index2=NoInput(0),
392392
)
393+
394+
395+
class _Curves:
396+
"""
397+
Container for a pricing object providing a mapping for curves.
398+
"""
399+
400+
def __init__(
401+
self,
402+
*,
403+
rate_curve: CurveOption_ = NoInput(0),
404+
disc_curve: CurveOption_ = NoInput(0),
405+
index_curve: CurveOption_ = NoInput(0),
406+
leg2_rate_curve: CurveOption_ = NoInput(0),
407+
leg2_disc_curve: CurveOption_ = NoInput(0),
408+
leg2_index_curve: CurveOption_ = NoInput(0),
409+
):
410+
self._rate_curve = rate_curve
411+
self._disc_curve = disc_curve
412+
self._index_curve = index_curve
413+
self._leg2_rate_curve = leg2_rate_curve
414+
self._leg2_disc_curve = leg2_disc_curve
415+
self._leg2_index_curve = leg2_index_curve
416+
417+
@property
418+
def rate_curve(self) -> CurveOption_:
419+
"""The curve used for floating rate or hazard rate forecasting on leg1."""
420+
return self._rate_curve
421+
422+
@property
423+
def disc_curve(self) -> CurveOption_:
424+
"""The curve used for discounting on leg1."""
425+
return self._disc_curve
426+
427+
@property
428+
def index_curve(self) -> CurveOption_:
429+
"""The index curve used for forecasting index values on leg1."""
430+
return self._index_curve
431+
432+
@property
433+
def leg2_rate_curve(self) -> CurveOption_:
434+
"""The curve used for floating rate or hazard rate forecasting on leg2."""
435+
return self._leg2_rate_curve
436+
437+
@property
438+
def leg2_disc_curve(self) -> CurveOption_:
439+
"""The curve used for discounting on leg2."""
440+
return self._leg2_disc_curve
441+
442+
@property
443+
def leg2_index_curve(self) -> CurveOption_:
444+
"""The index curve used for forecasting index values on leg2."""
445+
return self._leg2_index_curve
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from rateslib.instruments.components.cds import CDS
2+
from rateslib.instruments.components.irs import IRS
3+
4+
__all__ = [
5+
"IRS",
6+
"CDS",
7+
]

0 commit comments

Comments
 (0)