Uniswap V3 & Hummingbot

hummingbot
Hummingbot Blog
Published in
3 min readJun 22, 2021

This blog was originally posted on the Hummingbot blog on May 31, 2021.

At the beginning of this month, the DeFi space received some great news: Uniswap V3 would be launched. This was exciting news for anyone that is exploring the possibilities Decentralized Finance apps are creating.

What caught our attention on the Uniswap V3 announcement was the possibility to create different positions at different price ranges, making it resonate a lot with how traditional market-making strategies work.

Last week we were pretty happy to show what can be done on the first version of the strategy. If you are more of a video person, make sure to check the live stream recording to see what we have achieved so far.

On the other hand, if you prefer to read a written guide, stay with me here to learn how the strategy works, start using it, and the plans for improvement.

How the Uniswap V3 strategy works

DISCLAIMER: The strategy is still in development, so use it at your own risk since some major bugs that our team still isn’t aware of might exist. None of the examples provided in this article are financial advice, so do your own research before doing any trade operation.

The first thing you need to understand is that Uniswap V3 is about managing different liquidity positions.

The first implementation of our hummingbot strategy aims to simulate the usual behavior of the `pure_market_making` strategy: Create opposing buy and sell orders around the mid-price, looking to capture the spread as the price moves around a specific range.

If you want to provide liquidity on Uniswap V3 manually, you just have to enter the lower and upper price range you want to provide liquidity and forget about it. As long as the market is trading between these prices, you will receive trading fees proportional to your provided liquidity.

Be aware of transaction gas costs. For example, if you set the starting position range too small, the bot might end up removing and adding liquidity positions too often, and it might end up eating your profits.

How to start using the Uniswap V3 strategy

As I mentioned before, our team is still working on improving this strategy, so if you decide to try it out, be aware of the possibility of undiscovered bugs and behaviors. Because of that, you won’t find it on the latest (0.39) hummingbot version.

But if you want to try it out and experiment with it, you have to run hummingbot from source on the `feat/uniswap_v3` branch.

To install from source, you can find the proper instructions on our documentation page about installation.

You will also need the gateway API running from source, so make sure you also follow the instructions on our documentation page.

To change branches after pulling the source code, run the following command to change to the correct branch:

git checkout feat/uniswap_v3

After configuring and starting hummingbot on the right branch, you will be able to see the new strategy when entering the create command:

Uniswap V3 Strategy creation

To proper configure the strategy, you will have to enter the following configurations (The exact questions asked might change in the future):

While this is the first version of the strategy, we have set some plans on how to improve it:

  • Track positions “profit”
  • Use positions profit to decide when to move a position
  • Use volatility to set better price ranges
  • Create and manage more than two liquidity positions
  • Use better ways to distribute the liquidity on different price ranges

We also value our community feedback, so if you have any idea or suggestions on how we could make this strategy better, feel free to reach our team on our Discord or create a new issue on our Githubpage.

Happy trading!

--

--

hummingbot
Hummingbot Blog

hummingbot, an #opensource #crypto #marketmakingbot. Decentralize #marketmaking: hummingbot.io