C++ in finance. Having more to say, please consider to be our guest blogger.

Oct
20

**Heston stochastic volatility**model is widely used in both industry and academia, due to the correlation between stock process and volatility process, plus a non-negative square root volatility, simulation of Heston volatility doesn't sound easy & stable. Professor Mark Joshi has a recent working paper

*Fast and Accurate Long Stepping Simulation of the Heston Stochastic Volatility Model*, as its title suggests: this paper aims to provide a better simulation scheme.

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

Sep
17

Quantivity introduced an interesting article a few days ago

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.

**Combined Regression and Ranking**that may be interesting to some of you.The basic idea of

**Combined Regression and Ranking**is to optimize regression and ranking objectives simultaneously. Generally we are trying to keep the predicted values as close as possible to the true target value for regression based method, such as minimizing the mean square error (MSE), however, besides accurately producing values, in some circumstances we are more interested in a model able to predict the ranking as well. A good example in the paper is: considering nearly all observations have target value y=0 and only a small fraction have value y=1, therefore a model predicting 0 for all cases is good enough using regression, however, it failes to return a useful & meaningful ranking.The objective funtion for

**combined regression and ranking**is given bywhere 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.

Apr
5

One big issue of pricing barrier option with Binomial tree or other lattice method is its slow convergence rate, the barrier option value converges very slowly as the number of tree or lattice levels increase, often requiring unattainably large computing times for even a modest accuracy. A typical plot of barrier option binomial tree results against its analytic value looks like

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.

*source from paper Enhanced Numerical Methods for Options with Barriers*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.

Jan
19

**Meta Financial Functions Library**is a free library for option pricing written in C++, as of now, Meta Systems offers no commercial products, and the library is still under beta, as indicated by its author: "The Meta Financial Formula Library implements many commonly used functions as correctly as possible once and then provides wrapper functions and code to be able to reuse the implemenation from other tools and languages."

At the moment

**Meta Financial Functions Library**covers a wide range of vanilla and exotic options, which can be obviously seen from the name of functions, for example, a list of functions includes black76, black76_put, black76_call, blackscholes, gbs, gcarry, AmericanExchangeOption, AssetOrNothing, BAWAmericanApprox, BSAmericanApprox, BinaryBarrier, CashOrNothing, ComplexChooser, DiscreteAdjustedBarrier, DoubleBarrier, EquityLinkedFXO, EuropeanExchangeOption, ExchangeExchangeOption, Executive, ExtendibleWriter, ExtremeSpreadOption, FixedStrikeLookback, FloatingStrikeLookback, ForEquOptInDomCur, ForwardStartOption, GapOption, GeometricAverageRateOption, JumpDiffusion, LevyAsian, LookBarrier, OptionsOnOptions, OptionsOnTheMaxMin, PartialFixedLB, PartialFloatLB, PartialTimeBarrier, PartialTimeTwoAssetBarrier, Quanto, RollGeskeWhaley, SimpleChooser, SoftBarrier, SpreadApproximation, StandardBarrier, SuperShare, SuperShare_inlined, Swapoption, TakeoverFXoption, TimeSwitchOption, TurnbullWakemanAsian, TwoAssetBarrier, TwoAssetCashOrNothing, TwoAssetCorrelation, VasicekBondPrice, VasicekBondOption...

, 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.

Jan
15

Attended a training of NAG Toolbox for MATLAB today (NAG is short for Numerical Algorithms Group), nice presentation and persuasive performance against Matlab toolbox. I will soon get a licence and start to experience myself.

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.

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

**finite element**codes, using among other aspects adaptive meshes and a wide array of tools classes often used in**finite element**program. As stated on its webpage: "deal.II is a C++ program library targeted at the computational solution of partial differential equations using**adaptive finite elements**. It uses state-of-the-art programming techniques to offer you a modern interface to the complex data structures and algorithms required." It should be very useful for those people playing often with PDE numerical solution.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.