Overall Statistics |
Total Orders
256
Average Win
0.47%
Average Loss
-0.38%
Compounding Annual Return
0.994%
Drawdown
11.400%
Expectancy
0.326
Start Equity
100000
End Equity
115818.02
Net Profit
15.818%
Sharpe Ratio
-0.318
Sortino Ratio
-0.099
Probabilistic Sharpe Ratio
0.030%
Loss Rate
40%
Win Rate
60%
Profit-Loss Ratio
1.22
Alpha
-0.014
Beta
0.049
Annual Standard Deviation
0.03
Annual Variance
0.001
Information Ratio
-0.699
Tracking Error
0.138
Treynor Ratio
-0.192
Total Fees
$603.89
Estimated Strategy Capacity
$6000.00
Lowest Capacity Asset
QAT VQ6KGBSR66AT
Portfolio Turnover
0.44%
|
# 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. from AlgorithmImports import * from pandas.tseries.offsets import BDay class RamadanEffect(QCAlgorithm): def initialize(self): self.set_start_date(2010, 1, 1) self.set_cash(100000) self.symbols: List[Symbol] = [ self.add_equity(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 on_data(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.set_holdings(portfolio, True) else: # close trades if self.portfolio.invested: self.liquidate()