tradeblocks-mcp 3.11.0 → 4.1.0
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/README.md +244 -38
- package/dist/chunk-4UU7IT2A.js +5944 -0
- package/dist/chunk-4UU7IT2A.js.map +1 -0
- package/dist/{chunk-K7YAYGV6.js → chunk-6J7OBXZX.js} +745 -5633
- package/dist/chunk-6J7OBXZX.js.map +1 -0
- package/dist/{chunk-TKUG3FOR.js → chunk-BH6SQOWF.js} +23 -5
- package/dist/chunk-BH6SQOWF.js.map +1 -0
- package/dist/{chunk-3KDAY4J4.js → chunk-D4AWELQU.js} +8 -9
- package/{server/chunk-35ZZUXY7.js.map → dist/chunk-D4AWELQU.js.map} +1 -1
- package/dist/{chunk-5SZL2WXB.js → chunk-IW75IC6I.js} +5 -32
- package/dist/chunk-IW75IC6I.js.map +1 -0
- package/dist/chunk-YRD62LDE.js +5674 -0
- package/dist/chunk-YRD62LDE.js.map +1 -0
- package/dist/{chunk-Q4ZODPP6.js → chunk-ZSVYX5PP.js} +6 -23
- package/dist/chunk-ZSVYX5PP.js.map +1 -0
- package/dist/daily-log-processor-T2QMVGBA.js +9 -0
- package/dist/daily-log-processor-ZFTGQDOD.js +10 -0
- package/dist/{daily-logs-store-3FVXJCAS.js → daily-logs-store-65YHFJ5F.js} +3 -5
- package/dist/{daily-logs-store-X4IAX7S5.js → daily-logs-store-PXB53WEK.js} +3 -5
- package/dist/market/provenance/index.d.ts +5 -18
- package/dist/market/provenance/index.js +566 -18905
- package/dist/market/provenance/index.js.map +1 -1
- package/dist/{sync-B3XG73TH.js → sync-EH7J3HBY.js} +7 -7
- package/dist/test-exports.js +972 -453
- package/dist/test-exports.js.map +1 -1
- package/dist/trade-processor-6QSOAWJN.js +9 -0
- package/dist/trade-processor-VJ3XUDTH.js +10 -0
- package/dist/{trades-store-HDB2Q3EC.js → trades-store-MOFJHRC2.js} +3 -5
- package/dist/{trades-store-5SLXLMGH.js → trades-store-UGZ62A7N.js} +3 -5
- package/package.json +5 -5
- package/server/{chunk-4AGMJIIZ.js → chunk-24O66TM5.js} +6 -23
- package/server/chunk-24O66TM5.js.map +1 -0
- package/server/{chunk-N2RXXORM.js → chunk-2E3K452Q.js} +23 -5
- package/server/chunk-2E3K452Q.js.map +1 -0
- package/server/{chunk-35ZZUXY7.js → chunk-76OEJGQX.js} +8 -9
- package/{dist/chunk-3KDAY4J4.js.map → server/chunk-76OEJGQX.js.map} +1 -1
- package/server/chunk-7N6HBOAY.js +6163 -0
- package/server/chunk-7N6HBOAY.js.map +1 -0
- package/server/chunk-MCT6A2WW.js +593 -0
- package/server/chunk-MCT6A2WW.js.map +1 -0
- package/server/{chunk-S7VOE7AB.js → chunk-N5WZQZB4.js} +4154 -8778
- package/server/chunk-N5WZQZB4.js.map +1 -0
- package/server/{chunk-YKGDAXGE.js → chunk-NLYLE5C6.js} +5 -32
- package/server/chunk-NLYLE5C6.js.map +1 -0
- package/server/cli.d.ts +2 -0
- package/server/cli.js +62 -0
- package/server/cli.js.map +1 -0
- package/server/daily-log-processor-NXSUFX32.js +11 -0
- package/server/{daily-logs-store-GK6B3X2V.js → daily-logs-store-YAXASQN4.js} +3 -5
- package/server/index.d.ts +17 -7
- package/server/index.js +2681 -1241
- package/server/index.js.map +1 -1
- package/server/setup-4EJSSDL4.js +9 -0
- package/server/{sync-6QGYOVPT.js → sync-SBFJFPOU.js} +7 -7
- package/server/trade-processor-NYDJ3VMH.js +11 -0
- package/server/{trades-store-QH6Z3OYG.js → trades-store-MF7YYLCH.js} +3 -5
- package/server/trades-store-MF7YYLCH.js.map +1 -0
- package/src/cli.ts +63 -0
- package/src/db/connection.ts +5 -6
- package/src/db/data-root.ts +1 -1
- package/src/db/dataset-schemas.ts +236 -0
- package/src/index.ts +47 -20
- package/src/market/ingestor/market-ingestor.ts +29 -5
- package/src/market/ingestor/types.ts +3 -0
- package/src/market/provenance/content-object-store.ts +6 -46
- package/src/market/provenance/durable-directory.ts +92 -0
- package/src/market/provenance/index.ts +1 -0
- package/src/market/provenance/partition-commit-store.ts +26 -62
- package/src/market/provenance/xnys-calendar-data.ts +117 -0
- package/src/market/provenance/xnys-session-calendar.ts +35 -138
- package/src/market/published-rates.ts +52 -0
- package/src/market/stores/duckdb-quote-store.ts +11 -3
- package/src/market/stores/duckdb-spot-store.ts +2 -2
- package/src/market/stores/parquet-quote-store.ts +11 -3
- package/src/market/stores/parquet-spot-store.ts +7 -2
- package/src/market/stores/quote-store.ts +8 -1
- package/src/market/stores/spot-sql.ts +20 -2
- package/src/market/stores/spot-store.ts +9 -3
- package/src/plugins.ts +6 -0
- package/src/prompts.ts +393 -0
- package/src/setup.ts +708 -0
- package/src/sync/block-sync.ts +2 -1
- package/src/test-exports.ts +2 -0
- package/src/tools/analysis.ts +112 -32
- package/src/tools/blocks/analysis.ts +322 -209
- package/src/tools/blocks/comparison.ts +8 -4
- package/src/tools/blocks/core.ts +61 -32
- package/src/tools/blocks/paired-comparison.ts +7 -20
- package/src/tools/blocks.ts +1 -1
- package/src/tools/datasets.ts +147 -0
- package/src/tools/imports.ts +58 -42
- package/src/tools/market-data.ts +51 -5
- package/src/tools/market-fetch.ts +8 -6
- package/src/tools/middleware/strict-arguments.ts +67 -0
- package/src/tools/performance.ts +32 -98
- package/src/tools/profile-analysis.ts +203 -77
- package/src/tools/reports/fields.ts +8 -3
- package/src/tools/reports/helpers.ts +28 -6
- package/src/tools/reports/predictive.ts +31 -45
- package/src/tools/reports.ts +4 -3
- package/src/tools/schema.ts +9 -0
- package/src/tools/shared/field-analysis.ts +171 -0
- package/src/tools/sql.ts +8 -3
- package/src/utils/block-loader.ts +254 -122
- package/src/utils/csv-discovery.ts +1 -3
- package/src/utils/data-availability.ts +2 -3
- package/src/utils/filter-predicates.ts +48 -19
- package/src/utils/market-enricher.ts +93 -115
- package/src/utils/market-provider.ts +17 -2
- package/src/utils/option-quote-greeks.ts +10 -6
- package/src/utils/providers/massive.ts +153 -34
- package/src/utils/quote-parquet-projection.ts +13 -7
- package/src/utils/schema-metadata.ts +3 -2
- package/src/utils/starting-capital.ts +38 -0
- package/src/utils/threshold-sweep.ts +35 -0
- package/src/utils/trade-analysis-fields.ts +72 -0
- package/dist/chunk-4VWUMBAZ.js +0 -859
- package/dist/chunk-4VWUMBAZ.js.map +0 -1
- package/dist/chunk-5SZL2WXB.js.map +0 -1
- package/dist/chunk-AH7VIHDT.js +0 -329
- package/dist/chunk-AH7VIHDT.js.map +0 -1
- package/dist/chunk-DJRGJXYP.js +0 -453
- package/dist/chunk-DJRGJXYP.js.map +0 -1
- package/dist/chunk-K7YAYGV6.js.map +0 -1
- package/dist/chunk-P3IETL3K.js +0 -93
- package/dist/chunk-P3IETL3K.js.map +0 -1
- package/dist/chunk-PS2XIVFN.js +0 -359
- package/dist/chunk-PS2XIVFN.js.map +0 -1
- package/dist/chunk-Q4ZODPP6.js.map +0 -1
- package/dist/chunk-TEJVVTIM.js +0 -912
- package/dist/chunk-TEJVVTIM.js.map +0 -1
- package/dist/chunk-TKUG3FOR.js.map +0 -1
- package/dist/daily-log-processor-DMJA7D2X.js +0 -10
- package/dist/daily-log-processor-IBZMMS72.js +0 -9
- package/dist/trade-processor-DQMN7JZF.js +0 -10
- package/dist/trade-processor-EWPJXBZZ.js +0 -9
- package/server/chunk-4AGMJIIZ.js.map +0 -1
- package/server/chunk-N2RXXORM.js.map +0 -1
- package/server/chunk-S7VOE7AB.js.map +0 -1
- package/server/chunk-YKGDAXGE.js.map +0 -1
- package/server/chunk-YQZDWXAU.js +0 -938
- package/server/chunk-YQZDWXAU.js.map +0 -1
- package/server/daily-log-processor-XNMWJNJ6.js +0 -11
- package/server/trade-processor-TO27NFQW.js +0 -11
- /package/dist/{daily-log-processor-DMJA7D2X.js.map → daily-log-processor-T2QMVGBA.js.map} +0 -0
- /package/dist/{daily-log-processor-IBZMMS72.js.map → daily-log-processor-ZFTGQDOD.js.map} +0 -0
- /package/dist/{daily-logs-store-3FVXJCAS.js.map → daily-logs-store-65YHFJ5F.js.map} +0 -0
- /package/dist/{daily-logs-store-X4IAX7S5.js.map → daily-logs-store-PXB53WEK.js.map} +0 -0
- /package/dist/{sync-B3XG73TH.js.map → sync-EH7J3HBY.js.map} +0 -0
- /package/dist/{trade-processor-DQMN7JZF.js.map → trade-processor-6QSOAWJN.js.map} +0 -0
- /package/dist/{trade-processor-EWPJXBZZ.js.map → trade-processor-VJ3XUDTH.js.map} +0 -0
- /package/dist/{trades-store-5SLXLMGH.js.map → trades-store-MOFJHRC2.js.map} +0 -0
- /package/dist/{trades-store-HDB2Q3EC.js.map → trades-store-UGZ62A7N.js.map} +0 -0
- /package/server/{daily-log-processor-XNMWJNJ6.js.map → daily-log-processor-NXSUFX32.js.map} +0 -0
- /package/server/{daily-logs-store-GK6B3X2V.js.map → daily-logs-store-YAXASQN4.js.map} +0 -0
- /package/server/{sync-6QGYOVPT.js.map → setup-4EJSSDL4.js.map} +0 -0
- /package/server/{trade-processor-TO27NFQW.js.map → sync-SBFJFPOU.js.map} +0 -0
- /package/server/{trades-store-QH6Z3OYG.js.map → trade-processor-NYDJ3VMH.js.map} +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,102 @@ Model Context Protocol (MCP) server for options trading analysis. Works with Cla
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
+
### Prerequisites (before using npm or npx)
|
|
18
|
+
|
|
19
|
+
Open a terminal (PowerShell on Windows) and run `node --version`, `npm --version`,
|
|
20
|
+
and `npx --version`. TradeBlocks' packaged server requires Node **18 or newer**;
|
|
21
|
+
Node **24 LTS** is recommended (and used for development). Your chosen client
|
|
22
|
+
may require a newer Node version, so Node 24 is the easiest shared choice.
|
|
23
|
+
|
|
24
|
+
If any command is missing, install Node **with npm**, then close and reopen the terminal:
|
|
25
|
+
|
|
26
|
+
| Platform | Install Node/npm |
|
|
27
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
28
|
+
| macOS | Use the macOS installer from [nodejs.org](https://nodejs.org/en/download), or `brew install node` if you already use Homebrew. |
|
|
29
|
+
| Windows | Use the Windows installer from [nodejs.org](https://nodejs.org/en/download), or `winget install OpenJS.NodeJS.LTS`. Reopen PowerShell afterward. |
|
|
30
|
+
| Linux | Follow the Linux instructions at [nodejs.org](https://nodejs.org/en/download) for your distribution or version manager; choose Node 24 with npm rather than an older distribution package. |
|
|
31
|
+
|
|
32
|
+
Then repeat the three version checks. Install/open your chosen client separately:
|
|
33
|
+
[Claude Desktop](https://claude.ai/download),
|
|
34
|
+
[Claude Code](https://code.claude.com/docs/en/setup),
|
|
35
|
+
[Codex CLI](https://developers.openai.com/codex/cli/) (`npm install -g @openai/codex`),
|
|
36
|
+
or [Gemini CLI](https://geminicli.com/docs/get-started/installation/)
|
|
37
|
+
(`npm install -g @google/gemini-cli`). Setup does not install any of these.
|
|
38
|
+
Desktop's configuration directory must already exist; on Linux follow your Desktop
|
|
39
|
+
distribution's instructions. Local setup does not need OO, a provider key, or a skills plugin.
|
|
40
|
+
|
|
41
|
+
### Guided local setup
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Interactive: select a client and folder, review changes, explicitly approve
|
|
45
|
+
npx tradeblocks-mcp setup
|
|
46
|
+
|
|
47
|
+
# Agent/non-interactive: preview only (non-zero consent_required result)
|
|
48
|
+
npx tradeblocks-mcp setup --client codex --folder "/path/to/backtests" --json
|
|
49
|
+
|
|
50
|
+
# Apply the reviewed preview and verify
|
|
51
|
+
npx tradeblocks-mcp setup --client codex --folder "/path/to/backtests" --yes --json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Client choices are `claude-desktop`, `claude-code`, `codex`, and `gemini`.
|
|
55
|
+
Interactive setup shows all four clients numbered with detected/not-detected
|
|
56
|
+
markers and accepts a number or client name; it never selects one automatically.
|
|
57
|
+
Without `--json`, the preview and result are readable prose, including the
|
|
58
|
+
quoted launch command, verification, client action and next steps.
|
|
59
|
+
Folder paths are resolved to absolute paths, including paths with spaces. Setup
|
|
60
|
+
previews the exact file, entry and official user-scope registration command.
|
|
61
|
+
It can create a missing data folder only under the same consent. Without a TTY,
|
|
62
|
+
setup never prompts and requires `--client`, `--folder`, and `--yes` to write.
|
|
63
|
+
`--json` emits exactly one final result object on stdout; a redacted preview goes
|
|
64
|
+
to stderr before any write, even with `--yes`. Inspect `plannedChange` in a
|
|
65
|
+
preview run before approving it with `--yes`. Exit 0 means both registration
|
|
66
|
+
(or an equivalent existing entry) **and** MCP verification succeeded.
|
|
67
|
+
|
|
68
|
+
A differing `tradeblocks` entry needs separate replacement permission:
|
|
69
|
+
interactive setup asks separately, or agents add **both** `--replace` and
|
|
70
|
+
`--yes`. Replacement preserves existing `env` keys **and their values** and removes
|
|
71
|
+
other TradeBlocks-specific launch settings. Unknown entry fields (including URLs)
|
|
72
|
+
are conflicts, not equivalent stdio registrations. Gemini replacement refuses
|
|
73
|
+
environment values containing `=` before writing: its CLI truncates those values;
|
|
74
|
+
update the launch manually in its settings file while retaining the environment.
|
|
75
|
+
Previews show differing field names and environment key names, never existing
|
|
76
|
+
values or client diagnostics. Desktop updates preserve unrelated settings/servers,
|
|
77
|
+
use a same-directory temporary file and atomic rename, and back up existing files.
|
|
78
|
+
For all CLI clients, setup backs up an existing config before registration and
|
|
79
|
+
restores it if remove/add fails or read-back differs from the preview. The vendor
|
|
80
|
+
CLI may itself normalize or remove unrelated settings on successful registration
|
|
81
|
+
(Claude Code can drop unknown top-level keys); setup does not promise to undo a
|
|
82
|
+
successful vendor rewrite. The backup retains the original bytes. Backups may
|
|
83
|
+
contain secrets; protect them like the original and remove them when no longer needed.
|
|
84
|
+
|
|
85
|
+
Setup refuses unreadable or malformed configuration without rewriting it. This
|
|
86
|
+
includes Gemini settings with comments: repair/export strict JSON yourself
|
|
87
|
+
before using guided setup; manual configuration remains available below.
|
|
88
|
+
CLI registration uses `claude mcp add -s user`, `codex mcp add`, or
|
|
89
|
+
`gemini mcp add -s user`, not project-scope edits. Desktop uses the per-OS paths
|
|
90
|
+
below. The registered command uses the absolute `npx` found on your PATH.
|
|
91
|
+
For Desktop, setup also supplies Node/npm's directory in the server's `PATH`
|
|
92
|
+
when no existing server `PATH` is present, because a GUI may not inherit an
|
|
93
|
+
nvm shell's PATH. Moving/upgrading that Node installation can require setup
|
|
94
|
+
again; an existing server `PATH` is preserved, not overridden.
|
|
95
|
+
|
|
96
|
+
Verification starts the **read-back configured server subprocess**, performs MCP
|
|
97
|
+
`initialize` and `tools/list` with a 120-second timeout, and reports server
|
|
98
|
+
name/version and tool count. It does **not** prove that the AI client itself
|
|
99
|
+
connected. Restart/reopen Desktop or start a new CLI-client session afterward.
|
|
100
|
+
If verification fails, registration may already have succeeded: inspect the
|
|
101
|
+
result's `appliedChange`, fix the indicated prerequisites, and rerun.
|
|
102
|
+
The bounded two-minute window allows for a first npx launch downloading the
|
|
103
|
+
package and native DuckDB binaries. Setup explains that possibility before
|
|
104
|
+
verification starts.
|
|
105
|
+
The server's first npx launch may need network access to download TradeBlocks;
|
|
106
|
+
setup does not install clients, Node/npm, or change system settings.
|
|
107
|
+
|
|
108
|
+
For **Claude Code only**, the separate
|
|
109
|
+
[tradeblocks-skills plugin](https://github.com/tradeblocks-org/tradeblocks-skills)
|
|
110
|
+
is optional and is not installed by setup. Manual CSV import and core analysis
|
|
111
|
+
remain available without the plugin, OO, or market-data credentials.
|
|
112
|
+
|
|
17
113
|
### Option 1: npx (All Platforms)
|
|
18
114
|
|
|
19
115
|
Run directly without installation:
|
|
@@ -37,7 +133,7 @@ npm install
|
|
|
37
133
|
npm run build -w packages/mcp-server
|
|
38
134
|
|
|
39
135
|
# Run the server
|
|
40
|
-
node packages/mcp-server/server/
|
|
136
|
+
node packages/mcp-server/server/cli.js ~/Trading/backtests
|
|
41
137
|
```
|
|
42
138
|
|
|
43
139
|
## Quick Start
|
|
@@ -251,23 +347,17 @@ Or set `TRADEBLOCKS_NO_AUTH=true` in `.env`.
|
|
|
251
347
|
|
|
252
348
|
## Agent Skills
|
|
253
349
|
|
|
254
|
-
For guided conversational workflows, install the
|
|
350
|
+
For guided conversational workflows, install the agent skills from their standalone plugin,
|
|
351
|
+
[tradeblocks-skills](https://github.com/tradeblocks-org/tradeblocks-skills). In Claude Code:
|
|
255
352
|
|
|
256
353
|
```bash
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
# Install to other platforms
|
|
261
|
-
tradeblocks-mcp install-skills --platform codex
|
|
262
|
-
tradeblocks-mcp install-skills --platform gemini
|
|
263
|
-
|
|
264
|
-
# Check installation status
|
|
265
|
-
tradeblocks-mcp check-skills
|
|
266
|
-
|
|
267
|
-
# Remove skills
|
|
268
|
-
tradeblocks-mcp uninstall-skills
|
|
354
|
+
/plugin marketplace add tradeblocks-org/tradeblocks-skills
|
|
355
|
+
/plugin install tradeblocks@tradeblocks-skills
|
|
269
356
|
```
|
|
270
357
|
|
|
358
|
+
The former `install-skills`, `check-skills`, and `uninstall-skills` commands now only print these
|
|
359
|
+
instructions.
|
|
360
|
+
|
|
271
361
|
Skills provide structured prompts for tasks like:
|
|
272
362
|
|
|
273
363
|
- Strategy health checks
|
|
@@ -275,7 +365,68 @@ Skills provide structured prompts for tasks like:
|
|
|
275
365
|
- Portfolio addition recommendations
|
|
276
366
|
- Correlation analysis
|
|
277
367
|
|
|
278
|
-
See [
|
|
368
|
+
See the [tradeblocks-skills README](https://github.com/tradeblocks-org/tradeblocks-skills) for details.
|
|
369
|
+
|
|
370
|
+
## Prompts
|
|
371
|
+
|
|
372
|
+
The same MCP server exposes five prompts in stdio and HTTP. In Claude Code, when
|
|
373
|
+
the server is named `tradeblocks`, pick them from the `/` menu, where they appear
|
|
374
|
+
as `/tradeblocks:bring-in-oo-backtest (MCP)`, `/tradeblocks:is-this-optimum-real (MCP)`,
|
|
375
|
+
`/tradeblocks:stress-oo-portfolio (MCP)`, `/tradeblocks:live-vs-oo (MCP)` and
|
|
376
|
+
`/tradeblocks:allocate-oo-portfolio (MCP)`, or type
|
|
377
|
+
`/mcp__tradeblocks__bring-in-oo-backtest` (likewise for the others).
|
|
378
|
+
Other MCP clients can list and get these prompts through their prompt interface.
|
|
379
|
+
The server name is chosen by the user; these are not Option Omega tool prefixes.
|
|
380
|
+
|
|
381
|
+
Each prompt takes optional arguments, typed after the command in Claude Code in
|
|
382
|
+
this order, for example
|
|
383
|
+
`/mcp__tradeblocks__bring-in-oo-backtest <savedBacktestId> my-strategy`:
|
|
384
|
+
`bring-in-oo-backtest` and `stress-oo-portfolio` take `ooId` (an OO saved
|
|
385
|
+
backtest or portfolio ID, or a run's `runId`) and `block`; `is-this-optimum-real`
|
|
386
|
+
takes `optimizationId`; `live-vs-oo` takes `block`; `allocate-oo-portfolio`
|
|
387
|
+
takes `ooId` (saved portfolio ID or run ID) and `block`. Without arguments the
|
|
388
|
+
prompts work from the conversation.
|
|
389
|
+
|
|
390
|
+
| Prompt | Purpose |
|
|
391
|
+
| ----------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
392
|
+
| `bring-in-oo-backtest` | Capture a backtest's trade log as a block, or import an OO-exported trade CSV. |
|
|
393
|
+
| `is-this-optimum-real` | Compare the optimizer's best cell with a stable-region candidate using scratch runs and TradeBlocks robustness tests. |
|
|
394
|
+
| `stress-oo-portfolio` | Stress a portfolio's economic trades in an existing or imported block. |
|
|
395
|
+
| `live-vs-oo` | Compare live trades in a reporting log with an OO reference backtest's block. |
|
|
396
|
+
| `allocate-oo-portfolio` | Check TradeBlocks allocation leads in OO shared-funds runs; never alter the saved source. |
|
|
397
|
+
|
|
398
|
+
TradeBlocks never calls Option Omega. With the `tradeblocks-skills` Claude Code
|
|
399
|
+
plugin installed, the import prompt uses `/tradeblocks:oo-capture`, and the
|
|
400
|
+
optimum prompt directs to `/tradeblocks:is-this-optimum-real`. That skill
|
|
401
|
+
captures each scratch run separately and combines verified trades under
|
|
402
|
+
distinct strategies in one trade-only comparison block for a paired
|
|
403
|
+
best-minus-centre test. This test covers jointly traded days, not the
|
|
404
|
+
optimizer's selection from the grid. Without the plugin,
|
|
405
|
+
`bring-in-oo-backtest` asks for OO's trade-log and daily-log CSVs and imports
|
|
406
|
+
both in one `import_csv` call with `dailyLogPath`, so the block carries OO's
|
|
407
|
+
marked daily curve; it says so when the daily log is missing. The optimum
|
|
408
|
+
prompt without the plugin has each run's trade-log CSV exported from OO and
|
|
409
|
+
imported into separate blocks: it runs tests against zero per block and states
|
|
410
|
+
that no paired difference ran. The CSV must
|
|
411
|
+
be readable by the TradeBlocks server; for Docker/HTTP, put it inside the
|
|
412
|
+
mounted server data directory. If unavailable, stop instead of rebuilding
|
|
413
|
+
CSV from model responses.
|
|
414
|
+
|
|
415
|
+
`allocate-oo-portfolio` and the read-only `stress-oo-portfolio` use
|
|
416
|
+
`/tradeblocks:oo-capture` for a saved portfolio only when the installed skill
|
|
417
|
+
describes saved-portfolio capture (older plugin versions do not); otherwise
|
|
418
|
+
they use an existing block, or import OO's portfolio trade-log CSV
|
|
419
|
+
with `import_csv` and optionally its whole-book daily log with `dailyLogPath`.
|
|
420
|
+
TradeBlocks' correlation, marginal, tail, what-if and health results are
|
|
421
|
+
trade-derived counterfactual proposals, never OO marked equity or OO headline
|
|
422
|
+
figures. The whole-book curve has no per-member marks. A candidate is OO-tested
|
|
423
|
+
only after `get_portfolio_status` reports complete and `get_portfolio_results`
|
|
424
|
+
is read; saving requires an explicit request and a new portfolio. OO's headline
|
|
425
|
+
and marked-equity figures remain OO's; TradeBlocks' realized trade statistics
|
|
426
|
+
do not replace marked-account drawdown.
|
|
427
|
+
|
|
428
|
+
`live-vs-oo` reads the reporting log from the OO reference block's own folder
|
|
429
|
+
(see below); put the CSV there instead of importing it as a separate block.
|
|
279
430
|
|
|
280
431
|
## Block Directory Structure
|
|
281
432
|
|
|
@@ -297,20 +448,25 @@ backtests/
|
|
|
297
448
|
**tradelog.csv** - Trade records with these key columns:
|
|
298
449
|
|
|
299
450
|
- Date Opened, Time Opened, Date Closed, Time Closed
|
|
300
|
-
- P/L (
|
|
301
|
-
|
|
302
|
-
-
|
|
451
|
+
- P/L (Option Omega exports already include fees; `import_csv` defaults to
|
|
452
|
+
`plBasis: "net_includes_fees"`. Use `"gross_before_fees"` only if fees still need deducting)
|
|
453
|
+
- Strategy (optional; the block ID is used when missing), Legs (or Symbol)
|
|
454
|
+
- No. of Contracts, Premium (optional; dollars per contract: `250` and `250.00` both mean $250)
|
|
455
|
+
- P/L % (optional; when numeric, report tools use Option Omega's value as the trade's `plPct`;
|
|
456
|
+
otherwise `plPct` is P/L ÷ |Premium × No. of Contracts| × 100)
|
|
303
457
|
|
|
304
458
|
**dailylog.csv** - Daily portfolio values:
|
|
305
459
|
|
|
306
460
|
- Date
|
|
307
|
-
- Net Liquidity (or Portfolio Value, Equity)
|
|
461
|
+
- Net Liquidity (or Portfolio Value, Value, Equity)
|
|
308
462
|
- P/L, Drawdown % (optional)
|
|
309
463
|
|
|
310
464
|
**Flexible Detection**: Files don't need standard names. The server detects CSV types by examining column headers (ISS-006).
|
|
311
465
|
|
|
312
466
|
## Available Tools
|
|
313
467
|
|
|
468
|
+
These tables show common tools; [MCP Tools Reference](../../docs/mcp-tools.md) lists every registered tool.
|
|
469
|
+
|
|
314
470
|
### Core Tools
|
|
315
471
|
|
|
316
472
|
| Tool | Description |
|
|
@@ -321,6 +477,12 @@ backtests/
|
|
|
321
477
|
| `get_strategy_comparison` | Compare strategies within a block |
|
|
322
478
|
| `compare_blocks` | Compare statistics across multiple blocks |
|
|
323
479
|
|
|
480
|
+
Trade-calendar dates in tool output are calendar days in `YYYY-MM-DD` form and name
|
|
481
|
+
the same day on every server timezone. That covers a trade's opened or closed day, a
|
|
482
|
+
daily-log day, and any range or window built from them, such as `dateRange`,
|
|
483
|
+
walk-forward windows, `peakExposure` dates, and `run_sql` DATE columns. Real instants,
|
|
484
|
+
such as `calculatedAt`, sync times, and market-feed timestamps, remain ISO timestamps.
|
|
485
|
+
|
|
324
486
|
### Analysis Tools
|
|
325
487
|
|
|
326
488
|
| Tool | Description |
|
|
@@ -348,21 +510,35 @@ backtests/
|
|
|
348
510
|
|
|
349
511
|
### Market Data Tools
|
|
350
512
|
|
|
351
|
-
| Tool | Description
|
|
352
|
-
| ---------------------------- |
|
|
353
|
-
| `import_market_csv` | Import market data CSV with column mapping
|
|
354
|
-
| `import_from_database` | Import from external DuckDB databases
|
|
355
|
-
| `import_flat_file` | Import a local Parquet or CSV flat file for a ticker/timespan
|
|
356
|
-
| `fetch_bars` | Fetch daily or intraday OHLCV bars from configured provider
|
|
357
|
-
| `fetch_quotes` | Fetch option minute quotes from configured provider
|
|
358
|
-
| `fetch_chain` | Fetch option chain snapshot for an underlying on a given date
|
|
359
|
-
| `compute_vix_context` | Compute cross-ticker VIX regime fields for a date range
|
|
360
|
-
| `refresh_market_data` | Composite daily refresh: fetch bars, auto-fire VIX context, return coverage report
|
|
361
|
-
| `enrich_market_data` | Compute ~40 derived indicators from raw OHLCV
|
|
362
|
-
| `enrich_trades` | Enrich trades with market
|
|
363
|
-
| `analyze_regime_performance` | Analyze P&L by
|
|
364
|
-
| `suggest_filters` |
|
|
365
|
-
| `calculate_orb` | Opening range breakout analysis from intraday bars
|
|
513
|
+
| Tool | Description |
|
|
514
|
+
| ---------------------------- | ----------------------------------------------------------------------------------- |
|
|
515
|
+
| `import_market_csv` | Import market data CSV with column mapping |
|
|
516
|
+
| `import_from_database` | Import from external DuckDB databases |
|
|
517
|
+
| `import_flat_file` | Import a local Parquet or CSV flat file for a ticker/timespan |
|
|
518
|
+
| `fetch_bars` | Fetch daily or intraday OHLCV bars from configured provider |
|
|
519
|
+
| `fetch_quotes` | Fetch option minute quotes from configured provider |
|
|
520
|
+
| `fetch_chain` | Fetch option chain snapshot for an underlying on a given date |
|
|
521
|
+
| `compute_vix_context` | Compute cross-ticker VIX regime fields for a date range |
|
|
522
|
+
| `refresh_market_data` | Composite daily refresh: fetch bars, auto-fire VIX context, return coverage report |
|
|
523
|
+
| `enrich_market_data` | Compute ~40 derived indicators from raw OHLCV |
|
|
524
|
+
| `enrich_trades` | Enrich trades with causal market/dataset values, provenance and custom fields |
|
|
525
|
+
| `analyze_regime_performance` | Analyze P&L by presets or any registered field (numeric bins or categorical values) |
|
|
526
|
+
| `suggest_filters` | Default market filters or optional fields with generic threshold/exclusion sweeps |
|
|
527
|
+
| `calculate_orb` | Opening range breakout analysis from intraday bars |
|
|
528
|
+
| `import_daily_dataset` | Import or replace a user Static Dataset with per-column timing |
|
|
529
|
+
| `list_daily_datasets` | List user datasets, fields, timing and coverage |
|
|
530
|
+
| `delete_daily_dataset` | Remove a dataset and its registered fields |
|
|
531
|
+
| `list_analysis_fields` | Discover built-in and dataset fields at runtime |
|
|
532
|
+
|
|
533
|
+
Since 4.1.0, user daily datasets use `<dataset>.<column>` field names in profile filters,
|
|
534
|
+
predictive reports, regime analysis and threshold sweeps. `import_daily_dataset` takes
|
|
535
|
+
`name`, exactly one of inline `content` or `csvPath` under the server's data root, and optional
|
|
536
|
+
`ticker`, `columnTiming` and `knownBy` (`HH:mm` ET). Re-import replaces the named dataset
|
|
537
|
+
atomically, without changing market data or requiring provider credentials. Date-only close
|
|
538
|
+
values are available the following calendar day at 00:00 ET; date-only open values require
|
|
539
|
+
`knownBy`; timestamped rows are as-of. Sparse columns carry forward their latest available
|
|
540
|
+
observation without a freshness cutoff. See the [dataset tools reference](../../docs/mcp-tools.md#market-analysis)
|
|
541
|
+
and [4.1.0 behavior changes](../../releases/v4.1.0.md#behavior-changes).
|
|
366
542
|
|
|
367
543
|
### Strategy Profile Tools
|
|
368
544
|
|
|
@@ -376,11 +552,41 @@ backtests/
|
|
|
376
552
|
| `validate_entry_filters` | Test each entry filter's contribution to edge |
|
|
377
553
|
| `portfolio_structure_map` | Regime x structure coverage matrix across strategies |
|
|
378
554
|
|
|
555
|
+
`validate_entry_filters` names unknown market fields with reasons in
|
|
556
|
+
`unresolvable_filters`, warnings, and its summary; they are excluded from ablation
|
|
557
|
+
so known filters remain analyzable. If all market filters are unknown, it returns
|
|
558
|
+
`error: "no_resolvable_filters"`. `analyze_structure_fit` reports the same exclusions
|
|
559
|
+
and keeps its remaining dimensions. Known fields with missing daily values retain
|
|
560
|
+
their existing missing-data treatment.
|
|
561
|
+
|
|
379
562
|
### Import Tools
|
|
380
563
|
|
|
381
|
-
| Tool | Description
|
|
382
|
-
| ------------ |
|
|
383
|
-
| `import_csv` | Import a CSV file as a
|
|
564
|
+
| Tool | Description |
|
|
565
|
+
| ------------ | -------------------------------------------------------- |
|
|
566
|
+
| `import_csv` | Import a CSV file as a block from a server-readable path |
|
|
567
|
+
|
|
568
|
+
`import_csv` accepts `csvPath`, `blockName`, optional `csvType` (default `tradelog`),
|
|
569
|
+
optional `dailyLogPath` for a paired daily log, and `plBasis` (default
|
|
570
|
+
`net_includes_fees` for Option Omega exports; `gross_before_fees` when fee columns
|
|
571
|
+
still need deducting). Both paths must be readable by the server: local for stdio,
|
|
572
|
+
or inside its mounted data directory for Docker/HTTP. Paths can be absolute, use
|
|
573
|
+
`~`, or use filename-only search via `searchPaths` (default: Downloads, Desktop, Documents).
|
|
574
|
+
The pair creates one block with a stamped `tradelog.csv` and verbatim `dailylog.csv`.
|
|
575
|
+
A bad daily log rejects the whole import without creating a block. The usual
|
|
576
|
+
result fields describe the primary CSV; its `dateRange` holds the first and last
|
|
577
|
+
calendar dates (`YYYY-MM-DD`).
|
|
578
|
+
Paired results also include `dailyLog.recordCount` and `dailyLog.dateRange`
|
|
579
|
+
in the same calendar-date form. Unfiltered `get_statistics` uses daily-log drawdown;
|
|
580
|
+
strategy-filtered statistics use the trade log instead.
|
|
581
|
+
|
|
582
|
+
Before writing a block, `import_csv` refuses an invalid opened/closed trade or reporting
|
|
583
|
+
calendar date, missing or unparseable P/L, or missing/unparseable daily-log value. For
|
|
584
|
+
gross-before-fees trade imports, both commission values are also required. Errors
|
|
585
|
+
identify the CSV file line including the header; a rejected pair leaves no block.
|
|
586
|
+
Daily-log aliases load as net liquidity in imported and folder-discovered blocks;
|
|
587
|
+
folder loading drops a row with a missing/unparseable value rather than using zero.
|
|
588
|
+
`recordCount` counts loaded rows, and a missing Strategy in a trade log uses the
|
|
589
|
+
block ID in the receipt and in subsequent tools.
|
|
384
590
|
|
|
385
591
|
## Development
|
|
386
592
|
|
|
@@ -428,6 +634,6 @@ See the [Market Data Guide](../../docs/market-data.md) for import examples, tick
|
|
|
428
634
|
|
|
429
635
|
- [Usage Guide](../../docs/usage.md) - Detailed usage examples and workflows
|
|
430
636
|
- [Web Platforms Guide](../../docs/web-platforms.md) - Connect to ChatGPT, Google AI Studio, Julius
|
|
431
|
-
- [Agent Skills](
|
|
637
|
+
- [Agent Skills](https://github.com/tradeblocks-org/tradeblocks-skills) - Conversational workflows for guided analysis
|
|
432
638
|
- [Market Data Guide](../../docs/market-data.md) - Import workflow, Massive API, and column mapping reference
|
|
433
639
|
- [Main Application](../../README.md) - Web-based UI for TradeBlocks
|