Quotation

In this paper, we present three new discretization schemes for the Heston stochastic volatility model - two schemes for simulating the variance process and one scheme for simulating the integrated variance process conditional on the initial and the end-point of the variance process. Instead of using a short time-stepping approach to simulate the variance process and its integral, these new schemes evolve the Heston process accurately over long steps without the need to sample the intervening values. Hence, prices of financial derivatives can be evaluated rapidly using our new approaches.

looks brilliant indeed, interested readers shall download the C++ code and paper directly at http://www.markjoshi.com/downloads/index.htm

Tags - heston , simulation , volatility

The basic idea of

The objective funtion for

where the first part is for regression loss, the second part is for pairwise ranking loss, and the parameter alpha intuitively trades off between optimizing regression loss and optimizing pairwise loss.

Some possible financial applications of

...

Download the paper at http://www.eecs.tufts.edu/~dsculley/papers/combined-ranking-and-regression.pdf and free C++ at http://code.google.com/p/sofia-ml.

Tags - regression , ranking

where the pricing performance is in a sawtooth fashion, with severe periodic spikes that move away from the correct result, which is a nightmare for a researcher because adding more steps doesn't necessarily mean to yield a more accurate answer.

The reason for this is that the barrier being used by the tree is generally different from the true barrier value, for example, as demonstrated below, no matter inner barrier or outer barrier is chosen in practice, calculated value will always be smaller or bigger than correct value, where true barrier shall be used.

John Hull presents three approaches for overcoming this problem, namely, positioning nodes on the barriers, adjusting for nodes not lying on barriers, and the adaptive mesh model. Interested readers please refer to chapter 20, from page 467 to 472, the 5th version, Options, futures and other derivatives. Or read another paper in detail "Enhanced Numerical Methods for Options with Barriers" by Emanuel Derman, etc downloadable at http://www.ederman.com/new/docs/gs-numerical_methods.pdf.

The way shared today is distinct from the three approaches, unlike traditional methods to ensure convergence through placing the barrier in close proximity to, or directly onto, the nodes of the tree lattice, this method applies a suitable transition probability adjustment, thereafter called

Please read the paper for detail at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=964623 and check the accompanying C++ codes at http://www.codeproject.com/KB/recipes/Zeppelin_Barrier_Options1.aspx

Tags - barrier , option , binomial

At the moment

, what a long list! you shall download the library at http://www.metasystems.no/, which is free and the author makes the source code clean and publicly available, learning from others is always enjoying.

Tags - library

Anyway, I got to know two sites after the training, first one is deal.II, which is a finite element differential equations analysis library aiming to enable rapid development of modern

The other site is Walking randomly, a blog where the author randomly collects things including mathematics, physics, vintage computing, Linux, pocket PCs, Android, music and programming. I am especially interested in its Matlab, R, NAG, and statistics categories.

Have a nice weekend.

Tags - nag , finite-element

This is a collection of pointers to:

* free source code available on the net,

* books which come with source code, and hence act as low-cost libraries,

* articles and documents, especially those available over the net.

Check it out if you happen to find it useful: http://cliodhna.cop.uop.edu/~hetrick/c-sources.html

Tags - numerical

Here is another

Tags - sobol , monte carlo

price, implied volatility and Greek letters;

Black-Scholes analytic formula;

binomial tree lattice;

Cox-Ross-Rubinstein parametrisation;

Jarrow-Rudd equal-probabilitiy parametrisation;

control variable technique;

Broadie-Detemple penultimate node analytic approximation;

Monte carlo simulation with the following variance reduction and normal sampling techniques:

antithetic variable;

moment matching, also known as quadratic re-sampling;

Mersenne Twister pseudo-random numbers;

Halton quasi-random numbers;

Box-Muller polar normal inversion;

Moro normal inversion;

unlimited maximum number of steps in binomial trees and unlimited maximum number of trials and time intervals in Monte carlo simulations;

exotic option support: Asian average price, binary cash-or-nothing and asset-or-nothing, chooser option;

Download at http://www.atomproject.org/download.shtml

Tags - calculator , option

Computational support is provided for supports various matrix classes for vectors, non-symmetric matrices, SPD matrices, symmetric matrices, banded, triangular, and tridiagonal matrices; however, it does not include all of the capabilities of original f77 LAPACK. Emphasis is given to routines for solving linear systems consisting of non-symmetric matrices, symmetric positive definite systems, and solving linear least-square systems.

Download at http://math.nist.gov/lapack++/

Tags - algebra

PCA is a useful statistical technique that has found application in fields such as face recognition and image compression, and is a common technique for finding patterns in data of high dimension.

For more detail please check http://transp-or2.epfl.ch/pagesPerso/javierFiles/software.php

Tags - pca

american_option_approximation: uses the Black Scholes formulae for European options, to approximate the values of American options.

