ARIMA model fitting function

Course Name: Financial Time Series Analysis for Trading, Section No: 18, Unit No: 11, Unit type: Notebook


Function to predict the price of 1 day

def predict_price_ARIMA(train_data):

    # Define model

    model = ARIMA(train_data, order=(2, 1, 2))

    # Fit the model

    try:

        model_fit = model.fit(disp=0, start_params=model_fit_0.params)

        # Make forecast

        return model_fit.forecast()[0][0]

    except:

        pass





Can anyone explain the meaning of code beneah Fit he model

Why try: and except:

Hi Tanul,



Below "Fit the model", we are using a try-except block to fit the model. The try block is used to raise an exception in case of an error. While fitting the model, if there is an error, the try block raises an exception and the control is passed to the except block. Since we don't want to do anything in case of an error, we simply use the pass statement in the except block.



Hope I was able to answer your question.



Thanks!

Thanks Satyapriya.



Would you please share your email address?

I would like to address more queries regarding the live trading sessions and related queries for smooth execution.



Also, more questions regarding upgrading as a fundamental investor.



Thank you.

 

Thanks Satyapriya.



Would you please share your email address?

I would like to address more queries regarding the live trading sessions and related queries for smooth execution.



Also, more questions regarding upgrading as a fundamental investor.



Thank you.

Hi Tanul,



You can always shoot a mail to "quantra@quantinsti.com" with your queries and the team can help you with each and every question.

The community is also an awesome place to ask as others might have the same query and thus, it helps in spreading knowledge. 



Hope this helps :slight_smile: