I have dataset of ticker information with timestamps spanning over a month, but I need to grab only the times at 4:00PM. The closest tick to this is 16:00:03, which is what I currently use. I hard coded the vales for the month of August by manually inputting the dates, but would like to change this so I can specify what month to use instead of inputting every day, or setting a start and end date.
df = df.loc[((df["timestamp"] == "2021-08-02 16:00:03")) |
((df["timestamp"] == "2021-08-03 16:00:03")) |
((df["timestamp"] == "2021-08-04 16:00:03")) |
((df["timestamp"] == "2021-08-05 16:00:03")) |
((df["timestamp"] == "2021-08-06 16:00:03")) ]
timestamp bidprice askprice
0 2021-08-02 14:59:03 99.937500 99.949219
1 2021-08-02 15:00:03 99.941406 99.945312
2 2021-08-02 15:01:03 99.941406 99.945312
3 2021-08-02 15:02:03 99.941406 99.945312
4 2021-08-02 15:03:03 99.941406 99.945312
...
timestamp bidprice askprice
468109 2021-09-01 22:55:02 110.500000 110.546875
468110 2021-09-01 22:56:02 110.500000 110.546875
468111 2021-09-01 22:57:02 110.500000 110.546875
468112 2021-09-01 22:58:02 110.484375 110.531250
468113 2021-09-01 22:59:02 110.484375 110.531250