american_option_fudge: approximates the value of American Options as the value of the corresponding European option, plus the addition of a fudge factor

binomial_option: typical binomial tree to price option value

Bisection_Secant< functor, real > : This class is a child class of Bisection. The algorithm converges faster because it changes from the bisection to the secant algorithm /// on every other iteration

european_option_pair : Black Scholes option pricing formulae for puts and calls

...

Click for more and downloading http://acumenconsultinginc.net/TechNotes/public_options/html/annotated.html

Tags - option , c++

This first year paper is based on Pesaran et al. (2000) who generalise the cointegration tests

introduced by Johansen to include exogenous I(1) variables in a VECM model. It reiterates

the proofs for their central test statistics and presents them in a less dense format: Following

Pesaran et al. (2000), this paper focuses on the derivation of the corresponding cointegrating rank

tests, by first introducing a VAR model, subsequently deriving the likelihood for the cointegration

parameters and, finally, the test statistics and their asymptotic distributions. The final section

introduces tests on whether the required exogeneity restrictions hold. In addition, this paper is

concerned with implementing the mentioned test statistics in a Matlab routine.

Paper and Matlab code: http://www.zeugner.eu/arbeiten/tafel.php

Tags - cointegration

It supports matrix types: Matrix (rectangular matrix); UpperTriangularMatrix; LowerTriangularMatrix; DiagonalMatrix; SymmetricMatrix; BandMatrix; UpperBandMatrix; LowerBandMatrix; SymmetricBandMatrix; IdentityMatrix; RowVector; ColumnVector.

Only one element type (float or double) is supported.

The library includes the operations *, +, -, *=, +=, -=, Kronecker product, Schur product, concatenation, inverse, transpose, conversion between types, submatrix, determinant, Cholesky decomposition, QR triangularisation, singular value decomposition, eigenvalues of a symmetric matrix, sorting, fast Fourier and trig. transforms, printing and an interface with Numerical Recipes in C.

Introduction and package downloading: http://www.robertnz.net/nm_intro.htm

http://www.robertnz.net/download.html

Tags - matrix , library

REFERENCES:

Kuan, Chung-Ming and Tung Liu (1995). "Forecasting exchange rates using feedforward and recurrent networks", Journal of Applied Econometrics, forthcoming.

Gencay, Ramazan and W. D. Dechert (1992). "An algorithm for the n Lyapunov exponents of an n-dimensional unknown dynamical system", Physica D, 59, 142-157.

http://www.sfu.ca/~rgencay/lyap.html

Tags - neural-network

The Levenberg-Marquardt algorithm has proved to be an effective and popular way to solve nonlinear least squares problems. MINPACK-1 contains Levenberg-Marquardt codes in which the Jacobian matrix may be either supplied by the user or calculated by using finite differences. IMSL , MATLAB , ODRPACK , and PROC NLP also contain Levenberg-Marquardt routines.

The algorithms in ODRPACK solve unconstrained nonlinear least squares problems and orthogonal distance regression problems, including those with implicit models and multiresponse data.

For detail about Levenberg-Marquardt nonlinear least squares algorithms introduction and code pls click http://www.ics.forth.gr/~lourakis/levmar/

Tags - levenberg-marquardt , optimization

Singular Value Decomposition to solve ill conditioned square matrices.

Excel, C++ Add-in and Demo Spreadsheet with application manual and on-line help are at http://www.financial-risk-manager.com/risks/analytics/multivar/an_mv_t.html#svd

wiki(Singular value decomposition)

Tags - svd , matrix

Quotation

Vegas is the simplest of the four. It uses importance sampling for variance reduction, but is only in some cases competitive in terms of the number of samples needed to reach a prescribed accuracy. Nevertheless, it has a few improvements over the original algorithm and comes in handy for cross-checking the results of other methods.

Suave is a new algorithm which combines the advantages of two popular methods: importance sampling as done by Vegas and subregion sampling in a manner similar to Miser. By dividing into subregions, Suave manages to a certain extent to get around Vegas' difficulty to adapt its weight function to structures not aligned with the coordinate axes.

Divonne is a further development of the CERNLIB routine D151. Divonne works by stratified sampling, where the partitioning of the integration region is aided by methods from numerical optimization. A number of improvements have been added to this algorithm, the most significant being the possibility to supply knowledge about the integrand. Narrow peaks in particular are difficult to find without sampling very many points, especially in high dimensions. Often the exact or approximate location of such peaks is known from analytic considerations, however, and with such hints the desired accuracy can be reached with far fewer points.

Cuhre employs a cubature rule for subregion estimation in a globally adaptive subdivision scheme. It is hence a deterministic, not a Monte Carlo method. In each iteration, the subregion with the largest error is halved along the axis where the integrand has the largest fourth difference. Cuhre is quite powerful in moderate dimensions, and is usually the only viable method to obtain high precision, say relative accuracies much below 1e-3.

