Step-by-step visual explanation
Setting things up
Before launching your customized Kandel strategy, you will be asked to set specific input parameters. For more information, you can refer to the Parameters description table, as well as the Choosing parameters section.
Based on the selected price range, the price grid is constructed using a geometric progression. The Min and Max prices of the user inputs are the limits of the grid.
The increments are calculated using a key metric called ratio (of the geometric progression). Kandel starts from the Min price, all the way up to the Max price. By default, the ratio is 1%.
In this example, the user selected an ETH/USDC trading pair.
Based on the selected amount of initial liquidity to be deposited, Kandel draws the volume distribution (i.e. the initial volume at each price point).
In the example of a uniform volume distribution, the user's liquidity is spread evenly throughout the price grid.
For this explanation, we are conveniently using a 1 ETH allocation for each increment. If based on our parameters, our Kandel would create a price grid of 10 points, for example, then we would use 10 ETH in total (1 ETH * 10 price points).
Populating Bids and Asks
Afterwards, the Kandel strategy contract populates the price grid by posting offers:
- Bids are posted from min price to mid price (current price)
- Asks are on the other side of the book, from mid price to max price
Bid is taken
Reposting liquidity as an Ask
The received amount of base tokens (ETH) is used to post a dual offer at a step size k=1 above. This is automatically handled by Kandel, it is part of its trading behaviour.
Since the volume objective at the relevant index is 1 ETH, all the received liquidity is used to populate corresponding ask. Our Kandel just received 1 ETH (previous Bid), and is using it all to repost an offer, an Ask (called dual offer).
Ask is taken
Inversely to the bid example, when an ask is taken, the Kandel strategy contract sends the corresponding amount of base tokens (ETH) and receives a corresponding amount of quote tokens (USDC).
Reposting liquidity as an Bid
The received amount of quote tokens (USDC) is used to post a dual offer step size k=1 below.
In our example:
- We just received 1,300 USDC for sending 1 ETH through our ask
- Previously, we sent 1,287 USDC and received 1 ETH through our bid
- The compounding rate is 100%
Therefore, 100% of the spread (or 13 USDC) is reinvested into the strategy. A new bid at k=1 steps below is reposted, and offers 1,300 USDC for 1.01 ETH.
- Profit = 1,300 USDC - 1,287 USDC = 13 USDC
- 13 / 1300 = 0.01 = 1%
- i.e. we made a 1% profit on the spread
- Kandel will repost our bid to offer 1,287+13 USDC for 1*1.01 ETH, reinvesting the 1% profit we just made
Another Ask is taken
When another ask is taken, once again Kandel sends the corresponding amount of base tokens (ETH) and receives a corresponding amount of quote tokens (USDC).
Reposting liquidity as a Bid #2
Similarly to our previous bid, the received amount of quote tokens (USDC) is used to post a dual offer step size k=1 below.
If an ask was to be taken next, the profit from the spread would be reinvested into the strategy.