How to retrieve orders status with ibkr api?

Discussion in 'Interactive Brokers' started by isidore_2023, Feb 1, 2023.

  1. Hi,

    i want to retrieve all open orders status from my account with ibkr api.
    In the documentation i found this:

    class TestClient(EClient):
    def __init__(self, wrapper):
    EClient.__init__(self, wrapper)

    @iswrapper
    def openOrder(self, orderId, contract, order, orderState):
    print("openOrder. orderId:", orderId, "contract:", contract, "order:", order, "orderState:", orderState)

    @iswrapper
    def orderStatus(self, orderId, status, filled, remaining, avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld, mktCapPrice):
    print("orderStatus. orderId:", orderId, "status:", status, "filled:", filled, "remaining:", remaining, "avgFillPrice:", avgFillPrice, "permId:", permId, "parentId:", parentId, "lastFillPrice:", lastFillPrice, "clientId:", clientId, "whyHeld:", whyHeld, "mktCapPrice:", mktCapPrice)

    @iswrapper
    def nextValidId(self, orderId):
    self.start()

    def start(self):
    self.reqAllOpenOrders()

    class TestWrapper(wrapper.EWrapper):
    def __init__(self):
    wrapper.EWrapper.__init__(self)

    app = TestClient(TestWrapper())
    app.connect("127.0.0.1", 7497, 0)
    app.run()

    How do you call the function reqAllOpenOrders() from another class in python ?

    Any help, thank you.


    Thank you
     
  2. spy

    spy

    The same way you call any other object methods. Why should it be different?

    You may want to consider reading a quick refresher on Python object orientation before diving into the IB API.
     
  3. Found, i was looking for something that i have already done when placing an order, it returns the order status.
    i close this thread.
    Thank you
     
  4. 2rosy

    2rosy

    <script src=""></script>