This issue is not particularly related to the example provided. The concern I have is that when I tried to run this code, some trade updates doesn't get reflected to the algo via trade_updates. For example: A trade gets executed, but the trade_update doesn't show up in the feed hence the algo thinks that the trade never took place in the first place and then 2 minutes later, it tries to cancel the trade.
Why does certain trade_updates doesn't show up? Please note that I saw this behavior in my paper account.