@coinrithm/mcp-trading 0.7.3 → 0.7.4
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.
- package/CHANGELOG.md +171 -158
- package/README.md +277 -240
- package/dist/agent/cli.js +9 -5
- package/dist/agent/observe.d.ts +4 -0
- package/dist/agent/observe.js +23 -4
- package/dist/client.d.ts +18 -0
- package/dist/client.js +18 -0
- package/dist/http.js +3 -1
- package/dist/tools.d.ts +22 -0
- package/dist/tools.js +582 -10
- package/package.json +86 -86
package/README.md
CHANGED
|
@@ -1,240 +1,277 @@
|
|
|
1
|
-
# @coinrithm/mcp-trading
|
|
2
|
-
|
|
3
|
-
**Deploy an AI trading agent with paper money — for free.** Give any model
|
|
4
|
-
(Claude, GPT, Gemini, Llama…) a 50,000 mUSD virtual account and let it trade
|
|
5
|
-
spot, futures, and prediction markets on
|
|
6
|
-
[CoinRithm](https://coinrithm.com/agentic-trading). No real money, no exchange,
|
|
7
|
-
no risk — a proving ground to show an agent works *before* anything is on the
|
|
8
|
-
line, with a public **Agent Arena** leaderboard ranked by realized paper PnL.
|
|
9
|
-
|
|
10
|
-
**Plus a free prediction-market data surface — no key at all.** The same server
|
|
11
|
-
ships four keyless `pm_data_*` tools serving CoinRithm's public cross-venue
|
|
12
|
-
dataset: live odds across 11 venues (Polymarket, Kalshi, Smarkets, Limitless,
|
|
13
|
-
Manifold, Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx), cross-venue matches with a
|
|
14
|
-
liquidity-aware reference probability, a whale-trade tape, and market-wide
|
|
15
|
-
volume stats ($60B+ all-time tracked). Point any MCP client at the hosted
|
|
16
|
-
endpoint `https://mcp.coinrithm.com/mcp` and call them anonymously — the API
|
|
17
|
-
key is only needed for the trading tools.
|
|
18
|
-
|
|
19
|
-
Agents are **OKF bundles** — an open, model-agnostic folder of markdown + YAML
|
|
20
|
-
(strategy, persona, hard caps) that any runtime can read. Two ways to run the
|
|
21
|
-
**same** bundle:
|
|
22
|
-
|
|
23
|
-
- **Managed — nothing to install.** Build and deploy an agent in your browser
|
|
24
|
-
with the **Agent Studio** (CoinRithm → My Agents → Studio): fork a house agent
|
|
25
|
-
or write one from scratch, and CoinRithm runs it **free on Llama 3.1 8B**
|
|
26
|
-
(NVIDIA NIM) on an always-on scheduler. The fastest path to a live agent.
|
|
27
|
-
- **Self-host — this package.** Bring your own model key and run the
|
|
28
|
-
`observe→decide→validate→act` loop on your machine, or wire the MCP server
|
|
29
|
-
into Claude Desktop / Cursor / Codex.
|
|
30
|
-
|
|
31
|
-
This package ships two binaries:
|
|
32
|
-
|
|
33
|
-
- **`coinrithm-mcp`** — an MCP server that lets an AI agent paper-trade on
|
|
34
|
-
CoinRithm (spot, futures, prediction markets) using a personal API key.
|
|
35
|
-
- **`coinrithm-agent`** — a self-host **agent runner**: author an agent as a
|
|
36
|
-
folder and run an `observe→decide→validate→act` loop with your own model key,
|
|
37
|
-
**dry-run by default**. See [Agent runner](#agent-runner-coinrithm-agent) below.
|
|
38
|
-
|
|
39
|
-
> **Paper trading only** — virtual funds (50,000 mUSD). Not financial advice.
|
|
40
|
-
|
|
41
|
-
## Quick start
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
# Run the MCP server with your CoinRithm key (no install needed):
|
|
45
|
-
COINRITHM_API_KEY=crk_live_… npx -y @coinrithm/mcp-trading
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Get a `crk_live_…` key from CoinRithm → Profile → API Keys. To author and run a
|
|
49
|
-
self-host agent instead, see [Agent runner](#agent-runner-coinrithm-agent).
|
|
50
|
-
Building from source? `npm install && npm run build`.
|
|
51
|
-
|
|
52
|
-
## Agent runner (`coinrithm-agent`)
|
|
53
|
-
|
|
54
|
-
This package also ships a **self-host agent runner**. You write an agent as a
|
|
55
|
-
folder (strategy + hard caps in markdown/YAML); the runner compiles it and runs
|
|
56
|
-
an `observe → decide → validate → act` loop, asking *your* model (bring-your-own
|
|
57
|
-
key) for structured decisions and executing only the ones that pass your caps —
|
|
58
|
-
**dry-run by default**, paper-only across spot, futures, and prediction markets.
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
coinrithm-agent new my-agent --preset conservative
|
|
62
|
-
coinrithm-agent validate my-agent
|
|
63
|
-
COINRITHM_API_KEY=crk_live_… ANTHROPIC_API_KEY=sk-ant-… \
|
|
64
|
-
coinrithm-agent run my-agent --once --dry-run
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Full guide (env vars, fail-closed guarantees, folder layout):
|
|
68
|
-
**[docs/agent-runner.md](https://github.com/CoinRithm/coinrithm-agent-trading/blob/main/docs/agent-runner.md)**.
|
|
69
|
-
The CoinRithm hosted scheduler runs this same engine for you — see the
|
|
70
|
-
[scheduler README](../../packages/scheduler/README.md) for the built,
|
|
71
|
-
DB-driven runtime.
|
|
72
|
-
|
|
73
|
-
## Two ways to run
|
|
74
|
-
|
|
75
|
-
| Mode | Entry | Auth | Who it's for |
|
|
76
|
-
| --- | --- | --- | --- |
|
|
77
|
-
| **stdio** (single-user, local) | `dist/index.js` | `COINRITHM_API_KEY` env var | Claude Desktop / Cursor / Codex on your machine |
|
|
78
|
-
| **Streamable HTTP** (multi-user, hosted) | `dist/http.js` | **per-request** `Authorization: Bearer` header | The shared hosted endpoint at `mcp.coinrithm.com` |
|
|
79
|
-
|
|
80
|
-
The hosted HTTP server holds **no** key: each request brings its own
|
|
81
|
-
`crk_live_…` in the Authorization header, and the server forwards exactly that
|
|
82
|
-
key upstream. The Authorization header is **optional** on the hosted endpoint —
|
|
83
|
-
the four keyless `pm_data_*` market-data tools work anonymously; every other
|
|
84
|
-
tool requires it. See [`DEPLOY.md`](./DEPLOY.md).
|
|
85
|
-
|
|
86
|
-
## Configure (stdio)
|
|
87
|
-
|
|
88
|
-
| Env var | Required | Default | Notes |
|
|
89
|
-
| --- | --- | --- | --- |
|
|
90
|
-
| `COINRITHM_API_KEY` | yes (stdio only) | — | A `crk_live_…` key from CoinRithm → Profile → API Keys. **Ignored by the HTTP entry.** |
|
|
91
|
-
| `COINRITHM_API_URL` | no | `https://api.coinrithm.com` | Upstream base URL (live) |
|
|
92
|
-
| `PORT` | no | `8787` | HTTP entry only |
|
|
93
|
-
|
|
94
|
-
## Run
|
|
95
|
-
|
|
96
|
-
- **stdio** (for Claude Desktop / Claude Code / Cursor / most MCP hosts):
|
|
97
|
-
```bash
|
|
98
|
-
COINRITHM_API_KEY=crk_live_... node dist/index.js
|
|
99
|
-
# or, after npm link / npx:
|
|
100
|
-
coinrithm-mcp
|
|
101
|
-
```
|
|
102
|
-
- **Streamable HTTP** (multi-user; no key in env — clients send their own):
|
|
103
|
-
```bash
|
|
104
|
-
npm run start:http
|
|
105
|
-
# POST http://localhost:8787/mcp with Authorization: Bearer crk_live_...
|
|
106
|
-
# GET http://localhost:8787/healthz (liveness, no auth)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Tools
|
|
110
|
-
|
|
111
|
-
| Tool | Scope | Wraps |
|
|
112
|
-
| --- | --- | --- |
|
|
113
|
-
| `whoami` | any | `GET /api/agent/me` |
|
|
114
|
-
| `get_portfolio` | read | `GET /api/agent/portfolio` |
|
|
115
|
-
| `get_wallet` | read | `GET /api/agent/wallet` |
|
|
116
|
-
| `resolve_symbol` | read | `GET /api/agent/resolve` |
|
|
117
|
-
| `get_equity_curve` | read | `GET /api/agent/equity-curve` |
|
|
118
|
-
| `get_my_trades` (venue) | read | `GET /api/agent/trades` |
|
|
119
|
-
| `get_market_context` (coinId) | read | `GET /api/agent/market/:coinId` |
|
|
120
|
-
| `get_candles` (coinId, range) | read | `GET /api/agent/market/:coinId/candles` |
|
|
121
|
-
| `discover_pm_markets` | read | `GET /api/agent/pm/discover` |
|
|
122
|
-
| `get_performance` | read | `GET /api/agent/performance` |
|
|
123
|
-
| `get_agent_ledger` | read | `GET /api/agent/ledger` |
|
|
124
|
-
| `export_agent_ledger` | read | `GET /api/agent/ledger/export` |
|
|
125
|
-
| `export_run_evidence` | read | `GET /api/agent/ledger/export?runId=...` |
|
|
126
|
-
| `get_arena_leaderboard` | read | `GET /api/arena` |
|
|
127
|
-
| `get_arena_agent` (handle) | read | `GET /api/arena/:handle` |
|
|
128
|
-
| `list_open_orders` | read | `GET /api/agent/orders/open` |
|
|
129
|
-
| `get_positions` (venue) | read | `GET /api/agent/positions/{futures,pm}` |
|
|
130
|
-
| `spot_quote` | read | `POST /api/agent/spot/quote` |
|
|
131
|
-
| `futures_quote` | read | `POST /api/agent/futures/quote` |
|
|
132
|
-
| `pm_quote` | read | `POST /api/agent/pm/quote` |
|
|
133
|
-
| `place_spot_order` | trade:spot | `POST /api/agent/spot/order` |
|
|
134
|
-
| `cancel_spot_order` | trade:spot | `POST /api/agent/spot/order/:id/cancel` |
|
|
135
|
-
| `open_futures_position` | trade:futures | `POST /api/agent/futures/open` ¹ |
|
|
136
|
-
| `set_futures_sl_tp` | trade:futures | `POST /api/agent/futures/sl-tp` ² |
|
|
137
|
-
| `close_futures_position` | trade:futures | `POST /api/agent/futures/close` |
|
|
138
|
-
| `open_pm_position` | trade:pm | `POST /api/agent/pm/open` ¹ |
|
|
139
|
-
| `pm_data_overview` | none (public) | `GET /api/prediction-markets/overview` |
|
|
140
|
-
| `pm_data_events` | none (public) | `GET /api/prediction-markets/events` |
|
|
141
|
-
| `pm_data_event` (source, slug) | none (public) | `
|
|
142
|
-
| `pm_data_whales` | none (public) | `GET /api/prediction-markets/whales` |
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
1
|
+
# @coinrithm/mcp-trading
|
|
2
|
+
|
|
3
|
+
**Deploy an AI trading agent with paper money — for free.** Give any model
|
|
4
|
+
(Claude, GPT, Gemini, Llama…) a 50,000 mUSD virtual account and let it trade
|
|
5
|
+
spot, futures, and prediction markets on
|
|
6
|
+
[CoinRithm](https://coinrithm.com/agentic-trading). No real money, no exchange,
|
|
7
|
+
no risk — a proving ground to show an agent works *before* anything is on the
|
|
8
|
+
line, with a public **Agent Arena** leaderboard ranked by realized paper PnL.
|
|
9
|
+
|
|
10
|
+
**Plus a free prediction-market data surface — no key at all.** The same server
|
|
11
|
+
ships four keyless `pm_data_*` tools serving CoinRithm's public cross-venue
|
|
12
|
+
dataset: live odds across 11 venues (Polymarket, Kalshi, Smarkets, Limitless,
|
|
13
|
+
Manifold, Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx), cross-venue matches with a
|
|
14
|
+
liquidity-aware reference probability, a whale-trade tape, and market-wide
|
|
15
|
+
volume stats ($60B+ all-time tracked). Point any MCP client at the hosted
|
|
16
|
+
endpoint `https://mcp.coinrithm.com/mcp` and call them anonymously — the API
|
|
17
|
+
key is only needed for the trading tools.
|
|
18
|
+
|
|
19
|
+
Agents are **OKF bundles** — an open, model-agnostic folder of markdown + YAML
|
|
20
|
+
(strategy, persona, hard caps) that any runtime can read. Two ways to run the
|
|
21
|
+
**same** bundle:
|
|
22
|
+
|
|
23
|
+
- **Managed — nothing to install.** Build and deploy an agent in your browser
|
|
24
|
+
with the **Agent Studio** (CoinRithm → My Agents → Studio): fork a house agent
|
|
25
|
+
or write one from scratch, and CoinRithm runs it **free on Llama 3.1 8B**
|
|
26
|
+
(NVIDIA NIM) on an always-on scheduler. The fastest path to a live agent.
|
|
27
|
+
- **Self-host — this package.** Bring your own model key and run the
|
|
28
|
+
`observe→decide→validate→act` loop on your machine, or wire the MCP server
|
|
29
|
+
into Claude Desktop / Cursor / Codex.
|
|
30
|
+
|
|
31
|
+
This package ships two binaries:
|
|
32
|
+
|
|
33
|
+
- **`coinrithm-mcp`** — an MCP server that lets an AI agent paper-trade on
|
|
34
|
+
CoinRithm (spot, futures, prediction markets) using a personal API key.
|
|
35
|
+
- **`coinrithm-agent`** — a self-host **agent runner**: author an agent as a
|
|
36
|
+
folder and run an `observe→decide→validate→act` loop with your own model key,
|
|
37
|
+
**dry-run by default**. See [Agent runner](#agent-runner-coinrithm-agent) below.
|
|
38
|
+
|
|
39
|
+
> **Paper trading only** — virtual funds (50,000 mUSD). Not financial advice.
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Run the MCP server with your CoinRithm key (no install needed):
|
|
45
|
+
COINRITHM_API_KEY=crk_live_… npx -y @coinrithm/mcp-trading
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Get a `crk_live_…` key from CoinRithm → Profile → API Keys. To author and run a
|
|
49
|
+
self-host agent instead, see [Agent runner](#agent-runner-coinrithm-agent).
|
|
50
|
+
Building from source? `npm install && npm run build`.
|
|
51
|
+
|
|
52
|
+
## Agent runner (`coinrithm-agent`)
|
|
53
|
+
|
|
54
|
+
This package also ships a **self-host agent runner**. You write an agent as a
|
|
55
|
+
folder (strategy + hard caps in markdown/YAML); the runner compiles it and runs
|
|
56
|
+
an `observe → decide → validate → act` loop, asking *your* model (bring-your-own
|
|
57
|
+
key) for structured decisions and executing only the ones that pass your caps —
|
|
58
|
+
**dry-run by default**, paper-only across spot, futures, and prediction markets.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
coinrithm-agent new my-agent --preset conservative
|
|
62
|
+
coinrithm-agent validate my-agent
|
|
63
|
+
COINRITHM_API_KEY=crk_live_… ANTHROPIC_API_KEY=sk-ant-… \
|
|
64
|
+
coinrithm-agent run my-agent --once --dry-run
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Full guide (env vars, fail-closed guarantees, folder layout):
|
|
68
|
+
**[docs/agent-runner.md](https://github.com/CoinRithm/coinrithm-agent-trading/blob/main/docs/agent-runner.md)**.
|
|
69
|
+
The CoinRithm hosted scheduler runs this same engine for you — see the
|
|
70
|
+
[scheduler README](../../packages/scheduler/README.md) for the built,
|
|
71
|
+
DB-driven runtime.
|
|
72
|
+
|
|
73
|
+
## Two ways to run
|
|
74
|
+
|
|
75
|
+
| Mode | Entry | Auth | Who it's for |
|
|
76
|
+
| --- | --- | --- | --- |
|
|
77
|
+
| **stdio** (single-user, local) | `dist/index.js` | `COINRITHM_API_KEY` env var | Claude Desktop / Cursor / Codex on your machine |
|
|
78
|
+
| **Streamable HTTP** (multi-user, hosted) | `dist/http.js` | **per-request** `Authorization: Bearer` header | The shared hosted endpoint at `mcp.coinrithm.com` |
|
|
79
|
+
|
|
80
|
+
The hosted HTTP server holds **no** key: each request brings its own
|
|
81
|
+
`crk_live_…` in the Authorization header, and the server forwards exactly that
|
|
82
|
+
key upstream. The Authorization header is **optional** on the hosted endpoint —
|
|
83
|
+
the four keyless `pm_data_*` market-data tools work anonymously; every other
|
|
84
|
+
tool requires it. See [`DEPLOY.md`](./DEPLOY.md).
|
|
85
|
+
|
|
86
|
+
## Configure (stdio)
|
|
87
|
+
|
|
88
|
+
| Env var | Required | Default | Notes |
|
|
89
|
+
| --- | --- | --- | --- |
|
|
90
|
+
| `COINRITHM_API_KEY` | yes (stdio only) | — | A `crk_live_…` key from CoinRithm → Profile → API Keys. **Ignored by the HTTP entry.** |
|
|
91
|
+
| `COINRITHM_API_URL` | no | `https://api.coinrithm.com` | Upstream base URL (live) |
|
|
92
|
+
| `PORT` | no | `8787` | HTTP entry only |
|
|
93
|
+
|
|
94
|
+
## Run
|
|
95
|
+
|
|
96
|
+
- **stdio** (for Claude Desktop / Claude Code / Cursor / most MCP hosts):
|
|
97
|
+
```bash
|
|
98
|
+
COINRITHM_API_KEY=crk_live_... node dist/index.js
|
|
99
|
+
# or, after npm link / npx:
|
|
100
|
+
coinrithm-mcp
|
|
101
|
+
```
|
|
102
|
+
- **Streamable HTTP** (multi-user; no key in env — clients send their own):
|
|
103
|
+
```bash
|
|
104
|
+
npm run start:http
|
|
105
|
+
# POST http://localhost:8787/mcp with Authorization: Bearer crk_live_...
|
|
106
|
+
# GET http://localhost:8787/healthz (liveness, no auth)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Tools
|
|
110
|
+
|
|
111
|
+
| Tool | Scope | Wraps |
|
|
112
|
+
| --- | --- | --- |
|
|
113
|
+
| `whoami` | any | `GET /api/agent/me` |
|
|
114
|
+
| `get_portfolio` | read | `GET /api/agent/portfolio` |
|
|
115
|
+
| `get_wallet` | read | `GET /api/agent/wallet` |
|
|
116
|
+
| `resolve_symbol` | read | `GET /api/agent/resolve` |
|
|
117
|
+
| `get_equity_curve` | read | `GET /api/agent/equity-curve` |
|
|
118
|
+
| `get_my_trades` (venue) | read | `GET /api/agent/trades` |
|
|
119
|
+
| `get_market_context` (coinId) | read | `GET /api/agent/market/:coinId` |
|
|
120
|
+
| `get_candles` (coinId, range) | read | `GET /api/agent/market/:coinId/candles` |
|
|
121
|
+
| `discover_pm_markets` | read | `GET /api/agent/pm/discover` |
|
|
122
|
+
| `get_performance` | read | `GET /api/agent/performance` |
|
|
123
|
+
| `get_agent_ledger` | read | `GET /api/agent/ledger` |
|
|
124
|
+
| `export_agent_ledger` | read | `GET /api/agent/ledger/export` |
|
|
125
|
+
| `export_run_evidence` | read | `GET /api/agent/ledger/export?runId=...` |
|
|
126
|
+
| `get_arena_leaderboard` | read | `GET /api/arena` |
|
|
127
|
+
| `get_arena_agent` (handle) | read | `GET /api/arena/:handle` |
|
|
128
|
+
| `list_open_orders` | read | `GET /api/agent/orders/open` |
|
|
129
|
+
| `get_positions` (venue) | read | `GET /api/agent/positions/{futures,pm}` |
|
|
130
|
+
| `spot_quote` | read | `POST /api/agent/spot/quote` |
|
|
131
|
+
| `futures_quote` | read | `POST /api/agent/futures/quote` |
|
|
132
|
+
| `pm_quote` | read | `POST /api/agent/pm/quote` |
|
|
133
|
+
| `place_spot_order` | trade:spot | `POST /api/agent/spot/order` |
|
|
134
|
+
| `cancel_spot_order` | trade:spot | `POST /api/agent/spot/order/:id/cancel` |
|
|
135
|
+
| `open_futures_position` | trade:futures | `POST /api/agent/futures/open` ¹ |
|
|
136
|
+
| `set_futures_sl_tp` | trade:futures | `POST /api/agent/futures/sl-tp` ² |
|
|
137
|
+
| `close_futures_position` | trade:futures | `POST /api/agent/futures/close` |
|
|
138
|
+
| `open_pm_position` | trade:pm | `POST /api/agent/pm/open` ¹ |
|
|
139
|
+
| `pm_data_overview` | none (public) | compact `GET /api/prediction-markets/overview` |
|
|
140
|
+
| `pm_data_events` | none (public) | compact `GET /api/prediction-markets/events` |
|
|
141
|
+
| `pm_data_event` (source, slug, detail?) | none (public) | bounded event evidence by default; `detail: "full"` returns the untouched API record |
|
|
142
|
+
| `pm_data_whales` (limit, default 10) | none (public) | compact `GET /api/prediction-markets/whales` |
|
|
143
|
+
| `pm_data_disagreements` (limit, sort, sourceKind, ...) | none (public) | compact `GET /api/prediction-markets/matches/public` |
|
|
144
|
+
| `pm_data_calibration` | none (public) | `GET /api/prediction-markets/calibration` |
|
|
145
|
+
| `pm_data_canonical` (key?, limit, cursor) | none (public) | `GET /api/prediction-markets/canonical` (+ `/:key` detail) |
|
|
146
|
+
| `pm_data_volume_history` | none (public) | `GET /api/prediction-markets/volume-history` |
|
|
147
|
+
|
|
148
|
+
The eight `pm_data_*` tools wrap CoinRithm's free public cross-venue dataset
|
|
149
|
+
(all 11 venues: Polymarket, Kalshi, Smarkets, Limitless, Manifold,
|
|
150
|
+
Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx). They require no API key, never attach yours, and
|
|
151
|
+
are research surfaces: `pm_data_events` list rows carry `referenceProbability`
|
|
152
|
+
(a liquidity-aware cross-venue consensus on matched questions); `pm_data_event`
|
|
153
|
+
includes `crossSourceMatches` (the same real-world question priced on other
|
|
154
|
+
venues), `referenceProbability`, `volumeHistory`, and resolution evidence.
|
|
155
|
+
Discovery calls deliberately omit heavyweight descriptions, full outcome
|
|
156
|
+
ladders, embedded event objects, and sparklines so they do not consume an
|
|
157
|
+
agent's context before it decides what to inspect. Event search returns the
|
|
158
|
+
five highest-probability outcomes plus `outcomeCount`; follow with
|
|
159
|
+
`pm_data_event(source, slug)` for bounded event evidence, then request `detail: "full"` only when the complete provider-rich record is necessary.
|
|
160
|
+
Figures are self-computed aggregates on a disclosed per-venue basis — cite
|
|
161
|
+
CoinRithm when quoting them.
|
|
162
|
+
|
|
163
|
+
CoinRithm's trust-layer surfaces are keyless too: `pm_data_disagreements`
|
|
164
|
+
returns graph-clustered, orientation-proven cross-venue probability gaps on
|
|
165
|
+
the SAME real-world question (each cluster bounded to its top-5
|
|
166
|
+
highest-delta shared outcomes per pairwise comparison); `pm_data_calibration`
|
|
167
|
+
scores which venue forecasts best (Expected Calibration Error + a 10-bucket
|
|
168
|
+
reliability curve over resolved markets); `pm_data_canonical` is CoinRithm's
|
|
169
|
+
stable cross-venue identity for one question (list, or pass `key` for one
|
|
170
|
+
canonical's venue members + append-only judgment lineage); and
|
|
171
|
+
`pm_data_volume_history` is the global daily volume trend (real-money venues
|
|
172
|
+
only, ~90-day rolling window).
|
|
173
|
+
|
|
174
|
+
¹ Server-flag gated; live now. Returns `403 … not enabled` only if CoinRithm later disables it.
|
|
175
|
+
|
|
176
|
+
² Set/clear resting stop-loss / take-profit on an open futures position.
|
|
177
|
+
Naturally idempotent — no `idempotencyKey` needed (unlike spot orders, opens,
|
|
178
|
+
and closes, which all require one; reuse replays the original result).
|
|
179
|
+
|
|
180
|
+
Tool results return the HTTP status + JSON body so the model sees real server
|
|
181
|
+
responses (including `{ error, blockReasons }` on blocked entries). Public
|
|
182
|
+
discovery tools use the bounded summary shape described above; action and
|
|
183
|
+
event-detail tools preserve the full response body.
|
|
184
|
+
They also include `ledgerEventId` and `ledgerStatus` when CoinRithm records the
|
|
185
|
+
private action ledger row for the call.
|
|
186
|
+
|
|
187
|
+
## Acceptable Use of Market Data
|
|
188
|
+
|
|
189
|
+
Market Data (prices, probabilities, order books, volumes, event/market
|
|
190
|
+
metadata, and settlement outcomes sourced from third-party prediction-market
|
|
191
|
+
venues) is licensed to CoinRithm by those venues and provided subject to
|
|
192
|
+
CoinRithm's Terms of Use. You — and any agent, model, or application you
|
|
193
|
+
operate — may use it only to read live context for paper-trading decisions
|
|
194
|
+
and to score or evaluate decisions against settled outcomes. You may NOT:
|
|
195
|
+
(a) train, fine-tune, evaluate, or benchmark any AI/ML model on it (read-only
|
|
196
|
+
inference input to an already-trained model is permitted; training/
|
|
197
|
+
fine-tuning corpora are not); (b) redistribute, resell, sublicense, or
|
|
198
|
+
bulk-extract it; (c) use it to build, operate, or support any product that
|
|
199
|
+
competes with a source venue or with CoinRithm. Full terms:
|
|
200
|
+
[coinrithm.com/en/terms-of-use](https://www.coinrithm.com/en/terms-of-use)
|
|
201
|
+
|
|
202
|
+
## Private ledger and trace metadata
|
|
203
|
+
|
|
204
|
+
Every `/api/agent/*` call is recorded privately for the calling key: reads,
|
|
205
|
+
quotes, writes, rejects, idempotent replays, latency, sanitized summaries, and
|
|
206
|
+
optional run/decision metadata. CoinRithm logs execution and performance for
|
|
207
|
+
paper trading; it does **not** run your agent or verify hidden reasoning.
|
|
208
|
+
|
|
209
|
+
All MCP read/quote/write tools accept optional `agentTrace`:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"runId": "run-2026-06-12",
|
|
214
|
+
"decisionId": "decision-7",
|
|
215
|
+
"strategyLabel": "momentum",
|
|
216
|
+
"confidence": 0.72,
|
|
217
|
+
"rationaleSummary": "Short private summary only; no chain-of-thought."
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use the same `runId` across a session and a new `decisionId` per quote/write
|
|
222
|
+
intent. Then call `get_agent_ledger` to inspect rows or `export_agent_ledger`
|
|
223
|
+
with `runId` to export a private run-evidence bundle:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"runId": "run-2026-06-12",
|
|
228
|
+
"limit": 1000
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The export includes a manifest and summary: first/last event time, venues,
|
|
233
|
+
ledger statuses, quote/write/reject/replay counts, related paper-trade ids, and
|
|
234
|
+
the sanitized ledger rows. It also includes `executionAssumptions`: paper
|
|
235
|
+
account only, latest stored market/probability snapshots, and the versioned
|
|
236
|
+
`paper_execution_v1` cost model (paper execution is **not costless** — fills
|
|
237
|
+
charge a modeled taker fee plus spread + slippage on spot/PM, disclosed per fill;
|
|
238
|
+
futures funding is not modeled), and worker-driven resting order / SL / TP /
|
|
239
|
+
settlement timing. It is a reproducibility artifact for your
|
|
240
|
+
run; it is not a full point-in-time market archive and does not expose hidden
|
|
241
|
+
reasoning. Aggregate audit stats include trace coverage for `runId` and
|
|
242
|
+
`decisionId`. Run exports also include `retentionPolicy`: private ledger rows
|
|
243
|
+
use a rolling retention window and exports are capped. They include
|
|
244
|
+
`evidenceChecklist`, a derived pass/warn/fail checklist for trace completeness,
|
|
245
|
+
decision ids, quote-before-trade coverage, rejected calls, export truncation,
|
|
246
|
+
execution assumptions, and outcome attribution; it does not create additional
|
|
247
|
+
retained data. `outcomeSummary` derives best-effort realized PnL from existing
|
|
248
|
+
related trade/position ids, and spot orders can also match through their
|
|
249
|
+
idempotency keys once a terminal `ClosedOrder` exists. It reports whether
|
|
250
|
+
coverage is `none`, `partial`, or `complete`; it does not store new data. Public
|
|
251
|
+
Arena surfaces only aggregate audit stats; raw request logs and rationale
|
|
252
|
+
summaries stay private.
|
|
253
|
+
|
|
254
|
+
`get_my_trades`, `list_open_orders`, and `get_positions` accept an optional
|
|
255
|
+
`updatedSince` cursor and their responses carry `asOf` — pass it back to poll
|
|
256
|
+
only what changed (how an agent discovers worker-fired SL/TP, liquidations,
|
|
257
|
+
and PM settlements).
|
|
258
|
+
|
|
259
|
+
## Rate limits
|
|
260
|
+
|
|
261
|
+
Every key carries two per-key budgets: **120 requests/min** and **20
|
|
262
|
+
trade-writes/min**, surfaced via `RateLimit-*` response headers. On a `429`
|
|
263
|
+
the tool result includes `retryAfterSeconds` plus a pacing hint — wait at
|
|
264
|
+
least that long before retrying.
|
|
265
|
+
|
|
266
|
+
## Agent Arena
|
|
267
|
+
|
|
268
|
+
Opted-in agents are publicly ranked by realized PnL — every agent with any
|
|
269
|
+
decided (win/loss) trade is listed (a small-sample asterisk flags thin records;
|
|
270
|
+
the live gate is surfaced as `minDecidedTrades` in the response) at
|
|
271
|
+
[coinrithm.com](https://coinrithm.com/agentic-trading) — set `agentName` /
|
|
272
|
+
`agentPublic` / `agentModel` on your key to join, then check your standing
|
|
273
|
+
with `get_arena_leaderboard` / `get_arena_agent`. Pass `window: "7d" | "30d"`
|
|
274
|
+
to `get_arena_leaderboard` for the weekly/monthly board (re-ranked by
|
|
275
|
+
in-window PnL; the min-decided gate and badges stay all-time).
|
|
276
|
+
|
|
277
|
+
stdout is the MCP JSON-RPC channel; this server logs only to stderr.
|
package/dist/agent/cli.js
CHANGED
|
@@ -43,12 +43,16 @@ function pinWarnings(path) {
|
|
|
43
43
|
if (!existsSync(pin))
|
|
44
44
|
return [];
|
|
45
45
|
const parsed = parseYaml(readFileSync(pin, "utf8"));
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
];
|
|
46
|
+
const warnings = [];
|
|
47
|
+
const openapi = parsed?.api?.openapiVersion;
|
|
48
|
+
if (openapi && openapi !== COINRITHM_API.openapiVersion) {
|
|
49
|
+
warnings.push(`⚠ functionality/coinrithm.yaml pins API ${openapi}; current is ${COINRITHM_API.openapiVersion} (warning only, not a block)`);
|
|
51
50
|
}
|
|
51
|
+
const mcp = parsed?.api?.mcpVersion;
|
|
52
|
+
if (mcp && mcp !== COINRITHM_API.mcpVersion) {
|
|
53
|
+
warnings.push(`⚠ functionality/coinrithm.yaml pins MCP ${mcp}; current is ${COINRITHM_API.mcpVersion} (warning only, not a block)`);
|
|
54
|
+
}
|
|
55
|
+
return warnings;
|
|
52
56
|
}
|
|
53
57
|
catch {
|
|
54
58
|
/* ignore */
|
package/dist/agent/observe.d.ts
CHANGED
|
@@ -4,4 +4,8 @@ export interface ObserveOutput {
|
|
|
4
4
|
observation: Observation;
|
|
5
5
|
skip?: string;
|
|
6
6
|
}
|
|
7
|
+
export declare function isCalibrationChurnMarket(market: {
|
|
8
|
+
slug?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
}): boolean;
|
|
7
11
|
export declare function observe(client: CoinRithmClient, spec: AgentSpec, state: RunState, trace?: AgentTrace): Promise<ObserveOutput>;
|
package/dist/agent/observe.js
CHANGED
|
@@ -28,6 +28,16 @@ const PM_COIN_NAMES = {
|
|
|
28
28
|
UNI: "Uniswap",
|
|
29
29
|
SUI: "Sui",
|
|
30
30
|
};
|
|
31
|
+
// Repeated micro-contracts are useful for execution smoke tests but are a poor
|
|
32
|
+
// calibration universe: outcomes overlap heavily, resolve too quickly to admit
|
|
33
|
+
// meaningful independent research, and drown the public scorecard in Bitcoin
|
|
34
|
+
// coin flips. Non-mechanical calibration agents receive a deeper discovery
|
|
35
|
+
// page with these rows removed. Mechanical baselines intentionally keep the
|
|
36
|
+
// unmodified universe so their reference contract remains reproducible.
|
|
37
|
+
const PM_CALIBRATION_CHURN_RE = /(updown|up-or-down|-5-?min|-5m-|-15m|15m(?:-|$)|(?:5|15)\s+min(?:ute)?s?|-1h-|hourly|-daily-|\bdaily\b|what-price-will[^\n]*(?:today|tomorrow)|-above-on-|-price-on-|this[ -]week|of[ -]the[ -]week|-weekly-)/i;
|
|
38
|
+
export function isCalibrationChurnMarket(market) {
|
|
39
|
+
return PM_CALIBRATION_CHURN_RE.test(`${market.slug ?? ""} ${market.title ?? ""}`);
|
|
40
|
+
}
|
|
31
41
|
// Fetch candles for one coin and reduce them to a compact indicator bundle.
|
|
32
42
|
// Tolerant by design: any failure (HTTP error, malformed/sparse candles) returns
|
|
33
43
|
// null so the cycle proceeds with price-only context rather than skipping.
|
|
@@ -289,6 +299,9 @@ export async function observe(client, spec, state, trace) {
|
|
|
289
299
|
let pmResolutions = [];
|
|
290
300
|
let pmMarkets = [];
|
|
291
301
|
if (wantPm) {
|
|
302
|
+
const curatedCalibrationBoard = spec.objective?.primary === "calibration" &&
|
|
303
|
+
spec.model?.provider !== "mechanical";
|
|
304
|
+
const primaryDiscoveryLimit = curatedCalibrationBoard ? 30 : 12;
|
|
292
305
|
// Bias PM discovery toward CRYPTO markets the agent has a price view on — the
|
|
293
306
|
// only PM edge a price agent reliably has (probed 2026-06-24: the default board
|
|
294
307
|
// is World Cup / elections / F1, which an agent has no edge on). The discover
|
|
@@ -299,7 +312,7 @@ export async function observe(client, spec, state, trace) {
|
|
|
299
312
|
const pmQuery = PM_COIN_NAMES[topCoin] ?? spec.risk.watchlist[0] ?? "Bitcoin";
|
|
300
313
|
const [pmPosR, pmDiscFirst] = await Promise.all([
|
|
301
314
|
client.pmPositions(undefined, trace),
|
|
302
|
-
client.discoverPmMarkets({ q: pmQuery, limit:
|
|
315
|
+
client.discoverPmMarkets({ q: pmQuery, limit: primaryDiscoveryLimit }, trace),
|
|
303
316
|
]);
|
|
304
317
|
let pmDiscR = pmDiscFirst;
|
|
305
318
|
const firstCount = pmDiscR.ok
|
|
@@ -378,6 +391,9 @@ export async function observe(client, spec, state, trace) {
|
|
|
378
391
|
// quoteable id NESTED at outcomes[].externalMarketId — expandPmMarkets turns
|
|
379
392
|
// that into one row per quoteable outcome (eligible + not-held filtered).
|
|
380
393
|
let mergedRows = expandPmMarkets(pmDiscR.data, heldPmKeys);
|
|
394
|
+
if (curatedCalibrationBoard) {
|
|
395
|
+
mergedRows = mergedRows.filter((market) => !isCalibrationChurnMarket(market));
|
|
396
|
+
}
|
|
381
397
|
// ── Crypto-targeted secondary discover (pm_ref hallucination fix) ────────
|
|
382
398
|
// The prompt tells the model its SHARPEST PM edge is the crypto price view it
|
|
383
399
|
// JUST formed — but that is only actionable if the board actually LISTS a
|
|
@@ -409,10 +425,13 @@ export async function observe(client, spec, state, trace) {
|
|
|
409
425
|
// rows that actually reference the targeted coin (a fuzzy backend match
|
|
410
426
|
// can't dilute the board with off-topic events).
|
|
411
427
|
const primaryEventKeys = new Set(mergedRows.map((m) => `${m.source}|${m.slug}`));
|
|
412
|
-
|
|
428
|
+
let secRows = expandPmMarkets(secR.data, heldPmKeys)
|
|
413
429
|
.filter((m) => titleMentionsCoin(m.title, topAnalyzed))
|
|
414
|
-
.filter((m) => !primaryEventKeys.has(`${m.source}|${m.slug}`))
|
|
415
|
-
|
|
430
|
+
.filter((m) => !primaryEventKeys.has(`${m.source}|${m.slug}`));
|
|
431
|
+
if (curatedCalibrationBoard) {
|
|
432
|
+
secRows = secRows.filter((market) => !isCalibrationChurnMarket(market));
|
|
433
|
+
}
|
|
434
|
+
secRows = secRows.slice(0, 4);
|
|
416
435
|
// Reserve slots for the targeted rows so the 12-cap can't slice off the
|
|
417
436
|
// very markets the secondary fetch exists to surface. Primary rows keep
|
|
418
437
|
// priority; the targeted rows are appended.
|