Hey guys, I can't seem to figure this out, and maybe it's just not possible, but does anyone know how I'd update an order tag within the OnOrderEvent handler? I was hoping something like the below would work, but it seems to have no impact. Note that I'm using the Algorithm Framework, and am not creating my orders directly.

def OnOrderEvent(self, orderEvent): """ Handles various order events. """ # Handle filled orders if orderEvent.Status == OrderStatus.Filled: order = self.Transactions.GetOrderById(orderEvent.OrderId) orderTicket = self.Transactions.GetOrderTicket(orderEvent.OrderId) # Tag pnl of covered short position if orderTicket is not None and orderEvent.Direction == OrderDirection.Buy: orderPNL = self.Portfolio[orderEvent.Symbol].Profit orderUpdate = UpdateOrderFields() orderUpdate.Tag = f'PNL: ${orderPNL:,.2f}' orderTicket.Update(orderUpdate)

 

Author