Replies: 4 comments 1 reply
-
Please open this as a discussion (not an issue) on the ib_async repo. there is nothing to be done at the container level. Now regarding your question you should be able to do (this works for me) # this is pseudo code
ib = IB.connect()
contract=...
order = ...
ib.placeOrder(contract,order)
ib_async.util.sleep(1) # wait for order to be filled
# you should get the previously placed order
orders = ib.orders() there is an open pull request that might be related ib-api-reloaded/ib_async#150 but again, i don't have this issue. if there are orders in the TWS i get orders in the API |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the reply. I'm not using ib_async at all, or Python for that matter. |
Beta Was this translation helpful? Give feedback.
-
I use ib_async, sorry I should not have assumed that. As the underlying API is the same, it should not matter if it's python, C# or java. In any case, i just did a quick test(with ib_async) and everything works fine import ib_async
ib_async.util.startLoop()
ib = ib_async.IB().connect("tws", 7499, clientId=0)
mes_contract = ib_async.ContFuture('MES',exchange='CME',currency='USD')
ib.qualifyContracts(mes_contract)
mes_ticker = ib.reqMktData(mes_contract)
ib_async.util.sleep(0.1)
mes_order = ib_async.LimitOrder(action='BUY',totalQuantity=1,lmtPrice=mes_ticker.ask)
mes_trade = ib.placeOrder(mes_contract,mes_order)
# orders
ib.orders()
[LimitOrder(orderId=5, permId=460758322, action='BUY', totalQuantity=1.0, lmtPrice=6011.75, auxPrice=0.0)]
# complete orders
ib.reqCompletedOrders(True)
[Trade(contract=Future(conId=691171673, symbol='MES', lastTradeDateOrContractMonth='20250620', right='?', multiplier='5', exchange='CME', currency='USD', localSymbol='MESM5', tradingClass='MES'), order=Order(permId=460758322, action='BUY', orderType='LMT', lmtPrice=6011.75, auxPrice=0.0, tif='DAY', ocaType=3, displaySize=2147483647, trailStopPrice=6012.75, volatilityType=0, deltaNeutralOrderType='None', referencePriceType=0, account='XZ1234567', clearingIntent='IB', cashQty=0.0, dontUseAutoPriceForHedge=True, filledQuantity=1.0, refFuturesConId=2147483647, shareholder='Not an insider or substantial shareholder', parentPermId=9223372036854775807), orderStatus=OrderStatus(orderId=0, status='Filled', filled=0.0, remaining=0.0, avgFillPrice=0.0, permId=0, parentId=0, lastFillPrice=0.0, clientId=0, whyHeld='', mktCapPrice=0.0), fills=[], log=[], advancedError='')] |
Beta Was this translation helpful? Give feedback.
-
Thanks, Are there any settings or environment variables that you're setting that could be relevant here? I've been stuck on this for days and pulling my hair out, I can't see what is wrong.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using image ghcr.io/gnzsnz/tws-rdesktop:stable in a kubernetes cluster for my apps to talk to, this is working great.
I am recently writing code to call reqCompletedOrders, which pulls all filled or cancelled orders for the day. I am able to run this code successfully while my code is pointing to the TWS software on my local machine (config using port 7497), which returns me my completed orders as it should.
I then port-forward port 7499 (code changed to use this instead) to my local machine to run my code against ghcr.io/gnzsnz/tws-rdesktop:stable and it no longer works. I am able to connect to the client with this and perform other processes like placing orders, but reqCompletedOrders returns nothing! It is the same code that is running, same clientId that I'm using to connect, just pointing to a different port depending on the target!
Have you heard of this before? Or have any suggestions as to why this would be the case? I'm scrambling for ideas! Thanks.
Beta Was this translation helpful? Give feedback.
All reactions