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’