Why account_updates channel did not trigger?

Hello, I write below codes to submit order to buy or sell stocks. I am paper trading only.

def subscribe_updates(self):
        self.conn.register(r'account_updates', self.on_account_updates)
        self.conn.register(r'trade_updates', self.on_trade_updates)

        self.conn.run(['account_updates', 'trade_updates'])

    async def on_account_updates(self, conn, channel, data):
        print('account updates: ', channel, data)
        self.cash = data['cash']

    async def on_trade_updates(self, conn, channel, data):
        print('order: ', data.order)

However, I found 2 issues with the above code:

  1. the feedback from server have a delay, I don’t think it is in realtime
  2. sell or buy stock only trigger trade_updates channel. In my opinion, buy stock will reduce money and sell stock will add money, why account_updates does not get triggered? Or any bugs in my code?

Thanks for your help

#2 makes sense to me. I thought it would be updated also, though haven’t checked on my side.

Thanks @mrea. Yes, that’s why I feel a bit surprised. Also, It is likely due to some bugs in my codes. Can you see obvious errors :slight_smile: ?

currently account_updates doesn’t trigger for order executions (yet).

Got it, @hitoshi. Thanks for your confirmation.

1 Like