Using Market Maker Bots on Decentralised Exchange: First Look

Take a sneak peak into a future DCRDEX feature. The market maker bots are in their initial development stage and should be used with extreme caution.

Using Market Maker Bots on Decentralised Exchange: First Look
Using Market Maker Bots on Decentralised Exchange: First Look

Let’s open dexc the same way we did last time. But this time we’re going to add a flag in the command line call --experimental.

This flag enables the market maker bots, but please note these are in their development stage and should be used with extreme caution. As the flag says, these features are experimental. If you’re not comfortable using tools that are not production-ready, remove the --experimental flag from the command line before proceeding.

Enter the following statement into the terminal, press enter and open dexc in your browser using the address provided:

./dexc —experimental

Remember, the terminal must remain open and running in the background. If the terminal is closed with active orders, this could cause the trade to fail and incur penalties.

For those new to DCRDEX, the best pair to currently experiment with is the DCR / LTC pair. The lot size is lower than all the other pairs. It has a fast settlement time and both coins have an easy to use native wallet.

One barrier to entry, is you need to have a small amount of DCR or BTC to pay the fidelity bond. Hopefully, in the not so distant future, Litecoin users will be able to pay this using LTC.

DCRDEX Active Trades

Setup some static orders

Let’s start by placing some static buy and sell orders on the DCR / LTC pair.

  • Select the price you’d like to buy or sell at
  • Select the quantity. For this pair, the size is in increments of 2dcr
  • Press the “place order button”
  • On the next page, check you are happy with the details of the trade
  • As an extra option, you can enable the advance trading features and increase the fee if necessary. This is especially useful if the blockchains you’re transacting with are congested.
  • If everything is as expected, enter your password and press the “Buy” button. The bid will be added to the order books.
  • On the markets page, rolling your mouse over the order will display an arrow on the chart.

I’ll also show this process from the sell side, so we have two static bids entered into the order books. Notice that the advanced options are now open by default. Once again, I’m going to increase the LTC fee and turn off the “pre size funds” option.

Setup market maker bots

Next, let's set up the maker maker bots, so we can trade more dynamically and take advantage of any moving market. Market Maker bots also help fill out the order books, as they are constantly adapting with market changes.

As said previously, this feature is still in development and should be used with caution.

Go to the hamburger menu, top right of the screen, and click on the “market maker” link.

You can open as many market maker bots as you like and have them running on any or all active markets.

To activate a new market maker bot, select the coins for the pair. Then enter the number of lots. On the DCR / LTC pair, each lot is 2 dcr.

Currently, any DCRDEX pair that doesn’t have an active pair on one of the listed exchanges doesn’t have access to the oracle feature. The oracle feature is not available for the DCR / LTC pair. Instead, the bot uses the “basis price” and moves accordingly.

Next, select the “show other settings” for the gap strategies. I’m no expert here, I mainly stick with the “Percentage plus” Strategy and tweak the percentage spread parameter. I’ve found that setting this greater than 1% (which is the default) and less than 3% from the spread can yield good results. Most of what I’m doing here is trial and error. I’m sure others will come up with better, more interesting combinations and creative solutions.

Initially, as the oracle doesn’t work, we’ll turn it off by reducing the “oracle weight” to zero. Then press the start button and enter your password. Your first mmbot is now active.

Your bot will appear on the right, under the “your programme” section. If you head over to the markets page, you’ll see an order has been placed on both sides of the order book. Approximately 1% from the spread on each side.

As these orders are overlapping another bot, let’s edit our bot. Head back to the market maker page and click the “configure” button on your program. This puts the bot in edit mode. Change the percentage spread, in this case, to 0.01 which is approximately 2% from the spread. You can move this number closer, but if the market moves considerably, you could find yourself on the losing end of a trade. Keep in mind, it’s not uncommon for a crypto market to move plus or minus 4% over a very short period of time. Once you’re happy, press the “update” button.

This will cancel your previous orders and update the order books with your new configuration.

Let’s create another market maker bot. Remember, we can have multiple bots on the same market, or we can have them on different markets. In this instance, we’ll stick with the DCR / LTC pair and add the bot approximately 3% from the spread with 2 lots on both sides of the trade.

As you can see, we’ve now got two bots working at the same time and if we head over to the markets page you’ll see the new bids being added to the order books.

Market maker bots can be edited, paused or retired at any point. Clicking the pause button will cancel the orders, but the bot will be available at a later point if you want to start it again. It will even be there if you close the software and come back at a later time. Which means you don’t need to continuously keep setting up the same bots.

Retiring the bot will remove it altogether. And, pressing the “configuration” button, lets you edit to your heart's content.

Completing a trade

One last thing before we finish, let’s complete a trade and watch the settlement process. For this example, I’m going to sell 2 lots of DCR using the “Market Order” tab. In previous examples, I’ve always used the “limit order” tab and generally prefer completing orders this way.

But as we’ll take an existing order, this method is just fine. Click the market order tab, press the “Sell DCR” button, enter your lot size and finally press the “Place order to sell DCR” button.

On the next page, check you are happy and select your preferred settings. Enter your password and press the “Sell DCR” button. Your order will be instantly filled and the settlement part of the process will start.

Head over to the settlement page to watch the transaction complete:

  • Because I’m the taker, I have to wait for the maker's “initialisation transaction” to be fully confirmed on the blockchain. On the LTC chain, this takes 5 block confirmations.
  • Next, the maker's “initialisation transaction” gets entered into the DCR blockchain, this also has to be fully confirmed before the swap can take place. On the Decred blockchain, this takes 3 block confirmations.
  • The redemption is the final part of the process, which happens simultaneously and completes the trade for both parties.
  • Funds will become available after one or two confirmations. When fully settled, the status turns from “Settling” to “Executed”.
  • The full on-chain settlement for this trade took less than an hour.

How much did this trade cost

DCRDEX is fully peer to peer and includes no trading fees or other value extraction methods, but there are mining fees to consider. To check how much this trade costed in mining fees, copy and paste the associated fees into a converter. In my case, I’ll use Coin Market Cap’s converter.

  • The DCR mining fees cost 0.00005020 DCR, which equals $0.000745
  • The LTC mining fees cost 0.00000286 LTC, which equals $0.000265
  • Total = $0.00110 (one tenth of a cent)

Closing DCRDEX

If this is the end of your trading session, and you want to close DCRDEX, first make sure you have no active trades, including bots. If you have active trades, wait for them to fully settle or cancel them if they are still in the order books. Bots need to be paused or retired from the market maker page.

Next, sign out of DCRDEX using the hamburger menu top right of the software. Then close the browser.

Finally, head over to your open terminal and on the active line, press Ctrl + c to stop dexc from running. Once the code confirms that the software has stopped, it’s safe to close the terminal. And you’re done.