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

May
10

Stock returns however exhibit nonormal skewness and kurtosis as pointed out by Hull (1993) and Nattenburg (1994). Moreover, the volatility skews are a consequence of the empirical normality assumption violation. For this reason, Corrado and Su (1996) extend the Black-Scholes formula to account for nonnormal skewness and kurtosis in stock returns.

This package calculates the European put and call option prices using the Corrado and Su (1996) model. This method explicitly allows for excess skewness and kurtosis in an expanded Black-Scholes option pricing formula. The approach adapts a Gram-Charlier series expansions of the standard normal density function to yield an option price formula that is the sum of a Black–Scholes option price plus adjustment terms for nonnormal skewness and kurtosis (Corrado and Su, 1997).

For skewness = 0 and kurtosis = 3, the Corrado-Su option prices are equal to the prices obtained using the Black and Scholes (1973) model.

You can download the Matlab code at Corrado and Su (1996) European Option Prices.

References:

Corrado, C.J., and Su T. Skewness and kurtosis in S&P 500 Index returns implied by option prices. Financial Research 19:175–92, 1996.

Corrado, C.J., and Su T. Implied volatility skews and stock return skewness and kurtosis implied by stock option prices. European Journal of Finance 3:73–85, 1997.

Hull, J.C., "Options, Futures, and Other Derivatives", Prentice Hall, 5th edition, 2003.

Luenberger, D.G., "Investment Science", Oxford Press, 1998.

This package calculates the European put and call option prices using the Corrado and Su (1996) model. This method explicitly allows for excess skewness and kurtosis in an expanded Black-Scholes option pricing formula. The approach adapts a Gram-Charlier series expansions of the standard normal density function to yield an option price formula that is the sum of a Black–Scholes option price plus adjustment terms for nonnormal skewness and kurtosis (Corrado and Su, 1997).

For skewness = 0 and kurtosis = 3, the Corrado-Su option prices are equal to the prices obtained using the Black and Scholes (1973) model.

You can download the Matlab code at Corrado and Su (1996) European Option Prices.

References:

Corrado, C.J., and Su T. Skewness and kurtosis in S&P 500 Index returns implied by option prices. Financial Research 19:175–92, 1996.

Corrado, C.J., and Su T. Implied volatility skews and stock return skewness and kurtosis implied by stock option prices. European Journal of Finance 3:73–85, 1997.

Hull, J.C., "Options, Futures, and Other Derivatives", Prentice Hall, 5th edition, 2003.

Luenberger, D.G., "Investment Science", Oxford Press, 1998.

Jun
27

This memo explains how to use the MATLAB code for estimating a Markov Regime Switching Model with time varying transition probabilities. The code is developed by Zhuanxin Ding based on the original code by Marcelo Perlin for estimating a Markov

Regime Switching Model with constant transition probability matrix.

Click here for an introduction paper and Matlab codes are here.

Regime Switching Model with constant transition probability matrix.

Click here for an introduction paper and Matlab codes are here.

Apr
16

The last decade we have seen a significant increase in the demand for high frequency data. This is explained for a large part by an increased attention of the academic world in algoritmic trading. Moreover, as lot of papers suggest, the profitability has been shifted to an intra-daily format. In this segment, speed is what counts. For instance, Scholtus and Van Dijk (2012) state that strategies that yield a positive return when they experience no delay, a delay of 200 milliseconds is enough to lower their performance significanlty. Given the competition on the market from large institutions, such as JP Morgan and Morgan Stanley, a private investor has always a competative disadvantage due to its lack of the required technology. Nevertheless, there is always room for improvement in the modelling of stochastic intra-daily processes such as the VWAP and daily volatility.

A key ingredient in these research areas is proper and clean (historical and up-to-date) intra-daily data. On the web there are various resources available, but most of them require a relatively high fee. Other solutions require the use of a specific software. However, there are ways to retrieve intra-daily data for free using Google Finance and also without any software.

