tradeblocks-mcp 3.0.2 → 3.3.1

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 (218) hide show
  1. package/README.md +85 -80
  2. package/dist/{chunk-LDKTV7GW.js → chunk-27S67XW3.js} +24 -52
  3. package/dist/chunk-27S67XW3.js.map +1 -0
  4. package/dist/{chunk-FGZH632F.js → chunk-2E63THNI.js} +13 -11
  5. package/dist/chunk-2E63THNI.js.map +1 -0
  6. package/dist/{chunk-QTTR7AAW.js → chunk-2I3S2ZLT.js} +325 -84
  7. package/dist/chunk-2I3S2ZLT.js.map +1 -0
  8. package/dist/{chunk-4BLCXNQ6.js → chunk-4HZLVUOZ.js} +179 -183
  9. package/dist/chunk-4HZLVUOZ.js.map +1 -0
  10. package/dist/{chunk-XXYOUIZY.js → chunk-NWNSKALN.js} +63 -80
  11. package/dist/chunk-NWNSKALN.js.map +1 -0
  12. package/dist/{chunk-PRAYH3RT.js → chunk-WNTYA7ER.js} +29 -12
  13. package/dist/chunk-WNTYA7ER.js.map +1 -0
  14. package/dist/{chunk-BKQ4PM4Y.js → chunk-YZA4RS76.js} +24 -18
  15. package/dist/chunk-YZA4RS76.js.map +1 -0
  16. package/dist/{chunk-W2PP3LEH.js → chunk-ZTJXC3LS.js} +17 -8
  17. package/dist/chunk-ZTJXC3LS.js.map +1 -0
  18. package/dist/daily-log-processor-MZW2XBZY.js +9 -0
  19. package/dist/{daily-logs-store-D3QC2XPV.js → daily-logs-store-3C3OTGPK.js} +2 -2
  20. package/dist/iv-solver-worker.js +9 -1
  21. package/dist/market-provider-6U33TQUT.js +16 -0
  22. package/dist/{proto-3HZTCWK4.js → proto-V23GIZG2.js} +2 -2
  23. package/dist/{sync-PO4IPCYV.js → sync-3UBC37VW.js} +7 -7
  24. package/dist/test-exports.js +876 -483
  25. package/dist/test-exports.js.map +1 -1
  26. package/dist/trade-processor-DKDCWGKD.js +9 -0
  27. package/dist/{trades-store-LOL3FQSF.js → trades-store-R3NL25T2.js} +2 -2
  28. package/package.json +2 -6
  29. package/server/{chunk-CSDVJPBB.js → chunk-536NSFED.js} +29 -12
  30. package/server/chunk-536NSFED.js.map +1 -0
  31. package/server/{chunk-WA5AAPCH.js → chunk-A3UKD64A.js} +17 -8
  32. package/server/chunk-A3UKD64A.js.map +1 -0
  33. package/server/{chunk-PNKG7RY7.js → chunk-OMUDNJBJ.js} +63 -80
  34. package/server/chunk-OMUDNJBJ.js.map +1 -0
  35. package/server/{chunk-72GKJE2U.js → chunk-RJDJHZ5Y.js} +934 -335
  36. package/server/chunk-RJDJHZ5Y.js.map +1 -0
  37. package/server/{chunk-NZO6PT64.js → chunk-RM4B2VKS.js} +167 -177
  38. package/server/chunk-RM4B2VKS.js.map +1 -0
  39. package/server/{chunk-5EBXHT6C.js → chunk-SY6GDNVI.js} +24 -18
  40. package/server/chunk-SY6GDNVI.js.map +1 -0
  41. package/server/{chunk-FBNDMCT5.js → chunk-T66KH2XH.js} +13 -11
  42. package/server/chunk-T66KH2XH.js.map +1 -0
  43. package/server/{chunk-NRFXAJF7.js → chunk-W5E7FHC4.js} +24 -52
  44. package/server/chunk-W5E7FHC4.js.map +1 -0
  45. package/server/{config-6IZXEFEX.js → config-DK7KOMNL.js} +1 -1
  46. package/server/config-DK7KOMNL.js.map +1 -0
  47. package/server/daily-log-processor-B2VPU2FQ.js +10 -0
  48. package/server/{daily-logs-store-NU7M4L5C.js → daily-logs-store-YFNXTB7J.js} +2 -2
  49. package/server/http-server.js +2 -5
  50. package/server/index.js +2497 -2029
  51. package/server/index.js.map +1 -1
  52. package/server/iv-solver-worker.js +9 -1
  53. package/server/market-provider-L56RFHAC.js +17 -0
  54. package/server/{proto-DWRZJO4E.js → proto-YZ4TLX2N.js} +2 -2
  55. package/server/{sync-QFI5L7S7.js → sync-CENKDN53.js} +7 -7
  56. package/server/trade-processor-3PI4LHZI.js +10 -0
  57. package/server/{trades-store-VY26MWER.js → trades-store-RTTEYMXH.js} +2 -2
  58. package/src/auth/clients-store.ts +4 -4
  59. package/src/auth/code-store.ts +1 -1
  60. package/src/auth/config.ts +11 -12
  61. package/src/auth/login-page.ts +8 -10
  62. package/src/auth/provider.ts +35 -30
  63. package/src/auth/token.ts +17 -15
  64. package/src/db/backtest-schemas.ts +38 -8
  65. package/src/db/connection.ts +107 -40
  66. package/src/db/data-root.ts +22 -0
  67. package/src/db/index.ts +37 -5
  68. package/src/db/json-adapters.ts +22 -31
  69. package/src/db/json-migration.ts +11 -15
  70. package/src/db/json-store.ts +5 -3
  71. package/src/db/market-datasets.ts +48 -15
  72. package/src/db/market-schemas.ts +11 -5
  73. package/src/db/market-views.ts +119 -32
  74. package/src/db/parquet-writer.ts +7 -7
  75. package/src/db/profile-schemas.ts +39 -22
  76. package/src/db/schemas.ts +2 -2
  77. package/src/http-server.ts +7 -12
  78. package/src/index.ts +8 -9
  79. package/src/market/ingestor/index.ts +1 -4
  80. package/src/market/ingestor/market-ingestor.ts +140 -67
  81. package/src/market/ingestor/types.ts +1 -3
  82. package/src/market/stores/chain-sql.ts +2 -8
  83. package/src/market/stores/chain-store.ts +1 -4
  84. package/src/market/stores/duckdb-chain-store.ts +3 -14
  85. package/src/market/stores/duckdb-enriched-store.ts +3 -13
  86. package/src/market/stores/duckdb-quote-store.ts +10 -27
  87. package/src/market/stores/duckdb-spot-store.ts +4 -20
  88. package/src/market/stores/enriched-sql.ts +3 -9
  89. package/src/market/stores/enriched-store.ts +2 -2
  90. package/src/market/stores/parquet-chain-store.ts +5 -22
  91. package/src/market/stores/parquet-enriched-store.ts +4 -16
  92. package/src/market/stores/parquet-oi-daily-store.ts +3 -14
  93. package/src/market/stores/parquet-quote-store.ts +9 -29
  94. package/src/market/stores/parquet-spot-store.ts +14 -33
  95. package/src/market/stores/quote-store.ts +2 -10
  96. package/src/market/stores/spot-sql.ts +3 -15
  97. package/src/market/stores/spot-store.ts +1 -1
  98. package/src/market/tickers/defaults.json +6 -6
  99. package/src/market/tickers/loader.ts +2 -7
  100. package/src/market/tickers/registry.ts +5 -15
  101. package/src/market/tickers/schemas.ts +2 -6
  102. package/src/models/strategy-profile.ts +39 -39
  103. package/src/sync/block-sync.ts +44 -65
  104. package/src/sync/index.ts +1 -4
  105. package/src/sync/metadata.ts +14 -20
  106. package/src/test-exports.ts +139 -123
  107. package/src/tools/analysis.ts +180 -159
  108. package/src/tools/batch-exit-analysis.ts +100 -59
  109. package/src/tools/blocks/analysis.ts +116 -101
  110. package/src/tools/blocks/comparison.ts +281 -364
  111. package/src/tools/blocks/core.ts +208 -253
  112. package/src/tools/blocks/health.ts +571 -563
  113. package/src/tools/blocks/index.ts +2 -0
  114. package/src/tools/blocks/paired-comparison.ts +425 -0
  115. package/src/tools/blocks/similarity.ts +316 -283
  116. package/src/tools/edge-decay.ts +124 -197
  117. package/src/tools/exit-analysis.ts +130 -77
  118. package/src/tools/greeks-attribution.ts +84 -35
  119. package/src/tools/guides.ts +4 -6
  120. package/src/tools/imports.ts +11 -14
  121. package/src/tools/market-data.ts +1067 -757
  122. package/src/tools/market-enrichment.ts +3 -3
  123. package/src/tools/market-fetch.ts +148 -67
  124. package/src/tools/market-imports.ts +12 -12
  125. package/src/tools/middleware/sync-middleware.ts +5 -6
  126. package/src/tools/performance.ts +185 -302
  127. package/src/tools/profile-analysis.ts +52 -66
  128. package/src/tools/profiles.ts +106 -69
  129. package/src/tools/regime-advisor.ts +20 -45
  130. package/src/tools/replay.ts +81 -77
  131. package/src/tools/reports/discrepancies.ts +298 -328
  132. package/src/tools/reports/fields.ts +7 -25
  133. package/src/tools/reports/helpers.ts +18 -49
  134. package/src/tools/reports/predictive.ts +27 -70
  135. package/src/tools/reports/slippage-trends.ts +315 -345
  136. package/src/tools/reports/slippage.ts +1 -4
  137. package/src/tools/reports/strategy-matches.ts +399 -441
  138. package/src/tools/schema.ts +43 -40
  139. package/src/tools/shared/filters.ts +3 -9
  140. package/src/tools/snapshot.ts +9 -30
  141. package/src/tools/sql.ts +15 -14
  142. package/src/tools/tickers.ts +1 -4
  143. package/src/utils/batch-exit-analysis.ts +31 -42
  144. package/src/utils/black-scholes.ts +39 -29
  145. package/src/utils/block-loader.ts +69 -83
  146. package/src/utils/calibration-probe.ts +3 -4
  147. package/src/utils/chain-loader.ts +3 -3
  148. package/src/utils/csv-discovery.ts +16 -22
  149. package/src/utils/data-quality.ts +24 -36
  150. package/src/utils/exit-triggers.ts +91 -96
  151. package/src/utils/field-timing.ts +94 -79
  152. package/src/utils/filter-predicates.ts +13 -9
  153. package/src/utils/flatfile-importer.ts +94 -64
  154. package/src/utils/greeks-decomposition.ts +152 -100
  155. package/src/utils/iv-solver-pool.ts +55 -25
  156. package/src/utils/iv-solver-worker.ts +5 -5
  157. package/src/utils/market-enricher.ts +528 -497
  158. package/src/utils/market-importer.ts +31 -12
  159. package/src/utils/market-provider.ts +21 -23
  160. package/src/utils/massive-tier.ts +5 -7
  161. package/src/utils/migrate-option-data-helpers.ts +2 -8
  162. package/src/utils/option-quote-greeks.ts +25 -31
  163. package/src/utils/option-time.ts +4 -8
  164. package/src/utils/output-formatter.ts +1 -4
  165. package/src/utils/provider-capabilities.ts +1 -4
  166. package/src/utils/providers/massive.ts +59 -93
  167. package/src/utils/providers/thetadata/backfill.ts +14 -23
  168. package/src/utils/providers/thetadata/client.ts +12 -8
  169. package/src/utils/providers/thetadata/decode.ts +2 -20
  170. package/src/utils/providers/thetadata/endpoints.ts +32 -40
  171. package/src/utils/providers/thetadata/join.ts +11 -10
  172. package/src/utils/providers/thetadata/proto.ts +12 -10
  173. package/src/utils/providers/thetadata/quote-mid-greeks.ts +5 -5
  174. package/src/utils/providers/thetadata.ts +11 -10
  175. package/src/utils/quote-enricher.ts +4 -4
  176. package/src/utils/quote-parquet-projection.ts +3 -11
  177. package/src/utils/sample-date-selector.ts +3 -5
  178. package/src/utils/schema-metadata.ts +102 -70
  179. package/src/utils/ticker.ts +5 -9
  180. package/src/utils/trade-replay.ts +77 -68
  181. package/dist/chunk-4BLCXNQ6.js.map +0 -1
  182. package/dist/chunk-BKQ4PM4Y.js.map +0 -1
  183. package/dist/chunk-FGZH632F.js.map +0 -1
  184. package/dist/chunk-LDKTV7GW.js.map +0 -1
  185. package/dist/chunk-PRAYH3RT.js.map +0 -1
  186. package/dist/chunk-QTTR7AAW.js.map +0 -1
  187. package/dist/chunk-W2PP3LEH.js.map +0 -1
  188. package/dist/chunk-XXYOUIZY.js.map +0 -1
  189. package/dist/daily-log-processor-6MWJ23JK.js +0 -9
  190. package/dist/market-provider-VDRJUEF2.js +0 -16
  191. package/dist/trade-processor-NHU4VWRX.js +0 -9
  192. package/manifest.json +0 -141
  193. package/server/chunk-5EBXHT6C.js.map +0 -1
  194. package/server/chunk-72GKJE2U.js.map +0 -1
  195. package/server/chunk-CSDVJPBB.js.map +0 -1
  196. package/server/chunk-FBNDMCT5.js.map +0 -1
  197. package/server/chunk-NRFXAJF7.js.map +0 -1
  198. package/server/chunk-NZO6PT64.js.map +0 -1
  199. package/server/chunk-PNKG7RY7.js.map +0 -1
  200. package/server/chunk-WA5AAPCH.js.map +0 -1
  201. package/server/config-6IZXEFEX.js.map +0 -1
  202. package/server/daily-log-processor-Y3PVSVBM.js +0 -10
  203. package/server/market-provider-VOYYVYWT.js +0 -17
  204. package/server/trade-processor-JWVS37KM.js +0 -10
  205. /package/dist/{daily-log-processor-6MWJ23JK.js.map → daily-log-processor-MZW2XBZY.js.map} +0 -0
  206. /package/dist/{daily-logs-store-D3QC2XPV.js.map → daily-logs-store-3C3OTGPK.js.map} +0 -0
  207. /package/dist/{market-provider-VDRJUEF2.js.map → market-provider-6U33TQUT.js.map} +0 -0
  208. /package/dist/{proto-3HZTCWK4.js.map → proto-V23GIZG2.js.map} +0 -0
  209. /package/dist/{sync-PO4IPCYV.js.map → sync-3UBC37VW.js.map} +0 -0
  210. /package/dist/{trade-processor-NHU4VWRX.js.map → trade-processor-DKDCWGKD.js.map} +0 -0
  211. /package/dist/{trades-store-LOL3FQSF.js.map → trades-store-R3NL25T2.js.map} +0 -0
  212. /package/server/{daily-log-processor-Y3PVSVBM.js.map → daily-log-processor-B2VPU2FQ.js.map} +0 -0
  213. /package/server/{daily-logs-store-NU7M4L5C.js.map → daily-logs-store-YFNXTB7J.js.map} +0 -0
  214. /package/server/{market-provider-VOYYVYWT.js.map → market-provider-L56RFHAC.js.map} +0 -0
  215. /package/server/{proto-DWRZJO4E.js.map → proto-YZ4TLX2N.js.map} +0 -0
  216. /package/server/{sync-QFI5L7S7.js.map → sync-CENKDN53.js.map} +0 -0
  217. /package/server/{trade-processor-JWVS37KM.js.map → trade-processor-3PI4LHZI.js.map} +0 -0
  218. /package/server/{trades-store-VY26MWER.js.map → trades-store-RTTEYMXH.js.map} +0 -0
