Overall Statistics |
Total Trades 4 Average Win 0% Average Loss 0.00% Compounding Annual Return 119.637% Drawdown 0.800% Expectancy -1 Net Profit 1.011% Sharpe Ratio 16.803 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.404 Beta 0.293 Annual Standard Deviation 0.038 Annual Variance 0.001 Information Ratio -2.741 Tracking Error 0.056 Treynor Ratio 2.168 Total Fees $5.23 |
# # QuantConnect Basic Template: # Fundamentals to using a QuantConnect algorithm. # # You can view the QCAlgorithm base class on Github: # https://github.com/QuantConnect/Lean/tree/master/Algorithm # import numpy as np from algorithm1 import * class Control(QCAlgorithm): def Initialize(self): # Set the cash we'd like to use for our backtest # This is ignored in live trading self.SetCash(100000) # Start and end dates for the backtest. # These are ignored in live trading. self.SetStartDate(2017,1,1) self.SetEndDate(2017,1,5) # Add assets you'd like to see self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol self.a1 = Algo1(self) self.a1.Initialize() def OnData(self, slice): self.a1.Rebalance() self.Debug("test control") # Simple buy and hold template self.SetHoldings(self.spy, .5)
class Algo1(object): def __init__(self, control_self): self.control_self = control_self def Initialize(self): self.control_self.Debug("initialize algo1") # Add assets you'd like to see self.control_self.qqq = self.control_self.AddEquity("QQQ", Resolution.Minute).Symbol def Rebalance(self): self.control_self.Debug("test algorithm1") # Simple buy and hold template self.control_self.SetHoldings(self.control_self.qqq, .5)