Skip to main content

Introduction

The ANK API is a REST service built with Axum that provides backtesting capabilities for DeFi strategies. It supports Aave lending/borrowing strategies and Uniswap liquidity provision strategies with comprehensive performance analytics.

Base URL

The API server runs on:
http://0.0.0.0:8080

Starting the Server

From the apps/api directory:
cargo run
The server will start and listen on port 8080. You should see:
listening on 0.0.0.0:8080

Available Endpoints

Health Check

  • GET / - Server health check
    • Returns: "ank-api OK"

Backtesting

  • POST /backtest - Run Aave strategy backtest
  • POST /backtest/uniswap - Run Uniswap strategy backtest
See Backtesting for detailed documentation.

Price Feeds

  • GET /prices/{symbol} - Get current or historical price for an asset
  • GET /prices/{symbol}/historical - Get OHLC historical price data range
  • GET /prices/assets - List all available assets
See Price Feeds for detailed documentation.

Response Format

All endpoints return JSON responses. Successful responses include the relevant data structure, while errors return appropriate HTTP status codes:
  • 400 Bad Request - Invalid input parameters
  • 500 Internal Server Error - Server-side errors

Error Handling

Error responses follow this format:
{
  "error": "bad request: Invalid asset symbol"
}
or
{
  "error": "internal error: Failed to execute backtest"
}

Quick Start Example

# Check server health
curl http://localhost:8080/

# Get current ETH price
curl http://localhost:8080/prices/ETH

# List available assets
curl http://localhost:8080/prices/assets

Build docs developers (and LLMs) love