Madjik API documentation

Using the Madjik API for ML

Historical time series as machine-learning features.

ML-ready data

  • Historical time series per metric with intervals from 1m to 1w
  • value_normalized (0–100) alongside raw values — minimal preprocessing
  • Per-point provenance so you can train on live data only, or weight backfills differently — critical for avoiding hindsight leakage (see Data provenance)
  • History depth depends on your plan (see limits)

Example: building a feature frame

import pandas as pd
import requests

BASE = "https://api.madjik.io/v1"
headers = {"X-API-Key": "YOUR_API_KEY"}

def fetch_series(metric_id, interval="1h"):
    r = requests.get(f"{BASE}/metrics/{metric_id}/timeseries",
                     params={"interval": interval}, headers=headers)
    r.raise_for_status()
    df = pd.DataFrame(r.json()["data"])
    df["timestamp"] = pd.to_datetime(df["timestamp"])
    return df.set_index("timestamp")[["value_normalized", "provenance"]] \
             .rename(columns={"value_normalized": metric_id})

features = pd.concat([fetch_series(m)[m] for m in
                      ["M50014", "M50015", "M50016", "M50030"]], axis=1)

Best practices

  • Filter by provenance for training — exclude or down-weight backfill_model_retro points, and never train on forecast points as if they were observations
  • Time-series cross-validation — crypto regimes shift
  • Handle gaps honestly — absent points are deliberately absent, not zeros
  • Retrain regularly — market structure changes