Skip to main content
All CollectionsPerpetualsOrders
Short-term vs long-term order types
Short-term vs long-term order types

Short term vs long term order types

dYdX Operations Services Ltd. avatar
Written by dYdX Operations Services Ltd.
Updated over a month ago

What are short-term orders?

As part of the default settings of the v4 open source software (”dYdX Chain”), short-term orders are short-lived orders that are not stored on-chain unless filled. These orders stay in-memory of the network validators, for up to 20 blocks, with only their fill amount and expiry block height being committed to state. Short-term orders are mainly intended for use by market makers with high throughput or for market orders. More information on short-term orders on dYdX Chain is available here.

What are long-term orders?

As part of the default settings of the v4 open source software, long-term orders are “stateful orders” that are committed to the blockchain. Long-term orders encompass any order that lives on the orderbook for longer than the short block window. The short block window represents the maximum number of blocks past the current block height that a short-term MsgPlaceOrder or MsgCancelOrder message will be considered valid by a validator. Currently the default short block window is 20 blocks on the v4 open source software.

How are short-term orders different from long term orders?

Short-term orders are different than long-term orders on the v4 open source software because short-term orders only stay in-memory up to 20 blocks. Short-term orders are only valid until after the chain passes the Good-Till-Block parameter (aka expiry, even if partially-filled or cancelled). Meanwhile, long-term orders are stateful orders that persists in the in-memory orderbook until filled, expired, or canceled.

Why can short-term orders only be Good-Till-Block (GTB)?

Short term orders can only be GTB because in the interest of being resilient to chain halts or slowdowns. Short-term orders have a maximum GTB of current block height + short block window. The default value is 20 blocks, or about 30 seconds on the v4 open source software.

Why can stateful orders only be Good-Till-Block-Time (GTBT)?

Stateful orders have a maximum GTBT of current block time + Stateful Order Time Window. The maximum default value is 90 days on the front end and 95 days on the protocol for v4 open source software. GTBT is used instead of GTB to give a more meaningful expiration time for stateful orders.

Disclaimer and Terms

This document may provide information with respect to the dYdX Chain software, and/or non-mandatory guidelines and suggestions that may help with using dYdX Chain software. dYdX Operations Services Ltd. does not run dYdX Chain validators nor operate or control the dYdX Chain network. dYdX Operations Services Ltd. is not responsible for any actions taken by other third parties who use dYdX Chain software. dYdX Operations Services Ltd. services and products are not available to persons or entities who reside in, are located in, are incorporated in, or have registered offices in the United States or Canada, or Restricted Persons (as defined in the Terms of Use). The content provided herein does not constitute, and should not be considered, or relied upon as, financial advice, legal advice, tax advice, investment advice or advice of any other nature, and you agree that you are responsible to conduct independent research, perform due diligence and engage a professional advisor prior to taking any financial, tax, legal or investment action related to the foregoing content. The information contained herein, and any use of products or services provided by dYdX Operations Services Ltd., are subject to the Terms of Use.

Did this answer your question?