Release Notes#

The future development of rateslib is open to many avenues. Some possibilities are listed below. The author is very interested in any feedback and this can be given on the public Issues board at the project github repository: Rateslib Project, or by direct email contact, see rateslib.

1.7.0 (No Release Date)#

Feature

Description

Instruments

ytm() added to FloatRateNote to allow the calculation of yield-to-maturity for that Instrument based on calc_mode similar to FixedRateBonds. (529)

Bug

STIRFuture now correctly handles the fx and base arguments when using the npv() or analytic_delta() methods. (519)

Bug

rate() now correctly calculates when fixings are provided in any of the acceptable formats and contains all data to do so, in the absense of a forecast curve, instead of returning None for some cases. This allows for cashflows() to return values even when curve is not constructed. (530) (532) (535) (536)

Refactor

Minor Breaking Change! get_calendar() has dropped the kind argument being only useful internally. (524)

Refactor

Minor Breaking Change! FXForwards.rate has dropped the path and return_path arguments being mainly useful internally. Replicable functionality is achieved by importing and using the internal method rateslib.fx.FXForwards._rate_with_path(). (537)

1.6.0 (30th November 2024)#

Feature

Description

Instruments

Add CDS for credit pricing, as well as the associated components; CreditPremiumLeg, CreditPremiumPeriod, CreditProtectionLeg, CreditProtectionPeriod. (419) (425) (426)

Instruments

Add an additional method analytic_rec_risk() to measure the sensitivity of a change in recovery_rate for a CDS. (448)

Instruments

Add the spec options; ‘audusd_xcs’, ‘audusd_xcs3’, ‘nzdusd_xcs3’, ‘nzdaud_xcs3’, ‘us_ig_cds’ (429) (454)

Instruments

Add a fixings_table() method to floating rate based Instruments: IRS, SBS, FRA, IIRS, ZCS, STIRFuture, FloatRateNote. (467) (470) (490) (493) (499) (500) (510)

Instruments

Add a fixings_table() method to Portfolio, Fly, Spread to aggregate fixings tables on contained and applicable Instruments. (491) (508)

Legs

Add method fixings_table() to a FloatLegMtm and ZeroFloatLeg. (480) (482) (489)

Periods

Minor Breaking Change! The method fixings_table() returns a DataFrame with amended column headers to reference the Curve id from which the fixing notionals are derived, and populates additional columns.

Performance

Curve caching introduced to Curve, LineCurve, IndexCurve to improve performance of repeatedly fetched curve values such as in Solvers and standardised Instruments. This feature can be opted out of using the defaults.curve_caching setting. Note also the added clear_cache() method. (435)

Performance

Smile caching introduced to FXDeltaVolSurface, to improve performance of fetched Smiles at repeated expiries. This feature can be opted out of using the defaults.curve_caching setting. Note also the added clear_cache() method. (481)

Automatic Differentiation

Add a new object for AD management, a Variable, which allows a user to inject manual exogenous sensitivities into calculations. See what is an exogenous Variable? (452)

Risk Sensitivities

Add method exo_delta() to calculate the delta sensitivity against a user-defined exogenous Variable. (453)

Dependencies

Python 3.13 (with GIL) is officially supported and tested. (463)

Bug

MultiCsaCurve and get_imm are now included in the main namespace. (436) (486)

Bug

Adding Dual or Dual2 type spread using shift() method now avoids TypeErrors where possible and maintains appropriate AD orders for each existing and new object. (440)

Bug

The method fixings_table() is amended for IBOR type fixings to account for DCFs, amended payment dates, and interpolated stubs. Requires a new disc_curve argument for proper discounting. (470)

Bug

No longer allow the creation of very short Schedules with holiday dates that collapse to empty Periods. (484)

Developers

rateslib-rs extension upgrades to using PyO3:0.22, nadarray:0.16, numpy:0.22. (460)

1.5.0 (25th September 2024)#

Feature

Description

Instruments

Added “nzd_irs3”, “nzd_irs6”, “se_gbb” and “uk_gbb” to available spec defaults. (397) (403)

Instruments

BondCalcMode and BillCalcMode added to allow more flexibility when adding new bond specifications with other defined calculation conventions. (402)

Calendars

Add a “wlg” calendar for New Zealand IRS. (363)

Calendars

Add a method, get_imm(), to calculate IMM dates. (371)

Serialization

PPSplines are now serializable. Read more here. (374)

Refactor

Minor Breaking Change! PPSpline equality is now True if both spline coefficients are unsolved, i.e. None. (374)

Refactor

The __repr__ method of all Curve types, FXRates and FXForwards types, the Solver, Schedule, and all Period, Leg and Instrument types are changed for better display in associated packages. (387) (388) (389) (390) (413) (416) (418)

Performance

Improve the speed of bond ytm() calculations from about 750us to 500us on average. (380)

