Serving the Quantitative Finance Community

 
User avatar
iggytyper
Topic Author
Posts: 0
Joined: June 26th, 2010, 11:30 pm

Modern Portfolio Theory C++ Sample Code

September 4th, 2013, 9:14 pm

Hi, has anyone seen some sample code for C++ floating around the net?Thank you
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Modern Portfolio Theory C++ Sample Code

September 5th, 2013, 5:39 am

do you mean some quadratic optimisation code ?
knowledge comes, wisdom lingers
 
User avatar
iggytyper
Topic Author
Posts: 0
Joined: June 26th, 2010, 11:30 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 6:03 am

Just calculating Portfolio Return and Porfolio variance for "n" assets thank you again
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 6:42 am

dont know of any but this is not a difficult problem to solve.
Last edited by daveangel on September 8th, 2013, 10:00 pm, edited 1 time in total.
knowledge comes, wisdom lingers
 
User avatar
Tad
Posts: 0
Joined: January 27th, 2010, 11:39 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 6:44 am

daveangel,I would be very interested in the code you mentioned!
 
User avatar
Tad
Posts: 0
Joined: January 27th, 2010, 11:39 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 6:49 am

as for your question iggytyper, my first hit on google washttp://finance.bi.no/~bernt/gcc_prog/recipes/recipes.pdfPage 77 (and following) seems to be what you are looking for, you will apparently need third party libraries, however.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 8:11 am

QuoteOriginally posted by: Taddaveangel,I would be very interested in the code you mentioned!there is some code called quadprog on the internet by Berwin Turlach. It is in fortran so you will need to translate to C or C++. I translated into VBA and it seems to work. It handles both equality and inequality constraints.
knowledge comes, wisdom lingers
 
User avatar
Tad
Posts: 0
Joined: January 27th, 2010, 11:39 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 8:20 am

looks good, thanks, I will look into that!
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 9:01 am

QuoteOriginally posted by: daveangelQuoteOriginally posted by: Taddaveangel,I would be very interested in the code you mentioned!there is some code called quadprog on the internet by Berwin Turlach. It is in fortran so you will need to translate to C or C++. I translated into VBA and it seems to work. It handles both equality and inequality constraints.Alglib has a QP solver http://alglib.codeplex.com/releases/view/68418AFAIK Kienitz and Wetterau have a QP Solver in Matlab in their recent book. http://www.mathworks.nl/matlabcentral/f ... modSQP.m// At the end of the day, Fortran is still king for matrices.
Last edited by Cuchulainn on September 8th, 2013, 10:00 pm, edited 1 time in total.
 
User avatar
iggytyper
Topic Author
Posts: 0
Joined: June 26th, 2010, 11:30 pm

Modern Portfolio Theory C++ Sample Code

September 9th, 2013, 10:23 am

Thank you so much for the replies!