🔮Madjik docs

SDKs

Python and TypeScript clients, webhook receivers and Google Sheets functions: the same data as the API and MCP, with the limits handled for you.

The SDKs sit next to the REST API and the MCP server: same data, same plans, same keys. They handle retries and rate limits, page through your plan's history limits, and verify webhooks, so you write the analysis, not the plumbing.

InterfaceUse it for
REST APIAny language, direct control, webhooks and exports
MCPAI assistants and agents that call Madjik as a tool
SDKsPython and TypeScript apps, notebooks and backtests, and spreadsheets

Install

Python 3.9+

pip install https://docs.madjik.io/sdk/madjik-0.2.0-py3-none-any.whl
pip install "madjik[pandas] @ https://docs.madjik.io/sdk/madjik-0.2.0-py3-none-any.whl"    # with DataFrame output

TypeScript / JavaScript (Node 18+, zero dependencies)

npm install https://docs.madjik.io/sdk/madjik-0.2.0.tgz

Google Sheets

Download madjik-sheets-Code.gs, paste it into Extensions → Apps Script in your sheet, reload, then Madjik → Set API key.

These files are served from docs.madjik.io (MIT licence) and will also be listed on PyPI and npm, after which the commands shorten to pip install madjik and npm install madjik. Verify what you download against the SHA-256 values below.

Python

from madjik import Madjik
mj = Madjik()                                    # reads MADJIK_API_KEY
mj.metrics(as_dataframe=True)                    # every metric in ONE call
mj.definition("M10004")                          # inputs, lookback, version (no key needed)

# history at scale: a dry run first, then a cached, quota-aware panel
mj.plan_calls(["M10004", "M10005"], start="2026-09-01", interval="1h")
df = mj.panel(["M10004", "M10005"], start="2026-09-01", interval="1h", live_only=True, lag=1)

panel() pages through your plan's points-per-call limit, paces calls to the speed limit, caches finished history chunks on disk (an interrupted or quota-limited run resumes the next day), and returns one UTC-indexed table. live_only=True gives point-in-time history and lag=1 shifts values so a value is only used after its timestamp. join_asof() attaches prices without look-ahead. A 429 waits for Retry-After and retries.

TypeScript / JavaScript

import { Madjik } from "madjik";
const mj = new Madjik();
const all = await mj.metrics();                                                        // every metric, one call
const ts = await mj.timeseries("M10004", { start: "2026-09-01T00:00:00Z", liveOnly: true });

Typed, Node 18+, the same retry behaviour, and an Express handler for webhooks.

Receiving webhooks (Pro and Enterprise)

# Python (FastAPI)
from madjik.webhooks import fastapi_handler
app.post("/madjik")(fastapi_handler(SECRET, lambda ev: print(ev.metric_id, ev.value)))

// Node (Express)
import { expressHandler } from "madjik";
app.post("/madjik", express.raw({ type: "application/json" }), expressHandler(SECRET, async (ev) => { /* ... */ }));

Both verify X-Madjik-Signature-V2 with a 5-minute replay window and deduplicate on X-Madjik-Event-Id. See Webhooks for the delivery contract; mj.test_webhook(id) sends a sample event and re-enables a webhook that was disabled after repeated failures.

Google Sheets

=MADJIK("M10004")                          latest value (or "signal", "method", "confidence", "timestamp", ...)
=MADJIK_SERIES("M10004", 30, "1d", TRUE)   last 30 days, live-only (point-in-time safe)
=MADJIK_FRESH("M10004")                    when it was last refreshed (no key needed)
=MADJIK_STATUS()                           127/129 metrics fresh (no key needed)

All metrics are fetched in one call and cached for a time that follows your plan (Free about 3 h, Starter about 17 min, Pro about 2 min), so a large sheet costs one call per refresh.

Downloads

FileSizeSHA-256
madjik-0.2.0-py3-none-any.whl14 KB2b3f718f3a285ff89bf1bc8c64fa656df6da332151759e739065a29163e79053
madjik-0.2.0.tar.gz17 KB5c4796b1e9b71724c6e532606eb12676d9daf590a985fae2da9af0b6b4f94ec3
madjik-0.2.0.tgz7 KB951b15dd3d0c310c922b3daae216e3371aad22a8736ce779c3ea938deebc44ae
madjik-sheets-Code.gs7 KBd2e8a467f130352b82930ca749b39a71d343d07ee05cb193c9096c33b628c183

Madjik metrics are informational indicators, not investment advice.