Is an order's change in to a position atomic?


In handle_data I’m assuming that once I create an order then I can be sure that there will either be an open order or (once it has completed) an open position.

Is that a safe assumption or is there a potential race condition where the order has completed but the position isn’t listed in the context’s positions yet?


Catalyst updates the position, once an order has been filled. It removes the open order right after it was updated in the position. So the scenario specified isn’t possible.