I am trying to implement a few new features for my trading system. My plan for now is to initially buy the stocks i wants (using Vwap) and when the order has closed (bought all the quantity) I want to collect 3 parameters(ticker name,avg price, quantity bought),of the order (in order to place TP\SL commands). Neither reqPosition nor orderStatus or reqExecutions seems to return all of them and I couldn't figure how how to do it yet. Any insight on my small problem would be great!

Thank a lot in advance!

  • 1
    $\begingroup$ If you are using Python, you may want to have a look at the ib-insync library. It's a wrapper for IB's native Python API. It has much better documentation and plenty of code examples and notebooks: ib-insync.readthedocs.io/readme.html $\endgroup$ – amdopt Nov 25 '20 at 15:52
  • $\begingroup$ @amdopt Totally agree. I find the IB API to be abstract and difficult to use. Amir Ariely: ib_insync makes it easy to retrieve the portfolio and positions and will give you the three parameters you have an interest in. $\endgroup$ – Brian O'Donnell Nov 25 '20 at 16:57
  • $\begingroup$ Thank you both a lot! I am trying to change my code to ib_insync. Could you please tell me what it the function that returns the ticker'avg price and quantity when the position is fulfilled? $\endgroup$ – Amir Ariely Nov 30 '20 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.