Posts

🔥 State of Technology Update — Order Types 🔥

avatar of @defire
25
@defire
·
·
0 views
·
3 min read

Overview

This is the second in a series of posts which will keep you updated on the state of technology development of the deFIRE products. The topic of this piece is centered around the mechanics of the order types (Market, Limit, Stop Loss) and their interactions with the wider crypto-ecosystem.

General Order Flow

The important part to understand how orders work in the deFIRE system is to be aware of the flow from ‘Main’, to ‘Order Modules’, to ‘Pool Handlers’, to the exterior ‘Pool Handlers’. This flow is the path your orders will take when you decide to buy and sell assets through deFIRE!

Orders will originate from the Main Smart contract, being either a Limit/Stop Loss/Market order for a specific token pairing. Those orders are then distributed to the aforementioned Order Contracts to be executed downstream via our DEX handlers on the DEX with the best prices for the supplied asset.

As an example, say you supply the contract with ADA and you want to swap for AGIX, which happens to be listed on multiple DEXs like OccamX/SundaeSwap/MinSwap, and additionally you want to place a market order for the AGIX token. The Main Contract will take your supplied ADA, record it, send it to the Market Order Module which will then connect with the DEX handler and find the best price across the various DEXs to swap your ADA for some AGIX!

Order Types

  • Market Order

The most original and basic order type currently out on the market, users will swap and have their order executed at the current market prices for the tokens. The downside of this order is that the user does not have direct control of the price that they sell or are filled at, they simply get whatever price is available at the time of the trade, but they get it instantly on command. These trades should be executed when the assets are stable in relation to each other, as volatile and fast moving price changes could result in slippage returning the user an unexpected amount of tokens either under or over what the user may have originally tried to swap for.

  • Limit Order

The logic of the limit order is to buy a crypto asset at no more than a specific price, or to sell a crypto asset at no less than a specific price (or better for either direction). This gives the trader control over the price at which the trade is executed, however, the order may never be filled/executed. Limit orders are used when the trader wishes to have control over the order price but the trade off is they lose certainty of execution. A limit order may be partially filled and users could be given control on partial fill percentage. Common additional constraints: fill or kill (FOK) and all or none (AON). FOK orders are either filled completely or cancelled, while AON orders stipulate that the order must be filled with the entire number of token specified, or not filled at all. If it is not filled, it is still held on the order book for later execution.

  • Stop Loss Order

The logic of the stop loss order is that it considers orders to buy/sell a crypto asset once the price reaches a specified price, known as the stop price. Traders generally use a buy-stop order to limit a loss or to protect a profit on a crypto asset that they have sold short, and they use a sell–stop order to limit a loss or to protect a profit on a token that they own. When the stop price is reached, and the stop order then becomes a market order, the trade will be executed immediately, but not necessarily at or near the stop price, particularly when the order is placed into a fast-moving market, or if there is insufficient liquidity available relative to the size of the order the user may then incur slippage on their asset as mentioned in the ‘Market Order’ section.

In subsequent posts we will talk more about the internal architecture of deFIRE’s trading system, the backend modules and other modules that comprise deFIRE’s infrastructure.

Official Social Media

Website
Telegram Community Telegram Channel
Twitter
Medium
Reddit
Instagram

Posted Using LeoFinance Beta