API Documentation
WebSocket connections, REST endpoints for market data and analytics, and Groq AI integration routes.
WebSocket Connection
Real-Time Market Data Stream
Live order book updates, trades, and ticker data via persistent WebSocket connection.
// Bybit WebSocket - Live Order Book & Trades
wss://stream.bybit.com/v5/public/linear
// Subscribe to BTC order book (depth 50)
{
"op": "subscribe",
"args": ["orderbook.50.BTCUSDT"]
}
// Subscribe to live trades
{
"op": "subscribe",
"args": ["publicTrade.BTCUSDT"]
}Supported streams: orderbook.{1|50|200}.{symbol}, publicTrade.{symbol}, tickers.{symbol}, kline.{interval}.{symbol}
REST Endpoints — Market Data
Market Data & Analytics
Fetch tickers, klines, order books, and historical data via REST API.
/v5/market/tickersReal-time ticker data for all symbols or specific category
?category=linear&symbol=BTCUSDT/v5/market/klineHistorical kline/candlestick data with configurable intervals
?category=linear&symbol=BTCUSDT&interval=15&limit=200/v5/market/orderbookOrder book depth snapshot (1, 50, 200 levels)
?category=linear&symbol=BTCUSDT&limit=50/v5/market/recent-tradeRecent public trades for a symbol
?category=linear&symbol=BTCUSDT&limit=50/v5/market/funding/historyHistorical funding rate data
?category=linear&symbol=BTCUSDT&limit=100// Bybit REST API Base
https://api.bybit.com
// Example: Fetch BTC ticker
fetch('https://api.bybit.com/v5/market/tickers?category=linear&symbol=BTCUSDT')
.then(res => res.json())
.then(data => console.log(data.result.list[0]))Groq AI Integration
AI-Powered Market Analysis
Natural language queries for market insights, powered by Groq LLM inference.
// POST /api/ai/chat
// Headers: Content-Type: application/json
// Request body
{
"messages": [
{ "role": "user", "content": "Analyze BTC funding rates and suggest entry points" }
],
"context": "trading" // Options: trading, technical, sentiment, general
}
// Response (streaming)
{
"id": "chatcmpl-xxx",
"choices": [{
"delta": { "content": "Based on current funding rates..." },
"finish_reason": null
}]
}context: "trading"Position sizing, risk management, entry/exit analysis
context: "technical"Chart patterns, indicators, support/resistance levels
context: "sentiment"Market sentiment, social signals, news analysis
context: "general"Crypto education, terminology, market mechanics
Integration Summary
8 API Integrations
Bybit, CoinGecko, TradingView, Groq, CoinCap, CryptoCompare, Fear & Greed, News API
Real-Time Data
WebSocket streams for order book, trades, tickers with <100ms latency
6 AI Contexts
Trading, technical, sentiment, general, portfolio, risk analysis modes