# 11 – M3L612 The Efficient Frontier V1

In this notebook, we will take a look at the efficient frontier. Recall that the expected shortfall and the variance of the optimal strategy are given by these equations. In this notebook, we will learn how to visualize and interpret this equations. We will start by taking a look at the expected shortfall. Recall that even if we use the same trading list, we’re not always going to get the same implementation shortfall due to random fluctuations in stock price. This is why we had to reframe the problem of finding the optimal strategy in terms of the average implementation shortfall and the variance of the implementation shortfall. So, whenever we talk about the expected shortfall, we’re really talking about the average implementation shortfall. Therefore, we can think of the expected shortfall as follows. Given a single trading list, the expected shortfall will be the value of the average implementation shortfall. If we were to implement this straight lists in the stock market many times. To see this in this code, we’re going to implement the same trading list for the certain number of trading simulations. We call this trading simulations episodes. Each episode consists of different random fluctuations in the stock price. The code outputs the average implementation shortfall and the standard deviation of the implementation shortfall for these episodes. It also outputs the expected shortfall and standard deviation of the shortfall from the Almgren increased model. In addition, it also outputs a plot of the implementation shortfall for each episode. We can see that the implementation shortfall for each episode is different. For example, for this episode we got an implementation shortfall of around $1 million. But for this episode, we’ve got an implementation shortfall around minus$500,000. Remember, that the negative sign means that we actually made money in this episode. This purple line indicates the average implementation shortfall for all these episodes. We can see that it has a value around $546,000 with a standard deviation of around$473,000. We will now see that as we increase the number of episodes, the average implementation shortfall and its standard deviation will get closer to the values predicted by the Almgren increase model. For example, if I set the number of episodes to 100,000, I now get values for the average implementation shortfall and its standard deviation that are pretty close to the values predicted by the ongoing increase model. We will then take a look at two extreme trading strategies. The first trading strategy corresponds to a trader that has no regard for risk and therefore, takes as much risk as possible by selling his shares at a constant rate over a long period of time. This trading strategy will deal with the lowest possible expected shortfall, but it will also yield the largest possible standard deviation. The second strategy corresponds to a trader that wants to take zero-risk. Therefore, he sells all his shares in a single trade despite the huge transaction costs. This strategy would yield the highest expected shortfall, but will yield the lowest possible standard deviation of zero. In the last section, we will take a look at the efficient frontier. Almgren and Chris showed that for each value of lambda, there is a uniquely determine optimal trading strategy. We will define the efficient frontier to be the set of all these optimal trading strategies. That is the efficient frontier is the set that contains the optimal strategy for each value of lambda. This code plus to the efficient frontier for a range of lambda values. You can choose a particular value of lambda to see if it’s suspect shortfall and level a variance. For example, here we see the expected shortfall and level of variance for a trader with this value of lambda. A trader that wants to take more risk will be at this end of the plot displaying a smaller spectrum shortfall, but a higher level of variants. On the other hand, a traitor that also who want to take a lot of risk will be at this under the plot, displaying a much higher expected shortfall, but at much lower level of variance.