Bug

FXRates fix support for pickling which allows multithreading across CPU pools or external serialization. (393)

Bug

The eom parameter for spec “us_gb” and “us_gb_tsy” and associated aliases is corrected to True. (368)

Bug

Creating IRS or similar Instruments with a termination of “1b” or business days now correctly uses the specified calendar. (378)

Bug

ProxyCurve, CompositeCurve, and MultiCsaCurve now correctly initialise a randomised curve id when one is not provided. (387)

Bug

Altered the default specs for eur_stir3 to reflect a EURIBOR settlement, and aud_irs3 to reflect a no-lagged publication. (395)

Bug

The conventions for “SE_GBB” and “SE_GB” amended for T+2 settle instead of T+1, and the calculation for YTM adjusted for simple yield in the last coupon period. (410)

Bug

IMM FRAs with an IMM roll date only need to define the IMM roll on leg1 and no longer also on leg2. (409)

1.4.0 (28th Aug 2024)#

Feature

Description

Calendars

add_tenor() acquires the new optional argument mod_days which, by default, negates the modification rule for day type tenors and applies it only to month and year type tenors.

Calendars

Add NamedCal for improved control of calendar serialization and loading.

Instruments

Add a cashflows() method to generic FXOption and also as a pre-requisite to FXOptionPeriod. This also allows the derivative method cashflows_table() to function for FXOption.

Instruments

Add an internal routine to derive FXOption expiry and delivery according to FX market conventions using the new settlement calendar system introduced in v1.3.0.

Instruments

Add eom parameter to FXOptions for exact expiry and delivery date calculation when given as string tenor.

Instruments

The default calc_mode for Bill, FixedRateBond, FloatRateNote and IndexFixedRateBond is now separately configurable for each type.

Instruments / Legs

Can now have effective and termination dates which are non-business dates in unmodified schedules.

Surfaces

Add weights to FXDeltaVolSurface to give more control of temporal interpolation of volatility.

Bug

Publicly exposed the PPSpline.bsplmatrix function for displaying intermediate spline calculation results of the spline coefficient matrix.

Bug

Dual and Dual2 fix support for pickling which allows multithreading across CPU pools.

Bug

Expose gradient() as a method in the rateslib public API.

Bug

Expose NamedCal as a class in the rateslib public API.

Bug

IndexFixedRateBond now correctly initialises when using a pandas.Series as index_fixings argument.

Bug

ZCIS now raises if an index_base cannot be forecast from an IndexCurve and the value should be known and input directly, to avoid Solver calibration failures.

Bug

npv and cashflows of a FloatPeriod now handle error messages regarding missing RFR fixings for an historical period which is only missing a single fixing.

1.3.0 (9th July 2024)#

Feature

Description

Instruments

calc_mode of FixedRateBond has been refactored to allow more standardised names. The existing modes are deprecated and will be removed in v2.0.

Instruments

spec “de_gb”, “fr_gb”, “it_gb”, “no_gb” and “nl_gb”, added to FixedRateBond to quickly create German, French, Italian, Norwegian and Dutch government bonds.

Calendars

The pandas holiday and calendar system has been removed in favour of a rust implementation for calendar objects: Cal and UnionCal.

Calendars

Breaking Change! The create_calendar() methods is deprecated and modified to accept different input arguments.

Calendars

Calendar string parsing has been enhanced to allow associated settlement calendars, and automatic creation of a UnionCal object. E.g. “tgt,ldn|nyc”.

Calendars

The Tokyo calendar ‘tyo’ has been added to align with TONA publication. The FED calendar ‘fed’ has also been added. The Sydney calendar “syd” has been added to align with AONIA publication.

Calendars

JSON serialisation/deserialisation of Cal and UnionCal added for saving/loading from database or file.

Calendars

The new DCF method ‘Bus252’ is added to allow Brazilian type calculations.

Dual

JSON serialisation/deserialisation of Dual and Dual2 added for saving/loading from database or file.

FXRates

The FXRates class has been delegated to the Rust extension to improve performance.

Performance

Algorithm for FXRates generation is modified to improve the speed of instance construction for a larger number of currencies.

FX Volatility

get_from_strike() on both Smiles and Surfaces has been refactored to remove the unnecessary phi argument.

Bug

ZCS now raises if fixed frequency is given as “Z”.

Bug

rate() method of a FixedRateBond now correctly returns the local currency price or yield-to-maturity without being wrongly converted by a base FX rate, if an FX object is also supplied to the pricing formula.

Bug

FXOption initialised with metric no longer raises if an alternate dynamic metric is requested as override in the rate() method.

Bug

Setting and resetting some types of values (namely by-reference stored values) of the defaults object is no longer ineffective.

Bug

Solving acyclic FXForwards systems is now stable for all orderings of currencies, and does not depend on a well chosen base currency.

