Reversion Solver

The Reversion Solver is the second solver in development by the Haiko team. It combines an on-chain market making strategy with an off-chain zkML model (developed in partnership with Giza) to place liquidity that automatically follows the price of an asset, capturing fees on mean reversion to the trend.

It is inspired by Maverick Protocol's Left and Right modes and enables liquidity provision in both volatile and stable market conditions. Unlike Maverick, the Reversion Solver automates the choice of mode for users using the results of the trend classification model.

Architecture

The Reversion Solver operates on an off-chain trend classification model (which ingests historical prices to classify the current trend between Up, Down or Ranging) to place countervailing liquidity positions in the Haiko AMM, capturing fees on reversion to the trend.

Positions automatically follow the price of an asset, updated on either single or double-sided price action depending on the prevailing trend.

The end-to-end flow for a position update is roughly as follows:

  1. Off-chain zkML model receives new price data and reruns trend classification

  2. Trend classification result is generated off-chain, then proven and trustlessly updated on-chain via Giza Agents and the Herodotus Cairo Verifier

  3. Positions are updated on the next swap

Trend Classification

Trend classification model: https://github.com/haiko-xyz/trend-classifier

The trend classification model uses gradient descent to classify the current trend.

It takes in historical OHLC price data to fit support and resistance trend lines over a lookback period. The trend line fit is optimised using gradient descent to minimise the sum of squared errors. The slope of the trend line is then used to classify the market at each tick.

This section is WIP and will continue to be updated in due course.

Last updated