A market order is an order to be executed immediately at current market price.
Market is the simplest and most basic order type. It tells the order management system (OMS) that the user is willing to take whatever price is available in the market. Upon detecting a market order, the matching engine (ME) will match it with available opposite orders in the order book. If the market order is a buy order, the ME will match it with existing sell orders in the order book until the buy order is fully filled. QUOINE currently uses a fill-and-kill approach if ME is unable to completely fill the order due to lack of sellers. This means the remaining portion of the order that is not filled is cancelled.
When entering a market order users must provide the following parameters/inputs:
- Order Size -- How much of the asset the user will be buying/selling
- Side -- Whether the user is buying or selling. Buy order indicates the user wishes to buy the asset.
A limit order is an order to be executed when market price hits a limit. This limit must be better than market price at the time the order is entered. Limit orders are not always executed as there is always a chance that market price never hits the limit.
Limit is also a basic order type. As opposed to a market order, a limit order allows the user to specify the maximum price he is willing to pay in case of a buy order or the minimum price he is willing to sell at in case of a sell order. Users must provide the following inputs to the OMS:
- Order Size
- Price that users is willing the buy at or sell for.
Upon receiving a limit order instruction, the ME will normally insert the order in the order book at the level indicated by the price. If the order side is ‘buy’ and the price is higher than the best ask, the ME will match with orders in the order book up to the order price provided by the user. If the order is not fully filled (i.e. order size is larger than available inventory up until that price), the order is left in the order book at the price level, essentially becoming the best bid. A similar approach is applied to sell orders if the sell price is below the best bid in the order book.
A stop order is an order to be executed when market price hits a limit. This limit must be worse than market price at the time the order is entered. Similar to limit orders, stop orders are not always executed as there is always a chance that market price never hits the limit.
At the basic level, stop orders are used when you want to "stop" your loss from getting too much, or to limit your loss. For example, you need to sell 1 BTC but don't have time to monitor the market. Market price at the time is $3000. So you set a limit order at $3100 for when price moves in your favor, and then a stop order at $2950 for when price moves against you. When the price hits $2950, the stop order will be executed as a market order.
For more advanced trading, stop orders are used by traders to take advantage of price breaks and price momentum in a given direction, allowing users to buy if the price is moving up or sell if price is moving down. The parameters required from the user are as follows:
- Direction specified by buy or sell. Buy Stop vs. Sell Stop order.
- Price at which order is triggered. Order is not triggered immediately and it’s only sent to the ME once this price is detected.
Placing a stop buy order @ $3,000 for 10 BTC would be the equivalent of given the OMS the following directions:
- Buy 10 BTC IF price of BTC raises to or above $3,000. This implies that the market price at the time the order is entered is below $3,000.
QUOINE OMS currently implements stop orders using market orders, ie. a market buy order is triggered once it detects the $3,000 price (in the above example) is crossed.
A sell stop order works in a similar fashion as a buy stop order but in the opposite direction. If the trader expects a break on the price on the down side, he can then place a sell stop order. A sell stop order for 10 BTC @ $2,500 gives the OMS the following instructions:
- Sell 10 BTC IF price falls to or below $2,500. This implies that the market price is above $2,500 at the time the order instructions are sent to the OMS.
If market price is above the price specified for a buy stop order, normally systems should reject these requests. Some systems allow these with a warning to the user. These orders are executed right away as market orders.
In margin trading, a stop order is exactly like a market order.
Trailing stop order
A trailing stop order is a stop order with a limit that "trails" after market price. They are normally used by traders to lock in profits of an existing position once the position PnL has gone into positive territory.
In a buy trailing stop order, limit is set at a fixed number above market ask with a "trail" amount. When market ask falls, limit will also fall ("trailing" after market ask) by the trail amount. When market ask rises, limit does not change, and the order is executed as a market order when the limit is hit.
Vice versa, in a sell trailing stop order, limit is set at a fixed number below market bid with a "trail" amount. When market bid rises, limit will also rise ("trailing" after market bid) by the trail amount. When market bid falls, limit does not change, and the order is executed as a market order when the limit is hit.
In margin trading, a trailing stop order is exactly like a market order, and the "trailing stop" has no meaning.
Let’s look at an example. A trader has bought 10 BTC at $3,000 and the price has now moved to $3,500, which means he’s currently sitting on a nice profit of $500 per BTC or $5,000. He feels the market will continue to go up but there is no guarantee so he wants to lock in his profits at $3,400 or $400 per BTC. In other words, he is willing to forgo $100 of his current $500 profit. He could do this by placing a simple stop sell at $3,400 for 10 BTC. This would allow him to keep $400 of the profits. But what if the price keeps going up? He would like his stop to also move accordingly so he can lock in higher than $400 profit and he’s still willing to forgo $100. So if price moves to $3,550, he would like his stop moved to $3,450 and so on. He could do this manually but then he would need to constantly monitor the market and manually adjust the stops, not a very feasible operation. This is where trailing stops come in. In this case, setting up a sell trailing stop with a distance of $100 would allow him to achieve just that. If price moves up, the stop adjusts keeping the $100 distance. If the price moves down, the stop does not move but it might get hit allowing him to take profits.