Aggregates price data from Stellar's Classic Order Book (SDEX) and AMM Liquidity Pools into a single, unified API.
What Horizon doesn't do: Horizon's /trade_aggregations only covers SDEX. AMM pool prices (derived from reserve ratios) are not aggregated anywhere. Lens fills this gap.
| Method | Path | Description |
|---|---|---|
| GET | /price/:assetA/:assetB |
Current VWAP, 24h volume, best route |
| GET | /price/:assetA/:assetB/route?amount=1000 |
Best execution route for a given amount |
| GET | /price/:assetA/:assetB/history?window=1h |
OHLCV history (1m, 5m, 1h, 24h) |
| GET | /pools |
Active AMM pools being watched |
| GET | /pairs |
Watched trading pairs |
| GET | /status |
Indexer health |
Available at /graphql with GraphiQL IDE at /graphiql.
query {
getPrice(assetA: "XLM", assetB: "USDC") {
price
bestRoute
vwap1h
volume24h
priceChange24h
}
getBestRoute(assetA: "XLM", assetB: "USDC", amount: 500) {
route
sdexPrice
ammPrice
estimatedOutput
slippagePct
recommendation
}
}# 1. Start PostgreSQL + Redis
docker-compose up -d
# 2. Install dependencies
npm install
# 3. Copy env
cp .env.example .env
# 4. Push database schema
npm run db:push
# 5. Start dev server
npm run dev- Runtime: Node.js 20 + TypeScript
- API: Fastify + Mercurius (GraphQL)
- Database: PostgreSQL + TimescaleDB
- Cache: Redis
- Queue: BullMQ
- Stellar: @stellar/stellar-sdk