React Router

API Reference

This document provides a detailed reference for the project's API.

Overview

The API provides real-time and historical pricing data for the indexed pools. It is built using the axum framework in Rust and provides a simple and efficient way to access the data stored in ClickHouse.

Authentication

All API endpoints require authentication. The authentication mechanism is implemented as a middleware that checks for a valid API key in the request headers.

Performance

The API is built on the high-performance axum web framework. Based on industry benchmarks and the simple nature of the API's endpoints, it is estimated that the API can handle 10,000 to 20,000 requests per second on appropriate hardware.

However, the actual performance can be influenced by several factors:

  • Hardware: The number of CPU cores, memory, and network infrastructure will significantly impact performance.
  • Database Performance: The performance of the ClickHouse database is a critical factor. A well-optimized database and efficient queries are essential for high throughput.
  • Network Latency: The latency between the API server and the ClickHouse database, as well as between the client and the API server, will affect the overall response time.
  • Request Mix: The performance may vary depending on the specific endpoints being called and the complexity of the queries.

For most use cases, the API should provide excellent performance and low latency.

Endpoints

Get Pool Pricing

This endpoint retrieves the 1-minute open prices for a given pool address.

  • URL: /v1/pricing/pools/:pool_address
  • Method: GET
  • URL Parameters:
    • pool_address (string, required): The base58-encoded public key of the pool.
  • Success Response:
    • Code: 200
    • Content:
      [
        {
          "open": 123.45
        },
        {
          "open": 123.46
        }
      ]
  • Error Response:
    • Code: 401 Unauthorized
    • Content: Unauthorized
    • Code: 500 Internal Server Error
    • Content: Internal server error

The endpoint returns an array of the last 100 1-minute open prices for the specified pool.

On this page