If you are familiar with MatLab you can use parts of the package 'Volume Weighted Average Price from Intra-Daily Data' by Semin Ibisevic referenced at Qoppa Investment Society. This package allows you to

(1) retrieve intra-daily stock price data from Google Finance; (2) calculate the VWAP at the end of each trading day; and (3) transform intra-daily data to a daily format. It is a relatively flexible function as it only requires the user to input the ticker symbol and the exchange where the security is listed on. Additionally, the user can define the frequency of the data (1 second or higher) and the period (for instance past 10 days).

A key ingredient in these research areas is proper and clean (historical and up-to-date) intra-daily data. On the web there are various resources available, but most of them require a relatively high fee. Other solutions require the use of a specific software. However, there are ways to retrieve intra-daily data for free using Google Finance and also without any software.

### Using Matlab

If you are familiar with MatLab you can use parts of the package 'Volume Weighted Average Price from Intra-Daily Data' by Semin Ibisevic referenced at Qoppa Investment Society. This package allows you to

(1) retrieve intra-daily stock price data from Google Finance; (2) calculate the VWAP at the end of each trading day; and (3) transform intra-daily data to a daily format. It is a relatively flexible function as it only requires the user to input the ticker symbol and the exchange where the security is listed on. Additionally, the user can define the frequency of the data (1 second or higher) and the period (for instance past 10 days).

### Without software

Mar
16

Often we have to face the problem of

M files:

more can be downloaded at here.

**solving a stochastic differential equation**, and even more often there is no analytic solution, in another words,**numerical monte carlo simulation**is applied. I don't need to write much about this topic as here is a fantastic paper on it already: An Algorithmic Introduction to Numerical Simulation of Stochastic Differential Equations, in which the author builds around 10 MATLAB programs, and the topics covered include stochastic integration, the Euler–Maruyama method, Milstein’s method, strong and weak convergence, linear stability, and the stochastic chain rule.M files:

**Euler–Maruyama method**: http://personal.strath.ac.uk/d.j.higham/em.m**Milstein’s method**: http://personal.strath.ac.uk/d.j.higham/milstrong.mmore can be downloaded at here.

Feb
25

I am not a fan of Markov Regime switching model, it is hard for me to really define how high is a high regime, or how low is a low regime, let alone the method to detect the regime switch. In case you like it, here is a good package for

Features of the package:

- Support for univariate and multivariate models.

- Support of any number of states and any number of explanatory variables.

- Estimation, by maximum likelihood, of any type of switching setup for the model. This means that you can choose which coefficients in the model, including distribution parameters, are switching states over time.

- A wrapper function for the estimation of regime switching autoregressive models, including multivariate case (MS-VAR) is included in the package.

- The values of standard error for the estimated coefficients can be calculated with 2 different methods.

- Includes a C version of hamilton’s filter that may be used for speeding up the estimation function (see pdf for details).

- Possibility of three distinct distribution assumptions for residual vector (Normal, t or GED).

- Support for reduced/constrained estimation (see pdf document for details).

**Markov Regime Switching Models in Matlab**, it provides functions for estimation, simulation and forecasting of a general Markov Regime Switching Regression.Features of the package:

- Support for univariate and multivariate models.

- Support of any number of states and any number of explanatory variables.

- Estimation, by maximum likelihood, of any type of switching setup for the model. This means that you can choose which coefficients in the model, including distribution parameters, are switching states over time.

- A wrapper function for the estimation of regime switching autoregressive models, including multivariate case (MS-VAR) is included in the package.

- The values of standard error for the estimated coefficients can be calculated with 2 different methods.

- Includes a C version of hamilton’s filter that may be used for speeding up the estimation function (see pdf for details).

- Possibility of three distinct distribution assumptions for residual vector (Normal, t or GED).

- Support for reduced/constrained estimation (see pdf document for details).