errors using the financial toolbox

6 views (last 30 days)
tom
tom on 9 Apr 2012
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 Comments
Daniel Shub
Daniel Shub on 9 Apr 2012
There appears to be a number of questions here. It is not very clear what you are asking or where you are having problems. Breaking the problem down, and then providing us with an example, will make it easier for us to help you
Walter Roberson
Walter Roberson on 9 Apr 2012
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

Sign in to comment.

Answers (2)

tom
tom on 10 Apr 2012
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 on 5 Sep 2012
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!