Overall Statistics |
Total Trades 14 Average Win 0.30% Average Loss -1.06% Compounding Annual Return -29.766% Drawdown 5.500% Expectancy -0.360 Net Profit -2.768% Sharpe Ratio -2.052 Probabilistic Sharpe Ratio 15.179% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 0.28 Alpha -0.242 Beta -0.009 Annual Standard Deviation 0.118 Annual Variance 0.014 Information Ratio -1.32 Tracking Error 0.177 Treynor Ratio 28.115 Total Fees $14.00 Estimated Strategy Capacity $400000000.00 Lowest Capacity Asset COIN XNNJXSXHIHYD |
import pandas as pd class CrawlingMagentaCaterpillar(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 4, 16) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.Universe.DollarVolume.Top(3)) self.data = pd.DataFrame() def OnData(self, data): for symbol in self.Portfolio.Keys: if not self.Portfolio[symbol].Invested: continue self.data = self.data.append(pd.DataFrame({'time': [str(self.Time.date())], 'symbol': [str(symbol)], 'quantity': [self.Portfolio[symbol].Quantity]}), ignore_index=True) def OnSecuritiesChanged(self, changes): for security in changes.RemovedSecurities: symbol = security.Symbol self.Liquidate(symbol) for security in changes.AddedSecurities: self.SetHoldings(security.Symbol, 0.25) def OnEndOfAlgorithm(self): self.ObjectStore.Save('data', self.data.to_json())