Differentiating the measures of risk

Let's explore different measures of risk. We will use the trading performance from the volatility adjusted mean reversion strategy we saw in Chapter 5, Sophisticated Algorithmic Strategies, as an example of a trading strategy in which we wish to understand the risks behind and quantify and calibrate them.

In Chapter 5, Sophisticated Algorithmic Trading Strategies, we built the Mean Reversion, Volatility Adjusted Mean Reversion, Trend Following, and Volatility Adjusted Trend Following strategies. During the analysis of their performance, we wrote the results into the corresponding CSV files. These can also be found in this book's GitHub repository, https://github.com/PacktPublishing/Learn-Algorithmic-Trading---Fundamentals-of-Algorithmic-Trading, or by running the volatility adjusted mean reversion strategy (volatility_mean_reversion.py) in Chapter 5, Sophisticated Algorithmic Strategies, in the Mean Reversion Strategy that dynamically adjusts for changing volatility section. Let's load up the trading performance .csv file, as shown in the following code block, and quickly look at what fields we have available:

import pandas as pd
import matplotlib.pyplot as plt

results = pd.read_csv('volatility_adjusted_mean_reversion.csv')
print(results.head(1))

The code will return the following output:

     Date        Open High        Low Close Adj Close  
0 2014-01-02 555.647278 556.788025 552.06073 554.481689 554.481689
Volume ClosePrice Fast10DayEMA Slow40DayEMA APO Trades Position PnL
0 3656400 554.481689 554.481689 554.481689 0.0 0 0 0.0

For the purposes of implementing and quantifying risk measures, the fields we are interested in are Date, High, Low, ClosePrice, Trades, Position, and PnL. We will ignore the other fields since we do not require them for the risk measures we are currently interested in. Now, let's dive into understanding and implementing our risk measures.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.237.51.235