Overall Statistics |
Total Trades 9744 Average Win 0.01% Average Loss 0.00% Compounding Annual Return 1.479% Drawdown 2.100% Expectancy 0.483 Net Profit 9.206% Sharpe Ratio 0.764 Probabilistic Sharpe Ratio 12.849% Loss Rate 53% Win Rate 47% Profit-Loss Ratio 2.13 Alpha 0.01 Beta 0.011 Annual Standard Deviation 0.013 Annual Variance 0 Information Ratio -0.174 Tracking Error 0.174 Treynor Ratio 0.907 Total Fees $1548786.21 Estimated Strategy Capacity $5000.00 Lowest Capacity Asset ADGE R735QTJ8XC9X |
#region imports from AlgorithmImports import * #endregion from QuantConnect.Data.UniverseSelection import * import math import numpy as np import pandas as pd import scipy as sp class PriceEarningsAnamoly(QCAlgorithm): def Initialize(self): self.SetStartDate(1998, 1, 2) # self.SetEndDate(1981, 1, 1) self.year = -1 self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.CoarseSelectionFunction) self.SetCash(100000000) def CoarseSelectionFunction(self, coarse): if self.Time.year == self.year: return [] self.year = self.Time.year CoarseWithFundamental = [x for x in coarse if x.HasFundamentalData] sortedByDollarVolume = sorted(CoarseWithFundamental, key=lambda x: x.DollarVolume, reverse=False) return [i.Symbol for i in sortedByDollarVolume[:1000]] def OnSecuritiesChanged(self, change): # liquidate securities that removed from the universe for security in change.RemovedSecurities: if self.Portfolio[security.Symbol].Invested: self.Liquidate(security.Symbol) count = len(change.AddedSecurities) # evenly invest on securities that newly added to the universe for security in change.AddedSecurities: self.SetHoldings(security.Symbol, 1.0/count)