I have a .txt file with three columns: Time, ticker, price. The time is spaced in 15 second intervals. It looks like this uploaded to jupyter notebook and put into a Pandas DF.
time ticker price 0 09:30:35 EV 33.860 1 00:00:00 AMG 60.430 2 09:30:35 AMG 60.750 3 00:00:00 BLK 455.350 4 09:30:35 BLK 451.514 ... ... ... ... 502596 13:00:55 TLT 166.450 502597 13:00:55 VXX 47.150 502598 13:00:55 TSLA 529.800 502599 13:00:55 BIDU 103.500 502600 13:00:55 ON 12.700 # NOTE: the first set of data has the data at market open for - # every other time point, so that's what the 00:00:00 is. #It is only limited to the 09:30:35 data.
I need to create a function that takes an input (a ticker) and then creates a bar chart that displays the data with 5 minute ticks ( the data is every 20 seconds, so for every 15 points in time).
So far I’ve thought about separating the “mm” part of the hh:mm:ss to just get the minutes in another column and then right a for loop that looks something like this:
for num in df['mm']: if num %5 == 0: print('tick')
then somehow appending the “tick” to the “time” column for every 5 minutes of data (I’m not sure how I would do this), then using the time column as the index and only using data with the “tick” index in it (some kind of if statement). I’m not sure if this makes sense but I’m drawing a blank on this. I’m pretty new to python so please bare with me.
If anyone could provide some insight I’d greatly appreciate it.