DeFi on Hive: Automated Market Making for the Masses

In the past month or so, I've made a 48% return on a small investment of 400 HIVE and a 24.8% return on 250 STEEM. Not bad, considering this was an experimental test of a new product just launched as part of Hive Engine & Steem Engine.

I'm the lead smart contract developer for the Engine platform, and responsible for building out the back-end that runs our new DSwap Market Maker. Like any good developer, I like to eat my own dog food. Meaning I actually use the products I build on a daily basis, seeing what works & what doesn't, trying out new ideas, and just generally making sure nothing is gonna explode.

After a month of such testing, early results are in, and if this doesn't get you excited to jump out of bed in the morning, I don't know what will!

Automated market making, you say? Whazzat?

Revolutionary, ground-breaking stuff, is what it is. For a bit of background, you can refer to these earlier posts by @aggroed :

Basically, DSwap gives you a hassle free way to setup your very own market maker bot on Hive Engine (and soon on Steem Engine as well). All you have to do is click a few buttons and fill out some settings on a web form. That's it. This is extremely powerful. Up until now, such bots were the sole domain of elite techies & programmers who have the special skills needed to code and run them.

But not anymore.

Now anyone with a Hive account can have their own market maker running in about 5 minutes. No technical skills needed.

Wowsa! Show me the money!

Gladly. When you sign into DSwap for the first time, you'll have to register for the market maker, which requires a small fee in BEE (Hive Engine's native utility token). After registering, you'll be presented with your account dashboard which looks something like this (I already have the market maker configured to place orders for me on several markets):

Basically, you can choose which Hive Engine token symbol you want the market maker to trade for you (or more than one, if you upgrade to premium service). Then you answer some questions to tell the market maker how it should place orders:

Then the market maker will start automatically placing orders for you. Every 10 minutes (or every 5 minutes for premium service), it will analyze the state of the order books and decide if it needs to adjust any orders. It will continue doing this, 24 hours a day, 7 days a week, 365 days a year, until you tell it to stop.

Now you can sit back, relax, and watch your profits pile up.

That sounds too easy... what's the catch?

Well... the devil is in the details, as they say. Let me be clear: this is not a totally passive, set-it-and-forget-it type of investment. It requires hands on, active management. You need to monitor the performance of the market maker, tweak settings every now & then as market conditions change, and be ready to step in if something goes wrong. During periods of rapid price movement, for example, it can be easy for too much one-sided trading to result in losses for the market maker, so at such times you'll want to disable the bot and wait for the turmoil to pass.

Performance and returns will vary considerably depending on the characteristics of individual markets, and how you've configured the market maker. It is entirely possible you will lose money. Making a profit in this game is one part science and one part art.

Have you got what it takes?

Umm... maybe?

Don't despair! Even if you're not a savvy market expert, there are some basic rules of thumb you can use to minimize the chance of losses and maximize your potential for gain. Here are some tips distilled from my month's worth of experimenting:

Tips For Success

  1. Start small: add just a single market at first, ideally this should be for a favorite token that you know & love (my very first market was SIM). Have the market maker place small orders, no more than 50 SWAP.HIVE on the buy side and an equivalent amount of tokens on the sell side.

  2. When in doubt, go with the defaults: if you're not sure about a particular market setting, just go with the default. The defaults are fairly sensible in most cases, and you can always change them later.

  3. Ignore small orders: The order books are often filled to the brim with puny, negligible orders, typically from other bots. You want to set the market maker to ignore such orders so they don't interfere with your market making. That's this question down at the bottom of the settings page:

  4. Target markets with large spreads: the bigger the spread (defined as the difference between highest bid price and lowest ask price), the bigger your potential for profit. Small spreads result in smaller profits and bigger risk.

  5. Target markets with high volume: the flip side of rule #4 is that markets with big spreads are often ones that are thinly traded, with low volume. Which is very boring. High volume is the bread & butter of good market making, you want lots of buys & sells sloshing money back & forth to hit your orders. So the Holy Grail is to find a market that has both large spreads and large trading volume. Otherwise, go for one or the other.

  6. Target markets with stable prices: rapid price movement is the enemy of automated market making. Volatility is welcome, as long as the price stays in a well defined range. You want a price chart that looks like this:

    Not one that looks like this:

  7. Use a dedicated account: don't market make with your main Hive account that has 50,000 SWAP.HIVE (unless you really want to risk that much money all at once). Setup a new, dedicated alt account that you will only use for DSwap. Put a small amount of SWAP.HIVE on it to start with, and add more over time as you get confident with the market maker. This allows you to control your maximum possible losses.

  8. Premium service is absolutely worth it: you'll need premium service to unlock the market maker bot's full power for you. It offers many advantages over basic service, such as the ability to use more powerful order placing strategies and place orders on multiple markets. That said, starting off with basic service is best. See how it goes for a week or two, get comfortable with things, and if you can stay profitable then think about ramping up your market making with a premium upgrade. It'll pay for itself in the long run.

