Quant BuffetRelax, Not Over Thinking

Ramadan Equity Rotation Strategy in Muslim-Majority Markets

Log in to collect

Academic paper

Strategy in a nutshell

The investment universe consists of countries for which stock market index data are available and in which the proportion of the population professing Muslim faith exceeded 50%. Most of the countries could be easily tracked via index ETFs. The research paper we use as an example uses 14 Muslim countries.

Ramadan is the ninth month in the Islamic calendar, which is based on the motion of the moon. The Ramadan month could be calculated by using the information on the lunar phases and sunset times from the astronomical calendar or information about Ramadan dates from various public sources.

The trading strategy is simple. The investor holds an equally weighted portfolio of ETFs during the Ramadan month. He/she is otherwise invested in cash.

Economic rationale

Academic research postulates that the euphoria derived from Ramadan could influence investor behavior in Islamic markets. The upbeat mood during Ramadan leads to positive investor sentiment and has a positive valuation effect on equity markets in Islamic countries.

Backtest performance

Annualised return6.7%
Beta0.049
Sharpe ratio-0.241
Sortino ratio-0.075
Maximum drawdown11%
Win rate65%

Full Python code

from AlgoLib import *
from pandas.tseries.offsets import BDay

class RamadanEffect(XXX):

def Initialize(self):
self.SetStartDate(2010, 1, 1)
self.SetCash(100000)

self.symbols: List[Symbol] = [
    self.AddEquity(x, Resolution.Daily).Symbol for x in ['TUR', 'GULF', 'GAF', 'PAK', 'UAE', 'QAT', 'EGPT', 'EWM', 'EIDO', 'KSA']
]

# Source: https://www.infoplease.com/calendars/holidays/islamic-holidays
csv_string_file: str = self.Download('data.quantpedia.com/backtesting_data/calendar/ramadan_dates.csv')
date_pairs_str: List[str] = csv_string_file.split('\r\n')
self.date_ranges: List[List] = []

for pair in date_pairs_str:
    split: List[str] = pair.split(';')
    
    self.date_ranges.append(
        pd.date_range(start=datetime.strptime(split[0], "%d.%m.%Y").date(), 
        end=datetime.strptime(split[1], "%d.%m.%Y").date())
    )

def OnData(self, slice: Slice) -> None:
if any(str(self.Time.date()) in self.date_ranges[i] for i in range(len(self.date_ranges))):
    # open trades
    if not self.Portfolio.Invested:
        portfolio: List[PortfolioTarget] = [
            PortfolioTarget(symbol, 1. / len(self.symbols)) for symbol in self.symbols if symbol in slice and slice[symbol]
        ]
        self.SetHoldings(portfolio, True)
else:
    # close trades
    if self.Portfolio.Invested:
        self.Liquidate()