API Documentation

Complete reference for integrating Stratum into your trading infrastructure. Access real-time regime classifications, risk metrics, and market data through RESTful endpoints and WebSocket streaming.

Introduction

The Stratum API provides programmatic access to real-time market regime classifications, risk metrics, and trading signals across 112+ symbols including stocks, crypto, ETFs, and forex pairs.

All API endpoints return JSON responses and use standard HTTP response codes. The base URL for all requests is:

Base URL
https://api.mhm.com/v1

Authentication

All API requests require authentication using an API key. Include your API key in the request header:

example.sh
curl -H "X-API-Key: your_api_key_here" \ https://api.mhm.com/v1/regime/BTC-USD
auth.py
import requests headers = { "X-API-Key": "your_api_key_here" } response = requests.get( "https://api.mhm.com/v1/regime/BTC-USD", headers=headers )
Getting your API key
API keys are available to Pro and Enterprise plan subscribers. You can generate and manage your API keys from your account dashboard at https://app.mhm.com/settings/api

Rate Limits

API rate limits vary by subscription tier to ensure fair usage and system stability:

Plan Requests/Minute Requests/Day WebSocket Connections
Starter 10 1,000 N/A
Pro 60 50,000 5 concurrent
Enterprise 300 500,000 50 concurrent

Rate limit information is included in response headers:

Response Headers
X-RateLimit-Limit: 60 X-RateLimit-Remaining: 57 X-RateLimit-Reset: 1640995200

Error Handling

The API uses standard HTTP status codes. Error responses include a JSON body with details:

Error Response
{ "error": "invalid_symbol", "message": "Symbol 'XYZ' not found", "status": 404 }
Status Code Description
200 Success - Request completed successfully
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
404 Not Found - Symbol or resource not found
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Server-side error

API Endpoints

GET /regime/{symbol}

Get the current regime classification for a specific symbol. Returns the regime type (trending, ranging, or transition), confidence level, and recommended strategy.

Path Parameters

Parameter Type Description
symbol required string Symbol to query (e.g., BTC-USD, AAPL, SPY, EURUSD)

Example Request

request.sh
curl -H "X-API-Key: your_api_key_here" \ https://api.mhm.com/v1/regime/BTC-USD
regime.py
import requests headers = {"X-API-Key": "your_api_key_here"} response = requests.get( "https://api.mhm.com/v1/regime/BTC-USD", headers=headers ) data = response.json() print(data)

Response

200 OK
{ "symbol": "BTC-USD", "regime": "trending", "signal": "favorable", "confidence": 0.843, "volatility": "high", "strategy": "trend_following", "timestamp": "2025-11-28T14:32:18Z" }

Response Fields

Field Type Description
symbol string The requested symbol
regime string Current regime: "trending", "ranging", or "transition"
signal string Trade signal: "favorable", "unfavorable", or "caution"
confidence number Classification confidence (0.0 to 1.0)
volatility string Volatility level: "low", "medium", or "high"
strategy string Recommended strategy: "trend_following", "mean_reversion", or "reduce_risk"
timestamp string ISO 8601 timestamp of the classification
GET /regime/{symbol}/history

Get historical regime classifications for a symbol. Useful for backtesting and analyzing regime changes over time.

Path Parameters

Parameter Type Description
symbol required string Symbol to query

Query Parameters

Parameter Type Description
start_date string Start date in ISO 8601 format (default: 30 days ago)
end_date string End date in ISO 8601 format (default: now)
interval string Data interval: "1h", "4h", "1d" (default: "1d")

Example Request

request.sh
curl -H "X-API-Key: your_api_key_here" \ "https://api.mhm.com/v1/regime/BTC-USD/history?interval=1d&start_date=2025-10-01"
history.py
import requests params = { "interval": "1d", "start_date": "2025-10-01" } response = requests.get( "https://api.mhm.com/v1/regime/BTC-USD/history", headers={"X-API-Key": "your_api_key_here"}, params=params )

Response

