Skip to content

relayer-data-api v0.1.0 — Trading Data API Initial Release

Pre-release
Pre-release

Choose a tag to compare

@shanu516516 shanu516516 released this 22 Aug 19:45
· 96 commits to main since this release

📊 Relayer Data API v0.1.0 – First Developer Release

This is the initial release of the Twilight Relayer Data API, a specialized read-only JSON-RPC service that provides structured access to real-time and historical trading data from the Twilight Relayer ecosystem.

🎯 Purpose & Design

The Data API is architurally separated from order submission systems to ensure uninterrupted access to trading data even under high load. This design supports scalable data consumption by external clients including trading dashboards, analytics engines, and monitoring tools.

📈 Data Access Features

Real-Time Trading Data

  • Order Management: Open and historical order tracking
  • Account State: Real-time balance and margin state queries
  • Market Data: Live price feeds and funding rate information
  • PnL Analytics: Realized and unrealized profit/loss calculations

Historical Data & Analytics

  • Complete order history with filtering capabilities
  • Historical price data and market trends
  • Account balance evolution over time
  • Comprehensive trading performance metrics

🏗️ Architecture Components

Service Purpose Features
API Server JSON-RPC endpoint Query processing, data serialization
Archiver Data persistence Historical data management, indexing
Auth Server Access control Authentication, rate limiting
PostgreSQL Data storage Optimized schemas for trading data

🚀 Key Benefits

  • High Availability: Independent operation from order submission systems
  • Scalable Access: Designed for multiple concurrent data consumers
  • Performance Optimized: Efficient querying with PostgreSQL backend
  • Developer Friendly: Clean JSON-RPC interface with comprehensive data models
  • Production Ready: Docker deployment with environment configuration

🛠️ Quick Start

Docker Deployment (Recommended)

bash > # Build with SSH key for private repo access > DOCKER_BUILDKIT=1 docker build . -t relayer-api --build-arg SSH_KEY="$(cat ~/.ssh/build_key)" > docker-compose -f twilight-relayerAPI/docker-compose.yaml up -d >

Local Development

bash > # Install dependencies > sudo apt install libpq-dev > cargo install diesel_cli --no-default-features --features postgres > > # Start PostgreSQL > docker run --rm -ePOSTGRES_DATABASE=relayer -ePOSTGRES_USER=relayer -ePOSTGRES_PASSWORD=relayer -p 5432:5432 postgres > > # Run services > cargo run --release --bin archiver # Data archiver > cargo run --release --bin api # API server > cargo run --release --bin auth # Auth server >

📋 Environment Setup

  • Configure DATABASE_URL for PostgreSQL connection
  • Set up authentication credentials for secure access
  • Review .env.example file for service configuration

⚠️ Important Notes

  • Order Submission: Use the separate Relayer Order API for placing/canceling orders
  • Development Status: First release - expect API refinements in future versions
  • Testing: Run ./init_test_db.sh && cargo test for comprehensive testing

🔗 Ecosystem Integration

Designed to work seamlessly with:


Perfect for: Trading dashboards, market analysis tools, portfolio trackers, and any application requiring reliable access to Twilight Relayer trading data.