Suave is a new algorithm which combines the advantages of two popular methods: importance sampling as done by Vegas and subregion sampling in a manner similar to Miser. By dividing into subregions, Suave manages to a certain extent to get around Vegas' difficulty to adapt its weight function to structures not aligned with the coordinate axes.

Divonne is a further development of the CERNLIB routine D151. Divonne works by stratified sampling, where the partitioning of the integration region is aided by methods from numerical optimization. A number of improvements have been added to this algorithm, the most significant being the possibility to supply knowledge about the integrand. Narrow peaks in particular are difficult to find without sampling very many points, especially in high dimensions. Often the exact or approximate location of such peaks is known from analytic considerations, however, and with such hints the desired accuracy can be reached with far fewer points.

Cuhre employs a cubature rule for subregion estimation in a globally adaptive subdivision scheme. It is hence a deterministic, not a Monte Carlo method. In each iteration, the subregion with the largest error is halved along the axis where the integrand has the largest fourth difference. Cuhre is quite powerful in moderate dimensions, and is usually the only viable method to obtain high precision, say relative accuracies much below 1e-3.

http://www.feynarts.de/cuba/

Tags - integration

The programming code is grounded on the book "Implementing Derivatives Models", page 260, Clewlow and Strickland, the code specifies a C++ implementation of a tree object. By input a set of parameters the class will form an array of nodes, each one corresponding to a node on the tree. Currently the tree is matched to the underlying interest rate curve, but not a vol. curve.

http://www.phineas.pwp.blueyonder.co.uk/TreeClass.htm

Tags - yield

The

download at http://www.iimahd.ernet.in/~jrvarma/software/ecb.zip

online convertible bonds calculator http://www.iimahd.ernet.in/~jrvarma/software/convertible.php, more are at http://www.iimahd.ernet.in/~jrvarma/software.php.

Tags - convertible bond

In previous entry how to price spread option with Monte Carlo simulation was introduced, here is another valuation method of spread options follwing the article Low-Fat Spreads by K. Ravindran, RISK, Oct 1993.

for detail check http://www.mathfinance.org/FF/cpplib.php。

Tags - spread , option

The Bates Model is a type of Jump-Difussion model that is able to improve calibration results for short term options. The Bates Model consists of Jumps processes built on top a Heston model.

http://www.javaquant.net/finalgo/BatesModel.html lists the C++ code to price Cliquet options using the Log-Jump variant of the Bates model with stochastic volatility.

wiki(Cliquet option)

Tags - cliquet , heston , option

Optimization packages are widelyspread, here is a site i introduced, optimization package. Several days ago a friend of mine sent me a link about lp-solver, which is a Mixed Integer Linear Programming (MILP) solver, convenient to use and highly efficient, cannot help sharing with you all. (please submit your favorite code site if you happen to find one and help others, thanx.)

The name itself tells you this package is for linear programming problem, What is Linear Programming then? A Linear Program (LP) is a problem that can be expressed as follows:

minimize cx

subject to Ax = b

x >= 0

where x is the vector of variables to be solved for, A is a matrix of known coefficients, and c and b are vectors of known coefficients. The expression "cx" is called the objective function, and the equations "Ax=b" are called the constraints. LP is widely used for portfolio optimization, for instance, to mimic the performance of an index, to minimize tracking error of your portfolio, etc. Don't hesitate to try it yourself.

PS: lp-solver can be called as a library from different languages like C, VB, .NET, Delphi, Excel, Java, ...It can also be called from AMPL, MATLAB, O-Matrix, Scilab, Octave, R via a driver program. you will find a way.

Download at http://lpsolve.sourceforge.net/5.5/.

Tags - optimization

For your attention, I found an excellent Finite Element package named

We know Finite Element method is an alternative to Finite Difference discretization of the BS and other equations in the price resp. the log-price space variable. The advantage of FE is that it gives convergent deterministic approximations of the option price under realistic, low smoothness assumptions on the payoff function, as e.g. for binary contracts and in particular allow a higher rate of convergence that that achievable with Monte Carlo simulations.

To get a deeper insight on and download open source

wiki(Finite element)

Tags - finite-element , pde

Here is another Vasicek application implemented with binomial tree in C++, the tree construction procedure is outlined in Tuckman famous book

For detail check this page http://math.nyu.edu/~atm262/spring06/ircm/vasicek/.

Tags - vasicek , binomial

The purpose of this book -Libor Market Model: Theory and Implementation is to analyze the Libor Market Model in theory and implement it practically to the evaluation of normal caps, barriers, European swaptions and ratchets, etc. The dynamic of the Libor Market Model will be derived and the whole steps of its implementation applying Monte Carlo simulation will be introduced. Implementation is accomplished via several volatility and correlation formulation. Special attention should be given when it comes to calibrate the Libor Market Model and model the forward rate volatilities and correlations since they could impact prices of interest rate derivatives substantially.

