Profile Picture

HandlePositionOverfilled on IB Live System

Posted By alpha23 6 Years Ago
Message
Posted Wednesday April 13 2011
I received the following exception today but was unable to find the cause? The audit trail shows a partial fill of 22 followed by a final fill of 43 on the initial sell limit of 65 while the log from position manager shows a partial fill of 22 followed by a partial fill of 44 after which the exception was thrown. Also, where/how can this exception be handled?

A Sell order (307: Limit Sell CNX @ 50.37 87/65: 22@50.37, 22@50.37, 43@50.37 - Filled) with a size of 65 was filled on position ID 57 with a size of 21.
at RightEdge.Common.PositionManager.HandlePositionOverfilled(PositionData pos, PositionState posState, BrokerOrder order, Fill fill, TradeType tradeType, String description)
at RightEdge.Common.PositionManager.OnOrderFilled(BrokerOrder order, Fill fill, PositionData pos, PositionState posState, TradeOrder tradeOrder)
at RightEdge.Common.PositionManager.broker_OrderUpdated(BrokerOrder brokerOrder, Fill fill, String information)
at RightEdge.Shared.BrokerWrapper.<>c__DisplayClass3.b__0(Object )
at RightEdge.Shared.CallbackStub.DoCallback()

Thanks, Duane
Posted Thursday April 14 2011
RightEdge registered the first fill twice, it looks like. I don't know why that happened... I've attached an updated version of the TWS plugin (with source) that supports detailed logging which would probably help diagnose this kind of issue. Drop the DLL in the bin folder and then go to the service settings to tell it where to store the log files.

To catch the exception, you can subscribe to the PositionManager.PositionOverfilled event and set the Handled property of the EventArgs to true. You can also modify the PositionOverfilledAction property of the PositionManager. However, if you let the system continue running, it will think there is a short position open with a size of 22, so you might not want to just let things continue.

Thanks,
Daniel

Attachments
TWSCSharpPlugin.zip (339 views, 77.00 KB)
Posted Tuesday February 18 2014
A Sell order (15947: Stop Sell USD/CHF @ 0.8884 1260000/770000 - Filled) with a size of 770000 was filled on position ID 3 with a size of 770000.
at RightEdge.Common.PositionManager.HandlePositionOverfilled(PositionData pos, PositionState posState, BrokerOrder order, Fill fill, TradeType tradeType, String description)
at RightEdge.Common.PositionManager.PositionOrderFilled(PositionData pos, PositionState posState, BrokerOrder order, Fill fill, TradeType tradeType, String description, Boolean sendUpdate)
at RightEdge.Common.PositionManager.OnOrderFilled(BrokerOrder order, Fill fill, PositionData pos, PositionState posState, TradeOrder tradeOrder)
at RightEdge.Common.PositionManager.broker_OrderUpdated(BrokerOrder brokerOrder, Fill fill, String information)
at RightEdge.Shared.BrokerWrapper.<>c__DisplayClass3.b__0(Object )
at RightEdge.Shared.CallbackStub.DoCallback()

I gave a search on the forums, and i found that the same problem have been raised before quite a while ago, but did not find any solution to it. Are there any updates on this issue I could use?
Thx in advance!
Posted Tuesday February 18 2014
Hi,

Can you find the TWS plugin log file for the day this happened and post it here? By default it will be in the TWSLogs folder under the RightEdge application data directory (which you can get to by going to Help\About RightEdge and clicking on the "Application Data Folder" link).

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems