The price of a security does not go up in a straight light. You may feel like you are on a rollercoaster. All your emotions are running wild the stock you bought is heading a different path to your expected path. Ah! this is the volatility I write about.
The prices swing up one day then down two days. Then you all reasoning is thrown out the window and you decide to close the positions that are causing you stress.
What is the measure volatility?
It is the standard deviation of the log returns on your portfolio, a stock price, an index or any financial instrument.
This is quite useful to understand the behavior and risk of an instrument. With this, you can calculate the expected return of a stock or portfolio.
View the code below to see sample calculations of a portfolio calculation in python. I have used data from yahoo finance. Please download the data if you wish to follow.
Next we will look at the VIX index and explain why it is a more important and accurate measure of volatility.
Also In future posts we will see how we can incorporate these measures into our AI algorithm.