Profile Picture

Detecting partial fills

Posted By blousetrader 7 Years Ago
Message
Posted Tuesday July 06 2010
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 ?
Posted Thursday July 08 2010
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.

blousetrader (7/6/2010)
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 ?
Posted Wednesday March 30 2011
Bill,

   I’m implementing a check in the OrderFilled event, which checks that OrderState = Filled, per your post above. Can you elaborate on your comment regarding the problem of partial fills getting new IDs? That is, does this mean that a partial fill may have a state equal to filled?

Also, I’m using IB. Is OrderState equal to OrdStatus from the TWS api?

Thanks, Duane
Posted Thursday March 31 2011
Since we haven't duplicated it, I'm entirely sure what the state is equal to. Presumably, that is the case. OrderState is not necessarily equal to OrdStatus. It's more complicated than that. Error codes back from IB may change the order state.

dwebber (3/30/2011)
Bill,

   I’m implementing a check in the OrderFilled event, which checks that OrderState = Filled, per your post above. Can you elaborate on your comment regarding the problem of partial fills getting new IDs? That is, does this mean that a partial fill may have a state equal to filled?

Also, I’m using IB. Is OrderState equal to OrdStatus from the TWS api?

Thanks, Duane


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems