errors using the financial toolbox
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Daniel Shub
am 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
am 9 Apr. 2012
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Antworten (2)
Javier
am 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
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!