POST /backtest
Run a backtest for Aave lending and borrowing strategies.Request Body
User ID for the backtest
Starting timestamp (Unix epoch seconds)
Number of simulation steps to run
Initial token balances. Map of token ID to amount (e18 string format)Example:
{"1": "10000000000000000000"} for 10 ETHToken symbol to ID mappingExample:
{"ETH": 1, "USDC": 2}Protocol identifiers
aave_id(string, optional): Aave protocol IDlido_id(string, optional): Lido protocol IDuniswap_id(string, optional): Uniswap protocol ID
Price data configuration. Must include
kind field with one of:constant: Fixed pricessimulated: GBM-based price simulationhistorical: Real historical price data
Strategy configuration. Must include
kind field with one of:aave_supply_only: Simple supply strategyaave_supply_borrow_once: Supply and borrow oncelido_stake_wrap_supply: Stake ETH with Lido, wrap to wstETH, supply to Aaveaave_leverage_band: Automated leverage band controller
Optional interest rates configuration
variable_borrow_rates: Map of token symbol to rate per tick (RAY format)supply_rates: Optional supply rates
Optional simulation parameters
gas_price_gwei(integer): Gas price in gweigas_token(integer): Token ID for gas payments (default: 1 for ETH)on_shortfall(string): Policy when user cannot pay gas - “reject_tx” or “allow_debt”
Response
Array of snapshots at each simulation step
Timestamp
Simulation step number
Total Aave deposit value (e18 format)
Total Aave debt value (e18 format)
Health factor in basis points
Net portfolio value (e18 format)
Gas costs for this step in USD
Backtest summary statistics
Total number of ticks executed
Minimum health factor (basis points)
Maximum health factor (basis points)
Maximum drawdown (e18 format)
Final net value (e18 format)
Initial net value (e18 format)
Total profit/loss (e18 format, can be negative)
Annualized volatility
Sharpe ratio
Sortino ratio
Total return percentage
Annual percentage rate
Annual percentage yield
Number of winning periods
Number of losing periods
Win rate percentage
Total gas costs in USD
Example Request
Example Response
POST /backtest/uniswap
Run a backtest for Uniswap liquidity provision strategies.Request Body
User ID for the backtest
Starting timestamp (Unix epoch seconds)
Ending timestamp (Unix epoch seconds)
Number of simulation steps
Initial token balances. Map of token ID to amount (u128)
Token symbol to ID mapping
Uniswap pool configuration
pool_address(string): Pool contract addresstoken0(integer): First token IDtoken1(integer): Second token IDfee_tier(integer): Fee tier (e.g., 500, 3000)tick_spacing(integer): Tick spacing
Strategy configuration. Must include
kind field with one of:simple_market_maker: Basic liquidity provisionconcentrated_liquidity: V3-style concentrated liquidityv4_hook_strategy: V4 hook testingbunni_hook: Bunni protocol hookskyber_hook: Kyber DMM hooks
Market data source configuration. Must include
kind field:mock: Simulated market datasubgraph: Historical subgraph data
Optional simulation parameters (gas configuration)
Response
Array of snapshots at each step with detailed market data and position info
Uniswap backtest summary
Total ticks executed
Initial portfolio value in USD
Final portfolio value in USD
Total return percentage
Annualized return
Maximum drawdown percentage
Total fees earned in USD
Total impermanent loss in USD
Sharpe ratio
Sortino ratio
Calmar ratio
Number of rebalances executed
Total gas costs in USD
Net profit after all costs
Detailed performance metrics including win rate, profit factor, APY, and trade statistics
Detailed results for each simulation step
Whether the backtest completed successfully
Status message