Serving the Quantitative Finance Community

 
User avatar
Lapsilago
Topic Author
Posts: 5
Joined: October 15th, 2004, 7:36 am
Location: Germany

Matlab Code - Financial Modelling

October 24th, 2012, 5:33 am

Hi all,We have released a book on Financial Modelling. The code is freely available athttp://www.mathworks.de/matlabcentral/fileexch ... 246981This could serve as a starting point for a project on Matlab MathFinance library. Anyone who is interested is very welcome not only to comment on the code, share extensions, debugging and developing new functionality. Anyone interested in joining can drop me a PM.Best, Lapsi
 
User avatar
Cuchulainn
Posts: 20255
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Matlab Code - Financial Modelling

October 24th, 2012, 6:05 am

Congratulations! I received a copy yesterday. Do you intend any C++/C# or other language interop?
Last edited by Cuchulainn on October 23rd, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
Lapsilago
Topic Author
Posts: 5
Joined: October 15th, 2004, 7:36 am
Location: Germany

Matlab Code - Financial Modelling

October 24th, 2012, 9:49 am

There is nothing really planned up to now. But maybe a good point for this qf project.I would be happy to test corresponding code against the Matlab stuff! Might be worth to go that way!Best, Lapsi
 
User avatar
Cuchulainn
Posts: 20255
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Matlab Code - Financial Modelling

October 25th, 2012, 3:27 pm

In the book (page 290) the authors mention the Predictor Corrector method for 1 factor SDE (btw I suppose alpha and beta are in range [0,1]?)In general, we can choose:1. Standard drift2. Corrected drift3. Averaging using trapezoidal [n, n+1] (2 function calls per step)4. Averaging using midpoint [n,n+1] (1 function call per step)JK/DW use options 1 + 3. In MC1 each of the 4 options is supported.From experiments options 2 + 4 give best results and better than 1 + 3. A deeper analysis of 4 options using Matlab and C++ is a good test. E.g. 1+4 in Matlab. BTW no one seems to use 4 altho' you see it all over the place in numerical analysis.
Last edited by Cuchulainn on October 24th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 20255
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Matlab Code - Financial Modelling

October 25th, 2012, 6:22 pm

The strong PC are described here.The main one is eq. 2.8 where they use trapezoidal. We can also use midpoint averaging.
Last edited by Cuchulainn on October 24th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
pimpel
Posts: 8
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

Matlab Code - Financial Modelling

November 15th, 2012, 8:04 am

Lapsi,In function modSQP on line 128 you have a call of quadOPT function started as:[sol,lambda,~,qiter] = ...In my version of Matlab ~ is used only as logical operator and that produces an error. Is it a bug, or just some difference in Matlab parameterization?
 
User avatar
Lapsilago
Topic Author
Posts: 5
Joined: October 15th, 2004, 7:36 am
Location: Germany

Matlab Code - Financial Modelling

November 19th, 2012, 9:46 am

Hi,we have used Matlab Verison R 2012a and I think "~" is there used as an optional output. Actually, Daniel W. did the SQP stuff. He will be back in December and then, he can suggest a solution of your problem.Best, Lapsi
 
User avatar
pimpel
Posts: 8
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

Matlab Code - Financial Modelling

November 19th, 2012, 10:11 pm

Lapsi,Is it working on you Matlab instalation? I have an older version, where it was used as a logical operator only meaning NOT. I searched the docs to 2012b version on mathworks.com, but I can not find other meaning than that of logical operator.Best, Pimpel
 
User avatar
Polter
Posts: 1
Joined: April 29th, 2008, 4:55 pm

Matlab Code - Financial Modelling

November 19th, 2012, 10:22 pm

Last edited by Polter on November 18th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Lapsilago
Topic Author
Posts: 5
Joined: October 15th, 2004, 7:36 am
Location: Germany

Matlab Code - Financial Modelling

November 20th, 2012, 8:52 am

Thanks Polter!Might be a good idea to move to a higher version then. But if you cannot do this for any reason I could ask Daniel W. who actually implemented SQP for a version without "~" when he is back in the office in Dec.Best, Lapsi
 
User avatar
pimpel
Posts: 8
Joined: May 12th, 2006, 5:26 pm
Location: Warsaw

Matlab Code - Financial Modelling

November 22nd, 2012, 9:15 am

Thank you all for the support, I think it is high time for moving to higher version, mine is already pretty old...Regards,Pimpel
 
User avatar
Salain
Posts: 0
Joined: April 22nd, 2010, 7:05 pm

Matlab Code - Financial Modelling

December 10th, 2012, 11:33 am

No need to change Matlab versions for that, just replace the tilde with an unused variable, such as "tildeTrash". If you don't want the overhead this causes then you can make a version of the called function without that returned parameter.