FXFixing#

class rateslib.data.fixings.FXFixing(fx_index, publication=NoInput.blank, delivery=NoInput.blank, value=NoInput.blank, identifier=NoInput.blank)#

Bases: _BaseFixing

An FX fixing value for cross-currency or non-deliverable settlement.

Examples

In [1]: fixings.add("WMR_10AMTYO_USDJPY", Series(index=[dt(1999, 12, 29)], data=[155.00]))

In [2]: fixings.add("WMR_10AMTYO_AUDUSD", Series(index=[dt(1999, 12, 29)], data=[1.260]))

In [3]: fxfix = FXFixing(
   ...:     delivery=dt(2000, 1, 4),
   ...:     fx_index=FXIndex(
   ...:         pair="audjpy",
   ...:         calendar="syd,tyo|fed",
   ...:         settle=2,
   ...:         isda_mtm_calendar="syd,tyo,ldn",
   ...:         isda_mtm_settle=-2,
   ...:         allow_cross=True,
   ...:     ),
   ...:     identifier="WMR_10AMTYO"
   ...: )
   ...: 

In [4]: fxfix.publication  #  <--  derived from isda attributes
Out[4]: datetime.datetime(1999, 12, 29, 0, 0)

In [5]: fxfix.value        #  <--  should be from the cross 1.26 * 155 = 195.3
Out[5]: np.float64(195.3)
Parameters:
  • fx_index (FXIndex, str, required) – The FXIndex defining the FX pair and its conventions.

  • publication (datetime, optional) – The publication date of the fixing. If not given, must provide delivery in order to derive the publication date.

  • delivery (datetime, optional) – The settlement delivery date of the cashflow. Can be used to derive the publication date. If not given is derived from the publication.

  • value (float, Dual, Dual2, Variable, optional) – The initial value for the fixing to adopt. Most commonly this is not given and it is determined from a timeseries of published FX rates.

  • identifier (str, optional) – The string name of the series to be loaded by the Fixings object. Will be appended with “_{pair}” to derive the full timeseries key.

Notes

This object is designed to systematically handle FX fixings across variety of conventions and is typically used for non-deliverable and MTM-XCS settlement.

If the FXIndex is configured to allow_cross (which is the general default) then it will adopt the WMR Benchmark Methodology and assume cross rates against base USD, except if the currency is one of the European currencies defined as having a base EUR, by that methodology.

Suppose one transacted a CADSEK mtm-XCS with a CAD mtm Leg. The ISDA MTM fixing date could be defined as being 2 business days prior to the cashflow under the Stockholm, New York, London and Toronto calendars. Under WMR, CAD has a USD base, and SEK has a EUR base, so the determination of this FX Fixing will be a 3-way cross: CADUSD * USDEUR * EURSEK.

WMR ignores market settlement convention and local calendars in the determination of the cross. So a cashflow due on 8th Jan ‘26 will determine a publication date as 5th Jan ‘26 (since the 6th Jan is holiday in Stockholm). All three WMR publication will have different settlement (delivery dates) for the publication date on the 5th Jan:

In [6]: fxfix = FXFixing(
   ...:     fx_index=FXIndex(
   ...:         pair="cadsek",
   ...:         calendar="tro,stk|fed",
   ...:         settle=2,
   ...:         isda_mtm_calendar="tro,ldn,stk,nyc",
   ...:         isda_mtm_settle=-2,
   ...:         allow_cross=True,
   ...:     ),
   ...:     delivery=dt(2026, 1, 8),
   ...: )
   ...: 

In [7]: fxfix.publication  #  <-- is 5th Jan determnined from the isda specications
Out[7]: datetime.datetime(2026, 1, 5, 0, 0)

In [8]: fxfix.fx_fixing1.delivery  #  <-- USDCAD is T+1 under "tro|fed" defined by defaults
Out[8]: datetime.datetime(2026, 1, 6, 0, 0)

In [9]: fxfix.fx_fixing2.delivery  #  <-- EURUSD is T+2 under "tgt|fed" defined by defaults
Out[9]: datetime.datetime(2026, 1, 7, 0, 0)

In [10]: fxfix.fx_fixing3.delivery  #  <-- EURSEK is T+2 under "tgt,stk|fed" defined by defaults
Out[10]: datetime.datetime(2026, 1, 8, 0, 0)

This has implications towards the forecasting of these fixing values. In order to properly forecast the above an FXForwards with all four currencies is required.

In [11]: fxfix.value_or_forecast(fx=fxf)  #  <-  FXForwards:usd,cad,eur,sek
Out[11]: <Dual: 6.685838, (fx_usdcad, fx_eurusd, fx_eursek), [-4.8, -5.7, 0.6]>

In [12]: fxf.rate("cadusd", dt(2026, 1, 6)) * fxf.rate("usdeur", dt(2026, 1, 7)) * fxf.rate("eursek", dt(2026, 1, 8))
Out[12]: <Dual: 6.685838, (fx_usdcad, fx_eurusd, fx_eursek), [-4.8, -5.7, 0.6]>

