A consultation about Time seires and data within coding

Hello there:



I have heard in other places (like youtube), than  stock prices can  be forecasted using time series right??, I think the model used is arima model for time series…Is it possible to actually make a code for forcasting time series using the arima model using real time data from interactive brokers??



Is so… how can you actually stream data  from interactive brokeres within a code…??



 

Hi Ghery,



It is indeed possible. To generate an arima model for stock price prediction, you can check this function of the stats models library. For fetching real-time data from IB servers, please see section 5, unit 1 of 

Automated Trading with IBridgePy using Interactive Brokers Platform course. 



When you get real-time data, decide on the time frame to use in arima model prediction analysis. For example, let's assume you chose to use the last 100 tick data for this analysis. Create an array or data frame variable of which size is 100. Store the first 100 tick data and then update this variable and call the function you created for arima analysis as you get new data. Based on the return value coming from this function, create orders. 



Of course, this is a projection to explain the main logic. To apply it effectively for a well-functioning code, you need to use the concepts described in the course(for example, context.flag=True should be used for generating signal etc.).



Hope this helps.

 

Thanks a lot