| Overall Statistics |
|
Total Trades 1144 Average Win 0.22% Average Loss -0.21% Compounding Annual Return 55.825% Drawdown 10.200% Expectancy 0.131 Net Profit 25.203% Sharpe Ratio 1.407 Loss Rate 44% Win Rate 56% Profit-Loss Ratio 1.03 Alpha -0.001 Beta 24.264 Annual Standard Deviation 0.236 Annual Variance 0.056 Information Ratio 1.349 Tracking Error 0.236 Treynor Ratio 0.014 Total Fees $1426.85 |
from Alphas.HistoricalReturnsAlphaModel import HistoricalReturnsAlphaModel
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
class ResistanceNadionGearbox(QCAlgorithm):
def Initialize(self):
self.stateData = { }
self.SetStartDate(2019, 1, 19) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
# Add crypto pair BTCUSD (provide for Universe Selection)
self.AddCrypto("BTCUSD", Resolution.Daily)
self.AddAlpha(HistoricalReturnsAlphaModel(7, Resolution.Daily))
self.SetExecution(ImmediateExecutionModel())
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.__numberOfSymbols = 100
self.__numberOfSymbolsFine = 5
self.SetUniverseSelection(FineFundamentalUniverseSelectionModel(self.CoarseSelectionFunction, self.FineSelectionFunction, None, None))
# sort the data by daily dollar volume and take the top 'NumberOfSymbols'
def CoarseSelectionFunction(self, coarse):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
# return the symbol objects of the top entries from our sorted collection
return [ x.Symbol for x in sortedByDollarVolume[:self.__numberOfSymbols] ]
# sort the data by P/E ratio and take the top 'NumberOfSymbolsFine'
def FineSelectionFunction(self, fine):
# sort descending by P/E ratio
sortedByPeRatio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:self.__numberOfSymbolsFine] ]