| Overall Statistics |
|
Total Trades 21567 Average Win 0.28% Average Loss -0.43% Compounding Annual Return 323.784% Drawdown 45.700% Expectancy 0.055 Net Profit 887.621% Sharpe Ratio 4.13 Probabilistic Sharpe Ratio 93.295% Loss Rate 37% Win Rate 63% Profit-Loss Ratio 0.66 Alpha 1.995 Beta 0.665 Annual Standard Deviation 0.513 Annual Variance 0.263 Information Ratio 3.899 Tracking Error 0.496 Treynor Ratio 3.187 Total Fees $0.00 Estimated Strategy Capacity $120000.00 Lowest Capacity Asset BTCUSD XJ |
from Alphas.RsiAlphaModel import RsiAlphaModel
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity
class CryptoRSI(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
self.SetEndDate(2021,8,1)
self.SetCash(10000)
#self.SetBrokerageModel(BrokerageName.AlphaStreams)
self.btcusd = self.AddCrypto("BTCUSD", Resolution.Minute)
self.btcRSI = self.RSI("BTCUSD", 14, MovingAverageType.Simple, Resolution.Minute)
#self.Securities["BTCUSD"].SetLeverage(10)
self.SetWarmup(60)
def OnData(self, data):
if self.btcRSI is None or not self.btcRSI.IsReady:
return
if self.btcRSI.Current.Value < 30:
self.Debug(str(self.btcRSI.Current.Value))
self.SetHoldings("BTCUSD",1)
if self.btcRSI.Current.Value > 70:
self.Debug(str(self.btcRSI.Current.Value))
self.Liquidate("BTCUSD")