The VIX (volatility index) is a financial index which measures the expectation of the volatility of the stock market index S&P 500 (SPX). The higher is the value of the VIX the higher are the expectations of important variations in the S&P 500 during the next month. Since volatility is a measure of risk in a portfolio, managers tend to flee away the market when the VIX increases.

The question today is to know whether it is a good strategy to use the VIX as an indicator of risk in the market, as a fear-index.

I downloaded the historical prices of both the S&P 500 and the VIX. Even though the VIX is not in a currency unit but in percentage, we still call the data historical prices. I propose a very simple portfolio strategy which is in total contradiction with the idea that the VIX is a fear gauge. I have a certain amount of money at the beginning of the year 2007, and I can short or long on the S&P 500 in the range of the money I have. My decision for a day only depends of the profit made by the VIX the previous day. If the VIX has increased I long on the S&P 500, if the VIX decreases I short. To define the quantity to invest in, I use a re-scaled and translated logistic function so that my decision is smooth and stay in the range I defined just before ([-1;1]). If you are interested in the logistic function you can go on the page of a good mathematics  website: http://mathworld.wolfram.com/LogisticEquation.html . Or even on the Wiki page (don’t worry I’m not crazy, I don’t trust Wiki, but this page is Okay): http://en.wikipedia.org/wiki/Logistic_regression.

With such a strategy which is against the mainstream of the portfolio strategies we have some good results (see next figure). If you had begun your portfolio manager career the 01/01/2007 with a huge amount of…100$ and had decided to invest according to the previous strategy you would have clearly over performed the S&P 500 index. You can see this on the following graph. Next time your parents tell you a story about the monster VIX don’t be scared!


The code (R):

# data contains the historical prices of the VIX and of the S&P500 as well as the date
data <- read.csv("U:/Blog/Post3/vixSP.csv", header=T, stringsAsFactors=FALSE)
data$date<-as.Date(data$date, format="%d/%m/%Y")

data$money = 100
data$profitSP = 0
data$profitVix = 0
data$decision = 0
length = length(data$vix)

for(i in 2:length){
  data$profitSP[i] = (data$sp500[i] - data$sp500[i-1])/data$sp500[i-1]*100
  data$profitVix[i] = (data$vix[i] - data$vix[i-1])/data$vix[i-1]*100
#   if(data$profitVix[i] > 7){data$decision[i] = 1}
#   if(data$profitVix[i] < -7){data$decision[i] = -1}
  data$decision[i] = ((exp(data$profitVix[i]/5)/(exp(data$profitVix[i]/5)+1))-(1/2))*2
}

for(i in 2:length){
data$money[i] = data$money[i-1] + data$decision[i-1] * data$money[i-1] * data$profitSP[i]/100
}

data$money = data$money/data$money[1]*100
data$sp500 = data$sp500/data$sp500[1]*100

plot(data$money~data$date, type = 'l', col = 'blue',axes=TRUE, ann=FALSE, ylim = c(50, 250))
lines(data$sp500~data$date, col = 'red')

title(xlab="Years", col.lab=rgb(0,0,0))
title(ylab="Index (US$)", col.lab=rgb(0,0,0))
legend("topleft",  c("Portfolio","S&P 500"), cex=1,
       col=c("blue","red"), lty = 1, inset = 0.1);
0

Add a comment

The financial market is not only made of stock options. Other financial products enable market actors to target specific aims. For example, an oil buyer like a flight company may want to cover the risk of increase in the price of oil. In this case it is possible to buy on the financial market what is known as a "Call" or a "Call Option".

A Call Option is a contract between two counterparties (the flight company and a financial actor). The buyer of the Call has the opportunity but not the obligation to buy a certain  quantity of a certain product (called the underlying) at a certain date (the maturity) for a certain price (the strike).

I found a golden website. The blog of Esteban Moro. He uses R to work on networks. In particular he has done a really nice code to make some great videos of networks. This post is purely a copy of his code. I just changed a few arguments to change colors and to do my own network.

To create the network, I used the  Barabási-Albert algorithm that you can find at the end of the post on the different algorithms for networks. Igraph is the library which has been used.
3

As you have certainly seen now, I like working on artificial neural networks. I have written a few posts about models with neural networks (Models to generate networks, Want to win to Guess Who and Study of spatial segregation).

Unfortunately, I missed so far a nice and pleasant aspect of networks : its graphical approach. Indeed, plots of neural networks are often really nice and really useful to understand the network.

Sometimes such a graph can point out some characteristics of the network.
1

I already talked about networks a few times in this blog. In particular, I had this approach to explain spatial segregation in a city or to solve the Guess Who? problem. However, one of the question is how to generate a good network. Indeed, I aim to study strategy to split a network, but I need first to work with a realistic neural network. I could have downloaded data of a network, but I'd rather study the different models proposed to generate neural networks.

The function apply() is certainly one of the most useful function. I was scared of it during a while and refused to use it. But it makes the code so much faster to write and so efficient that we can't afford not using it. If you are like me, that you refuse to use apply because it is scary, read the following lines, it will help you. You want to know how to use apply() in general, with a home-made function or with several parameters ? Then, go to see the following examples.
1

Have you ever played the board game "Guess who?". For those who have not experienced childhood (because it might be the only reason to ignore this board game), this is a game consisting in trying to guess who the opponent player is thinking of among a list of characters - we will call the one he chooses the "chosen character". These characters have several characteristics such as gender, having brown hair or wearing glasses.

If you want to choose randomly your next holidays destination, you are likely to process in a way which is certainly biased. Especially if you choose randomly the latitude and the longitude. A bit like they do in this lovely advertising (For those of you who do not speak French, this is about a couple who have won the national gamble prize and have to decide their next travel. The husband randomly picks Australia and the wife is complaining : "Not again!").
4

My previous post is about a method to simulate a Brownian motion. A friend of mine emailed me yesterday to tell me that this is useless if we do not know how to simulate a normally distributed variable.

My first remark is: use the rnorm() function if the quality of your simulation is not too important (Later, I'll try to explain you why the R "default random generation" functions are not perfect). However, it may be fun to generate a normal distribution from a simple uniform distribution.

The Brownian motion is certainly the most famous stochastic process (a random variable evolving in the time). It has been the first way to model a stock option price (Louis Bachelier's thesis in 1900).

The reason why is easy to understand, a Brownian motion is graphically very similar to the historical price of a stock option.
1

The merge of two insurance companies enables to curb the probability of ruin by sharing the risk and the capital of the two companies.

For example, we can consider two insurance companies, A and B. A is a well known insurance company with a big capital and is dealing with a risk with a low variance. We will assume that the global risk of all its customers follow a chi-square distribution with one degree of freedom.
Blog Archive
Translate
Translate
Loading