In the OrderFilled event, you get a reference to Trade. The Trade object contains a reference to Order. The OrderState contains an enumeration (BrokerOrderState
) to determine the state of the order according to the broker. The value of that enumeration should be Filled.
Be aware that there are reports of a problem where partial fills are getting new IDs. We haven't been able to duplicate it in a test environment yet, but I wanted you to be aware of the possibility.
My system can submit order to buy or short up to 4 contracts - when there is more than one very often in a live situation these go through as 2,3, or even 4 partial fills
to complete the 4 contracts.
In the ordefilled routine I'm checking to see the current position size to place a stop order. However in this situation the curent size can be less than 4 due to the partial fills
so the stop order gets placed with a lower number of contracts than desired.
How can I code around this ?