Git Product home page Git Product logo

rangetester's Introduction

Simple backtester for Uniswap v3 concentrated liquidity vs Uniswap v2 data.

Usage: node rangetester.js SYMBOL (eg. node rangetester.js MKR) – the input data for each pair has to be downloaded first using node importswaps.js POOL_ADDRESS to ./data/ directory (please create it first!).

Then define some parameters for test directly in script (see comments.)

It works like this:

  1. When "week" starts capital is allocated in middle of the range defined by top and bottom functions. Amplifier is calculated based on range.
  2. During the "week" fees are collected according to historical trades data. Only trades that fall into range are considered. Fees are calculated according to pool share and multiplied by amplifier.
  3. At the end of the "week" both tokens are taken out of pool (it will be a capital for the next week). Fees collected during week are added to the capital. Those rather cryptic numbers, eg. (-0.23%/-2.25%/1.78%) are: impermanent loss for the week (always a negative number) / week profit/loss excluding fees / week profit/loss including fees.

At the end of the backtest there are some numbers presented. Most of them are self-explanatory, but some are not. All numbers are in ETH not USD (unless it's explicitly specified)

VIR – Volume In Range (how much of total volume (V) was in range and generated fees) CVIR – it's VIR * amplifier VIR/V – how much % of volume was captured

Strategy impact – what was the impact of providing liquidity (this allows you to compare between pools disregarding change of token/ETH price)

rangetester's People

Contributors

reuptaken avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.