Skip to content

Instantly share code, notes, and snippets.

@alecloudenback
Created October 25, 2021 02:47
Show Gist options
  • Save alecloudenback/2926034839b2438e2ddb54362d38d261 to your computer and use it in GitHub Desktop.
Save alecloudenback/2926034839b2438e2ddb54362d38d261 to your computer and use it in GitHub Desktop.
Yields.jl Smith-Wilson Grading example (Solvency II)
using Yields, Plots
yields = [0.02,0.023,0.026,0.029,0.035]
maturities = [1,2,3,7,15]
price = [1,1,1,1,1]
payments = 1
observable_prices = Yields.BulletBondQuotes(yields,maturities,price,payments)
grading_speed = 0.01:0.01:0.25
ultimate_forward = 0.02
curves = [Yields.SmithWilson(observable_prices,ufr=ultimate_forward,α=g) for g in grading_speed ]
times = 0.5:0.5:30
zeros = [zero(curve,time) for time in times, curve in curves ]
plot(times,
rate.(zeros),
label="",
ylabel = "zero rate",
xlabel="time",
palette=palette(:dense,length(grading_speed)),
grid=false,
title="Solvency II Yield Curves \nwith different grading speeds \n (dummy data)"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment