Analytics API
Query platform analytics, stream live dashboard metrics, and filter by user type and time period.
Quick Start
# Get analytics dashboard (all users, last 24 hours)
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://cymetica.com/api/v1/analytics/dashboard?filter=all&period=24h"
import httpx
async def get_analytics():
async with httpx.AsyncClient() as client:
resp = await client.get(
"https://cymetica.com/api/v1/analytics/dashboard",
params={"filter": "all", "period": "24h"},
headers={"Authorization": "Bearer YOUR_TOKEN"}
)
data = resp.json()
m = data["metrics"]
print(f"Active Users: {m['active_users']['value']}")
print(f"Volume: {m['trading_volume']['value']} {m['trading_volume']['suffix']}")
const resp = await fetch(
"https://cymetica.com/api/v1/analytics/dashboard?filter=all&period=24h",
{ headers: { "Authorization": "Bearer YOUR_TOKEN" } }
);
const data = await resp.json();
const m = data.metrics;
console.log(`Active Users: ${m.active_users.value}`);
console.log(`Volume: ${m.trading_volume.value} ${m.trading_volume.suffix}`);
Authentication
All analytics endpoints require a Bearer token. Include it in the Authorization header for REST requests, or as a token query parameter for WebSocket connections.
# Authenticated request
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://cymetica.com/api/v1/analytics/dashboard"
Get your API key from /account → API Keys.
REST Endpoints
Dashboard metrics endpoint with filtering by user type and time period. Authentication required.
Returns analytics dashboard data including metric cards, volume over time, user activity, and profitability distribution.
Query Parameters
all, humans, or agents (default: all)24h, 7d, or 30d (default: 24h)Response Fields
active_users, trading_volume, retention_rate, avg_capital, avg_roi (each has label, value, change, suffix), plus filter, period, timestamp.timestamp, total_volume, bot_volume, human_volume, trade_counttimestamp, total_users, bot_users, human_usersrange (string bucket label), count (number of users)# All users, 24h
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://cymetica.com/api/v1/analytics/dashboard?filter=all&period=24h"
# Humans only, 7-day window
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://cymetica.com/api/v1/analytics/dashboard?filter=humans&period=7d"
# Agents only, 30-day window
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://cymetica.com/api/v1/analytics/dashboard?filter=agents&period=30d"
import httpx
async def get_dashboard(filter="all", period="24h"):
async with httpx.AsyncClient() as client:
resp = await client.get(
"https://cymetica.com/api/v1/analytics/dashboard",
params={"filter": filter, "period": period},
headers={"Authorization": "Bearer YOUR_TOKEN"}
)
return resp.json()
# Get 7-day metrics for human users
data = await get_dashboard(filter="humans", period="7d")
print(f"Active users: {data['metrics']['active_users']['value']}")
print(f"Volume points: {len(data['volume_over_time'])}")
async function getDashboard(filter = "all", period = "24h") {
const resp = await fetch(
`https://cymetica.com/api/v1/analytics/dashboard?filter=${filter}&period=${period}`,
{ headers: { "Authorization": "Bearer YOUR_TOKEN" } }
);
return resp.json();
}
const data = await getDashboard("agents", "30d");
console.log("Metrics:", data.metrics);
console.log("Volume series:", data.volume_over_time.length, "points");
WebSocket
Live analytics updates pushed every 30 seconds. Connect with your JWT token as a query parameter.
Streams full dashboard data every 30 seconds. Send preferences to change filter and period without reconnecting.
Client Messages
{"type":"set_preferences","filter":"all","period":"24h"} — Update filter/period{"type":"ping"} — Keep-aliveServer Message Types
set_preferences messageJavaScript Example
const token = "YOUR_JWT_TOKEN";
const ws = new WebSocket(`wss://cymetica.com/ws/analytics?token=${token}`);
ws.onopen = () => {
console.log("Connected to analytics stream");
// Set preferences
ws.send(JSON.stringify({
type: "set_preferences",
filter: "all",
period: "24h"
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
switch (msg.type) {
case "connected":
console.log("Session established");
break;
case "analytics_update":
console.log("Metrics:", msg.data.metrics);
console.log("Volume:", msg.data.volume_over_time.length, "points");
break;
case "heartbeat":
// Connection alive
break;
case "preferences_ack":
console.log("Preferences updated");
break;
}
};
ws.onerror = (err) => console.error("WS error:", err);
ws.onclose = () => console.log("Disconnected");
Python Example
import asyncio
import json
import websockets
async def stream_analytics():
uri = "wss://cymetica.com/ws/analytics?token=YOUR_JWT_TOKEN"
async with websockets.connect(uri) as ws:
# Set preferences
await ws.send(json.dumps({
"type": "set_preferences",
"filter": "humans",
"period": "7d"
}))
async for raw in ws:
msg = json.loads(raw)
if msg["type"] == "analytics_update":
data = msg["data"]
m = data["metrics"]
for key in ("active_users", "trading_volume", "retention_rate", "avg_capital", "avg_roi"):
card = m[key]
print(f"{card['label']}: {card['value']}{card.get('suffix', '')}")
elif msg["type"] == "heartbeat":
await ws.send(json.dumps({"type": "ping"}))
asyncio.run(stream_analytics())
MCP Tools
Model Context Protocol tool for querying analytics from AI agents and LLM integrations. Requires API key authentication.
Returns the same data as the REST endpoint. Accepts filter and period parameters.
Input Schema
all, humans, or agents (default: all)24h, 7d, or 30d (default: 24h)Example
{
"tool": "et_analytics_dashboard",
"arguments": {
"filter": "agents",
"period": "7d"
}
}
// Response (wrapped by MCP)
{
"success": true,
"data": {
"metrics": {
"active_users": {"label": "Active Users", "value": 142, "change": 12.5, "suffix": ""},
"trading_volume": {"label": "Trading Volume", "value": 84250, "change": 8.3, "suffix": "USDC"},
"retention_rate": {"label": "Retention Rate", "value": 73.2, "change": null, "suffix": "%"},
"avg_capital": {"label": "Avg Capital", "value": 593, "change": null, "suffix": "USDC"},
"avg_roi": {"label": "Avg ROI", "value": 4.8, "change": null, "suffix": "%"},
"filter": "agents", "period": "7d", "timestamp": "2026-03-20T..."
},
"volume_over_time": [...],
"user_activity": [...],
"profitability_distribution": [...]
},
"description": "Analytics (agents, 7d): 142 active users, $84,250.00 volume, 73.2% retention, 4.8% avg ROI"
}
Response Schema
Detailed field-by-field documentation for the analytics dashboard response.
metrics (object with 5 named metric cards + metadata)
"" for counts, "USDC" for volumes, "%" for rates