| Overall Statistics |
|
Total Trades 128 Average Win 0.32% Average Loss -0.50% Compounding Annual Return -0.024% Drawdown 11.400% Expectancy -0.002 Net Profit -0.158% Sharpe Ratio 0.013 Probabilistic Sharpe Ratio 0.266% Loss Rate 39% Win Rate 61% Profit-Loss Ratio 0.64 Alpha 0.001 Beta -0.002 Annual Standard Deviation 0.036 Annual Variance 0.001 Information Ratio -0.782 Tracking Error 0.167 Treynor Ratio -0.212 Total Fees $281.27 Estimated Strategy Capacity $11000.00 Lowest Capacity Asset QAT VQ6KGBSR66AT |
# https://quantpedia.com/strategies/ramadan-effect/
#
# The investment universe consists of countries for which stock market index data are available and in which the proportion of population the 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 information on the
# lunar phases and sunset times from 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 Ramadan month. He/she is otherwise invested in cash.
class RamadanEffect(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2015, 1, 1)
self.SetCash(100000)
self.symbols = ['TUR', 'GULF', 'GAF', 'PAK', 'UAE', 'QAT', 'EGPT', 'EWM', 'EIDO', 'KSA']
for symbol in self.symbols:
self.AddEquity(symbol, Resolution.Daily)
csv_string_file = self.Download('data.quantpedia.com/backtesting_data/economic/ramadan_dates.csv')
date_pairs_str = csv_string_file.split('\r\n')
date_pairs = []
for pair in date_pairs_str:
split = pair.split(';')
date_pairs.append([datetime.strptime(split[0], "%d.%m.%Y"), datetime.strptime(split[1], "%d.%m.%Y")])
start_dates = [pair[0] for pair in date_pairs]
end_dates = [pair[1] for pair in date_pairs]
self.Schedule.On(self.DateRules.On(start_dates), self.TimeRules.AfterMarketOpen(self.symbols[0]), self.Open)
self.Schedule.On(self.DateRules.On(end_dates), self.TimeRules.AfterMarketOpen(self.symbols[0]), self.Close)
def Open(self):
if not self.Portfolio.Invested:
count = len(self.symbols)
for symbol in self.symbols:
self.SetHoldings(symbol, 1 / count)
def Close(self):
self.Liquidate()