Bug

Converting an fx_array associated with the FXRates into second order for AD calculations now captures second order FX derivatives correctly by rebuilding the array, instead of a direct conversion setting second order derivatives to zero.

Bug

Entering the “single_vol” metric into the rate() method of a FXBrokerFly no longer raises.

Errors

Improved messages when missing fx objects for pricing FXExchange.

1.2.2 (31st May 2024)#

This version uses Rust bindings. See getting started for notes about installation changes.

New FX Volatility Products are set to beta status, probably until version 2.0.

Feature

Description

Performance

The modules rateslib.dual and rateslib.splines have been ported to Rust instead of Python to improve calculation times.

Splines

New methods ppev_single_dual(), ppev_single_dual2(), ppdnev_single_dual(), and ppdnev_single_dual2() have been added to ensure correct handling of AD with regards to both x-axis and y-axis variables. See section on using AD with splines

Splines

Added evaluate() for automatically handling which ppdnev method to use based on the AD sensitivities of the given x value.

Instruments

Breaking Changes! Amend FXExchange to remove the arguments currency and leg2_currency in favour of using pair which is consistent with the new FX Volatility naming convention. Also reverse the notional so that a +1mm EURUSD transaction is considered as a purchase of EUR and a sale of USD.

Instruments

FXSwap allows the dominant pair argument, consistent with other FX instruments to define the currencies. currency and leg2_currency are still currently permissible if pair is omitted.

Instruments

Basic FX Volatility Instruments have been added in beta status, including FXCall, FXPut, FXRiskReversal, FXStraddle, FXStrangle, FXBrokerFly and FXOptionStrat. See user guide section for more information.

FX Volatility

New pricing components FXDeltaVolSmile and FXDeltaVolSurface have been added to allow pricing of single expiry FX Options with a Smile interpolated over a Delta axis. See FX volatility construction.

AD

Added dual_norm_pdf() for AD safe standard normal probability density.

AD

Added newton_1dim() and newton_ndim() for AD safe Newton root solving in one or multiple dimensions.

Solver

Added quadratic_eqn() to return the solution of a quadratic equation in an AD safe and consistent return format to other solvers for convenience.

Bug

“ActActICMA” convention now handles frequency of “Z”, asserting that of “A”, albeit with a UserWarning.

Bug

npv and cashflows of a FloatPeriod did not handle error messages regarding missing RFR fixings for a historical period. Calculations wll now raise if missing fixings.

Bug

FXSwap now no longer raises TypeError for dual number type mixing when npv or rate are called after changing the AD order of curves and fx objects.

1.1.0 (20th Mar 2024)#

Feature

Description

Automatic Differentiation

Breaking Change! Dual number gradient method is no longer calculable on the object. Instead of dual.gradient(vars) use the following call gradient(dual, vars), using the provided function rateslib.dual.gradient().

Instruments

Added argument metric to Value so that specific Curve values derived as calculated figures (e.g. continuously compounded zero rate, or index value) can be calibrated by Solvers.

Bug

delta() and gamma() now work directly with given npv when fx is not provided.

Bug

npv() now returns 0.0 for historical payment dates correctly when given the local argument.

Bug

cashflows() no longer prints dual numbers to tables.

Performance

Curve iterations in the Solver were amended in the way they handle Dual variables in order to reduce upcasting and increase the speed of basic operations.

Performance

bsplev_single introduced a short circuit based on the positivity and support property to greatly improve time needed to solve curves with splines.

Performance

Curve with splines are remapped to use float posix timestamps rather than datetimes for building splines. Operations with floats are much faster than their equivalents using timedeltas.

1.0.0 (1st Feb 2024)#

Feature

Description

Bug

cashflows() now correctly identifies the DF at cash settled payment date.

Bug

fixings_table() now generates exact results (not in approximate mode) when RFR fixings are included in any period.

0.7.0 (29th Nov 2023)#

Feature

Description

Legs

Refactor how the defaults.fixings object works. Breaking change. Explained in Working with Fixings.

Legs

Allow fixings as a 2-tuple to manually define the first FloatPeriod (say as IBOR stub) and determine the rest from a Series. Also allow fx_fixings as a 2-tuple for similar reason for MTM XCS.

Instruments

Fly and Spread now express rate in basis point terms and not percent.

Instruments

Added calc_mode to BondFuture to calculate CME US treasury conversion factors correctly.

Instruments

ctd_index can now optionally return the ordered set of CTD indexes instead of just the CTD.

Instruments

Added cms() to perform multi-security CTD analysis on BondFuture.

Solver

Add an attribute result that contains retrievable iteration success or failure information.

Bug

Update analytic_delta() for STIRFuture to match delta.

Bug

Add the spec argument functionality missing for IndexFixedRateBond.

