iturri 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +83 -0
  2. package/index.mjs +9 -2
  3. package/package.json +20 -2
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # iturri
2
+
3
+ JavaScript client + CLI for the [Iturri](https://iturri.ai) verified
4
+ market-data API — historical market data for trading bots and AI agents where
5
+ **every bar carries a quality flag** (`verified · raw · reconciled ·
6
+ interpolated · disputed · outage`) and every candle is traceable to a
7
+ checksummed primary source.
8
+
9
+ - 124M+ quality-flagged OHLCV bars: 34 crypto symbols (1m/5m/15m/1h/1d since
10
+ 2015) + 86 US stocks & ETFs (consolidated-tape EOD since 2016, as-traded
11
+ and split-adjusted bases)
12
+ - Funding rates, open interest, taker order flow, curated events, market
13
+ context (Fear & Greed, VIX, DXY…)
14
+ - Leakage-safe feature matrices, multi-timeframe aligned bundles, BSQ token
15
+ sequences, training packs
16
+ - Agent-native: [11 MCP tools](https://iturri.ai/mcp) and
17
+ [x402 micropayments](https://iturri.ai/blog/market-data-api-for-ai-agents)
18
+ (USDC on Base) — no account, no API key
19
+ - Zero dependencies, ESM, Node ≥ 18
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ npm i iturri
25
+ ```
26
+
27
+ ## Quickstart
28
+
29
+ ```js
30
+ import { catalog, bars, features, setToken } from "iturri";
31
+
32
+ await catalog(); // free discovery — symbols, ranges, pricing
33
+
34
+ setToken("…"); // membership token from iturri.ai/subscribe
35
+ // (or export ITURRI_TOKEN)
36
+
37
+ const rows = await bars("BTC", "1h", { start: "2024-01-01", end: "2024-02-01" });
38
+ const clean = rows.filter(r => r.quality === "verified"); // the whole point
39
+
40
+ const feats = await features("SPY", "1d_split", { start: "2026-06-01" });
41
+ ```
42
+
43
+ Without a token, priced endpoints return HTTP 402 with an
44
+ [x402](https://iturri.ai/#docs) quote — payment-capable agents settle per
45
+ call ($0.001 per 1,000 candles) with no human in the loop.
46
+
47
+ ## CLI
48
+
49
+ ```sh
50
+ npx iturri catalog
51
+ npx iturri bars BTC 1h --start 2024-01-01 --end 2024-02-01
52
+ npx iturri features SPY 1d_split --start 2026-06-01
53
+ npx iturri bundle crypto # signed training-pack URLs
54
+ ```
55
+
56
+ ## Full surface
57
+
58
+ `catalog` · `bars` · `features` · `funding` · `openInterest` · `orderflow` ·
59
+ `context` · `events` · `regime` · `validate` · `bundle` — mirroring the
60
+ 11 MCP tools at `https://iturri.ai/mcp`.
61
+
62
+ `validate(symbol, tf, {start, end})` returns a data-quality report (coverage,
63
+ gaps, flag distribution) so you can audit a range **before** backtesting on it.
64
+
65
+ ## For AI agents (MCP)
66
+
67
+ ```json
68
+ { "mcpServers": { "iturri": { "type": "http", "url": "https://iturri.ai/mcp" } } }
69
+ ```
70
+
71
+ `describe_catalog` is free forever. See the
72
+ [MCP tutorial](https://iturri.ai/blog/connect-trading-data-to-claude-mcp).
73
+
74
+ ## Links
75
+
76
+ Docs: https://iturri.ai/#docs · OpenAPI: https://iturri.ai/openapi.json ·
77
+ llms.txt: https://iturri.ai/llms.txt · Python SDK: `pip install iturri` ·
78
+ Sourcing & verification policy: https://iturri.ai/sourcing
79
+
80
+ ---
81
+
82
+ Iturri sells **data and tooling only**. Nothing in any dataset, feature,
83
+ label, or tool is a trading signal, a prediction, or financial advice.
package/index.mjs CHANGED
@@ -3,13 +3,20 @@
3
3
  // Data and tooling only — never signals, predictions, or financial advice.
4
4
 
5
5
  export const BASE_URL = "https://iturri.ai";
6
+
7
+ // membership token: setToken("...") or ITURRI_TOKEN env (node)
8
+ export let token = (typeof process !== "undefined" && process.env?.ITURRI_TOKEN) || null;
9
+ export const setToken = (t) => { token = t; };
10
+ const authHeaders = () => (token ? { authorization: `Bearer ${token}` } : {});
6
11
  export const QUALITY = ["verified", "raw", "reconciled", "interpolated", "disputed", "outage"];
7
12
 
8
13
  async function get(path, params) {
9
14
  const url = new URL(BASE_URL + path);
10
15
  for (const [k, v] of Object.entries(params ?? {}))
11
16
  if (v !== undefined && v !== null) url.searchParams.set(k, v);
12
- const r = await fetch(url);
17
+ const r = await fetch(url, { headers: authHeaders() });
18
+ if (r.status === 402)
19
+ throw new Error("402 payment required — setToken()/ITURRI_TOKEN with a membership token from https://iturri.ai/subscribe, or pay per-call with an x402 client");
13
20
  if (!r.ok) throw new Error(`iturri api ${r.status}: ${(await r.json()).error ?? r.statusText}`);
14
21
  return r.json();
15
22
  }
@@ -55,7 +62,7 @@ export const validate = (symbol, tf, o = {}) => get("/api/validate", { symbol, t
55
62
  /** Signed download URLs: pack "crypto"|"equities", or "tokens" with a symbol. */
56
63
  export async function bundle(pack, symbol) {
57
64
  const r = await fetch(BASE_URL + "/api/bundle", {
58
- method: "POST", headers: { "content-type": "application/json" },
65
+ method: "POST", headers: { "content-type": "application/json", ...authHeaders() },
59
66
  body: JSON.stringify({ pack, symbol }),
60
67
  });
61
68
  if (!r.ok) throw new Error(`iturri api ${r.status}`);
package/package.json CHANGED
@@ -1,7 +1,25 @@
1
1
  {
2
2
  "name": "iturri",
3
- "version": "0.2.0",
4
- "description": "Client + CLI for the Iturri verified market-data API — every bar verified or flagged",
3
+ "version": "0.2.2",
4
+ "description": "Client + CLI for the Iturri verified market-data API — quality-flagged candles, funding, open interest, order flow and ML-ready bundles for trading bots and AI agents. MCP + x402 native.",
5
+ "keywords": [
6
+ "trading",
7
+ "market-data",
8
+ "crypto",
9
+ "equities",
10
+ "ohlcv",
11
+ "backtesting",
12
+ "quant",
13
+ "trading-bot",
14
+ "mcp",
15
+ "ai-agent",
16
+ "verified-data",
17
+ "x402"
18
+ ],
19
+ "homepage": "https://iturri.ai",
20
+ "bugs": { "email": "dev@iturri.ai" },
21
+ "repository": { "type": "git", "url": "git+https://github.com/iturri-ai/iturri-js.git" },
22
+ "author": "Iturri <dev@iturri.ai> (https://iturri.ai)",
5
23
  "type": "module",
6
24
  "main": "index.mjs",
7
25
  "exports": "./index.mjs",