Listen For Order Updates

I am trying to listen to order updates and can’t seem to get it to work. I can pull all orders or orders by client ID/Order ID, but haven’t figured out how to stream this.

Below is the code I have an the error message I am getting is ‘Stream’ object has no attribute ‘on’

import alpaca_trade_api as tradeapi

conn = tradeapi.stream.Stream(
key_id=api_key,
secret_key=api_secret,
base_url=‘https://paper-api.alpaca.markets’,
data_feed=‘iex’
)

client_order_id = r’my_client_order_id’
@conn.on(client_order_id)
async def on_msg(conn, channel, data):

print("Update for {}. Event: {}.".format(client_order_id, data['event']))

Start listening for updates.

conn.run([‘trade_updates’])

Hi,

I have the same issue. Did you find a solution?

Thanks

No, not yet. I am going to try and build my own async function that calls the API periodically. I just can’t figure this one out for some reason.