What does QUEUED status mean for orders?

There are cases where an order is supported by Jesse but is not supported by the exchange at that moment. In such cases, Jesse stores the order in a queue. When the exchange is ready to accept the order, Jesse will remove it from the queue and send it to the exchange.

Here are the two cases where this happens:

1. When the price difference of a LIMIT order is too high

Few exchanges have a limit for how far away you are allowed to place a limit order.

For example, on Binance Perpetual Futures it's at 13%. That means if the current price of an asset is $100, you cannot place a buy limit order at $50.

So if you do submit such an order the order will get queued by Jesse to be submitted later. By later, I mean when it reaches within the accepted limit of that exchange.

2. When submitting limit and stop orders at the same time in spot trading

Most spot exchanges only allow for sell orders as much as your balance. In other words, they don't allow you to submit both the stop-loss and take-profit (usually a LIMIT order) at the same time.

When using Jesse, you can submit both the stop-loss and take-profit, as usual, like with the below code:

def on_open_position(self, order):
    self.stop_loss = self.position.qty, self.price - 10
    self.take_profit = self.position.qty, self.price + 10

And here's how Jesse will handle it for you (behind the scenes):

Depending on the exchange you're trading on and its requirements, Jesse will submit the order(s) that is accepted at the moment, and queue the other(s). Once the live price gets closer to the other (queued) order, Jesse will cancel the previously submitted one, queue it, and submit the previously queued one. Confused? Don't worry, you don't have to worry about this at all. It'll all be handled by Jesse. But it's good to know what a queued order status is; because you will see it in the logs.

3. Handling exit orders on Bitget.com

Bitget's API has the limitation of not allowing to submit reduce-only orders more than the size of the open positions. This behavior makes it similar to how the spot trading works. To overcome this limitation, Jesse handles the submission of exit orders using queued orders.

Last updated: 2 years ago