Order Types
Last updated
Last updated
Market Order: Fills the best available offers immediately up to the specified quantity. Market orders execute instantly at the prevailing market rate, so they may lead to slippage when the price changes. To minimize the effects of price fluctuations, it is advisable to use limit orders instead.
Limit Order: Posts to the Order Book to be executed at a price at least as good as the specified limit price. Upon order creation, the Cost
of the order will be locked off-chain and deducted from Free Collateral
.
Stop Orders: These orders are stored outside of the Order Book in a Stand-by Server and are only sent to the book once the Oracle Price hits a user-specified Trigger Price. More details on Stop Orders can be found here.
These are the building blocks of Take Profit (TP) and Stop Loss (SL) orders, which are described in detail here.
There are a two types of stop orders:
Stop-Market: requires only a stop price and size to be specified. After index price crosses the stop price, a market order is placed and executes instantly at the prevailing market rate.
Stop-Limit: requires two prices, a Stop price and a Limit price, and size. After index price crosses the stop price, a limit order with the limit price is placed. This option is recommended for reduced slippage.
Post Only: This is a condition on the limit order to only execute as a maker order. If any of the order quantity takes offers available on the orderbook, the entire Post Only order is canceled.
Time-in-Force Order options are available for Limit Orders. The default is GTC.
Good till Cancel (GTC). An order placed on the order book stays active until cancelled, filled or expired. The default GTC expiration time is 90 days.
Immediate or Cancel (IOC). An IOC order is a taker-only order; it immediately fills as much order quantity as possible and cancels any quantity unfilled. No order is placed in the order book.
Fill or Kill (FOK). An FOK order is a taker-only order; it immediately either fills completely or is completely cancelled. No order is placed in the order book. This order type is useful for traders looking to trade large quantities, without affecting both the market price and their average trade execution price.
Every order must be cryptographically signed at creation. After orders are matched by the off-chain order matching engine, their respective signatures are sent to the smart contracts alongside the data of the trade. The signatures are verified before executing trades for the counterparties.
Signing an Order. All orders and order cancellation requests must be individually cryptographically signed.
Canceling An Order. Canceling an unfilled open order removes it from the order book and any freed up Margin
is moved back to the trader's Free Collateral
. After removing from the order book, the server will call the smart-contract-level cancel()
method. The contract verifies the signature on the cancel request and marks the order as canceled. From then on, any attempt to trade against a canceled order will fail.
Self-trade protection
If a trader completely or partially fills their own order, the self-traded order quantity is cancelled and the signatures are invalidated on-chain.