package/README.md CHANGED
@@ -14,13 +14,7 @@ Model Context Protocol (MCP) server for options trading analysis. Works with Cla
14
14
 
15
15
  ## Installation
16
16
 
17
- ### Option 1: MCPB Bundle (Claude Desktop - One Click)
18
-
19
- Download the latest `.mcpb` file from [Releases](https://github.com/tradeblocks-org/tradeblocks/releases) and double-click to install.
20
-
21
- The installer will prompt you to select your Trading Data Directory.
22
-
23
- ### Option 2: npx (All Platforms)
17
+ ### Option 1: npx (All Platforms)
24
18
 
25
19
  Run directly without installation:
26
20
 
@@ -32,9 +26,9 @@ npx tradeblocks-mcp ~/Trading/backtests
32
26
  npx tradeblocks-mcp --http ~/Trading/backtests
33
27
  ```
34
28
 
35
- See [Configuration by Platform](#configuration-by-platform) below for platform-specific setup.
29
+ For Claude Desktop, add the server to `claude_desktop_config.json` — see [Configuration by Platform](#configuration-by-platform) below for platform-specific setup.
36
30
 
37
- ### Option 3: From Source
31
+ ### Option 2: From Source
38
32
 
39
33
  ```bash
40
34
  git clone https://github.com/tradeblocks-org/tradeblocks
@@ -58,11 +52,11 @@ For detailed usage examples, see [../../docs/usage.md](../../docs/usage.md).
58
52
 
59
53
  ### Claude Desktop
60
54
 
61
- | Platform | Config Location |
62
- |----------|-----------------|
63
- | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
64
- | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
65
- | Linux | `~/.config/Claude/claude_desktop_config.json` |
55
+ | Platform | Config Location |
56
+ | -------- | ----------------------------------------------------------------- |
57
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
58
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
59
+ | Linux | `~/.config/Claude/claude_desktop_config.json` |
66
60
 
67
61
  ```json
68
62
  {
@@ -135,10 +129,10 @@ See [Web Platforms Guide](../../docs/web-platforms.md) for platform-specific set
135
129
 
136
130
  ## Transport Modes
137
131
 
138
- | Mode | Flag | Use Case | Platforms |
139
- |------|------|----------|-----------|
140
- | stdio | (default) | Local CLI tools | Claude Desktop, Claude Code, Codex CLI, Gemini CLI |
141
- | HTTP | `--http` | Web platforms, remote servers | ChatGPT, Google AI Studio, Julius AI |
132
+ | Mode | Flag | Use Case | Platforms |
133
+ | ----- | --------- | ----------------------------- | -------------------------------------------------- |
134
+ | stdio | (default) | Local CLI tools | Claude Desktop, Claude Code, Codex CLI, Gemini CLI |
135
+ | HTTP | `--http` | Web platforms, remote servers | ChatGPT, Google AI Studio, Julius AI |
142
136
 
143
137
  ```bash
144
138
  # stdio mode (default)
@@ -154,21 +148,21 @@ tradeblocks-mcp --directory ./data --blocks-dir ~/backtests
154
148
 
155
149
  ### Options
156
150
 
157
- | Flag | Description | Default |
158
- |------|-------------|---------|
159
- | `--http` | Start HTTP server instead of stdio | stdio |
160
- | `--port <n>` | HTTP server port | 3100 |
161
- | `--blocks-dir <path>` | Directory containing CSV block folders | same as data directory |
162
- | `--market-db <path>` | Path to market.duckdb | `<directory>/market.duckdb` |
163
- | `--no-auth` | Disable authentication (HTTP mode) | auth enabled |
151
+ | Flag | Description | Default |
152
+ | --------------------- | -------------------------------------- | --------------------------- |
153
+ | `--http` | Start HTTP server instead of stdio | stdio |
154
+ | `--port <n>` | HTTP server port | 3100 |
155
+ | `--blocks-dir <path>` | Directory containing CSV block folders | same as data directory |
156
+ | `--market-db <path>` | Path to market.duckdb | `<directory>/market.duckdb` |
157
+ | `--no-auth` | Disable authentication (HTTP mode) | auth enabled |
164
158
 
165
159
  ### Environment Variables
166
160
 
167
- | Variable | Description |
168
- |----------|-------------|
169
- | `BLOCKS_DIRECTORY` | Default data directory if not specified as argument |
161
+ | Variable | Description |
162
+ | ------------------------ | -------------------------------------------------------------- |
163
+ | `BLOCKS_DIRECTORY` | Default data directory if not specified as argument |
170
164
  | `TRADEBLOCKS_BLOCKS_DIR` | Directory for CSV block folders (overridden by `--blocks-dir`) |
171
- | `MARKET_DB_PATH` | Path to market.duckdb (overridden by `--market-db`) |
165
+ | `MARKET_DB_PATH` | Path to market.duckdb (overridden by `--market-db`) |
172
166
 
173
167
  ### ThetaData MDDS Credentials
174
168
 
@@ -201,6 +195,7 @@ docker run -d -p 3100:3100 -v ./data:/data --env-file .env romeo345/tradeblocks-
201
195
  ```
202
196
 
203
197
  Or with docker compose, set the image in `docker-compose.yml`:
198
+
204
199
  ```yaml
205
200
  services:
206
201
  tradeblocks:
@@ -274,6 +269,7 @@ tradeblocks-mcp uninstall-skills
274
269
  ```
275
270
 
276
271
  Skills provide structured prompts for tasks like:
272
+
277
273
  - Strategy health checks
278
274
  - Walk-forward analysis interpretation
279
275
  - Portfolio addition recommendations
@@ -299,12 +295,14 @@ backtests/
299
295
  ### CSV Formats
300
296
 
301
297
  **tradelog.csv** - Trade records with these key columns:
298
+
302
299
  - Date Opened, Time Opened, Date Closed, Time Closed
303
300
  - P/L (gross profit/loss)
304
301
  - Strategy, Legs (or Symbol)
305
302
  - No. of Contracts, Premium (optional)
306
303
 
307
304
  **dailylog.csv** - Daily portfolio values:
305
+
308
306
  - Date
309
307
  - Net Liquidity (or Portfolio Value, Equity)
310
308
  - P/L, Drawdown % (optional)
@@ -314,68 +312,75 @@ backtests/
314
312
  ## Available Tools
315
313
 
316
314
  ### Core Tools
317
- | Tool | Description |
318
- |------|-------------|
319
- | `list_blocks` | List all available blocks with summary stats |
320
- | `get_block_info` | Detailed info for a specific block |
321
- | `get_statistics` | Performance metrics (Sharpe, Sortino, drawdown, etc.) |
322
- | `get_strategy_comparison` | Compare strategies within a block |
323
- | `compare_blocks` | Compare statistics across multiple blocks |
315
+
316
+ | Tool | Description |
317
+ | ------------------------- | ----------------------------------------------------- |
318
+ | `list_blocks` | List all available blocks with summary stats |
319
+ | `get_block_info` | Detailed info for a specific block |
320
+ | `get_statistics` | Performance metrics (Sharpe, Sortino, drawdown, etc.) |
321
+ | `get_strategy_comparison` | Compare strategies within a block |
322
+ | `compare_blocks` | Compare statistics across multiple blocks |
324
323
 
325
324
  ### Analysis Tools
326
- | Tool | Description |
327
- |------|-------------|
328
- | `run_walk_forward` | Walk-forward analysis with configurable windows |
329
- | `run_monte_carlo` | Monte Carlo simulation with worst-case scenarios |
325
+
326
+ | Tool | Description |
327
+ | ------------------------ | -------------------------------------------------------- |
328
+ | `run_walk_forward` | Walk-forward analysis with configurable windows |
329
+ | `run_monte_carlo` | Monte Carlo simulation with worst-case scenarios |
330
330
  | `get_correlation_matrix` | Strategy correlation matrix (Kendall, Spearman, Pearson) |
331
- | `get_tail_risk` | Tail dependence and copula-based risk analysis |
332
- | `get_position_sizing` | Kelly criterion position sizing |
331
+ | `get_tail_risk` | Tail dependence and copula-based risk analysis |
332
+ | `get_position_sizing` | Kelly criterion position sizing |
333
333
 
334
334
  ### Performance Tools
335
- | Tool | Description |
336
- |------|-------------|
337
- | `get_performance_charts` | 16 chart types (equity, drawdown, distribution) |
338
- | `get_period_returns` | Returns aggregated by time period |
339
- | `compare_backtest_to_actual` | Backtest vs live performance comparison |
335
+
336
+ | Tool | Description |
337
+ | ---------------------------- | ----------------------------------------------- |
338
+ | `get_performance_charts` | 16 chart types (equity, drawdown, distribution) |
339
+ | `get_period_returns` | Returns aggregated by time period |
340
+ | `compare_backtest_to_actual` | Backtest vs live performance comparison |
340
341
 
341
342
  ### SQL Tools
342
- | Tool | Description |
343
- |------|-------------|
344
- | `run_sql` | Execute SQL queries against trades and market data |
343
+
344
+ | Tool | Description |
345
+ | ------------------- | ---------------------------------------------------- |
346
+ | `run_sql` | Execute SQL queries against trades and market data |
345
347
  | `describe_database` | Schema discovery with table info and example queries |
346
348
 
347
349
  ### Market Data Tools
348
- | Tool | Description |
349
- |------|-------------|
350
- | `import_market_csv` | Import market data CSV with column mapping |
351
- | `import_from_database` | Import from external DuckDB databases |
352
- | `import_flat_file` | Import a local Parquet or CSV flat file for a ticker/timespan |
353
- | `fetch_bars` | Fetch daily or intraday OHLCV bars from configured provider |
354
- | `fetch_quotes` | Fetch option minute quotes from configured provider |
355
- | `fetch_chain` | Fetch option chain snapshot for an underlying on a given date |
356
- | `compute_vix_context` | Compute cross-ticker VIX regime fields for a date range |
357
- | `refresh_market_data` | Composite daily refresh: fetch bars, auto-fire VIX context, return coverage report |
358
- | `enrich_market_data` | Compute ~40 derived indicators from raw OHLCV |
359
- | `enrich_trades` | Enrich trades with market context (lookahead-free) |
360
- | `analyze_regime_performance` | Analyze P&L by market regime |
361
- | `suggest_filters` | Suggest trade filters based on market conditions |
362
- | `calculate_orb` | Opening range breakout analysis from intraday bars |
350
+
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 context (lookahead-free) |
363
+ | `analyze_regime_performance` | Analyze P&L by market regime |
364
+ | `suggest_filters` | Suggest trade filters based on market conditions |
365
+ | `calculate_orb` | Opening range breakout analysis from intraday bars |
363
366
 
364
367
  ### Strategy Profile Tools
365
- | Tool | Description |
366
- |------|-------------|
367
- | `profile_strategy` | Create or update a strategy profile with structured metadata |
368
- | `get_strategy_profile` | Retrieve a stored strategy profile |
369
- | `list_profiles` | List all strategy profiles (optionally filtered by block) |
370
- | `delete_profile` | Delete a strategy profile |
371
- | `analyze_structure_fit` | Analyze strategy performance by regime/condition dimensions |
372
- | `validate_entry_filters` | Test each entry filter's contribution to edge |
373
- | `portfolio_structure_map` | Regime x structure coverage matrix across strategies |
368
+
369
+ | Tool | Description |
370
+ | ------------------------- | ------------------------------------------------------------ |
371
+ | `profile_strategy` | Create or update a strategy profile with structured metadata |
372
+ | `get_strategy_profile` | Retrieve a stored strategy profile |
373
+ | `list_profiles` | List all strategy profiles (optionally filtered by block) |
374
+ | `delete_profile` | Delete a strategy profile |
375
+ | `analyze_structure_fit` | Analyze strategy performance by regime/condition dimensions |
376
+ | `validate_entry_filters` | Test each entry filter's contribution to edge |
377
+ | `portfolio_structure_map` | Regime x structure coverage matrix across strategies |
374
378
 
375
379
  ### Import Tools
376
- | Tool | Description |
377
- |------|-------------|
378
- | `import_csv` | Import a CSV file as a new block *(CLI only - not available in Claude Desktop)* |
380
+
381
+ | Tool | Description |
382
+ | ------------ | ------------------------------------------------------------------------------- |
383
+ | `import_csv` | Import a CSV file as a new block _(CLI only - not available in Claude Desktop)_ |
379
384
 
380
385
  ## Development
381
386
 
@@ -388,9 +393,6 @@ npm run build
388
393
 
389
394
  # Run tests
390
395
  npm test
391
-
392
- # Pack MCPB bundle
393
- npm run mcpb:pack
394
396
  ```
395
397
 
396
398
  ## Market Data (Optional)
@@ -398,11 +400,13 @@ npm run mcpb:pack
398
400
  For market context (VIX regimes, intraday timing, gap analysis), import market data using MCP tools:
399
401
 
400
402
  **From a data provider (Massive.com default, or ThetaData):**
403
+
401
404
  1. **Fetch bars** via `fetch_bars { tickers, timespan, from, to }` — writes directly to Parquet
402
405
  2. **Fetch VIX context** via `fetch_bars` for VIX/VIX9D/VIX3M then `compute_vix_context`
403
406
  3. **Or use** `refresh_market_data` for a combined daily refresh in one call
404
407
 
405
408
  **From TradingView CSV exports:**
409
+
406
410
  1. **Export** from TradingView (any chart: SPX daily, VIX daily, SPX 5-min, etc.)
407
411
  2. **Import** via `import_market_csv` with a column mapping or `import_flat_file` for Parquet
408
412
  3. **Enrich** via `enrich_market_data` to compute ~40 derived indicators
@@ -410,6 +414,7 @@ For market context (VIX regimes, intraday timing, gap analysis), import market d
410
414
  No Pine Scripts needed — TradingView exports raw OHLCV natively.
411
415
 
412
416
  Market data lives in a separate `market.duckdb` (configurable via `MARKET_DB_PATH` or `--market-db`). Canonical v3.0 datasets:
417
+
413
418
  - `market.spot` — Raw per-minute OHLCV bars, ticker-first layout (keyed by `ticker, date, time`)
414
419
  - `market.spot_daily` — RTH-aggregated daily OHLCV view derived from `market.spot` (keyed by `ticker, date`)
415
420
  - `market.enriched` — Per-ticker computed enrichment indicators and calendar fields; OHLCV is NOT stored here (join `market.spot_daily` for OHLCV — keyed by `ticker, date`)
@@ -254,12 +254,7 @@ async function getTradesByDateRange(blockId, startDate, endDate) {
254
254
  return withReadTransaction(STORES.TRADES, async (transaction) => {
255
255
  const store = transaction.objectStore(STORES.TRADES);
256
256
  const index = store.index("composite_block_date");
257
- const range = IDBKeyRange.bound(
258
- [blockId, startDate],
259
- [blockId, endDate],
260
- false,
261
- false
262
- );
257
+ const range = IDBKeyRange.bound([blockId, startDate], [blockId, endDate], false, false);
263
258
  const result = await promisifyRequest(index.getAll(range));
264
259
  return result;
265
260
  });
@@ -356,9 +351,7 @@ async function getTradeStatistics(blockId) {
356
351
  const dates = trades.map((trade) => new Date(trade.dateOpened));
357
352
  const start = new Date(Math.min(...dates.map((d) => d.getTime())));
358
353
  const end = new Date(Math.max(...dates.map((d) => d.getTime())));
359
- const strategies = Array.from(
360
- new Set(trades.map((trade) => trade.strategy))
361
- ).sort();
354
+ const strategies = Array.from(new Set(trades.map((trade) => trade.strategy))).sort();
362
355
  return {
363
356
  totalTrades,
364
357
  totalPl,
@@ -517,11 +510,9 @@ async function initializeDatabase() {
517
510
  unique: false
518
511
  });
519
512
  tradesStore.createIndex("pl", "pl", { unique: false });
520
- tradesStore.createIndex(
521
- "composite_block_date",
522
- ["blockId", "dateOpened"],
523
- { unique: false }
524
- );
513
+ tradesStore.createIndex("composite_block_date", ["blockId", "dateOpened"], {
514
+ unique: false
515
+ });
525
516
  }
526
517
  if (!db.objectStoreNames.contains(STORES.DAILY_LOGS)) {
527
518
  const dailyLogsStore = db.createObjectStore(STORES.DAILY_LOGS, {
@@ -533,11 +524,7 @@ async function initializeDatabase() {
533
524
  dailyLogsStore.createIndex(INDEXES.DAILY_LOGS_BY_DATE, "date", {
534
525
  unique: false
535
526
  });
536
- dailyLogsStore.createIndex(
537
- "composite_block_date",
538
- ["blockId", "date"],
539
- { unique: false }
540
- );
527
+ dailyLogsStore.createIndex("composite_block_date", ["blockId", "date"], { unique: false });
541
528
  }
542
529
  if (!db.objectStoreNames.contains(STORES.REPORTING_LOGS)) {
543
530
  const reportingStore = db.createObjectStore(STORES.REPORTING_LOGS, {
@@ -546,26 +533,18 @@ async function initializeDatabase() {
546
533
  reportingStore.createIndex(INDEXES.REPORTING_LOGS_BY_BLOCK, "blockId", {
547
534
  unique: false
548
535
  });
549
- reportingStore.createIndex(
550
- INDEXES.REPORTING_LOGS_BY_STRATEGY,
551
- "strategy",
552
- { unique: false }
553
- );
554
- reportingStore.createIndex(
555
- "composite_block_date",
556
- ["blockId", "dateOpened"],
557
- { unique: false }
558
- );
536
+ reportingStore.createIndex(INDEXES.REPORTING_LOGS_BY_STRATEGY, "strategy", {
537
+ unique: false
538
+ });
539
+ reportingStore.createIndex("composite_block_date", ["blockId", "dateOpened"], {
540
+ unique: false
541
+ });
559
542
  }
560
543
  if (!db.objectStoreNames.contains(STORES.CALCULATIONS)) {
561
544
  const calculationsStore = db.createObjectStore(STORES.CALCULATIONS, {
562
545
  keyPath: "id"
563
546
  });
564
- calculationsStore.createIndex(
565
- INDEXES.CALCULATIONS_BY_BLOCK,
566
- "blockId",
567
- { unique: false }
568
- );
547
+ calculationsStore.createIndex(INDEXES.CALCULATIONS_BY_BLOCK, "blockId", { unique: false });
569
548
  calculationsStore.createIndex("calculationType", "calculationType", {
570
549
  unique: false
571
550
  });
@@ -593,16 +572,12 @@ async function initializeDatabase() {
593
572
  const staticDatasetRowsStore = db.createObjectStore(STORES.STATIC_DATASET_ROWS, {
594
573
  autoIncrement: true
595
574
  });
596
- staticDatasetRowsStore.createIndex(
597
- INDEXES.STATIC_DATASET_ROWS_BY_DATASET,
598
- "datasetId",
599
- { unique: false }
600
- );
601
- staticDatasetRowsStore.createIndex(
602
- INDEXES.STATIC_DATASET_ROWS_BY_TIMESTAMP,
603
- "timestamp",
604
- { unique: false }
605
- );
575
+ staticDatasetRowsStore.createIndex(INDEXES.STATIC_DATASET_ROWS_BY_DATASET, "datasetId", {
576
+ unique: false
577
+ });
578
+ staticDatasetRowsStore.createIndex(INDEXES.STATIC_DATASET_ROWS_BY_TIMESTAMP, "timestamp", {
579
+ unique: false
580
+ });
606
581
  staticDatasetRowsStore.createIndex(
607
582
  "composite_dataset_timestamp",
608
583
  ["datasetId", "timestamp"],
@@ -669,12 +644,7 @@ async function getDailyLogsByDateRange(blockId, startDate, endDate) {
669
644
  return withReadTransaction(STORES.DAILY_LOGS, async (transaction) => {
670
645
  const store = transaction.objectStore(STORES.DAILY_LOGS);
671
646
  const index = store.index("composite_block_date");
672
- const range = IDBKeyRange.bound(
673
- [blockId, startDate],
674
- [blockId, endDate],
675
- false,
676
- false
677
- );
647
+ const range = IDBKeyRange.bound([blockId, startDate], [blockId, endDate], false, false);
678
648
  const result = await promisifyRequest(index.getAll(range));
679
649
  return result;
680
650
  });
@@ -750,7 +720,9 @@ async function getDailyLogStatistics(blockId) {
750
720
  const dates = entries.map((entry) => new Date(entry.date));
751
721
  const start = new Date(Math.min(...dates.map((d) => d.getTime())));
752
722
  const end = new Date(Math.max(...dates.map((d) => d.getTime())));
753
- const sortedEntries = entries.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
723
+ const sortedEntries = entries.sort(
724
+ (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
725
+ );
754
726
  const finalPortfolioValue = sortedEntries[0]?.netLiquidity || 0;
755
727
  const maxDrawdown = Math.min(...entries.map((entry) => entry.drawdownPct));
756
728
  const totalPl = entries.reduce((sum, entry) => sum + entry.dailyPl, 0);
@@ -864,4 +836,4 @@ export {
864
836
  getTradesPage,
865
837
  exportTradesToCSV
866
838
  };
867
- //# sourceMappingURL=chunk-LDKTV7GW.js.map
839
+ //# sourceMappingURL=chunk-27S67XW3.js.map