avoiding partially filled orders

Hi, is there a way to set a spot limit order in GTC timeframe that will not be partially filled?
I have a logic where I set the price of an order and wait until it is filled, but I would like to avoid additional code that would handle partially_filled orders, so it would be better to set the order that it can be either filled, or cancelled, but not partially filled.

this can be done by setting timeInForce=FOK, please find details from the document:

thanks, I submitted a FOK order via the binance web - advanced trading mode and it immediately expired… I can’t see in the docs how to set the expiration

I am also interested in clarification about Fill Or Kill. Binance API docs say:

“An order will expire if the full order cannot be filled upon execution.”

But based on what other sites say about FOK, I think a more accurate description would be that it expires if it cannot be IMMEDIATELY filled when the call is made? In other words, it’s not a limit order that will stay open until it can be filled in one go.

I guess there is no option to “fill or wait” because then the order book would contain limit orders that another user cannot execute (their trade offer won’t fill it 100% and will thus be ignored).

I managed to solve the issue in a way that in case I receive a status update that my order is PARTIALLY_FILLED I continue to wait in a loop for further status updates until I get the final FILLED status - that’s when I exit the loop and the order is fully filled. My experience is that once the order is starting to be partially filled it is fully filled within a few minutes.