On Wed, Aug 4, 2021 at 04:15 AM, Luke wrote:
Also often the buy order has partial fills, my current system sends for each fill separate sell order, so if i got it right, i need to create one sell order with full position otherwise its treated as separate sell orders altho they were created based on one buy order?
This explains it. You mention that for each partial fill on a buy order you generate a separate sell order. Each of these sell orders are treated by IB as separate and incur commission. Your IB account is a net account, so they don't link your sell orders to your buy orders. So IB won't think "this was one buy order, so we'll consider this bunch of sell orders as one order". IB sees that you have a current position of 246 shares, and that you are selling some portion of that position. They don't care how you came about to have these 246 shares.
I can suggest two possible ways of handling the situation:
(1) You wait until your entire buy order has been filled. So you wait until the quantity of "remaining shares" has gone down to zero. Then you place your one sell order for the entire position size you have in your account. Or,
(2) If your buy order does not seem to fill completely you can cancel it after waiting a while. This will cancel the remaining portion which has not yet been filled. Then you can place one sell order for the total position quantity in your portfolio.