My logic is driven only from entire fill, so no actions are taken when order is partfilled.
Also what matters, I use Position object to get current strategy position.
Recently I have faced with problem:
According to Execution table - I have simultaneous (within 1 second) order part fill and then fill.
But strategy is reported about 2 fills ( IExecution.Order.OrderState = OrderState.Filled)
So for example I have an order for 4 lots to buy. Strategy receives following:
- onExecution: (order state = filled; Position.Quantity = 3; Position.MarketPosition= MarketPosition.Long; ) ( where should have been reported as partfilled)
- onExecution: (order state = filled; Position.Quantity = 4; Position.MarketPosition= MarketPosition.Long)
And as you understand that is not what one would expect to receive.
So my question is following: how do I work with it?
If IExecution object, which is passed to onExecution, is synchronized between threads, is there a Position object that is synchronized as well - so I would get correct strategy direction and position?
I could ignore second reported fill, but I need to know correct strategy position at the moment of first onExecution callback.

Comment