Smith & Wilson algorithm

Smith & Wilson is a popular algorithm for approximating financial curves such as bond yields or rates.
289 descargas
Actualizado 20 Jun 2023
Popular algorithm for interpolating and extrapolating various curves such as bond yields and risk-free rates.
This implementation is based on the Technical documentation of the Methodology to derive EIOPA's risk-free interest rate term structure (Version published on 12/09/2019. See Section 7).
Problem
When analysing market expectations of future rates, a common approach is o look at fixed income instruments such as government or corporate bonds that mature in the future. In practice, the maturities observable (and liquid) on the market rarely covers all the maturities that are needed.
Solution
This implementation takes as input the available market information, parameters describing the long-term behaviour of the curve and the data on desired (target) maturities for which the yields are needed.
Market information input:
  • Observed yields of the zero-coupon bonds (ZCB).
  • Maturity of the observed ZCB.
Parameters:
  • Ultimate froward rate ufr represents the rate to which the rate curve will converge as time increases.
  • Convergence speed parameter α controls the speed at which the curve converges towards the ufr parameter from the last liquid point (last data point available in the market information input).
Desired output:
  • List of maturities for which the SW algorithm will calculate the yields.
Note that this implementation assumes that the yields were calculated on ZCB. This assumption can be easily relaxed in future releases.
The implementation is split in two parts:
  1. The available market data and the parameters are used to calibrate the algorithm. This returns a calibration vector that can be used to interpolate or extrapolate target maturities. This is done by calibrating the kernel functions. Look at the function Calibrate_b().
  2. The yields for ZCB with targeted maturities are Interpolated/extrapolated. Look at the function ExtrapolateSW().
The syntax in the functions tries to be consistent with EIOPA technical specifications.
Getting started
Given the data on 6 ZCB with maturities of 1,2,4,5,6, and 7 years with observed yields 1%, 2%, 3%, 3.2%, 3.5% and 4% respectively. The user is interested in yields for ZCB at maturities 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20 years. The given calibration for the parameter alpha is 0.15 and the ultimate forward rate is 4%.
The commands to calculate the target yields would be:
r_Obs = [0.01; 0.02; 0.03; 0.032; 0.035; 0.04]; % yields observed on the market
T_Obs = [1; 2; 4; 5; 6; 7]; % maturities of bonds observed on the market
T_Target = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 15; 20]; % Targeted maturities for interpolation/extrapolation
ufr = 0.04; % ultimate forward rate
alpha = 0.15; % convergence speed parameter
b = SWCalibrate(r_Obs, T_Obs, ufr, alpha) % calibration vector calculation
r_Target = SWExtrapolate(T_Target, T_Obs, b, ufr, alpha) % calculation of target yields
r_Target % display target yields
A visual (Excel) example of what the code does can be found in the GitHub repository of the Python implementation:

Citar como

Gregor Fabjan (2024). Smith & Wilson algorithm (https://github.com/qnity/smith_wilson_matlab), GitHub. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2021b
Compatible con cualquier versión desde R2014a
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

No se pueden descargar versiones que utilicen la rama predeterminada de GitHub

Versión Publicado Notas de la versión
1.1.6

Project now has a website

1.1.5

New GitHub name for our company

1.1.4

Linked to the new GitHub address

1.1.3

Updated to a working GitHub link

1.1.2

Forgot to include T_Obs = [1; 2; 4; 5; 6; 7] in the example

1.1.1

Minor fixes

1.1.0

Typo in SWExtrapolate

1.0.9

Minor formating changes

1.0.8

Added link to GitHub

1.0.7

Reformated the documentation for better clarity.

1.0.6

Fixed name of SWExtrapolate function in description

1.0.5

Fixed the name of SWCalibrate in the description

1.0.4

Per request added an example of use in the description

1.0.3

Added a link to the Excel example.

1.0.2

Removed repetitive parts of the description

1.0.1

Conversion of the file main.mlx to main.m.

1.0.0

Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.