Pricing a bond with different YTM (at cross sectional level)

2 ビュー (過去 30 日間)
Saad
Saad 2011 年 6 月 29 日
Dear Sir or Madam
I was wondering if there is a function in matlab that prices bonds with different YTM?. For example:
Bond price= coupon/(YTM_1) +coupon/(YTM_2)^2+.................+coupon/(YTM_n)^n
Thank you very much
S

回答 (3 件)

Oleg Komarov
Oleg Komarov 2011 年 6 月 29 日
N = 100;
C = 5; %Semi-annual
YTM = rand(1,10)*.1;
P = sum([C./(1+YTM(1:9)).^(1:9), (N+C)/(1+YTM(10))^10]);
Or if you have the financial toolbox for precise daycounts use bndprice

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 29 日
You know, MATLAB has Financial Toolbox

Saad
Saad 2011 年 6 月 30 日
To Fangjun /Oleg I know that but I have a time series of bond and for each row I have a zero rate with different maturities so bndprice doesnt work....
in each row i have to account for different YTM at different maturities and I have to account for accrual coupon rate..any ideas how to solve that??
  1 件のコメント
Oleg Komarov
Oleg Komarov 2011 年 7 月 6 日
You can still apply a vectorized solution from my example.
To be more precise you need to provide an example on how you stored all of that info.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePrice and Analyze Financial Instruments についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by