Liquidity Modules
Liquidity modules are plug-and-play addons for Hydro Relayers that instantly fill orderbooks and bootstrap liquidity with minimial effort.
Getting Started With Hydro Liquidity Modules
We currently have two primary forms of liquidity modules available for Hydro Relayers. We will be continuously refining these and adding more options - if you have any requests/suggestions on these, please reach out on our Relayer Slack Channel.
Determining Which Liquidity Module To Use
A trading pair can be broken down into two categories:
- The pair has no liquidity on existing marketplaces (or very little)
- The pair has good liquidity on existing marketplaces
If the trading pair is not liquid on any other marketplaces (typical in newer markets), liquidity can be bootstrapped through the Hydro AMM Bot Liquidity Module. This module deploys an algorithmic trading bot which performs "Constant Product Market Making" (e.g. the Uniswap model).
If the asset is liquid somewhere else, the Constant Product Method might not be as sustainable under volatile market conditions. Instead, in this case you have the potential to funnel that existing liquidity into your Hydro Relayer through what we refer to as "liquidity bridges".
Constant Product Market Making
Github Repository: https://github.com/HydroProtocol/amm-bots
The Constant Product Market Making bot generates a full orderbook based on a pre-determined initial price for a market. Every transaction that occurs on this market will adjust the prices of the market:
- Buying large amounts of the base token will increase the price
- Selling large amounts of the base token will decrease the price
A typical Constant Market Making model has a continuous price curve. This bot discretizes the continuous price curve and creates a number of limit orders to simulate the curve. The orderbook will appear to be static, but every trade will shift the market accordingly.
Pros:
- Extremely easy to setup
- Creates a full orderbook that shifts appropriately under buy/sell demand
- Perfect for long-tail tokens or newer markets
Cons:
- Requires tokens for both sides of the market (base and quote token)
- Vulnerable to arbitrage if the trading pair is traded heavily elsewhere
- Not ideal on popular trading pairs
This repository is setup to run naturally on the Hydro Dex Scaffold. For detailed usage instructions, check the amm-bots repository.
Liquidity Bridges - Mirroring Liquidity From Existing Sources
Popular trading pairs have existing sources of liquidity on other exchanges. In the current state of the ecosystem, the majority of liquidity tends to exist on centralized exchanges.
Fortunately, it's possible to channel this existing liquidity into your Hydro Relayer through automated trading bots and order mirroring. This is a technique commonly used by centralized exchanges that launch their own decentralized exchanges (examples: bitfinex/ethfinex, coinbase/paradex, etc.).
For Hydro Relayers, the general concept is that you can setup orders that almost identically mirror that of an exchange that has good liquidity (with a slight increase in spread to account for fees). Whenever an order is executed on your Relayer, you can instantly balance in out by making the corresponding order on the platform with good liquidity.
Historically, setting this up would require a significant time input to create/manage your own bot. You would have to fully integrate with multiple exchange API's and program your own bot. Fortunately, there are easier options available now.
Hummingbot was created for this explicit purpose. Hummingbot is a configurable automated trading bot that can be setup to do cross-exchange arbitrage. It is also already configured to work with the standard Hydro Relayer API. You can effectively mirror Binance's liquidity using hummingbot.
Note that we will be adding more automated steps for setting up liquidity bridges to our SDK in time.