A developer-friendly market data processing API for Injective that provides computed & derived market metrics.

A developer-friendly market data processing API for Injective that provides computed & derived market metrics.
This API processes raw Injective market data into actionable intelligence including:
Market Summary (price, volume, spread, depth)
Liquidity Metrics (bid/ask depth, imbalance, concentration)
Volatility Metrics (price change, volatility index, anomaly detection)
Health Indicators (liquidity, stability, activity scores)
This API fetches real-time data from Injective Exchange API:
Markets: All trading pairs available on Injective
Orderbook: Real-time buy/sell orders
Trades: Recent trade history
Candles: OHLCV price history
/exchange/v1/markets - List all markets
/exchange/v1/orderbook/{market_id} - Orderbook snapshot
/exchange/v1/trades/{market_id} - Recent trades
/exchange/v1/orderbook/candles/{market_id} - Price history
Configure mainnet or testnet via environment variable:
INJECTIVE_ENVIRONMENT=mainnet # or "testnet"Mainnet: https://api.injective.exchange
Testnet: https://testnet.api.injective.exchange
Copy .env.example to .env and configure:
cp .env.example .envEdit .env with your settings:
# Injective API Configuration
INJECTIVE_ENVIRONMENT=mainnet # "mainnet" or "testnet"
INJECTIVE_API_BASE_URL=https://api.injective.exchange
INJECTIVE_API_TIMEOUT=30
INJECTIVE_USE_REAL_DATA=true # Set to false to use mock data for testing
# Application Configuration
APP_NAME=Injective Market Intelligence API
APP_VERSION=1.0.0
APP_HOST=0.0.0.0
APP_PORT=8000
DEBUG=false
# Optional: Redis Cache
REDIS_URL=redis://localhost:6379/0
CACHE_TTL=60uvicorn app.main:app --reloadThe API will be available at http://localhost:8000
Interactive API documentation available at:
Swagger UI: http://localhost:8000/docs
ReDoc: http://localhost:8000/redoc
GET /healthGET /api/v1/marketsLists all available markets on Injective Exchange.
Response:
{
"markets": [
{
"market_id": "0x...",
"ticker": "INJ/USDT",
"base_denom": "inj",
"quote_denom": "usdt"
}
],
"count": 1
}GET /api/v1/markets/{market_id}/summaryGet comprehensive market overview with price, volume, spread, and depth.
Response:
{
"market_id": "0x...",
"market_name": "INJ/USDT",
"price": "42.50",
"price_change_24h": "+5.2%",
"volume_24h": "12500000",
"spread": "0.02%",
"bid_depth": "500000",
"ask_depth": "480000"
}GET /api/v1/markets/{market_id}/liquidityGet detailed liquidity metrics including depth, imbalance, and concentration.
Response:
{
"market_id": "0x...",
"bid_depth_top10": "500000",
"ask_depth_top10": "480000",
"depth_imbalance_pct": "2.04%",
"liquidity_concentration": "0.65",
"spread_bps": 20
}GET /api/v1/markets/{market_id}/volatilityGet volatility indicators including price change and volatility index.
Response:
{
"market_id": "0x...",
"price_change_24h": "+5.2%",
"volatility_index": 1.5,
"abnormal_movement_detected": false
}GET /api/v1/markets/{market_id}/healthGet comprehensive health scoring with individual component metrics.
Response:
{
"market_id": "0x...",
"liquidity_score": 85,
"stability_score": 72,
"activity_score": 90,
"overall_health": 82,
"rating": "A"
}app/
├── api/routes/ # API endpoints
├── services/ # Business logic & data fetching
│ ├── injective_raw.py # Injective API client
│ ├── injective_norm.py # Data normalizer
│ └── market_service.py # Service orchestration
├── computations/ # Metric calculations
│ ├── liquidity.py # Liquidity metrics
│ ├── volatility.py # Volatility metrics
│ └── health.py # Health scoring
├── models/ # Pydantic schemas
└── core/ # Configuration
Injective Exchange API (REST)
↓
Raw Data Fetcher (injective_raw.py)
↓
Data Normalizer (injective_norm.py)
↓
Computation Engine (volatility, liquidity, health)
↓
REST API (FastAPI)
For testing without real API calls, set:
INJECTIVE_USE_REAL_DATA=falseThis will use mock data instead of making real API calls.
This project follows standard Python conventions with type hints.
# Build and run with Docker Compose
docker-compose up -dThis starts:
FastAPI application on port 8000
Redis for caching (optional)
Background worker for data refresh (optional)
This project is submitted for the Ninja API Forge hackathon.
Category: Computation/Derived Data API
Features:
✅ Developer-friendly REST API
✅ Real-time Injective data integration
✅ Computed market metrics
✅ Clean, extensible architecture
✅ Docker deployment ready
MIT License