Open ghost opened 2 years ago
IOC
means instant or cancelled
. So, I'd assume, it was not executed instantly and therefore cancelled and set up with a more recent price to get that fill.
Is there any way to avoid cancellations? Sometimes I get to buy or sell at a very different price. I don't know if it could be more interesting to use Good till cancelled (GTC) or Fill or Kill (FOK) or any other option. I don't know which one is the option by default, but in the previous version, without time_in_force, the order is placed instantly.
The problem is the price is changing dramatically. The previous method used the default of open until cancelled mode.
You are correct that the order would immediately succeed. The problem is, you most likely didn't purchase anything. You just have an open order. And since the price is moving dramatically, you missed your opportunity.
Now, you have to issue issue a cancel order request and issue a new one. That extra step of issuing a cancel to your open order (that didn't get filled), is a waste of time compared to the option of fill or cancel immediately (ioc mode).
I can't weigh in on the GTC or FOK options. I've never tried those.
I'm using the last version of place_order (trade_client.py) with the parameter time_in_force='ioc'. I would like to understand why it always fails before than buy or sell, getting a order_status='cancelled'. Could I avoid this?