@@ -47,101 +47,6 @@ class FloatRateNote(_BaseBondInstrument):
4747 """
4848 Create a floating rate note (FRN) security.
4949
50- Parameters
51- ----------
52- effective : datetime
53- The adjusted or unadjusted effective date.
54- termination : datetime or str
55- The adjusted or unadjusted termination date. If a string, then a tenor must be
56- given expressed in days (`"D"`), months (`"M"`) or years (`"Y"`), e.g. `"48M"`.
57- frequency : str in {"M", "B", "Q", "T", "S", "A"}, optional
58- The frequency of the schedule. "Z" is not permitted.
59- stub : str combining {"SHORT", "LONG"} with {"FRONT", "BACK"}, optional
60- The stub type to enact on the swap. Can provide two types, for
61- example "SHORTFRONTLONGBACK".
62- front_stub : datetime, optional
63- An adjusted or unadjusted date for the first stub period.
64- back_stub : datetime, optional
65- An adjusted or unadjusted date for the back stub period.
66- See notes for combining ``stub``, ``front_stub`` and ``back_stub``
67- and any automatic stub inference.
68- roll : int in [1, 31] or str in {"eom", "imm", "som"}, optional
69- The roll day of the schedule. Inferred if not given.
70- eom : bool, optional
71- Use an end of month preference rather than regular rolls for inference. Set by
72- default. Not required if ``roll`` is specified.
73- modifier : str, optional
74- The modification rule, in {"F", "MF", "P", "MP"}
75- calendar : calendar or str, optional
76- The holiday calendar object to use. If str, looks up named calendar from
77- static data.
78- payment_lag : int, optional
79- The number of business days to lag regular coupon payments by.
80- payment_lag_exchange : int, optional
81- The number of business days to lag notional exchange payments by.
82- notional : float, optional
83- The leg notional, which is applied to each period.
84- currency : str, optional
85- The currency of the leg (3-digit code).
86- amortization: float, optional
87- The amount by which to adjust the notional each successive period. Should have
88- sign equal to that of notional if the notional is to reduce towards zero.
89- convention: str, optional
90- The day count convention applied to calculations of period accrual dates.
91- See :meth:`~rateslib.scheduling.dcf`.
92- float_spread : float, optional
93- The spread applied to determine cashflows. Can be set to `None` and designated
94- later, perhaps after a mid-market spread for all periods has been calculated.
95- spread_compound_method : str, optional
96- The method to use for adding a floating spread to compounded rates. Available
97- options are `{"none_simple", "isda_compounding", "isda_flat_compounding"}`.
98- fixings : float or list, optional
99- If a float scalar, will be applied as the determined fixing for the first
100- period. If a list of *n* fixings will be used as the fixings for the first *n*
101- periods. If any sublist of length *m* is given as the first *m* RFR fixings
102- within individual curve and composed into the overall rate.
103- fixing_method : str, optional
104- The method by which floating rates are determined, set by default. See notes.
105- method_param : int, optional
106- A parameter that is used for the various ``fixing_method`` s. See notes.
107- ex_div : int
108- The number of business days prior to a cashflow which determines the last settlement date
109- for which a coupon payment is still receivable. See :meth:`BondMixin.ex_div`.
110- settle : int
111- The number of business days for regular settlement time, i.e, 1 is T+1.
112- calc_mode : str
113- A calculation mode for dealing with bonds under different conventions. See notes.
114- curves : CurveType, str or list of such, optional
115- A single *Curve* or string id or a list of such.
116-
117- A list defines the following curves in the order:
118-
119- - Forecasting *Curve* for ``leg1``.
120- - Discounting :class:`~rateslib.curves.Curve` for ``leg1``.
121- spec : str, optional
122- An identifier to pre-populate many field with conventional values. See
123- :ref:`here<defaults-doc>` for more info and available values.
124- metric: str, optional
125- The pricing metric returned by the ``rate`` method of the *Instrument*.
126-
127- Notes
128- -----
129- .. warning::
130-
131- FRNs based on RFR rates which have ex-div days must ensure that fixings are
132- available to define the entire period. This means that `ex_div` days must be less
133- than the `fixing_method` `method_param` lag minus the time to settlement time.
134-
135- That is, a bond with a `method_param` of 5 and a settlement time of 2 days
136- can have an `ex_div` period of at maximum 3.
137-
138- A bond with a `method_param` of 2 and a settlement time of 1 day cnan have an
139- `ex_div` period of at maximum 1.
140-
141- Attributes
142- ----------
143- ex_div_days : int
144- leg1 : FloatLeg
14550 """
14651
14752 _rate_scalar = 1.0
@@ -373,96 +278,6 @@ def accrued(
373278 settlement : datetime ,
374279 rate_curve : CurveOption_ = NoInput (0 ),
375280 ) -> DualTypes :
376- """
377- Calculate the accrued amount per nominal par value of 100.
378-
379- Parameters
380- ----------
381- settlement : datetime
382- The settlement date which to measure accrued interest against.
383- curve : Curve, optional
384- If ``forecast`` is *True* and fixings are future based then must provide
385- a forecast curve.
386-
387- Notes
388- -----
389- The settlement of an FRN will always be a definite amount. The
390- ``fixing_method``, ``method_param`` and ``ex_div`` will contain a
391- valid combination of parameters such that when payments need to be
392- cleared these definitive amounts can be calculated
393- via previously published fixings.
394-
395- If the coupon is IBOR based then the accrued
396- fractionally apportions the coupon payment based on calendar days, including
397- negative accrued during ex div periods. This rarely poses a problem since
398- IBOR is fixed well in advance of settlement.
399-
400- .. math::
401-
402- \\ text{Accrued} = \\ text{Coupon} \\ times \\ frac{\\ text{Settle - Last Coupon}}{\\ text{Next Coupon - Last Coupon}}
403-
404- With RFR rates, however, and since ``settlement`` typically occurs
405- in the future, e.g. T+2, it may be
406- possible, particularly if the bond is *ex-div* that some fixings are not known
407- today, but they will be known by ``settlement``. This is also true if we
408- wish to calculate the forward dirty price of a bond and need to forecast
409- the accrued amount (and also for a forecast IBOR period).
410-
411- Thus, there are two options:
412-
413- - In the analogue mode where very few fixings might be missing, and we require
414- these values to calculate negative accrued in an ex-div period we do not
415- require a ``curve`` but repeat the last historic fixing.
416- - In the digital mode where the ``settlement`` is likely in the future we
417- use a ``curve`` to forecast rates,
418-
419- Examples
420- --------
421- An RFR based FRN where the fixings are known up to the end of period.
422-
423- .. ipython:: python
424- :suppress:
425-
426- from rateslib import FloatRateNote
427- from pandas import date_range
428-
429- .. ipython:: python
430-
431- fixings = Series(2.0, index=date_range(dt(1999, 12, 1), dt(2000, 6, 2)))
432- frn = FloatRateNote(
433- effective=dt(1998, 12, 7),
434- termination=dt(2015, 12, 7),
435- frequency="S",
436- currency="gbp",
437- convention="Act365F",
438- ex_div=3,
439- fixings=fixings,
440- fixing_method="rfr_observation_shift",
441- method_param=5,
442- )
443- frn.accrued(dt(2000, 3, 27))
444- frn.accrued(dt(2000, 6, 4))
445-
446-
447- An IBOR based FRN where the coupon is known in advance.
448-
449- .. ipython:: python
450-
451- fixings = Series(2.0, index=[dt(1999, 12, 5)])
452- frn = FloatRateNote(
453- effective=dt(1998, 12, 7),
454- termination=dt(2015, 12, 7),
455- frequency="S",
456- currency="gbp",
457- convention="Act365F",
458- ex_div=7,
459- fixings=fixings,
460- fixing_method="ibor",
461- method_param=2,
462- )
463- frn.accrued(dt(2000, 3, 27))
464- frn.accrued(dt(2000, 6, 4))
465- """ # noqa: E501
466281 acc_idx = self .leg1 ._period_index (settlement )
467282 if self .leg1 .rate_params .fixing_method == FloatFixingMethod .IBOR :
468283 frac = self .kwargs .meta ["calc_mode" ]._settle_accrual (self , settlement , acc_idx )
0 commit comments