GitPedia

Demeter

Demeter is a blockchain backtesting tool that supports trading types such as swaps, liquidity provider, lending, and options. It is compatible with markets including Uniswap, GMX, Aave, Deribit, and Squeeth.

From zelos-alpha·Updated June 15, 2026·View on GitHub·

Demeter is a backtesting framework for Defi of ethereum-like chain. It allows investors test their strategy and evaluate return rate with real market data. At present, demeter support backtest on uniswap v3 and aave v3 The project is written primarily in Python, distributed under the MIT License license, first published in 2022. Key topics include: aave, backtesting, defi, deribit, ethereum.

Latest release: v1.3.0
April 29, 2026View Changelog →

Demeter

Introduction

Demeter is a backtesting framework for Defi of ethereum-like chain. It allows investors test their strategy and evaluate
return rate with real market data. At present, demeter support backtest on uniswap v3 and aave v3

Demeter's style is borrowed from backtrader, allowing developers of traditional financial engineering to get started
quickly.

Demeter has good testing accuracy, it can calculate income and net worth close to the real world. Demeter has also made
some optimizations for backtesting speed.

Features

  • backtrader style: Demeter's design style and operation process are modeled after Backtrader, making it easier for
    users to get started.
  • broker/market: Demeter draws on the concepts of brokers and markets from real markets. Broker holds the asset and
    provide various market to invest. Demeter supports a variety of markets, including uniswap and aave, and more market
    is coming. Users can test strategies for investing in multiple markets.
  • Data feeding: Backtesting requires real market data. Thanks to the transparency of blockchain, those data can be
    fetched from event logs of transaction. We provided demeter-fetch to
    do this work. It can download event logs from rpc or google big query and decode them to market data.
  • Accuracy: In the design of demeter, accuracy is an important consideration. In order to provide higher accuracy,
    the core calculations of uniswap and aave do not follow theoretical formulas, but draw on the code of the contract.
    This allows demeter to have higher calculations accuracy.
  • Rich output: In order to allow users to evaluate strategies intuitively, demeter provides a wealth of output,
    including asset changes in accounts and position adjustment records. With the indicator calculation module, users can
    choose the best investment strategy.
  • Indicators: Besides the simulation of defi market, demeter also provides various indicators. Those indicators will
    help user to decide how and when to make transactions, and evaluate their strategies.
  • Rich interface in strategy: In strategy, demeter provide a lot of interface, which help user to write strategy
    freely. With triggers, user can make transactions a specified time or price. With on_bar and after_bar function, user
    can check and calculate on each iteration. Initialize and finalize function are also provided.
  • Price: Price is the key to calculate token net value, since it will be used among markets. We separate price from
    market.data. Prices can be downloaded from coingecko and some centralized market.
  • Decimal places: You can define decimal places to avoid long decimal.

Markets

  • Uniswap V3 As a popular automated market maker, uniswap is famous for its complexity. To raise fund
    utilization rate, uniswap add tick range to position, which makes it difficult to estimate the return on investment.
    Demeter provides comprehensive calculation and evaluation tools to help users test the returns of various positions.
  • Aave V3 Aave is a popular liquidity protocol which allow user to deposit and borrow assets. Through supply
    asset to aave, user can earn interest, and borrowing allow user to earn extra profit or to hedging price changes.
    Demeter support supply/repay/borrow/repay/liquidation transactions on aave.
  • Deribit
  • Sequeeth
  • GMX V1
  • GMX V2
  • Boros (experimental)

Boros Experimental Support

This repository now includes experimental Boros support under
demeter.boros_v4.

Two sample workflows are available:

  • samples/strategy-example/72_boros_funding_convergence.py
    • Two-leg Boros spread backtest using two Boros implied-rate markets
  • samples/strategy-example/77_boros_convergence_with_perp_funding.py
    • Four-leg style experimental backtest that keeps the two Boros legs and
      mounts Binance and Hyperliquid funding histories as synthetic perp
      cashflows

The Boros implementation currently supports:

  • raw Boros event loading from orderbook/*.csv and liquidity/*.csv
  • Boros settlement recovery using latestFTime, floating_index, and
    fee_index
  • taker-only replay with TX_REPLAY_BEST_EXEC
  • higher-fidelity event replay with EVENT_REPLAY_FULL_PROTO
  • result exports including trade, settlement, spread, and perp funding ledgers

Mode selection and current Boros engine comparison are documented in:

  • samples/boros-backtest-modes/README.md
  • samples/boros-backtest-modes/CURRENT_COMPARISON.md
  • samples/boros-backtest-modes/RELEASE_GUIDANCE.md

Current limitations:

  • no standalone perp market yet
  • no maker queue simulation
  • no full liquidation or external margin model
  • still marked experimental rather than protocol-perfect

Conclusion

Our vision is to become the best Defi backtesting tool, you can check
our release_note for the latest updates.

Please go to the website for a full description

Donation

If you like this project and would like to support our development, please consider donating. Your support will help us
continue to improve and expand our features, thank you for your generosity!

ChainAddress
Bitcoinbc1pex0d2rkpsgmwauahauxlthakqz27c0ura75zjqhmj0vet07mu65swur90n
Ethereum0x41FE1FFdF42121496b2e67287962E25Bb75dAA2D
Polygon0x41FE1FFdF42121496b2e67287962E25Bb75dAA2D
TRONTM3DG2TzEvyv9Amv9oBHJA7Q2URJZWPFmz
SolanaDHS2KwrNbeHEfSnfiEMNYB15dWv9qnbMSYJtayAWCw2s
BSC0x41FE1FFdF42121496b2e67287962E25Bb75dAA2D

Contributors

Showing top 3 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from zelos-alpha/demeter via the GitHub API.Last fetched: 6/15/2026