Using the Madjik API for ML
Historical time series as machine-learning features.
ML-ready data
- Historical time series per metric with intervals from
1mto1w value_normalized(0–100) alongside raw values — minimal preprocessing- Per-point
provenanceso you can train onlivedata 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_retropoints, and never train onforecastpoints 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
