Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : C++ : 



Sort by:  Title () Date () Rating () Popularity ()
Files currently sorted by: Title (Z to A)


Category: C++ View Full Details
Download Now!Windows / Linux / Unix Real-time Options Calculator
Submitter: ABradford Date: 2011/1/9
Description:
Real-time Option Chain Control System for Windows/Linux/Unix.
It supports over 86 theoretical option models. It's not a 1 line options calculator but rather is a full control system giving option chains. Its the most comprehensive open source options program on the Internet. It uses Financial Numerical Recipes in C++ (Bernt Arne Oedegaard) and Meta Systems AS metaoptions-0.0.4 (Bjorn Augestad) option libraries and more. Full source code is provided.

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 661 times  661  File Size 0 bytes  Supported Platforms Windows / Linux / Unix  Home Page http://opensourcefinancialmodels.com
Rating: 8.00 (2 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (36)

Category: C++ View Full Details
Download Now!Tutorial for using MINPACK's C version of Levenberg Marquardt optimizer
Submitter: vanna Date: 2008/5/21
Description:
Following is a demo for using Quantlib's Levenberg Marquardt optimizer, which is based on MINPACK's optimizer
It demonstrates fitting a function
f(x)=a*x*x*x + b*x*x + c

Following are input supplied to the optimizer:
1.A vector of independent variables which is x
2.A vector of observed values which is f(x)
3.Vector of initial guess paremeters a,b,c
4.Implementation of the function that returns difference between the observed values and the fitted values. This is done by changing code of fcn function in lmdif.hpp file.


Following are details:

1.Create new project in C++ - win32 console application. Uncheck option "precompiled header" in Application Settings dialog
2.click on Project->Add new item. Select code and C++ file.Enter name lmdif.hpp

3.Copy all the code from here :
http://quantlib.svn.sourceforge.net/viewvc/*checkout*/quantlib/branches/DevCycle/Rev14441/QuantLib/ql/math/optimization/lmdif.cpp?revision=10026
Paste it into file lmdif.hpp

4.Edit lmdiff.hpp file
Comment out line 64 : #include <ql/math/optimization/levenbergmarquardt.hpp>
Comment out line 270: QuantLib::LevenbergMarquardt::fcn(m, n, x, fvec, iflag);

5.Implement function to be minimized
Modify the function fcn in file lmdif.hpp as follows:


void fcn(int m,int n, double* x, double* fvec,int *iflag)
{
  //QuantLib::LevenbergMarquardt::fcn(m, n, x, fvec, iflag);
    double a=x[0];
    double b=x[1];
    double c=x[2];
    for (int i=0;i<m;i++)
    {
        double xi=independent_variables[i];
        double observed_value=oberved_values[i];
        double fitted_value=a*xi*xi*xi + b*xi*xi + c;
        fvec[i]=fitted_value-observed_value;
    }
}




6. In the main.cpp file call QuantLib::MINPACK::lmdif to minimize the function. This is the code:
#include "stdafx.h"

double* independent_variables;
double* oberved_values;
#include "lmdif.hpp"


int _tmain(int argc, _TCHAR* argv[])
{
    int m=10; //no. of observation variables
    int n=3; //no. of paremeters 
    independent_variables = new double[m]; //this is the vector of independent variables 
    oberved_values = new double[m]; //this is the vector of observed variables to be fitted
    for (int i=0;i<m;i++)
    {
      independent_variables[i]=i*2+5;
      double xi=independent_variables[i];
      double yi=16*xi*xi*xi + 12*xi*xi + 15;
      oberved_values[i]=yi;
    }
    double* x=new double[n]; //initial estimate of parameters vector
    x[0]=0.1;
    x[1]=0.1;
    x[2]=0.1;

    double* fvec=new double[m]; //no need to populate 
    double ftol=1e-08; //tolerance
    double xtol=1e-08; //tolerance
    double gtol=1e-08; //tolerance
    int maxfev=400; //maximum function evaluations
    double epsfcn=1e-08; //tolerance
    double* diag=new double[n]; //some internal thing
    int mode=1; //some internal thing
    double factor=1; // a default recommended value
    int nprint=0; //don't know what it does
    int info=0; //output variable
    int nfev=0; //output variable will store no. of function evals
    double* fjac=new double[m*n]; //output array of jacobian
    int ldfjac=m; //recommended setting
    int* ipvt=new int[n]; //for internal use
    double* qtf=new double[n]; //for internal use
    double* wa1=new double[n]; //for internal use
    double* wa2=new double[n]; //for internal use
    double* wa3=new double[n]; //for internal use
    double* wa4=new double[m]; //for internal use

    QuantLib::MINPACK::lmdif( m, n, x, fvec, ftol,
           xtol, gtol, maxfev, epsfcn, diag,  mode,  factor,
           nprint,  &info, &nfev, fjac,ldfjac, ipvt, qtf,
           wa1, wa2, wa3, wa4);

    //the below is output result. compare it with the values used to generate 
    //observed variables
    double a=x[0];
    double b=x[1];
    double c=x[2];

	return 0;

}

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 860 times  860  File Size 0 bytes  Supported Platforms  Visual C++ 2005 express  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (8)

Category: C++ View Full Details
Download Now!Tutorial code for using GSL to generate random numbers
Submitter: vanna Date: 2010/11/26
Description:
This file demonstrates how to generate random numbers in Visual C++ 2010 express using GNU GSL. I just uploaded it for the sake of being handy, in case I forget later..

Here is link to demo project:
http://www.quantcode.com/modules/docmanager/view_file.php?curent_file=358&curent_dir=19

To get started on using GSL in Visual C++ 2010 , please refer this link:
http://www.quantcode.com/modules/smartfaq/faq.php?faqid=94

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 324 times  324  File Size 0 bytes  Supported Platforms GSL Visual C++   Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (12)

Category: C++ View Full Details
Download Now!Trinomial Tree implementation of Hull-White model
Submitter: vanna Date: 2006/12/1
Description:
C++ project on Trinomial Tree implementation of Hull-White model

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 2168 times  2168  File Size 0 bytes  Supported Platforms C++  Home Page http://www.ma.ic.ac.uk/~mdavis/code.htm
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (9)

Category: C++ View Full Details
Download Now!Trinomial Tree Class
Submitter: vanna Date: 2007/3/19
Description:
@author Phineas Campbell

This page contains the code and details of a C++ class that can be used to build a trinomial tree for the short rate. The tree fits to the yield curve but not to the vol. curve.

The code is based on the p code on page 260 in Clewlow and Strickland and the model should not be used without reference to that text.
The code defines a C++ implementation of a tree object. By passing a set of parameters the class will build an array of nodes, each one corresponding to a node on the tree. Currently the tree is fitted to the underlying interest rate curve, but not a vol. curve.


Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 1503 times  1503  File Size 0 bytes  Supported Platforms C++  Home Page http://www.phineas.pwp.blueyonder.co.uk/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (8)
(1) 2 3 4 5 6 7 8 9 10 11 »
Similar Links:

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.