Another question about orders using Ibridgepy

Hello there:



I was wondering, let's suppose a market order is sent to buy a particular stock using Ibridgepy on TWS (interactive brokers),  how do yoou fetch the price at which it was bought??



I mean, you could actually use the price for sending a profit taker order… or a stop loss order… But I need to fetch that price … How do you do it?



Thanks a lot

Hi Ghery,



To get the purchase price of an asset you can use Position object. You can get the cost basis of the position using this object. Here is the link to the documentation. 

Thanks a lot