I'm trying to subscribe to IB TWS order status through the following code. I've tried multiple times but it won't work. nothing coming back to my terminal when order is placed
from ib_async import *
ib = IB()
util.startLoop()
ib.connect('127.0.0.1', 7497, clientId=1)
print(ib.isConnected())
def orderStatusCallback(trade):
print(f'Order Status: {trade.order.orderId}, Status: {trade.orderStatus.status}')
print(f'Filled: {trade.orderStatus.filled}, Remaining: {trade.orderStatus.remaining}')
ib.orderStatusEvent += orderStatusCallback
ib.cancelOrderEvent += lambda trade: print(f'Order {trade.order.orderId} has been cancelled')
ib.openOrderEvent += lambda trade: print(f'Order {trade.order.orderId} has been opened')
ib.run()
I'm trying to subscribe to IB TWS order status through the following code. I've tried multiple times but it won't work. nothing coming back to my terminal when order is placed