CarmineOptions / derisk-research

MIT License
6 stars 26 forks source link

ODHack: Compute available liquidity at Haiko for any given token at any given price level #96

Closed lukaspetrasek closed 1 month ago

lukaspetrasek commented 4 months ago

"Compute available liquidity at Haiko for any given token at any given price level.

Let's choose, for example, the STRK-USDC pair and assume the current price is 2 USDC per 1 STRK. We're interested in the amounts of USDC that we'll be able to swap for STRK at Haiko while not pushing the price by more than 5% in a scenario where the STRK price falls to, e.g., 1.9 USDC, 1.8 USDC, ... 1 USDC, etc.

In order to achieve this, we want to transform the CLMM liquidity into an orderbook-like structure, i.e. bids: [(price_0, quantity_0), (price_1, quantity_1), ...] and asks: [(price_0, quantity_0), (price_1, quantity_1), ...].

The existing implementation for Ekubo should be followed.

Steps: 1) Get CLMM data for Haiko pools. 2) Transform the data to an orderbook-like structure. 3) Save the data in a database. 4) Load the stored data and for any given price (use price as a parameter), compute how much of the token A (parameter) can be swapped for token B (pa while not pushing the price further by more than 5% (parameter)."

Definition of Done The code functions well, is documented and tested. The transformation is correct, ideally experimentaly verified by the Haiko app. The transformed data is being saved in a database.

vibenedict commented 4 months ago

Hi, can i jump on this issue

faurdent commented 4 months ago

Hi, I would like to take this task. I have already worked with MySwap. I will start with fetch data from on-chain, analyzed them, calculate and transform them to asks and bids data structure and store it to db

lukaspetrasek commented 4 months ago

Hi, assigning @faurdent , because this task is complex and they provided a better description of the approach.

@faurdent Let me know if everything is clear and whether you'll be working on the issue. If you have any questions, please ask here. Since this task is quite complex, we can even schedule an introductory call. What is you TG handler please? 🙏🏼

Consider joining our TG group. See also our contributor guidelines.