Skip to content

Commit

Permalink
REF: restructure instruments (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
attack68 committed Sep 18, 2024
1 parent b8e1da9 commit 3b863f6
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 56 deletions.
18 changes: 6 additions & 12 deletions docs/source/c_solver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import warnings
warnings.filterwarnings('always')
from rateslib.solver import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down Expand Up @@ -130,8 +129,7 @@ the optimizer will update the curves.
.. plot::

from rateslib.curves import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down Expand Up @@ -190,8 +188,7 @@ calibrated.
.. plot::

from rateslib.curves import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down Expand Up @@ -389,8 +386,7 @@ example we establish a new cash-collateral discount curve and use
.. plot::

from rateslib.curves import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down Expand Up @@ -562,8 +558,7 @@ We can plot all five curves defined above by the 3 fundamental curves,
.. plot::

from rateslib.curves import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down Expand Up @@ -594,8 +589,7 @@ We can plot all five curves defined above by the 3 fundamental curves,

.. plot::

from rateslib.curves import *
from rateslib.instruments import *
from rateslib import *
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions docs/source/e_securities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ for example.
:parts: 1

.. autosummary::
rateslib.instruments.BondConvention
rateslib.instruments.FixedRateBond
rateslib.instruments.FloatRateNote
rateslib.instruments.Bill
Expand Down
40 changes: 0 additions & 40 deletions docs/source/i_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,46 +260,6 @@ Instruments
:no-heading:
:inherited-members:
:no-inheritance-diagram:
:skip: NoInput
:skip: IndexCurve
:skip: IndexFixedLeg
:skip: IndexMixin
:skip: ZeroIndexLeg
:skip: forward_fx
:skip: abstractmethod
:skip: add_tenor
:skip: concat
:skip: dcf
:skip: get_calendar
:skip: index_left
:skip: ABCMeta
:skip: Curve
:skip: CustomBusinessDay
:skip: MultiIndex
:skip: DataFrame
:skip: Dual
:skip: Dual2
:skip: FXRates
:skip: FXForwards
:skip: Series
:skip: datetime
:skip: Cashflow
:skip: FloatPeriod
:skip: FixedLeg
:skip: FixedLegMtm
:skip: FloatLeg
:skip: FloatLegMtm
:skip: ZeroFloatLeg
:skip: LineCurve
:skip: Solver
:skip: ZeroFixedLeg
:skip: forward_fx
:skip: partial
:skip: timedelta
:skip: FXCallPeriod
:skip: FXDeltaVolSmile
:skip: FXDeltaVolSurface
:skip: FXPutPeriod

Class Inheritance Diagram
--------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Sphinx substitutions

"""
.. ipython:: python
:suppress:
from rateslib import *
"""

from __future__ import annotations

import abc
Expand All @@ -16,7 +23,6 @@
from pandas.tseries.offsets import CustomBusinessDay

from rateslib import defaults
from rateslib.bonds import _BondConventions
from rateslib.calendars import (
_get_fx_expiry_and_delivery,
_get_years_and_months,
Expand All @@ -29,6 +35,7 @@
from rateslib.dual import Dual, Dual2, DualTypes, dual_log, gradient
from rateslib.fx import FXForwards, FXRates, forward_fx
from rateslib.fx_volatility import FXDeltaVolSmile, FXDeltaVolSurface, FXVolObj
from rateslib.instruments.bonds import _BondConventions
from rateslib.legs import (
FixedLeg,
FixedLegMtm,
Expand Down Expand Up @@ -4867,7 +4874,7 @@ def gamma(self, *args, **kwargs):

class BaseDerivative(Sensitivities, BaseMixin, metaclass=ABCMeta):
"""
Abstract base class with common parameters for many ``Derivative`` subclasses.
Abstract base class with common parameters for many *Derivative* subclasses.
Parameters
----------
Expand Down Expand Up @@ -6859,8 +6866,8 @@ def spread(self, *args, **kwargs):

class FRA(Sensitivities, BaseMixin):
"""
Create a forward rate agreement composing single period :class:`~rateslib.periods.FixedLeg`
and :class:`~rateslib.periods.FloatLeg` valued in a customised manner.
Create a forward rate agreement composing single period :class:`~rateslib.legs.FixedLeg`
and :class:`~rateslib.legs.FloatLeg` valued in a customised manner.
Parameters
----------
Expand Down Expand Up @@ -10428,3 +10435,39 @@ def _upper(val: str | NoInput):
if isinstance(val, str):
return val.upper()
return val


__all__ = [
"BaseDerivative",
"BaseMixin",
"Bill",
"BondMixin",
"BondFuture",
"FRA",
"FXBrokerFly",
"FXCall",
"FXExchange",
"FXOption",
"FXOptionStrat",
"FXPut",
"FXRiskReversal",
"FXStraddle",
"FXStrangle",
"FXSwap",
"FixedRateBond",
"FloatRateNote",
"Fly",
"IIRS",
"IRS",
"IndexFixedRateBond",
"Portfolio",
"SBS",
"STIRFuture",
"Sensitivities",
"Spread",
"Value",
"VolValue",
"XCS",
"ZCIS",
"ZCS",
]
File renamed without changes.

0 comments on commit 3b863f6

Please sign in to comment.