Using Python to understand the Egyptian stock market a little better

During the last 15 years a lot has happened in Egypt. From the Egyptian Revolution to the devaluation of the Egyptian pound, the EGX 30 has seen some turbulent years. But how has the EGX 30 performed over this time period? How have individual stocks performed? And which stocks outperformed the index? In this study, I will explore the performance of the EGX 30 and its constituents.


The data set which is collected from Thomson Reuters includes all stocks in the EGX 30 (as of November 2018) over the period from November 2003 until November 2018. It is worth nothing, that the data were not adjusted on a monthly basis in such a way that they reflect the changes in the historical composition of the index. This simply means that I did not account for new entrants & exits over the study period due to the lack of time. As a result, there are several stocks that contain less than 180 months of data (seen in graph below). For example, Ibnsina Pharma has only 10 months of data as it had its IPO in December 2018. Nevertheless, the majority of stocks have over 100 months of data included in the study. I used adjusted closing prices to calculate stock returns to account for stock splits and dividend payments.

How has each stock performed?

The first question you’re probably asking yourself is: How did each stock perform over this 15 year period? There are several ways to track performance including risk-adjusted returns, benchmark-adjusted returns among others. The first way we’ll explore the data is by looking at the distribution of returns for each stock. The graph below displays the maximum, upper quartile, median, lower quartile and minimum monthly return of each stock over the 15 year period. For example, the median monthly return of the EGX 30 is 1.6%.

What are the maximum returns of each stock?

Heliopolis Housing had the highest maximum return compared to the maximum returns of all other EGX 30 constituents. Further analysis revealed that it was during May 2007 where Heliopolis Housing had a whopping 100% monthly return. What happened?

A simple Google search reveals that Heliopolis Housing announced on the 8th of May 2007 that its net profits had risen 41 percent to LE 104.8 million for the first nine months of its 2006/7 financial year. According to the same report, “Heliopolis Housing shares were up 25.5 percent at LE 550 a share on speculation about the prices land will fetch in the final stage of a government auction.”


Arab Cotton Ginning Co. had the highest monthly percentage loss over the 15 year period of slightly over -86%. Further analysis reveals that this was during June 2018. What happened?

Standard deviation of EGX 30 constituents

Accoridng to Investopedia, the standard deviation helps determine market volatility or the spread of asset prices from their average price. When prices move wildly, standard deviation is high, meaning an investment will be risky. So, let’s look at the standard deviation of each stock in the EGX 30.

OCDI which stands for Six of October Development & Investment has the highest standard deviation during the period November 2003 until November 2018.

Final Remarks

This is just one blog post out of many where I’ll be exploring stock markets around the world. If you’re interested in finding out more, make sure you’re subscribed to our newsletter and follow us on Facebook. Let me know if you find out what happened to Arab Cotton Ginning (ACGC) in June 2018 and if you enjoyed this post in the comments section.

Suggested Posts

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s