FXPut#

class rateslib.instruments.FXPut(*args, **kwargs)#

Bases: FXOption

Create an FX Put option.

For parameters see FXOption.

Attributes Summary

fixed_rate

If set will also set the fixed_rate of the contained leg1.

float_spread

If set will also set the float_spread of contained leg1.

index_base

If set will also set the index_base of the contained leg1.

leg2_fixed_rate

If set will also set the fixed_rate of the contained leg2.

leg2_float_spread

If set will also set the float_spread of contained leg2.

leg2_index_base

If set will also set the index_base of the contained leg1.

periods

style

Methods Summary

analytic_delta(*args[, leg])

Not implemented for Option types.

analytic_greeks([curves, solver, fx, base, vol])

Return various pricing metrics of the FX Option.

cashflows([curves, solver, fx, base, vol])

Return the properties of all periods used in calculating cashflows.

cashflows_table([curves, solver, fx, base])

Aggregate the values derived from a cashflows() method on an Instrument.

delta([curves, solver, fx, base, local])

Calculate delta risk of an Instrument against the calibrating instruments in a Solver.

exo_delta(vars[, curves, solver, fx, base, ...])

Calculate delta risk of an Instrument against some exogenous user created Variables.

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])

Return the NPV of the Option.

plot_payoff([range, curves, solver, fx, ...])

rate([curves, solver, fx, base, vol, metric])

Return various pricing metrics of the FX Option.

Attributes Documentation

fixed_rate#

If set will also set the fixed_rate of the contained leg1.

Note

fixed_rate, float_spread, leg2_fixed_rate and leg2_float_spread are attributes only applicable to certain Instruments. 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 and leg2_index_base are attributes only applicable to certain Instruments. 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 and leg2_index_base are attributes only applicable to certain Instruments. AttributeErrors are raised if calling or setting these is invalid.

Type:

float or None

periods#
style = 'european'#

Methods Documentation

analytic_delta(*args, leg=1, **kwargs)#

Not implemented for Option types. Use analytic_greeks.

analytic_greeks(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, 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 constructs Curves 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, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface) – The volatility used in calculation.

Return type:

float, Dual, Dual2

cashflows(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, vol=NoInput.blank)#

Return the properties of all periods used in calculating cashflows.

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 constructs Curves from calibrating instruments.

  • fx (FXForwards) – The object to project the relevant forward and spot FX rates.

  • base (str, optional) – Not used by rate.

  • vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface) – The volatility used in calculation.

Return type:

DataFrame

cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, **kwargs)#

Aggregate the values derived from a cashflows() method on an Instrument.

Parameters:
  • curves (CurveType, str or list of such, optional) – Argument input to the underlying cashflows method of the Instrument.

  • solver (Solver, optional) – Argument input to the underlying cashflows method of the Instrument.

  • fx (float, FXRates, FXForwards, optional) – Argument input to the underlying cashflows method of the Instrument.

  • base (str, optional) – Argument input to the underlying cashflows method of the Instrument.

  • kwargs (dict) – Additional arguments input the underlying cashflows method of the Instrument.

Return type:

DataFrame

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:

    • Forecasting Curve for leg1.

    • Discounting Curve for leg1.

    • Forecasting Curve for leg2.

    • Discounting Curve for leg2.

  • 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 or FXForwards object, converts from local currency into base.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if fx_rate is an FXRates or FXForwards object.

  • local (bool, optional) – If True will ignore base - this is equivalent to setting base to None. Included only for argument signature consistent with npv.

Return type:

DataFrame

exo_delta(vars, curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vars_scalar=NoInput.blank, vars_labels=NoInput.blank, **kwargs)#

Calculate delta risk of an Instrument against some exogenous user created Variables.

See What are exogenous variables? in the cookbook.

Parameters:
  • vars (list[str]) – The variable tags which to determine sensitivities for.

  • 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:

    • Forecasting Curve for leg1.

    • Discounting Curve for leg1.

    • Forecasting Curve for leg2.

    • Discounting Curve for leg2.

  • 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 or FXForwards object, converts from local currency into base.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if fx_rate is an FXRates or FXForwards object.

  • local (bool, optional) – If True will ignore base - this is equivalent to setting base to None. Included only for argument signature consistent with npv.

  • vars_scalar (list[float], optional) – Scaling factors for each variable, for example converting rates to basis point etc. Defaults to ones.

  • vars_labels (list[str], optional) – Alternative names to relabel variables in DataFrames.

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:

    • Forecasting Curve for leg1.

    • Discounting Curve for leg1.

    • Forecasting Curve for leg2.

    • Discounting Curve for leg2.

  • 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 or FXForwards object, converts from local currency into base.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if fx_rate is an FXRates or FXForwards object.

  • local (bool, optional) – If True will ignore base. This is equivalent to setting base 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)#

Return the NPV of the 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 constructs Curves, Smiles or Surfaces from calibrating instruments.

  • fx (FXForwards) – The object to project the relevant forward and spot FX rates.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code). If not given defaults to fx.base.

  • local (bool, optional) – If True will return a dict identifying NPV by local currencies on each period.

  • vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface) – The volatility used in calculation.

Return type:

float, Dual, Dual2 or dict of such.

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=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 constructs Curves, Smiles or Surfaces from calibrating instruments.

  • fx (FXForwards) – The object to project the relevant forward and spot FX rates.

  • base (str, optional) – 3-digit currency to express values in (not used by the rate method).

  • vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface) – The volatility used in calculation.

  • metric (str in {"pips_or_%", "vol", "premium"}, optional) – The pricing metric type to return. See notes.

Return type:

float, Dual, Dual2

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.

If calculating the rate of an FXOptionStrat then the attributes rate_weight and rate_weight_vol will be used to combine the output for each individual FXOption within the strategy.

FXStrangle and FXBrokerFly have the additional metric ‘single_vol’ which is a more complex and integrated calculation.