• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Matlab code - Vasicek yield curve fitting, Various bond price models available

Hi! I have a similar question to that of Daniel. I first tested the code on some zero-coupon bonds (actually some bond strips, but that doesn't matter), and indeed it worked great.
But what I really wanted to do, is to fit the Vasicek model on a set of coupon-bearing bonds, resulting in a spot rate structure.
So what I did was I altered the code calculating the prices so that it would calculate the prices of my coupon bonds, and I used that measure directly for fitting, so using price errors instead of yield errors.
My results however aren't that good. So again in short: the only thing that actually changed is that I now use prices (for coupon-bearing bonds) directly. My inputs are time-to-maturity and market prices (and coupon rates of course). I didn't for example make any changes in the optimization options. Any suggestions to make a better fit? Thanks.
 
You price your coupon-bond as a portfolio-of-zero-bonds? I.e. as though the coupons were all independent of eachother? In practice, such an approach understates bond prices, because there is an inherant dependency on the coupons, if the issuer defaults on an earlier coupon, then all subsequents will default, so there is a credit risk component that is priced in by markets but not captured by this simple/naive approach.
You don't say in what way "your results are not good"?
 
Indeed, the theoretical price for my coupon-bearing bonds takes every cash flow (coupons and face value), and discounts it with the respective maturity of that specific cash flow. Defaulting isn't really an issue here, as I use Treasury bonds, and (still) assume them to be risk-free.
The results are not good in that the theoretical prices deviate too much from the market prices to be useful. I have errors of 20 (on a price of around 100). I don't know if it was clear from my first post, but it are the price errors I am trying to minimize, not the yields as in the original code.
If you've got the time, I can send you my adapted code.
 
Hi there.
I have research your Matlab files, but I am having some questions about the project I am doing. Daleholborow, could you please give me a hand with a CIR Process calibration in Matlab. Please find attached the project.
Thanks very much in advanced
 

Attachments

  • CIR Process.jpg
    CIR Process.jpg
    71.5 KB · Views: 349
Hi, I am currently working on implementing MLE for the Merton model parameters based on the paper by Duan in 1995. I know it was four years ago that you coded up the model, nevertheless it will be very grateful if you can share your matlab code here or sent it to me: irvingzhao@gmail.com
Many thanks,
Irving
 
from memory, the BS model i coded up was based on the Li and Wong paper, I don't know how that differs from Duan. I haven't gone back through it though sorry, I'm currently quite busy. Good luck.
 
Hello, I am a graduate student in math finance and I am having trouble writing a generic matlab program to price discount and coupon bonds. I need to first price them following Vasicek, then following CIR. I tried utilizing your code but unsuccessfully. Could you help me out?? Thanks!
 
Hello, I am a graduate student in math finance and I am having trouble writing a generic matlab program to price discount and coupon bonds. I need to first price them following Vasicek, then following CIR. I tried utilizing your code but unsuccessfully. Could you help me out?? Thanks!
Sorry guys, i am currently backpacking around the world for a few months so won't be able to assist with any programming questions. Good luck
 
Hi all!
I'm Italian, so please excuse me for my bad english!
I'm writing a thesis for my graduation! I have to construct a yield curve for italian and german bond! Which program I have to use? Where can I find the data? Which model should I use?

Please help me!!!

And very very thank you! :)
 
Hi all!
I'm Italian, so please excuse me for my bad english!
I'm writing a thesis for my graduation! I have to construct a yield curve for italian and german bond! Which program I have to use? Where can I find the data? Which model should I use?

Please help me!!!

And very very thank you! :)
lots of models you could use... look at Vasicek, Hull White, splines, etc etc... From the sounds of it, you have the chance to choose which model you use yourself? What are you trying to show / prove in your thesis? Do you have a topic?

Sorry for the slow reply, but I'm still travelling and will be doing so for several months, so I don't check Quantnet very often any more.

Start by downloading my thesis, earlier in this thread, and see if that gives you a few ideas on yield curve constructions. There will also be lots of topics on this in this forum and on Wilmott.com
 
Hello,

I have succesfuly calibrated vasicek model for daily interest rate data. For calibration I used dt (delta in time between two observations) = 1/252. Therefore I obtained annualized parameters. Now I need to simulate 1 000 simulationd of Vasicek model using calibrated coefficients and I dont know which dt to use in simulations. Do I have to use in simulations dt = 1/252 or I can use any dt I want, for example dt = 1/12 to have monthly observations?????????

Logically I would opt for 1/252, but monthly values would make my susequent analyzes easier.

Thanks anyone for reply, I am hopelles as I cannot find a clue anywhere, in any textbook, paper, anywhere :).
 
Can anyone help me in that

People use RMSE to validate Vasicek model. But I am not sure how to calculate it because RMSE = std deviation ( original yield - forecasted yield) and forecasted yield can have multiple values because it depends on r(t) and r(t) has a random term.

Any guidelines on how to calculate it will be really helpful. Any link to a research paper or online resource will be appreciated
 
Can anyone help me in that

People use RMSE to validate Vasicek model. But I am not sure how to calculate it because RMSE = std deviation ( original yield - forecasted yield) and forecasted yield can have multiple values because it depends on r(t) and r(t) has a random term.

Any guidelines on how to calculate it will be really helpful. Any link to a research paper or online resource will be appreciated

I would think r(t) is the current short rate (1 day ) as of today, time t; so is known from
yield curve.
 
Back
Top