erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.75k stars 723 forks source link

ib.openOrders() does not return pending orders (with "Master API client ID" ) #39

Closed zhaoy99 closed 6 years ago

zhaoy99 commented 6 years ago

I would like to get existing GoodTillCancel STOP Limit orders and update the limit price or perhaps cancel some of them.

from ib_insync import *
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=99)
ib.openOrders()
#Out[11]: []

ib.orders()
# Out[12]: []

Did I miss anything? Thanks

erdewit commented 6 years ago

Do you also have "Download open orders on connection" checked?

Note that the master client is "look no touch", it can see but not modify orders from other client ids.

zhaoy99 commented 6 years ago

"Download open orders on connection" is checked.

# TWS v967, on Mac, Python 3.6.2
In [5]: ibapi.__version__
Out[5]: '9.73.6'

In [6]: import ib_insync
In [7]: ib_insync.__version__
Out[7]: '0.8.17'
erdewit commented 6 years ago

I've tried it out and it works fine for me. You may look if the order can still be seen with TWS or with the clientId that it was created with, and what it's status is.