| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 5.886% Drawdown 3.500% Expectancy 0 Net Profit 5.965% Sharpe Ratio 1.016 Probabilistic Sharpe Ratio 49.977% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.038 Beta -0.002 Annual Standard Deviation 0.033 Annual Variance 0.001 Information Ratio -4.086 Tracking Error 0.565 Treynor Ratio -19.09 Total Fees $0.00 Estimated Strategy Capacity $0 |
import numpy as np
import subprocess
class BasicTemplateAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020,1, 1)
self.SetEndDate(2021,1,3)
self.SetCash(10)
self.Portfolio.SetCash("EUR", 10, Decimal(1.1))
self.crypto = "BTCEUR"
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
self.AddCrypto(self.crypto, Resolution.Daily)
self.mfi = self.MFI(self.crypto, 3, Resolution.Daily)
self.SetWarmUp(3)
stockPlot = Chart('Close Price Chart')
stockPlot2 = Chart('MFI Chart')
stockPlot.AddSeries(Series('Close Price', SeriesType.Line, 0))
stockPlot2.AddSeries(Series('MFI', SeriesType.Line, 0))
def OnData(self, data):
if not self.mfi.IsReady:
return
#BUY
if self.mfi.Current.Value < 20:
if not self.Portfolio.Invested:
self.Debug("BUYING")
self.SetHoldings(self.crypto, 0.6, True)
self.Debug("BOUGHT")
#SELL
if self.mfi.Current.Value > 80:
#self.SetHoldings(self.crypto, 1.0)
self.Debug("SELLING")
self.Liquidate()
self.Debug("SOLD ")
self.Plot('Close Price Chart', 'Close Price ' + self.crypto, self.Securities[self.crypto].Close)
self.Plot('MFI Chart','MFI ' + self.crypto, self.mfi.Current.Value)