FRA#
- class rateslib.instruments.FRA(effective=NoInput.blank, termination=NoInput.blank, frequency=NoInput.blank, roll=NoInput.blank, eom=NoInput.blank, modifier=NoInput.blank, calendar=NoInput.blank, payment_lag=NoInput.blank, notional=NoInput.blank, currency=NoInput.blank, convention=NoInput.blank, method_param=NoInput.blank, fixed_rate=NoInput.blank, fixings=NoInput.blank, curves=NoInput.blank, spec=NoInput.blank)#
Bases:
Sensitivities
,BaseMixin
Create a forward rate agreement composing single period
FixedLeg
andFloatLeg
valued in a customised manner.- Parameters:
args (dict) – Required positional args to
BaseDerivative
.fixed_rate (float or None) – The fixed rate applied to the
FixedLeg
. If None will be set to mid-market when curves are provided.fixings (float or list, optional) – If a float scalar, will be applied as the determined fixing for the first period. If a list of n fixings will be used as the fixings for the first n periods. If any sublist of length m is given as the first m RFR fixings within individual curve and composed into the overall rate.
method_param (int, optional) – A parameter that is used for the various
fixing_method
s. See notes.kwargs (dict) – Required keyword arguments to
BaseDerivative
.
Notes
FRAs are a legacy derivative whose FloatLeg
fixing_method
is set to “ibor”.Examples
Construct curves to price the example.
In [1]: eur3m = Curve( ...: nodes={ ...: dt(2022, 1, 1): 1.0, ...: dt(2023, 1, 1): 0.965, ...: dt(2024, 1, 1): 0.94 ...: }, ...: id="eur3m", ...: ) ...:
Create the FRA, and demonstrate the
rate()
,npv()
,analytic_delta()
.In [2]: fra = FRA( ...: effective=dt(2023, 2, 15), ...: termination="3M", ...: frequency="Q", ...: calendar="tgt", ...: currency="eur", ...: method_param=2, ...: convention="Act360", ...: notional=100e6, ...: fixed_rate=2.617, ...: curves=["eur3m"], ...: ) ...: In [3]: fra.rate(curves=eur3m) Out[3]: 2.5971685347783104 In [4]: fra.npv(curves=eur3m) Out[4]: -4685.809351368945 In [5]: fra.analytic_delta(curve=eur3m) Out[5]: 2362.815505051087
A DataFrame of
cashflows()
.In [6]: fra.cashflows(curves=eur3m) Out[6]: Type Period Ccy Acc Start Acc End Payment Convention DCF Notional DF Collateral Rate Spread Cashflow NPV FX Rate NPV Ccy 0 FRA Regular EUR 2023-02-15 2023-05-15 2023-02-15 ACT360 0.25 100000000.00 0.96 None -2.62 -259.72 -4871.50 -4685.81 1.00 -4685.81
For accurate sensitivity calculations;
delta()
andgamma()
, construct a curve model.In [7]: irs_kws = dict( ...: effective=dt(2022, 1, 1), ...: frequency="A", ...: leg2_frequency="Q", ...: convention="30E360", ...: leg2_convention="Act360", ...: leg2_fixing_method="ibor", ...: leg2_method_param=2, ...: calendar="tgt", ...: currency="eur", ...: curves=["eur3m", "eur3m"], ...: ) ...: In [8]: instruments = [ ...: IRS(termination="1Y", **irs_kws), ...: IRS(termination="2Y", **irs_kws), ...: ] ...: In [9]: solver = Solver( ...: curves=[eur3m], ...: instruments=instruments, ...: s=[1.55, 1.6], ...: instrument_labels=["1Y", "2Y"], ...: id="eur", ...: ) ...: SUCCESS: `func_tol` reached after 4 iterations (levenberg_marquardt), `f_val`: 8.531977771337697e-16, `time`: 0.0102s In [10]: fra.delta(solver=solver) Out[10]: local_ccy eur display_ccy eur type solver label instruments eur 1Y -2375.63 2Y 4766.74 In [11]: fra.gamma(solver=solver) Out[11]: type instruments solver eur label 1Y 2Y local_ccy display_ccy type solver label eur eur instruments eur 1Y 0.60 -0.48 2Y -0.48 -0.45
Attributes Summary
If set will also set the
fixed_rate
of the contained leg1.If set will also set the
float_spread
of contained leg1.If set will also set the
index_base
of the contained leg1.If set will also set the
fixed_rate
of the contained leg2.If set will also set the
float_spread
of contained leg2.If set will also set the
index_base
of the contained leg1.Methods Summary
analytic_delta
(curve[, disc_curve, fx, base])Return the analytic delta of the FRA.
cashflow
(curve)Calculate the local currency cashflow on the FRA from current floating rate and fixed rate.
cashflows
([curves, solver, fx, base])Return the properties of the leg used in calculating cashflows.
cashflows_table
([curves, solver, fx, base])delta
(*args, **kwargs)Calculate the delta of the Instrument.
gamma
(*args, **kwargs)Calculate the gamma of the Instrument.
npv
([curves, solver, fx, base, local])Return the NPV of the derivative.
rate
([curves, solver, fx, base])Return the mid-market rate of the FRA.
Attributes Documentation
- fixed_rate#
If set will also set the
fixed_rate
of the contained leg1.Note
fixed_rate
,float_spread
,leg2_fixed_rate
andleg2_float_spread
are attributes only applicable to certainInstruments
. AttributeErrors are raised if calling or setting these is invalid.- Type:
float or None
- float_spread#
If set will also set the
float_spread
of contained leg1.- Type:
float or None
- index_base#
If set will also set the
index_base
of the contained leg1.Note
index_base
andleg2_index_base
are attributes only applicable to certainInstruments
. AttributeErrors are raised if calling or setting these is invalid.- Type:
float or None
- leg2_fixed_rate#
If set will also set the
fixed_rate
of the contained leg2.- Type:
float or None
- leg2_float_spread#
If set will also set the
float_spread
of contained leg2.- Type:
float or None
- leg2_index_base#
If set will also set the
index_base
of the contained leg1.Note
index_base
andleg2_index_base
are attributes only applicable to certainInstruments
. AttributeErrors are raised if calling or setting these is invalid.- Type:
float or None
Methods Documentation
- analytic_delta(curve, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
Return the analytic delta of the FRA.
For arguments see
analytic_delta()
.
- cashflow(curve)#
Calculate the local currency cashflow on the FRA from current floating rate and fixed rate.
- cashflows(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
Return the properties of the leg used in calculating cashflows.
- Parameters:
args – Positional arguments supplied to
cashflows()
.kwargs – Keyword arguments supplied to
cashflows()
.
- Return type:
DataFrame
- cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
- delta(*args, **kwargs)#
Calculate the delta of the Instrument.
For arguments see
Sensitivities.delta()
.
- gamma(*args, **kwargs)#
Calculate the gamma of the Instrument.
For arguments see
Sensitivities.gamma()
.
- npv(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False)#
Return the NPV of the derivative.
See
BaseDerivative.npv()
.
- rate(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
Return the mid-market rate of the FRA.
Only the forecasting curve is required to price an FRA.