200 OK
{ "symbol": "BTC-USD", "interval": "1d", "data": [ { "timestamp": "2025-10-01T00:00:00Z", "regime": "ranging", "signal": "caution", "confidence": 0.678 }, { "timestamp": "2025-10-02T00:00:00Z", "regime": "trending", "signal": "favorable", "confidence": 0.821 } ] }
GET /risk/{symbol}

Get risk metrics and position sizing recommendations based on current market conditions and regime classification.

Example Request

request.sh
curl -H "X-API-Key: your_api_key_here" \ https://api.mhm.com/v1/risk/BTC-USD
risk.py
import requests response = requests.get( "https://api.mhm.com/v1/risk/BTC-USD", headers={"X-API-Key": "your_api_key_here"} )

Response

200 OK
{ "symbol": "BTC-USD", "volatility": 0.0342, "atr": 2847.32, "position_size_suggestion": 0.75, "stop_loss_suggestion": 0.035, "risk_level": "moderate", "timestamp": "2025-11-28T14:32:18Z" }
GET /alerts/{symbol}

Get active alerts and notifications for a symbol, including regime changes and risk warnings.

Response

200 OK
{ "symbol": "BTC-USD", "alerts": [ { "type": "regime_change", "severity": "high", "message": "Regime changed from ranging to trending", "timestamp": "2025-11-28T12:15:00Z" }, { "type": "volatility_spike", "severity": "medium", "message": "Volatility increased 45% in last hour", "timestamp": "2025-11-28T13:42:00Z" } ] }
GET /price/{symbol}

Get current price and basic market data for a symbol.

Response

200 OK
{ "symbol": "BTC-USD", "price": 96847.32, "change_24h": 3.42, "volume_24h": 28472834921, "high_24h": 97234.18, "low_24h": 94582.47, "timestamp": "2025-11-28T14:32:18Z" }
GET /symbols

Get a list of all available symbols with their current regime classifications.

Query Parameters

Parameter Type Description
category string Filter by category: "crypto", "stocks", "etf", "forex"
regime string Filter by regime: "trending", "ranging", "transition"

Response

200 OK
{ "total": 112, "symbols": [ { "symbol": "BTC-USD", "name": "Bitcoin", "category": "crypto", "regime": "trending", "price": 96847.32 }, { "symbol": "AAPL", "name": "Apple Inc.", "category": "stocks", "regime": "ranging", "price": 187.42 } ] }

WebSocket API

Subscribe to real-time regime updates via WebSocket for instant notifications when market conditions change.

Enterprise Feature
WebSocket streaming is available for Pro and Enterprise plans only. Upgrade your plan to access real-time streaming.

Connection

WebSocket URL
wss://api.mhm.com/v1/ws/{symbol}?api_key=your_api_key_here

Example: Python WebSocket Client

websocket_client.py
import websocket import json def on_message(ws, message): data = json.loads(message) print(f"Regime Update: {data}") def on_error(ws, error): print(f"Error: {error}") def on_close(ws, close_status_code, close_msg): print("Connection closed") def on_open(ws): print("Connected to Stratum WebSocket") api_key = "your_api_key_here" symbol = "BTC-USD" url = f"wss://api.mhm.com/v1/ws/{symbol}?api_key={api_key}" ws = websocket.WebSocketApp( url, on_open=on_open, on_message=on_message, on_error=on_error, on_close=on_close ) ws.run_forever()

Message Format

The server sends JSON messages whenever the regime classification changes or at regular intervals (configurable):

WebSocket Message
{ "type": "regime_update", "symbol": "BTC-USD", "regime": "trending", "signal": "favorable", "confidence": 0.843, "changed": true, "previous_regime": "ranging", "timestamp": "2025-11-28T14:32:18Z" }

Subscription Control

Send commands to the WebSocket to control your subscription:

Subscribe to Additional Symbol
{ "action": "subscribe", "symbol": "ETH-USD" }
Unsubscribe from Symbol
{ "action": "unsubscribe", "symbol": "BTC-USD" }