Overall Statistics |
Total Trades
1230
Average Win
1.88%
Average Loss
-0.82%
Compounding Annual Return
28.055%
Drawdown
77.100%
Expectancy
1.280
Net Profit
32073.154%
Sharpe Ratio
0.964
Probabilistic Sharpe Ratio
22.751%
Loss Rate
30%
Win Rate
70%
Profit-Loss Ratio
2.28
Alpha
0.168
Beta
0.835
Annual Standard Deviation
0.224
Annual Variance
0.05
Information Ratio
0.874
Tracking Error
0.181
Treynor Ratio
0.259
Total Fees
$10081.90
Estimated Strategy Capacity
$120000.00
Lowest Capacity Asset
CO UHRIGHQMWXNP
Portfolio Turnover
0.36%
|
#region imports from AlgorithmImports import * #endregion # https://quantpedia.com/strategies/net-current-asset-value-effect/ # # The investment universe consists of all stocks on the London Exchange. Companies with more than one class of ordinary shares and foreign companies # are excluded. Also excluded are companies on the lightly regulated markets and companies which belong to the financial sector. The portfolio of # stocks is formed annually in July. Only those stocks with an NCAV/MV higher than 1.5 are included in the NCAV/MV portfolio. This Buy-and-hold # portfolio is held for one year. Stocks are weighted equally. # # QC implementation changes: # - Instead of all listed stock, we select top 3000 stocks by market cap from QC stock universe. class NetCurrentAssetValueEffect(QCAlgorithm): def Initialize(self): self.SetStartDate(2000, 1, 1) self.SetCash(100000) self.symbol = self.AddEquity('SPY', Resolution.Daily).Symbol self.coarse_count = 3000 self.long = [] self.selection_flag = False self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction) self.Schedule.On(self.DateRules.MonthEnd(self.symbol), self.TimeRules.AfterMarketOpen(self.symbol), self.Selection) def OnSecuritiesChanged(self, changes): for security in changes.AddedSecurities: security.SetFeeModel(CustomFeeModel()) security.SetLeverage(10) def CoarseSelectionFunction(self, coarse): if not self.selection_flag: return Universe.Unchanged selected = [x.Symbol for x in coarse if x.HasFundamentalData and x.Market == 'usa'] return selected def FineSelectionFunction(self, fine): fine = [x for x in fine if x.EarningReports.BasicAverageShares.ThreeMonths > 0 and x.MarketCap != 0 and x.ValuationRatios.WorkingCapitalPerShare != 0] sorted_by_market_cap = sorted(fine, key = lambda x:x.MarketCap, reverse=True) top_by_market_cap = [x for x in sorted_by_market_cap[:self.coarse_count]] # NCAV/MV calc. self.long = [x.Symbol for x in top_by_market_cap if ((x.ValuationRatios.WorkingCapitalPerShare * x.EarningReports.BasicAverageShares.ThreeMonths) / x.MarketCap) > 1.5] return self.long def OnData(self, data): if not self.selection_flag: return self.selection_flag = False stocks_invested = [x.Key for x in self.Portfolio if x.Value.Invested] for symbol in stocks_invested: if symbol not in self.long: self.Liquidate(symbol) for symbol in self.long: if symbol in data and data[symbol]: self.SetHoldings(symbol, 1 / len(self.long)) self.long.clear() def Selection(self): if self.Time.month == 6: self.selection_flag = True # Custom fee model. class CustomFeeModel(FeeModel): def GetOrderFee(self, parameters): fee = parameters.Security.Price * parameters.Order.AbsoluteQuantity * 0.00005 return OrderFee(CashAmount(fee, "USD"))