you can download the free c course code by leaving your email at http://www.irina-goetsch.com/libor-market-model/app#order

wiki(LIBOR Market Model)

Tags - libor

x'(Ax - b) = 0

x >= 0

Ax - b >= 0

using the

function [x] = psor(A,b,x0)

omega = 1.5;

tol = 1e-9;

jmax = 1e+3;

n = length(b); x = x0; j = 1;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

while (norm(x-x0) > tol) && (j < jmax)

j = j + 1; x0 = x;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

end

return

A problem with this sample code is slow computation speed, Should you are happy with C++, the following C++ code which can be called directly in Matlab.

Click to download

wiki(Linear complementarity problem)

Tags - psor , american , option

below you will find the some sources of the sources in C++ and Java.T

Table with C++ sources

Closed expressions and Approximate Models for various Financial Option on Equity

Binary Tree method to Price Options on Equity

Monte Carlo pricer of Exotics

Monte Carlo Pricer of American Calls and Puts

Monte Carlo Pricer of European Barrier, Knock in and out Options

Monte Carlo Pricer European Spread Options

Monte Carlo Pricer of Interest Rate Derivatives (One factor)

Monte Carlo Pricer Ho Lee Model

Monte Carlo Pricer Hull White Model

Monte Carlo Pricer Black Derman Toy Model

Monte Carlo Pricer Brace Gatarek Musiela / Jamishidian Model

Monte Carlo pricer of exotics with constant Jump-Diffussion

Monte Carlo Pricer of Barrier, Knock in and out Options with Jump-Diffusion

Monte Carlo Pricer European Spread Options with Jump-Diffusion

Table with Java sources

Closed expressions and Approximate Models for various Financial Option on Equity

Binary Tree method to Price Options on Equity

Monte Carlo pricer of Exotics

Monte Carlo Pricer of American Calls and Puts

Monte Carlo Pricer of European Barrier, Knock in and out Options

Monte Carlo Pricer European Spread Options

Monte Carlo Pricer of Interest Rate Derivatives (One factor)

Monte Carlo Pricer Ho Lee Model

Monte Carlo Pricer Hull White Model

Monte Carlo Pricer Black Derman Toy Model

Monte Carlo Pricer Brace Gatarek Musiela / Jamishidian Model

Monte Carlo pricer of exotics with constant Jump-Diffussion

Monte Carlo Pricer of Barrier, Knock in and out Options with Jump-Diffusion

Monte Carlo Pricer European Spread Options with Jump-Diffusion

http://www.javaquant.net/downloads.html

wiki(Black Derman Toy)

Tags - bdt , monte carlo

more at http://math.nyu.edu/~atm262/spring06/ircm/cdo/index.html

wiki(Collateralized debt obligations)

Tags - cdo , copula

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html

wiki(Mersenne Twister)

Tags - random

The matrix W consists mainly of zeros, so we only need the first min(M,N) columns (three, in the example above) of matrix U to obtain matrix A. Similarly, only the first min(M,N) rows of matrix V T affect the product. These columns and rows are called left and right singular vectors.

http://www.alglib.net/matrixops/general/svd.php

Tags - matrix

In more detail, Terreneuve is our team name for the project in the Fall 2005 Computing in Finance course at NYU's Courant Institute Masters in Math Finance. Working from this specification we hope to design a useable C++ library for some important quantitative finance applications.

Our target audience (aside from our prof ;-)) is students in quantitative finance and those seeking a gentle introduction to financial computing. Obviously, we also intend to use the project as a learning opportunity. We refer those looking for a more comprehensive (and complex) library to the quantlib project.

http://terreneuve.sourceforge.net/

Quotation

In finance, there are areas where formulas tend to get involved. Sometimes it may be easier to follow an exact computer routine. I have made some **C++ subroutines that implements common algoritms in finance**. Typical examples are option/derivatives pricing, term structure calculations, mean variance analysis. These routines are presented together with a good deal of explanations and examples of use, but it is by no means a complete "book" with all the answers and explanations. I'm hoping to turn it into a book, but even in its incomplete state is should provide a good deal of useful algorithms for people working within the field of finance.

Book and Code are at http://finance-old.bi.no/~bernt/gcc_prog/index.html

Tags - finance

http://www.gsb.columbia.edu/faculty/pglasserman/Other/grklibor.pdf

http://www.gsb.columbia.edu/faculty/pglasserman/Other/greeks_code.zip

wiki(libor)

Tags - greeks , libor

a copy of the c++ code is available to download at http://www.markjoshi.com/design/

Tags - derivative