/dopex-ssov

Primary LanguageSolidity

SSOV V3 Backtesting

Dopex SSOV backtesting tool built with Foundry for testing SSOV V3 contracts.

Setup

Backtests

This project is an extension of this project where I aimed to simplify the process for running backtests. The process to run a collection of backtests now involves:

  • Prepare a CSV containing transaction details (epoch, blockNumber, strikeIndex, amount and txType), save it to the analysis folder here. Note: deposit and purchase transactions set via txType equal to 0 and 1, respectively.
  • In the command line, run:
forge test --match-test test_runStrategies --ffi
  • This requires the use of the Foundry ffi cheatcode. Read about it here.
  • After successfully running the test, the simulated ouptuts are saved in an output.csv file in the analysis folder. Here is an example output file.

Error Plots

The error rate of this tool was assessed by comparing real SSOV transactions against simulated ones. This was conducted for:

  • DPX weekly calls SSOV V3 (contract: 0x10FD85ec522C245a63239b9FC64434F58520bd1f).
  • Epochs: 1-9.
  • Writer transactions (deposit -> withdraw).

Results for the collateral token withdrawn and amount of DPX rewards are summarised in diagrams below.

Error collateral token (DPX) amount withdrawn Collateral token withdrawn

Error DPX reward amounts DPX reward amounts