FXOption#
- class rateslib.instruments.FXOption(pair, expiry, notional=NoInput.blank, eval_date=NoInput.blank, calendar=NoInput.blank, modifier=NoInput.blank, delivery_lag=NoInput.blank, strike=NoInput.blank, premium=NoInput.blank, premium_ccy=NoInput.blank, payment_lag=NoInput.blank, option_fixing=NoInput.blank, delta_type=NoInput.blank, metric=NoInput.blank, curves=NoInput.blank, vol=NoInput.blank, spec=NoInput.blank)#
Bases:
Sensitivities
Create an FX Option.
- Parameters:
pair (str) – The currency pair for the FX rate which the option is settled. 3-digit code, e.g. “eurusd”.
expiry (datetime, str) – The expiry of the option.
notional (float) – The amount in ccy1 (left side of pair) on which the option is based.
strike (float, Dual, Dual2, str in {"atm_forward", "atm_spot", "atm_delta", "[float]d"}) – The strike value of the option. If str there are four possibilities as above. If giving a specific delta should end with a ‘d’ for delta e.g. “-25d”. Put deltas should be input including negative sign.
eval_date (datetime, optional) – The date from which to evaluate a string tenor expiry.
modifier (str, optional) – The modification rule, in {“F”, “MF”, “P”, “MP”} for date evaluation.
calendar (calendar or str, optional) – The holiday calendar object to use. If str, looks up named calendar from static data.
delivery_lag (int, optional) – The number of business days after expiry that the physical settlement of the FX exchange occurs.
payment_lag (int or datetime, optional) – The number of business days after expiry to pay premium. If a datetime is given this will set the premium date explicitly.
premium (float) – The amount paid for the option.
premium_ccy (str) – The currency in which the premium is paid. Can only be one of the two currencies in pair.
option_fixing (float) – The value determined at expiry to set the moneyness of the option.
delta_type (str in {"spot", "forward"}) – When deriving strike from delta use the equation associated with spot or forward delta. If premium currency is ccy1 (left side of pair) then this will produce premium adjusted delta values. If the premium_ccy is ccy2 (right side of pair) then delta values are unadjusted.
metric (str in {"pips_or_%", "vol", "premium"}, optional) – The pricing metric returned by the
rate
method.curves (Curve, LineCurve, str or list of such, optional) – For FXOptions curves should be expressed as a list with the discount curves entered either as Curve or str for discounting cashflows in the appropriate currency with a consistent collateral on each side. E.g. [None, “eurusd”, None, “usdusd”]. Forecasting curves are not relevant.
spec (str, optional) – An identifier to pre-populate many field with conventional values. See here for more info and available values.
Attributes Summary
Methods Summary
analytic_greeks
([curves, solver, fx, base, ...])Return various pricing metrics of the FX Option.
cashflows_table
([curves, solver, fx, base])delta
([curves, solver, fx, base, local])Calculate delta risk of an Instrument against the calibrating instruments in a
Solver
.gamma
([curves, solver, fx, base, local])Calculate cross-gamma risk of an Instrument against the calibrating instruments of a
Solver
.npv
([curves, solver, fx, base, local, vol])plot_payoff
([range, curves, solver, fx, ...])rate
([curves, solver, fx, base, vol, metric])Calculate the rate of the FXOption
Attributes Documentation
- style = 'european'#
Methods Documentation
- analytic_greeks(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vol=NoInput.blank)#
Return various pricing metrics of the FX Option.
- Parameters:
curves (list of Curve) – Curves for discounting cashflows. List follows the structure used by IRDs and should be given as: [None, Curve for domestic ccy, None, Curve for foreign ccy]
solver (Solver, optional) – The numerical
Solver
that constructsCurves
from calibrating instruments.fx (FXForwards) – The object to project the relevant forward and spot FX rates.
base (str, optional) – Not used by analytic_greeks.
local (bool,) – Not used by analytic_greeks.
vol (float, or FXDeltaVolSmile) – The volatility used in calculation.
- Return type:
- cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
- delta(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, **kwargs)#
Calculate delta risk of an Instrument against the calibrating instruments in a
Solver
.- Parameters:
curves (Curve, str or list of such, optional) –
A single
Curve
or id or a list of such. A list defines the following curves in the order:solver (Solver, optional) – The
Solver
that calibrates Curves from given Instruments.fx (float, FXRates, FXForwards, optional) – The immediate settlement FX rate that will be used to convert values into another currency. A given float is used directly. If giving a
FXRates
orFXForwards
object, converts from local currency intobase
.base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if
fx_rate
is anFXRates
orFXForwards
object.local (bool, optional) – If True will ignore
base
- this is equivalent to settingbase
to None. Included only for argument signature consistent with npv.
- Return type:
DataFrame
- gamma(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, **kwargs)#
Calculate cross-gamma risk of an Instrument against the calibrating instruments of a
Solver
.- Parameters:
curves (Curve, str or list of such, optional) –
A single
Curve
or id or a list of such. A list defines the following curves in the order:solver (Solver, optional) – The
Solver
that calibrates Curves from given Instruments.fx (float, FXRates, FXForwards, optional) – The immediate settlement FX rate that will be used to convert values into another currency. A given float is used directly. If giving a
FXRates
orFXForwards
object, converts from local currency intobase
.base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if
fx_rate
is anFXRates
orFXForwards
object.local (bool, optional) – If True will ignore
base
. This is equivalent to settingbase
to None. Included only for argument signature consistent with npv.
- Return type:
DataFrame
- npv(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vol=NoInput.blank)#
- plot_payoff(range=NoInput.blank, curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vol=NoInput.blank)#
- rate(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, vol=NoInput.blank, metric='pips_or_%')#
Calculate the rate of the FXOption
Return various pricing metrics of the FX Option.
- Parameters:
curves (list of Curve) – Curves for discounting cashflows. List follows the structure used by IRDs and should be given as: [None, Curve for domestic ccy, None, Curve for foreign ccy]
solver (Solver, optional) – The numerical
Solver
that constructsCurves
from calibrating instruments.fx (FXForwards) – The object to project the relevant forward and spot FX rates.
base (str, optional) – Not used by analytic_greeks.
vol (float, or FXDeltaVolSmile) – The volatility used in calculation.
metric (str in {"pips_or_%", "vol", "premium"}, optional) – The pricing metric type to return. See notes.
- Return type:
Notes
The available choices for the pricing
metric
that can be used are:“pips_or_%”: if the
premium_ccy
is the foreign (RHS) currency then pips will be returned, else if the premium is the domestic (LHS) currency then % of notional will be returned.“vol”: the volatility used to price the option at that strike / delta is returned.
“premium”: the monetary amount in
premium_ccy
payable at the payment date is returned.