What I'm Trying to do
I'm trying to find out, at what minute in the first hour of the open of the market (9:30-10:30am Eastern US) is it statistically most likely, if my stock (Apple) is positive at that minute, the stock will close positive... as well as the same question but negative.... at what minute during the first hour (if apple is negative) is it most likely Apple will close negative.
To Clarify I'm trying to be able to say the following "Based on historical data it is most likely that if Apple is still negative by 32 minutes it will stay negative and close negative.... and here is how correlated it is the closing price. " And vice versa if it is positive.
So what I'm trying to do is find out what are the earliest two minutes in the first hour of trading that I either buy (if the stock is above yesterdays closing price(last minute)) or short (if the stock is below yesterdays closing price (last minute)). So it will be two separate calculations.
Here is the code I have so far that collects the data
#get our minute prices (using Quantopian)
prices = get_pricing(['AAPL'], start_date="2017-1-1", end_date="2019-5-1", fields='close_price', frequency='minute')
#change times to be the market time and not UTC time
prices_et = prices.tz_convert('US/Eastern') #Use the pandas 'between_time' method to select the time range.
#Fetches closing minute and the first hour of the market open