In traditional markets, a market maker is a company or an individual that quotes both a buy and a sell price in a financial instrument held in inventory, hoping to make a profit on the bid-offer spread. Due to the unique nature of crypto markets granting everyone direct access to exchange order books, anyone can be a market maker.
How a market maker makes money
The difference between the price at which a market maker is willing to buy an asset (the bid price) and the price that he/she is willing to sell it (the ask price) is known as the market maker spread, or bid-ask spread. Supposing that equal amounts of buy and sell orders arrive and the price never changes, this is the amount that the market maker will gain on each round trip (minus exchange fees).
How the strategy works
Once the bot is started, it will immediately place two limit orders - a buy order below the mid price, and a sell order above the mid price. The distance from the mid price is configurable in the bot parameters along with the exchange fee. In an ideal scenario, both orders are filled, resulting in a small profit. The bot will then place a new set of orders to repeat this cycle continuously.
The mid price is calculated as follows:
Mid Price = (Best Bid + Best Ask) / 2
The buy and sell prices are calculated as:
Buy Price = (Mid Price * (1 - Buy Price Threshold - Maker Fee)
Sell Price = (Mid Price * (1 + Sell Price Threshold + Maker Fee)
Note: Buy and Sell prices are automatically adjusted to account for the exchange fee.
Both buy and sell orders are filled, and profit is realized. The bot will then wait a specified period of time (Wait Time Before Next Orders) and place a new set of orders. This process repeats continuously as long as the bot remains active.
Neither orders are filled because there is little trading activity or the price keeps oscillating between our orders. After the short while (Wait Time To Cancel And Replace Orders), the bot will cancel both orders and issue a new set of limit orders per the latest values from the order book.
Only buy order is filled and the price starts trending downwards, leaving the sell order unexecuted/open. In this case, the lower the price moves, the greater the potential loss as we're stuck holding on to inventory we just bought but didn't sell. If the price drop to or below the stop-loss price, a market order to sell the held quantity is issued. Outstanding sell open order is cancelled and a new set of buy and sell orders are issued per current prices in the order book. The stop-loss features insures that we are not stuck holding a losing position for too long.
Only sell order is filled and the price starts trending upwards, leaving the buy order unexecuted/open. In this case, the higher the price moves away from our sell price, the more expensive it will be to buy back the same quantity later. If the price increases to or above our stop-loss threshold, a market-buy is issued to buy back the sold quantity. Outstanding sell open order is cancelled and a new set of buy and sell orders are issued per current prices in the order book.
The goal of this strategy is to complete as many buy/sell cycles as possible, making a small profit after covering our exchange fees. For this reason, it is ideal to trade markets where the bid-ask spread is wide (0.05%+) and there is sufficient trading volume. Popular markets such as BTC/USD(T) are not ideal as generally there is a lot of competition between market makers, resulting in tighter spreads and therefore less opportunity for others. One way to find ideal pairs to trade is to look at available markets for a coin on CoinGecko.
Secondly, whichever pair you choose to trade, be sure that you are comfortable holding both the base and the quote asset for the duration that the bot is running.
And finally, this bot is not limited to trading a range-bound market, we can trade uptrends or downtrends just as easily. Simply adjust the buy/sell thresholds to skew in the direction of the trend in order to maximize the chances of both orders getting filled.
Sufficient balance is required for both the base asset and the quote asset. For example, if you wish to trade BAT/USDT, with the order size 100, be sure that you have at least 100 BAT (for the sell order) and at least 17 USDT (for the buy order, at 0.17 price per unit). Insufficient balance in either asset will result in the exchange rejecting your orders, which will be shown in the logs. We recommend having a minimum of 10% available for each side as a buffer.
Configuration Name: A name/label for this configuration. You can copy and modify a configuration to run this bot on multiple markets simultaneously.
Exchange: The exchange to run this bot on. This bot cannot be backtested as it leverages a real-time strategy based on order book data.
Market: The pair (symbol) to trade. Quadency's standard convention is Base/Quote.
Amount Per Order: The amount you wish to use for buy and sell orders. In the example above, the bot will place a limit order to buy 50 XTZ and sell 50 XTZ.
Maker Fee: The maker fee (for limit orders) charged by your exchange. This fee is used to adjust the buy/sell prices to ensure the fee is covered before profit is made.
Buy Threshold: The distance from mid price to place a buy order. Enter percent value in decimal format.
Sell Threshold: The distance from mid price to place a sell order. Enter percent value in decimal format.
Wait Time Before Next Orders: Enter the number of minutes to wait before submitting next set of orders after both current orders are filled or stop-loss has been triggered.
Wait Time To Cancel and Replace Orders: Enter the number of minutes to wait before cancelling both open orders and submitting a new set of orders.
Stop-Loss Threshold: The distance from last executed order to trigger stop-loss. Note - when a stop-loss threshold is breached, a market order is sent to the exchange. A stop-loss can be to sell (if bought) and buy (if sold).
The value you use for stop-loss is more of an art than science: wider stop-loss values increase chances of the position to close in profit, however the the risk of holding on to a losing position (greater drawdown) is higher. Conversely, tighter stop-loss could mean frequent, but small losses, which can add up quickly. So it's best to test your settings with small amounts across different markets before settling on something.