So how exactly did you make 48% in a month?

Well, mostly by following the above tips.

I started small, with just a single token symbol. I monitored that market for a few weeks before adding any more, checking my orders once or twice a day and adjusting settings if I didn't like how orders were being placed. One key thing I watched was the spread: if my orders were too close together, I modified settings to ensure they got placed a little farther back in the order book.

Once I gained confidence in the market maker and saw profits starting to slowly accumulate, I upgraded to premium service and added 3 more markets. My idea was to keep all my money working for me, making sure most of my capital was spread out in active orders and not just sitting idle in my account doing nothing. I did leave some reserves of SWAP.HIVE though, so I'd have a little cushion if multiple buys got hit in a short period of time.

As profits continue to accumulate and I notice more capital sitting in my account unused, I'll probably add more markets. But it's important not to grow too fast; I won't add new markets unless I have enough excess SWAP.HIVE to support them. I also like to keep order sizes roughly the same across all markets, so my capital is more or less evenly distributed.

Once I reach a certain point, I will begin increasing order sizes so I can make profits faster. However I'm not there yet. I still keep my orders around 50 SWAP.HIVE in size, same as I did at the very beginning a month ago.

Did you take advantage of any particular market patterns?

You betcha! Over the past several days, DEC has been a great cash cow for me. It's a market making dream right now! Here's what the depth chart looks like as of this writing:

This kind of valley pattern is quite favorable. Notice the huge walls on the buy & sell sides, with a fairly large gap between them filled with small orders. In this situation, you can use the market maker bot's wall nestling premium order strategy to place orders snugly up against the big walls on both sides (around the circled areas, say).

Then you simply let trades pogo back & forth between the walls, hitting your orders along the way and giving you nice juicy profits as the market maker buys low & sells higher, over and over again. Which is exactly what I've been doing.

I'm excited! Where can I learn more?

Feel free to pop into the Engine Discord and ask around. Someone is usually around to point you in the right direction, and for market maker related queries you can ping me directly (I can't guarantee a timely response though as I'm often very busy).

If you need technical assistance it's better to raise a support ticket. Our support staff typically respond within 24-48 hours on business days.

Technical Resources

Did I mention the smart contracts that power the market maker are completely open source? You can find them here:

https://github.com/hive-engine/steemsmartcontracts/tree/hive-engine/contracts

  • botcontroller.js - smart contract for managing user account data, registering / upgrading accounts, enabling / disabling markets, etc
  • marketmaker.js - smart contract that runs the bot's order placing logic

Comprehensive technical documentation is available here:

https://github.com/hive-engine/steemsmartcontracts-wiki/blob/master/Bot-Controller-Contract.md

Even if you're not technically minded, it's worth skimming through the docs as it describes how the market maker functions in detail, what all the settings mean, and gives a point by point comparison of basic vs premium service features.

If you are a developer, the docs will teach you how to control the market maker bot using custom json transactions. That's useful if you want to manage the market maker by script or wish to program a whole new front-end as an alternative to the DSwap web site.


So head on over to DSwap today and get started. Have fun diving down the rabbit hole!

https://dswap.trade/


image.png


Images in this post are mostly screen shots I took myself. DSwap logo available from the Engine team, title image is licensed for public use from Pixabay.

H2
H3
H4
3 columns
2 columns
1 column
41 Comments
Ecency