I saw an issue that position quantity by OnPositionUpdate is different from real quantity.
This morning i had 3 sell orders (0.05M each, total 0.15M) filled for USDCAD ~ 7:30AM. One of the orders following stop order was rejected by IB (explain later). My strategy exited position for that particular fill with market order, leaving total position as 0.10M.
Then NT sent out close position and cancel strategy request based on its internal error handling logic. Up to this point so far so good.
Then the OnPositionUpdate showed my remaining position as 0.06M, which was 0.04M fewer real remaining quantity.
Following that, NT sent out close command with quantity 0.01M. So some part of NT's cancelling logic knew the real quantity. Up to this point, all my reaming position was bought back.
Immediately following this close command, NT send out another close command with quantity 0.04M, leaving me a net long 0.04M on USDCAD. Obviously another part of NT found out my position was not 0.06M but 0.10M and tried to close it.
Even so, I think NT should not have shut down my strategy without closing the long 0.04M position.
Any idea what is going on?
By the way, the issue with USDCAD is specific to IB which does not allow order submission at 5th deciaml but allows order fill at 5th decimal.

Comment