Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
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.

heston stochastic volatility monte carlo simulation
looks brilliant indeed, interested readers shall download the C++ code and paper directly at http://www.markjoshi.com/downloads/index.htm
Oct 18
Quantitativefinance.co.uk is a personal site developed with the aim of sharing some basic knowledge on risk management principles. At the moment it has only a few documents & files, including:

Using OLS regression to estimate alfa and beta of CAMP: Those routines estimats alfa, beta, R2 coefficient, Jarque-Bera statistic, Durbin-Watson statistic and more.
CIR and Vasicek 1 FACTOR model for estimating the term structure   This routine calculate the term structure parameters according to the CIR and Vasicek models. You can't parametrize the data source for estimating the model's parametrs but you can easly do that by changing the source code.
CIR and Vasicek 2 FACTORS models for estimating the term structure   The routine is the same of the previous one but use a 2 FACTORS model.  
Pricing an europen option   This is a very simple routine that calculate the value of an european option using both monte carlo simulation and BS metohd.
Calculating market value at risk   This is a complex routine that allows to calculate the market value at risk using different approaches: asset normal, port normal, beta normal.  
The creditmetrics© model   This spreadsheet calculates a credit VaR using credit spreads of traded corporate bonds (Credit Metrics). The term structure is estimated using a CIR approach.

Visit Quantitativefinance.co.uk for detail.
Oct 14
All else equal, investors should require higher returns on assets whose liquidity is lower, in other words, investors demand a higher expected return, and hence larger liquidity premium, by holding a less liquidity asset. Risk & return co-exist.

Is this really true for corporate bonds? I run a simple regression using R to test my data, where US corporate bonds are downloaded from TRACE (Trade Reporting and Compliance Engine), CDS data from Datastream, Treasury / Swap interest rate from Federal Reserve Bank, the total number of bonds in my sample is 2409 from year 2004 ~ 2010. Liquidity of a corporate bond is measured as in the paper Corporate Yield Spreads and Bond Liquidity by Chen, Lesmond, and Wei (2007), Journal of Finance,
corporate bond liquidity measure
where alpha1 & alpha2 represent bid & ask spread, respectively, by using maximum likelihood estimation we could estimate the transaction cost alpha2-alpha1 for each bond, obviously the higher the transaction cost, the lower the liquidity.
Tags: ,
Oct 6
This is a follow-up of my post Is NAG Toolbox Faster Than MATLAB's Fsolve? I got a few reply immediately after that, here is a short summary:

1, NAG's c05nb is faster than Matlab's fsolve with almost the same accuracy, but at the cost of additional programming. As mentioned by Michael at his replied post, c05nb speeds up overall computation time by a factor of 3 from 6.5 seconds to 2.32 seconds on average, which is excellent, but he also realizes "It’s pretty clear that the NAG function isn’t as easy to use as MATLAB’s fsolve function", such as transposition problems and the necessity to set global variables. Luckily, Michael confirms it is currently with NAG technical support and should be updated soon.
Tags: , ,
Oct 5
Walking Randomly is a blog I visit frequently devoting to share some fun stuff like how to use things like Matlab, Mathematica, Python, Condor, Beowulf clusters etc. Recently, I was reading a blog post on how to replace MATLAB's fsolve function with the NAG Toolbox for MATLAB  in order to get quite dramatic speed gains and thought I'd try it out for myself with a practical example in finance.

To make good use of fsolve, the example is to solve the Markowitz problem by finding an optimal portfolio with minimum variance for a targeted return, mathematically, for a portfolio of n risky assets we want to find the solution to:

subject to

here r-bar is a fixed pre-desired level for expected rate of return, and a solution is any portfolio that minimizes the objective function (variance) and offers expected rate r-bar. This is an example of what is called a quadratic program, an optimization problem with a quadratic objective function, and linear constraints. By introducing Lagrange multipliers and taking the first  derivative a solution to our Markowitz problem is found by finding a solution to the set of n + 2 linear equations

In the end, the problem falls into the standard framework of linear algebra, and amounts to computing the inverse of a matrix: solve Ax = b, and finally fsolve can be used directly.
Tags: , , ,
Pages: 8/69 First page Previous page 3 4 5 6 7 8 9 10 11 12 Next page Final page [ View by Articles | List ]