Overall Statistics |
Total Trades 1380 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $33000.00 Lowest Capacity Asset BTCUSD XJ |
from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Algorithm import * # <summary> # Regression algorithm to test the behaviour of ARMA versus AR models at the same order of differencing. # In particular, an ARIMA(1,1,1) and ARIMA(1,1,0) are instantiated while orders are placed if their difference # is sufficiently large (which would be due to the inclusion of the MA(1) term). # </summary> class AutoRegressiveIntegratedMovingAverageRegressionAlgorithm(QCAlgorithm): def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2021, 10, 1) self.SetEndDate(2021, 10, 2) self.EnableAutomaticIndicatorWarmUp = True self.SetCash(10000000) self.ticker = self.AddCrypto("BTCUSD",Resolution.Minute) #self.ticker = self.AddEquity("SPY", Resolution.Daily) #self.setBenchmark("SPY") self.arima = self.ARIMA(self.ticker.Symbol, 1, 1, 1, 50) self.ar = self.ARIMA(self.ticker.Symbol, 1, 1, 0, 50) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' if self.arima.IsReady: if self.arima.Current.Value > self.Securities[self.ticker.Symbol].Close and self.Portfolio.Invested == 0: self.SetHoldings(self.ticker.Symbol,1) elif self.Portfolio.Invested > 0 and self.arima.Current.Value < self.Securities[self.ticker.Symbol].Close: self.Liquidate() # if abs(self.arima.Current.Value - self.ar.Current.Value) > 1: # if self.arima.Current.Value > self.last: # self.MarketOrder("SPY", 1) # else: # self.MarketOrder("SPY", -1) # self.last = self.arima.Current.Value #self.Plot('SPY', self.Securities[self.ticker.Symbol].Close) self.Plot('BTCUSD',self.Securities[self.ticker.Symbol].Close) self.Plot('AR',self.ar.Current.Value) self.Plot('ARIMA',self.arima.Current.Value)