tradeblocks-mcp 2.2.6 → 2.3.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 CHANGED
@@ -16,7 +16,7 @@ Model Context Protocol (MCP) server for options trading analysis. Works with Cla
16
16
 
17
17
  ### Option 1: MCPB Bundle (Claude Desktop - One Click)
18
18
 
19
- Download the latest `.mcpb` file from [Releases](https://gitlab.com/davidromeo/tradeblocks/-/releases) and double-click to install.
19
+ Download the latest `.mcpb` file from [Releases](https://github.com/davidromeo/tradeblocks/releases) and double-click to install.
20
20
 
21
21
  The installer will prompt you to select your Trading Data Directory.
22
22
 
@@ -37,7 +37,7 @@ See [Configuration by Platform](#configuration-by-platform) below for platform-s
37
37
  ### Option 3: From Source
38
38
 
39
39
  ```bash
40
- git clone https://gitlab.com/davidromeo/tradeblocks
40
+ git clone https://github.com/davidromeo/tradeblocks
41
41
  cd tradeblocks
42
42
  npm install
43
43
  npm run build -w packages/mcp-server
@@ -53,6 +53,25 @@ async function ensureSyncTables(conn) {
53
53
  sync_version INTEGER DEFAULT 1
54
54
  )
55
55
  `);
56
+ const result = await conn.run(`
57
+ SELECT COUNT(*) AS cnt FROM duckdb_constraints()
58
+ WHERE schema_name = 'trades' AND table_name = '_sync_metadata'
59
+ AND constraint_type = 'PRIMARY KEY'
60
+ `);
61
+ const rows = await result.getRows();
62
+ if (Number(rows[0][0]) === 0) {
63
+ await conn.run(`DROP TABLE trades._sync_metadata`);
64
+ await conn.run(`
65
+ CREATE TABLE trades._sync_metadata (
66
+ block_id VARCHAR PRIMARY KEY,
67
+ tradelog_hash VARCHAR NOT NULL,
68
+ dailylog_hash VARCHAR,
69
+ reportinglog_hash VARCHAR,
70
+ synced_at TIMESTAMP NOT NULL,
71
+ sync_version INTEGER DEFAULT 1
72
+ )
73
+ `);
74
+ }
56
75
  }
57
76
  async function ensureTradeDataTable(conn) {
58
77
  await conn.run(`
@@ -315,6 +334,30 @@ async function ensureMarketTables(conn) {
315
334
  } catch {
316
335
  }
317
336
  }
337
+ await conn.run(`
338
+ CREATE TABLE IF NOT EXISTS market.option_chain (
339
+ underlying VARCHAR NOT NULL,
340
+ date VARCHAR NOT NULL,
341
+ ticker VARCHAR NOT NULL,
342
+ contract_type VARCHAR NOT NULL,
343
+ strike DOUBLE NOT NULL,
344
+ expiration VARCHAR NOT NULL,
345
+ dte INTEGER,
346
+ exercise_style VARCHAR,
347
+ PRIMARY KEY (underlying, date, ticker)
348
+ )
349
+ `);
350
+ await conn.run(`
351
+ CREATE TABLE IF NOT EXISTS market.data_coverage (
352
+ ticker VARCHAR NOT NULL,
353
+ date VARCHAR NOT NULL,
354
+ source VARCHAR NOT NULL, -- 'flatfile', 'api_trade', 'api_quote', 'csv_import'
355
+ bar_count INTEGER NOT NULL,
356
+ has_quotes BOOLEAN DEFAULT FALSE,
357
+ imported_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
358
+ PRIMARY KEY (ticker, date, source)
359
+ )
360
+ `);
318
361
  await conn.run(`
319
362
  CREATE TABLE IF NOT EXISTS market._sync_metadata (
320
363
  source VARCHAR NOT NULL,
@@ -754,6 +797,15 @@ async function openReadWriteConnection(dbPath, threads, memoryLimit) {
754
797
  await ensureReportingDataTable(connection);
755
798
  await ensureMarketTables(connection);
756
799
  await ensureProfilesSchema(connection);
800
+ try {
801
+ const ext = await import("./connection.ext.js");
802
+ const ctx = await ext.default(connection, {
803
+ baseDir: path.dirname(dbPath),
804
+ marketDbPath: storedMarketDbPath
805
+ });
806
+ if (ctx?.intradayWriteTable) _intradayWriteTable = ctx.intradayWriteTable;
807
+ } catch {
808
+ }
757
809
  connectionMode = "read_write";
758
810
  return connection;
759
811
  }
@@ -898,6 +950,10 @@ async function downgradeToReadOnly(dataDir) {
898
950
  function isConnected() {
899
951
  return connection !== null;
900
952
  }
953
+ var _intradayWriteTable = "market.intraday";
954
+ function getIntradayWriteTable() {
955
+ return _intradayWriteTable;
956
+ }
901
957
 
902
958
  // src/sync/block-sync.ts
903
959
  import * as fs5 from "fs/promises";
@@ -22617,7 +22673,7 @@ async function detectBlockChanges(conn, baseDir) {
22617
22673
  for (const entry of entries) {
22618
22674
  if (!entry.isDirectory()) continue;
22619
22675
  if (entry.name.startsWith(".") || entry.name.startsWith("_")) continue;
22620
- if (entry.name.includes(".")) continue;
22676
+ if (entry.name.endsWith(".tmp") || entry.name.endsWith(".duckdb") || entry.name.endsWith(".duckdb.tmp")) continue;
22621
22677
  const blockId = entry.name;
22622
22678
  folderNames.add(blockId);
22623
22679
  const blockPath = path4.join(baseDir, blockId);
@@ -22754,6 +22810,7 @@ export {
22754
22810
  upgradeToReadWrite,
22755
22811
  downgradeToReadOnly,
22756
22812
  isConnected,
22813
+ getIntradayWriteTable,
22757
22814
  detectCsvType,
22758
22815
  discoverCsvFiles,
22759
22816
  logCsvDiscoveryWarning,
@@ -22788,4 +22845,4 @@ decimal.js/decimal.mjs:
22788
22845
  * MIT Licence
22789
22846
  *)
22790
22847
  */
22791
- //# sourceMappingURL=chunk-FIKAXL2L.js.map
22848
+ //# sourceMappingURL=chunk-37JFR6NF.js.map