I have trading data in a pandas data frame in this format:
price, qty, time
123, 100, 9:00
125, 200, 9:05
130, 300, 9:10
125, 300, 10:01
123, 100, 11:05
etc.
I am trying to plot how many shares I bought at what price throughout the day. The ideas was to get data from my data frame into a new array and plot it. The array should look like this:
123, 200
125, 500
130, 300
the time data I can skip for now. What would be the best way to do this?
my_array = []
for item in df:
if item not in array:
my_array.append(item[0])
that should give me the unique prices I traded at. How can I now add the cumulative quantities of shares to the array for each price?
Thanks, Eric