Welcome to Quantra Classroom on managing market risk! In today's fast-paced and ever-changing market, it is essential to understand the risks associated with trading. Today, we aim to provide you with the knowledge and skills to effectively manage market risk.
You will learn:
- What market risk is?
- How to quantify market risk using VaR (Value at Risk) and ES (Expected Shortfall)?
- How to use options for hedging exposure?
What is market risk?
Market risk is the risk of losses on financial investments caused by adverse price movements. Examples of market risk are: changes in equity prices or commodity prices, interest rate moves or foreign exchange fluctuations.
Why is it important to quantify market risk?
Let’s say we have a long-only equities portfolio. This portfolio has a possibility to experience losses due to market risk. Hence it is important for you to quantify this risk. As a quant, you go by the saying, “Anything that is important always needs to be quantified”.
How do we quantify market risk?
We will look at two methods to quantify the market risk: - Value at Risk
- Expected Shortfall
These methods are covered in detail in this unit of Options Trading Strategies In Python: Advanced course.
VaR, or Value at Risk:
Imagine you have a stock portfolio. VaR is a way to figure out how much money you could lose over a certain amount of time with a certain level of certainty. For example, a 1-day VaR of your portfolio is $5 million with a 99% confidence level means that there's only a 1% chance that you'll lose more than $5 million in one day.
So most days, you won't lose more than $5 million, but there's still a tiny chance that you could lose more. It's like predicting the worst-case scenario so you can be prepared for it.
But how did we arrive at this VaR value of $5 million?
The steps followed to calculate the VaR are as follows:
- Get the price data of all the stocks in the portfolio
- Calculate the daily returns of all the stocks in the portfolio
- Add all the stock returns to compute portfolio returns. Here we have assumed equal allocation to all the stocks in the portfolio.
- Sort the portfolio returns from worst to best.
- The 99th, 95th, and 90th percentile values are the VaR for 99%, 95%, and 90% confidence levels, respectively.
You can get the Python code for calculating VaR from this unit of the Options Trading Strategies In Python: Advanced course on Quantra. You would have to enrol into a free course preview to access the Python code.
But is VaR the best choice?
Consider the following scenario. Suppose the risk department of a hedge fund tells a trader that the 1-day 99% VaR must not be more than $1 million. By posing this restriction, the risk department controls the risk exposure a trader can take while trading. On the other hand, to make a profit and seek higher payoffs, the trader might want to take a risky position. So although the trader will keep a daily loss of less than $1 million with a 99% probability, as he is required, he might keep the loss as high as $100 million for that 1% chance.
In this case, the trader satisfies the risk limits imposed by the fund but at the same time is taking an unacceptably high risk for 1% of the time. The graph shown below represents this scenario.

VaR is a measure of risk that tells you the maximum amount of money you could lose with a certain level of confidence. But it doesn't consider how much you could lose beyond that maximum amount. This is where Expected Shortfall comes in. It's a better way to measure risk because it looks at the average loss you could expect beyond the maximum amount. It takes into account the likelihood of those losses happening. So if your VaR is $1 million, Expected Shortfall would tell you how much more you could lose beyond that $1 million, on average.

When you look at a normal distribution curve, the area on the left side is where the losses occur. To find the Expected Shortfall, we will add the average of the worst losses that happen less than 1% of the time.
Now consider a scenario where the risk department of the hedge fund poses a restriction that the 1-day, 99% expected shortfall is $2 million. This statement implies that only 1% of the time, a single-day loss would be more than $2 million. While the VaR and expected shortfall interpretations are the same, the difference is in the way they are calculated. Expected Shortfall is more robust compared to VaR. With Expected Shortfall, a trader now can’t take up the $100 million risk since it would result in an expected shortfall much higher than the $2 million.