Overall Statistics Total Trades52Average Win0.00%Average Loss0.00%Compounding Annual Return0.096%Drawdown0.100%Expectancy3.353Net Profit0.090%Sharpe Ratio0.87Probabilistic Sharpe Ratio44.551%Loss Rate24%Win Rate76%Profit-Loss Ratio4.71Alpha0.001Beta0Annual Standard Deviation0.001Annual Variance0Information Ratio-2.148Tracking Error0.101Treynor Ratio-4.174Total Fees\$52.00
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
#
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

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(2013, 1, 7)
self.SetEndDate(2013, 12, 11)
self.EnableAutomaticIndicatorWarmUp = True
self.arima = self.ARIMA("SPY", 1, 1, 1, 50)
self.ar = self.ARIMA("SPY", 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
'''
self.last = self.arima.Current.Value