Note that this is different to the actual CADSEK forecast FX rate and this is due to those milaligned crosses and calendars.

In [13]: fxfix = FXFixing(
   ....:     fx_index=FXIndex(
   ....:         pair="cadsek",
   ....:         calendar="tro,stk|fed",
   ....:         settle=2,
   ....:         isda_mtm_calendar="tro,ldn,stk,nyc",
   ....:         isda_mtm_settle=-2,
   ....:         allow_cross=False,      #  <-  Everything the same except no crossing allowed
   ....:     ),
   ....:     delivery=dt(2026, 1, 8),
   ....: )
   ....: 

In [14]: fxfix.value_or_forecast(fx=fxf)
Out[14]: <Dual: 6.685726, (fx_usdcad, fx_eurusd, fx_eursek), [-4.8, -5.7, 0.6]>

In [15]: fxf.rate("cadsek", dt(2026, 1, 8))
Out[15]: <Dual: 6.685726, (fx_usdcad, fx_eurusd, fx_eursek), [-4.8, -5.7, 0.6]>

Attributes Summary

allow_cross

Whether the fixing uses WMR base currencies and majors or directly looks up the given pair.

date

The date of relevance for the fixing, e.g. the publication date of an IBORFixing.

delivery

The settlement delivery date of the fixing as specified directly, or implied from the FXIndex.

fx_fixing1

The first (or only) _FXFixingMajor required by the fixing.

fx_fixing2

The second _FXFixingMajor required by the fixing if crossed.

fx_fixing3

The third _FXFixingMajor required by the fixing if crossed.

fx_index

The FXIndex for the FX fixing.

identifier

The string name of the timeseries to be loaded by the Fixings object.

pair

The currency pair related to the FX fixing.

publication

The publication date of the fixing as specified directly, or implied from the FXIndex.

value

The fixing value.

Methods Summary

reset([state])

Sets the value attribute to NoInput, which allows it to be redetermined from a timeseries.

try_value_or_forecast(fx)

Return the determined value of the fixing or forecast it if not available.

value_or_forecast(fx)

Return the determined value of the fixing or forecast it if not available.

Attributes Documentation

allow_cross#

Whether the fixing uses WMR base currencies and majors or directly looks up the given pair.

date#

The date of relevance for the fixing, e.g. the publication date of an IBORFixing.

delivery#

The settlement delivery date of the fixing as specified directly, or implied from the FXIndex.

fx_fixing1#

The first (or only) _FXFixingMajor required by the fixing.

fx_fixing2#

The second _FXFixingMajor required by the fixing if crossed.

fx_fixing3#

The third _FXFixingMajor required by the fixing if crossed.

fx_index#

The FXIndex for the FX fixing.

identifier#

The string name of the timeseries to be loaded by the Fixings object.

pair#

The currency pair related to the FX fixing.

publication#

The publication date of the fixing as specified directly, or implied from the FXIndex.

value#

Methods Documentation

reset(state=NoInput.blank)#

Sets the value attribute to NoInput, which allows it to be redetermined from a timeseries.

Examples

In [1]: fx_fixing1 = FXFixing(publication=dt(2021, 1, 1), fx_index="eurusd", identifier="A")

In [2]: fx_fixing2 = FXFixing(publication=dt(2021, 1, 1), fx_index="gbpusd", identifier="B")

In [3]: fixings.add("A_eurusd", Series(index=[dt(2021, 1, 1)], data=[1.1]), state=100)

In [4]: fixings.add("B_gbpusd", Series(index=[dt(2021, 1, 1)], data=[1.4]), state=200)

# data is populated from the available Series
In [5]: fx_fixing1.value
Out[5]: np.float64(1.1)

In [6]: fx_fixing2.value
Out[6]: np.float64(1.4)

# fixings are reset according to the data state
In [7]: fx_fixing1.reset(state=100)

In [8]: fx_fixing2.reset(state=100)

# only the private data for fixing1 is removed because of its link to the data state
In [9]: fx_fixing1._value
Out[9]: <NoInput.blank: 0>

In [10]: fx_fixing2._value
Out[10]: np.float64(1.4)
Parameters:

state (int, optional) – If given only fixings whose state matches this value will be reset. If no state is given then the value will be reset.

Return type:

None

try_value_or_forecast(fx)#

Return the determined value of the fixing or forecast it if not available.

Parameters:

fx (FXForwards, optional) – The FXForwards object to forecast the forward FX rate.

Return type:

Result[float, Dual, Dual2, Variable]

value_or_forecast(fx)#

Return the determined value of the fixing or forecast it if not available.

Parameters:

fx (FXForwards, optional) – The FXForwards object to forecast the forward FX rate.

Return type:

float, Dual, Dual2, Variable