Simple project that provides a REST API that calculates the average of the mid-prices from the order books of three cryptocurrency exchanges: Binance, Huobi, and Kraken. The API integrates real-time data from Binance via WebSocket and fetches data from the Huobi and Kraken REST APIs on demand.
npm install
npm start
# Run all tests (unit + integration)
npm test
# Run only unit tests
npm run test:unit
# Run only e2e tests
npm run test:e2e
The deployed API is accessible at:
https://priceindex-1.onrender.com/api/average-midprice
- 200 OK
{
"averageMidPrice": 99507.51,
"sources": {
"binance": 99499.995,
"huobi": 99500.385,
"kraken": 99522.15
}
}Use this endpoint to retrieve the calculated average mid-price from Binance, Huobi, and Kraken.
- Order Book: Binance Order Book
- API Documentation: Binance WebSocket Market Streams
- Order Book: Huobi Order Book
- API Documentation: Huobi Market Depth API
- Order Book: Kraken Order Book
- API Documentation: Kraken Public Market Data
The API is deployed on Render and is available at: https://priceindex-1.onrender.com/api/average-midprice