Fok time_in_force orders

Every time I try to create a new order with a time_in_force of fok, it is immediately cancelled. Is there something I’m missing here?

I am using the Javascript API.

alpaca.createOrder({
symbol: ‘GOOG’,
qty: 1,
side: ‘buy’,
type: ‘market’,
time_in_force: ‘fok’,
})

are you using the V2 API?

1 Like

Could be helpful if you can tell us whether it’s paper or live.

Yes, using V2, paper. I am trying this during market hours as well.

My best guess is try putting a larger % on top of your order price to see if maybe the price is out of the min bid ask spread

You don’t specify a price at all with a market fok order, from what I can tell. My example above should just buy 1 unit of GOOG stock at whatever the current market price is. If for some reason it cannot, the order will cancel. I’d imagine cancels should be rare, since it is only a quantity of 1. I am testing around 25 stocks, and they all just immediately cancel.

Just a quick answer if your trying to order a stock with a market order and the price moves up the baseline price it would be compared to would change, my best guess is your buying a stock which price is changing rapidly that is possible to cause it to be canceled using the fok standard look into different time enforcement such as ‘day’

I noticed the same issue with the force or kill orders on the paper trading account (api v2), however everything seems to be fine on live trading.

@kris I don’t think the issue is related to the volatility of the underlying stock after the FOK order is issued, I tried with a different stocks both long and short on the paper account and all the orders get canceled.

I was wondering if there is any plan to make FOK orders to work on paper trading, or if there is already a fix that I am missing.

what % collar are you using?

I am not sure what you mean by % collar.

To be more precise I tried to execute a market order with type FOK, so no other parameters except the quantity of the order were asked.
The order works fine in live trading, instead it gets canceled immediately when issued on the paper trading account.

@kris let me know if you need more information.


look under Notes on Orders and Positions its 3rd to last

id suggest you learn the basics or you will empty out your wallet

Thank you for the suggestion, I did and I will take a look again.

However my answer was not related to the meaning of collar %, but to the fact that during market hours executing a market order to buy a single share of a stock with FOK time in force, the order status results canceled when using a paper trading account, instead filled when using the live trading account. I issued the same order multiple times on both the paper trading account and the live trading account on different stocks, the resulting status is always canceled on the paper trading account and filled on the live trading account.

As I wrote before, I don’t think that the stock price is changing so rapidly that the order gets canceled when using FOK as time in force, instead of DAY.

I will be happy to share more information if needed.

IOC/FOK in paper trading has had issues as simulation. The fix is hopefully being deployed in a few days.

Wow, I somehow missed that when I was reading through the docs:

That’s not what I want from market orders. Market orders should just buy at market. Weird.

Is there any way to override this collar behavior? It basically makes the API less useful for any stock currently held. If I wanted a limit order, then I’d specify limit order.

1 Like

every broker uses a collar

I’m getting 3/4 rejections on paper trade short sales (only 1 share @ FOK/market). While I haven’t investigated the meaning of “At this time, you are only allowed to short easy-to-borrow assets” to see if that is causing this, I have to wonder if the phrase “easy-to-borrow” isn’t specific to the broker/trading platform.