Bug

CompositeCurve now returns zero for DF item lookups prior to the initial node date.

Bug

net_basis now deducts accrued from the result when the prices are provided dirty.

0.6.0 (19th Oct 2023)#

Feature

Description

Instruments

Add a STIRFuture class

Instruments

Merge all XCS classes into one, adding new arguments, fixed, leg2_fixed and leg2_mtm to differentiate between types.

Curves

Separate MultiCsaCurve from CompositeCurve for increased transparency on its action.

Curves

Add the ability to supply curves in a dict for forecasting FloatPeriods to be able handle interpolated stub periods under an “ibor” fixing_method.

Solver

Added the methods jacobian() and market_movements() for coordinating multiple Solvers.

Bug

Instrument spec with method_param set to 2 day lag for certain IBOR instruments.

Bug

The npv() method on a Portfolio no longer allows mixed currency outputs to be aggregated into a single float value.

Bug

Now emit a warning if a discount factor or rate is requested on a curve with a spline outside of the rightmost boundary of the spline interval.

0.5.1 (11 Sep 2023)#

Feature

Description

Instruments

Rename FloatRateBond to FloatRateNote and removed the alias Swap.

Instruments

Add a spec keyword argument to allow instruments to be pre-defined and follow market conventions without the user needing to input these directly, but preserving an ability to overwrite specific values.

Instruments

Add calc_mode to Bonds to provide mechanisms to perform YTM calculations under different conventions and geographies.

Periods

FloatPeriod now allows averaging methods for determining the rate.

Curves

The shift() operation for Curves now defaults to using a CompositeCurve approach to preserve a constant spread to the underlying Curve via a dynamic association. Shifted curves can also optionally add id and collateral tags.

Schedule

A Schedule now has the arguments eval_date and eval_mode allow a tenor-tenor effective-termination input.

Defaults

Change the default Solver algorithm to “levenberg_marquardt” because it is more robust for new users, even if slower in general.

Bug

FXExchange can now be imported from rateslib and has been added to __init__.

Bug

cashflows_table() no longer returns empty when no collateral information is available.

Bug

fixings_table() now properly represents published fixing values as having zero nominal exposure.

Bug

solver.fx attribute is now properly passed through to the rate calculation of multi-currency instruments when fx is None.

0.4.0 (12 Aug 2023)#

Feature

Description

Instruments

Added split_notional to FXSwap to more accurately reflect the interbank traded product.

Instruments

Added FXExchange, to provide booking FX spot or FX forward trades.

Legs

Removed all LegExchange types, and replaced by adding initial_exchange and final_exchange as arguments to basic Legs.

Instruments

The payment_lag_exchange parameter for FXSwap was removed in favour of using payment_lag.

Defaults

Added historic fixing data until end July for ESTR, SOFR, SWESTR, SONIA and NOWA, for testing and validation.

Instruments

Collateral tags were added to Curves to permit the new method cashflows_table which tabulates future cashflows according to currency and collateral type.

Performance

Calendars are now cached which improves general performance by about 10%.

Bug

When performing operations on CompositeCurves the resultant curve now correctly inherits the multi_csa parameters.

Bug

FloatPeriod fixing exposure tables were marginally overestimated by ignoring discounting effects. This is corrected.

Bug

NumPy.float128 datatype is not available on Windows and caused loading errors.

Bug

The holiday calendars: ‘ldn’, ‘tgt’, ‘nyc’, ‘stk’, ‘osl’, and ‘zur’, have been reviewed and validated historic fixings against the historic fixing data. These are also now fully documented.

Bug

CompositeCurve can now be constructed from ProxyCurve and Curve combinations.

0.3.1 (29 Jul 2023)#

Feature

Description

Legs

Added IndexFixedLeg, ZeroIndexLeg, and IndexFixedLegExchange.

Instruments

Added IndexFixedRateBond, IIRS, ZCIS.

Curves

Added CompositeCurve.

0.2.0 (15 May 2023)#

Feature

Description

Instruments

Added BondFuture.

Curves

Added IndexCurve.

0.1.0 (24 Apr 2023)#

Feature

Description

Automatic Differentiation

A toolset for making risk sensitivity and gradient based calculations.

Calendars

A toolset for handling dates and holiday calendars for schedules.

Schedule

A toolset for generating financial schedules of financial instruments.

Splines

A toolset for allowing spline interpolation.

Curves

Initial classes for DF bases and value based interest rate curves.

Periods

Initial classes for handling fixed periods, float periods and cashflows.

Legs

Initial classes for aggregating periods.

Instruments

Adding standard financial instruments such as securities: bonds and bills, and derivatives such as: IRS, SBS, FRA, XCS, FXSwap

Solver

A set of algorithms for iteratively determining interest rate curves.

FX

Initial classes for handling FX rates an Fx forwards.