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.

Calculating volatility

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.


Future writings

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.



You have some spare money and are excited! You want to make this money work for you but you hear all the talk of a bubble coming soon you are worried. What will happen if you invest the spare cash? Will you make some money or will you lose it! This is uncertainty, this is a risk.

Risk is uncertainty. Uncertain your portfolio will return a profit. Risk is a very important topic in the financial markets and in the business world at large. Some risks are listed here.

  • Country risk
  • Systemic risk
  • Foreign exchange risk
  • Sector risk
  • Idiosyncratic risk
  • Political risk
  • Market risk
  • Credit risk
  • Liquidity risk
  • Company risk
  • Contagion
  • and many more…

When building your portfolio you need to be aware of the risks that affect the assets in your portfolio.

When managing a portfolio the quantifiable risk, volatility is the standard deviation of the portfolio return.

When analysing stock you have to remember that this is a time series. What this means is that you can carry out analysis on different time windows.

For example, Analysis of the daily return for one year, analysis of monthly return of one year or yearly return over 5 years.

How do we measure risk one way to measure risk is by using volatility.


Portfolio Analysis – Sharpe Ratio

To understand what a portfolio is please read my article here.

What is Sharpe ratio? It is a measure that adjust returns for risk. It enables you in a quantitative way to chose between two or more stocks.

Why and when will you need to use it? The simple answer to this is, if you are building a portfolio and are looking at instruments which seem to have the same performance, for example they rise 2% each month. You only have money to select three out of twenty such stocks what do you do?

Well one of the measures you can use is the Sharpe ratio developed by William Sharpe. This takes into account the volatility and risk free interest.

Historically, risk-free rate used for the calculation, were for example LIBOR and 3 month T-bill (90days). In more recent years this is set to 0%.

The Sharpe ratio can be viewed as return vs risk ratio i.e. how much risk was taken to obtain the return.

  • A high Sharpe ratio with a high portfolio return shows return to risk ratio was low
  • A Low Sharpe ratio with a high portfolio return shows return to risk ration was high. So a lot of risk was taken.



In the financial sector an investment portfolio is a collection or basket of weighted set of assets. The holder has a finite amount of cash and wishes to optimise the profit of this portfolio.

How do you create a portfolio?

  1. Have money to invest in something
  2. A broker that can execute on your behalf this can be an online broker or one where you need to call to place orders
  3. Open an account
  4. Analyse and allocate percentage of your money to the shares you want to buy

Yahoo is a very good tool for building dummy portfolios. This does not send your trades to the broker. Below is a dummy portfolio to illustrate a portfolio construction.

How you select the stocks to put into your portfolio is a whole new discussion.

Suppose I had $14,000 in 2019, I decided to buy some stock. Having done some analysis I allocate a proportion of my capital to purchasing the stocks. Below is my percentage allocation and the date of purchase.

Dummy portfolio
Starting Capital$14,000
StockTrade DatePurchase PriceQuantityCommissionTotal Cost/sharePortfolio %

As of today this dummy portfolio will be worth just over $22,000 a rise year on year of 65%.

Note: For the purpose of this exercise all the stocks are in the US stock market and are denominated in dollars. There are no other asset type.

Asset Class

What is an asset class? This is the classification or grouping of financial securities which we can trade. Examples of asset classes are stocks , fixed income, commodities futures and so on.

An example of a stock is AAPL (Apple). AAPL is know as the stock ticker.

An example of a commodity is crude oil, Gold , pork belly etc.

An example of fixed income (bond) is the german bund 10-YR bond.

Knowing this is not enough to trade but it is a simple example.

No Trading Asset Is An Island! – Part 1

No Trading Asset Is An Island! – Part 1

As the saying goes “no man is an island”. In the same way, it seems no stock is an Island. At least not in the trading world. If you trade you have got to factor the mind of the market traders. It is unpredictable!

What are the characteristics that point us to the fact that an asset is not an island? Risk everywhere! Let us use a well know stock as an example. Apple (AAPL) does not manufacture its own batteries, apple supplier list. In fact, it does not manufacture a host of its parts itself. Hence it is dependent on all these countries for the delivery of its product.

What does this mean? Well, first of all, countries of suppliers reside in countries outside Apple’s reporting country. We have some in the United States, Japan, Korea, China, and Taiwan as an example.

Firstly, this means Apple is exposed to currency risk against the foreign suppliers’ countries. So if you trade Apple you will need to de-risk these exposures by hedging in some way.

Secondly, you have a political risk. In recent months we have seen the trade wars between the United States of America and China. Compare timeline with price around that timeline. Notice the price swing in the period leading to this and after. 

It is clear that currencies are paired for example GBPUSD is the British pound against the dollar. So when the central bank governors speak traders pay close attention. So should stock traders because of the exposures they have to these pairs.

If the dollar was to rise against the Yen as an example, products become cheaper to buy from Japan. The inverse is true. If the dollar was to weaken against the Yen, then the cost of production goes up and this affects their bottom line.