How do we get purchase price data?

How can I get the price I purchased an equity at?

1 Like

I am in the same boat as you that I would like to know the buy date and buy price of an equity.

set a client order id when you buy. Then retrieve the order after its filled, and pull the fill_price out of it.
I am very amateur at python, so there may be other ways that are more efficient, but this is what I found and it works for me.

#retrieve the order by its client_order_id
my_order = api.get_order_by_client_order_id(client_order_id)

#turn that order into a string so you can dig the fill price out of the object it returns.
my_order = str(my_order)

#the fill price is returned as a string with " " around it. so I split item 20 from the object…which is the fill price and then only take the numbers.
fill_price = my_order.split()[20][1:][:-2]

1 Like