errors using the financial toolbox

조회 수: 8(최근 30일)
tom
tom 2012년 4월 9일
Hi,
I used Matlab when I was in college. haven't worked with Matlab since I started working in 2006. I am now trying to incorporate it in my daily work. I am using the following toolboxes:
  • financial toolbox
  • fixed income toolbox
  • financial derivatives toolbox
Can you please help me with the following questions?
1-It appears as if Matlab is executing certain formula’s in order to determine if certain prerequisites are met. How can I tell what verification formula’s will be run (so I can determine if all relevant paramenters are defined)?
2-Can you guys help me define my parameters in a way that all prerequisites are met (e.g. settle<maturity)
3-Error 1: Error using instargbondmod (line 119) Settle must be less than Maturity for all Bonds.
As I understand it, the instargbondmod function checks for:
if any(Settle > Maturity)
error(...)
end
I checked this. This prerequisite is met. However, the error report states: “Maturity is required for all Bond instruments.” How do I solve this?
4- How can I tell what is the cause of these errors and where/how they impact my script? And how can I solve them
Error in date2time (line 105)
Tsemi = semitimes(Settle, Dates, 0, Basis, EndMonthRule);
Error in intenvset (line 564)
RateSpec.EndTimes = date2time(RateSpec.ValuationDate,RateSpec.EndDates, ...
Error in BlackScholes (line 48)
RateSpec = intenvset('Compounding',1,'Rates', InterestRates,...
Kind Regards,
Tom
P.s. I was unable to attach the publication, but I am more than happy to send any part of the script to anyone who can help me!
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 4월 9일
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

댓글을 달려면 로그인하십시오.

답변(2개)

tom
tom 2012년 4월 10일
Daniel,
Thanks for your reply and thanks for correcting me. Since I am new to this forum, I do not yet knw how to best ask my questions.. I will break my problems down for you:
-My first question relates to the error reports I get when I run my script. It states that there is an Error using instargbondmod (line 119) Settle must be less than Maturity for all Bonds. However, I do not use this formula in mij script. Considering that this formula checks if some prerequisite are met for using one of the functions in my script, I assume that this instartbondmod formula is used as some kind of verification. I would like to konwo if this is true, and if it is true, I would like to know how I can tell in advance (i.e. before running the script) what verifacation formulae will be run (so I prevent error reprts such as this one)
-I would also like to know how I can best address the error reports I get. For example, running the script results in this error:
Error in date2time (line 105) Tsemi = semitimes(Settle, Dates, 0, Basis, EndMonthRule);
How can I interpret this error? And again: this error does not refer to a function I have included in my script. How can I tell what actually goes wrong in my script that results in this error (so I can prevent this)?
Kr, Tom

Javier
Javier 2012년 9월 5일
Hello Tom
As Daniel says. there must be a number of question. Financial toolbox allow you to value different assets. Here I show you how to value tow bonds.
Step 1 Define the rate structure (discount rates to value)
%Interest Rate Term Structures
StartDate='01-Jan-2000';
%Rates
EndDates=['02-Jan-2000';'03-Jan-2000';'06-Jan-2000';'10-Jan-2000' ... ;'01-Feb-2000';'01-Mar-2000';'01-Apr-2000';'01-May-2000';'01-Jun-2000';'01-Jul-2000' ... ;'01-Aug-2000';'01-Sep-2000';'01-Oct-2000';'01-Nov-2000';'01-Dec-2000';'01-Jan-2001' ... ;'01-Jan-2002';'01-Jan-2003';'01-Jan-2004';'01-Jan-2005'];
Rates=[0.0208;0.0208;0.0208;0.0209;0.0209;0.021;ones(10,1)*0.0215;0.0227;0.02441;0.02608;0.02764]; RateSpec=intenvset('Rates',Rates,'StartDates',StartDate,'EndDates',EndDates,'Compounding',1);
Length of Rates vector and EndDates must have the same size (maturity for each rate).
Step 2 Define Instruments
Semicolon separate information for each instrument
CouponRate=[0.035;0.03];
Settle=['01-Jan-2000';'01-Jan-2000'];
Maturity=['01-Jan-2002';'01-Aug-2003'];
Reset=[1;2]; %Annual =1 semiannual =2 coupon payment
Basis=[0;2];
Step 3 Valuation
[Price PriceNoAI, CFlowAmounts, CFlowDates]=fixedbyzero(RateSpec,CouponRate,Settle,Maturity,Reset,Basis);
Hope this help for bonds instruments. If have any inquired related to some other instrument, let me know. Please grade if it solve your question. Check the date format.
Best regards
Javier

Community Treasure Hunt

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

Start Hunting!

Translated by