tradeblocks-mcp 3.0.2 → 3.0.3
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 +82 -68
- package/dist/{chunk-LDKTV7GW.js → chunk-27S67XW3.js} +24 -52
- package/dist/chunk-27S67XW3.js.map +1 -0
- package/dist/{chunk-FGZH632F.js → chunk-2E63THNI.js} +13 -11
- package/dist/chunk-2E63THNI.js.map +1 -0
- package/dist/{chunk-BKQ4PM4Y.js → chunk-6S37CXUA.js} +11 -13
- package/dist/chunk-6S37CXUA.js.map +1 -0
- package/dist/{chunk-PRAYH3RT.js → chunk-AP7IHUUR.js} +29 -12
- package/dist/chunk-AP7IHUUR.js.map +1 -0
- package/dist/{chunk-QTTR7AAW.js → chunk-C6LL746C.js} +67 -84
- package/dist/{chunk-QTTR7AAW.js.map → chunk-C6LL746C.js.map} +1 -1
- package/dist/{chunk-W2PP3LEH.js → chunk-SEUZYQGQ.js} +17 -8
- package/dist/chunk-SEUZYQGQ.js.map +1 -0
- package/dist/{chunk-4BLCXNQ6.js → chunk-UBUC5A66.js} +105 -114
- package/dist/chunk-UBUC5A66.js.map +1 -0
- package/dist/{chunk-XXYOUIZY.js → chunk-VDU25Z6X.js} +63 -80
- package/dist/chunk-VDU25Z6X.js.map +1 -0
- package/dist/daily-log-processor-BY3ISY6K.js +9 -0
- package/dist/{daily-logs-store-D3QC2XPV.js → daily-logs-store-3C3OTGPK.js} +2 -2
- package/dist/iv-solver-worker.js +9 -1
- package/dist/market-provider-H3ARIVZ4.js +16 -0
- package/dist/{proto-3HZTCWK4.js → proto-V23GIZG2.js} +2 -2
- package/dist/{sync-PO4IPCYV.js → sync-EVLKB3ZJ.js} +7 -7
- package/dist/test-exports.js +358 -254
- package/dist/test-exports.js.map +1 -1
- package/dist/trade-processor-EYA3I3XB.js +9 -0
- package/dist/{trades-store-LOL3FQSF.js → trades-store-R3NL25T2.js} +2 -2
- package/manifest.json +3 -11
- package/package.json +1 -1
- package/server/{chunk-NZO6PT64.js → chunk-4P7D7YZP.js} +102 -113
- package/server/chunk-4P7D7YZP.js.map +1 -0
- package/server/{chunk-72GKJE2U.js → chunk-BOPHW5M6.js} +521 -235
- package/server/chunk-BOPHW5M6.js.map +1 -0
- package/server/{chunk-WA5AAPCH.js → chunk-GH2552SE.js} +17 -8
- package/server/chunk-GH2552SE.js.map +1 -0
- package/server/{chunk-5EBXHT6C.js → chunk-OBYKFW2B.js} +11 -13
- package/server/chunk-OBYKFW2B.js.map +1 -0
- package/server/{chunk-FBNDMCT5.js → chunk-T66KH2XH.js} +13 -11
- package/server/chunk-T66KH2XH.js.map +1 -0
- package/server/{chunk-NRFXAJF7.js → chunk-W5E7FHC4.js} +24 -52
- package/server/chunk-W5E7FHC4.js.map +1 -0
- package/server/{chunk-CSDVJPBB.js → chunk-YUCOAJ4Z.js} +29 -12
- package/server/chunk-YUCOAJ4Z.js.map +1 -0
- package/server/{chunk-PNKG7RY7.js → chunk-ZBJCF4ZG.js} +63 -80
- package/server/chunk-ZBJCF4ZG.js.map +1 -0
- package/server/{config-6IZXEFEX.js → config-DK7KOMNL.js} +1 -1
- package/server/config-DK7KOMNL.js.map +1 -0
- package/server/daily-log-processor-ENEUT22A.js +10 -0
- package/server/{daily-logs-store-NU7M4L5C.js → daily-logs-store-YFNXTB7J.js} +2 -2
- package/server/http-server.js +2 -5
- package/server/index.js +1771 -1538
- package/server/index.js.map +1 -1
- package/server/iv-solver-worker.js +9 -1
- package/server/market-provider-B437HKLW.js +17 -0
- package/server/{proto-DWRZJO4E.js → proto-YZ4TLX2N.js} +2 -2
- package/server/{sync-QFI5L7S7.js → sync-V25UQJA3.js} +7 -7
- package/server/trade-processor-L3PIQ5TG.js +10 -0
- package/server/{trades-store-VY26MWER.js → trades-store-RTTEYMXH.js} +2 -2
- package/src/auth/clients-store.ts +4 -4
- package/src/auth/code-store.ts +1 -1
- package/src/auth/config.ts +11 -12
- package/src/auth/login-page.ts +8 -10
- package/src/auth/provider.ts +35 -30
- package/src/auth/token.ts +17 -15
- package/src/db/backtest-schemas.ts +12 -4
- package/src/db/connection.ts +107 -40
- package/src/db/index.ts +37 -5
- package/src/db/json-adapters.ts +22 -31
- package/src/db/json-migration.ts +11 -15
- package/src/db/json-store.ts +5 -3
- package/src/db/market-datasets.ts +48 -15
- package/src/db/market-schemas.ts +11 -5
- package/src/db/market-views.ts +119 -32
- package/src/db/parquet-writer.ts +7 -7
- package/src/db/profile-schemas.ts +39 -22
- package/src/db/schemas.ts +2 -2
- package/src/http-server.ts +7 -12
- package/src/index.ts +8 -9
- package/src/market/ingestor/index.ts +1 -4
- package/src/market/ingestor/market-ingestor.ts +140 -67
- package/src/market/ingestor/types.ts +1 -3
- package/src/market/stores/chain-sql.ts +2 -8
- package/src/market/stores/chain-store.ts +1 -4
- package/src/market/stores/duckdb-chain-store.ts +3 -14
- package/src/market/stores/duckdb-enriched-store.ts +3 -13
- package/src/market/stores/duckdb-quote-store.ts +10 -27
- package/src/market/stores/duckdb-spot-store.ts +4 -20
- package/src/market/stores/enriched-sql.ts +3 -9
- package/src/market/stores/enriched-store.ts +2 -2
- package/src/market/stores/parquet-chain-store.ts +5 -22
- package/src/market/stores/parquet-enriched-store.ts +4 -16
- package/src/market/stores/parquet-oi-daily-store.ts +3 -14
- package/src/market/stores/parquet-quote-store.ts +9 -29
- package/src/market/stores/parquet-spot-store.ts +14 -33
- package/src/market/stores/quote-store.ts +2 -10
- package/src/market/stores/spot-sql.ts +3 -15
- package/src/market/stores/spot-store.ts +1 -1
- package/src/market/tickers/defaults.json +6 -6
- package/src/market/tickers/loader.ts +2 -7
- package/src/market/tickers/registry.ts +5 -15
- package/src/market/tickers/schemas.ts +2 -6
- package/src/models/strategy-profile.ts +39 -39
- package/src/sync/block-sync.ts +44 -65
- package/src/sync/index.ts +1 -4
- package/src/sync/metadata.ts +14 -20
- package/src/test-exports.ts +127 -123
- package/src/tools/analysis.ts +180 -159
- package/src/tools/batch-exit-analysis.ts +100 -59
- package/src/tools/blocks/analysis.ts +116 -101
- package/src/tools/blocks/comparison.ts +281 -364
- package/src/tools/blocks/core.ts +208 -253
- package/src/tools/blocks/health.ts +571 -563
- package/src/tools/blocks/similarity.ts +316 -283
- package/src/tools/edge-decay.ts +124 -197
- package/src/tools/exit-analysis.ts +130 -77
- package/src/tools/greeks-attribution.ts +84 -35
- package/src/tools/guides.ts +4 -6
- package/src/tools/imports.ts +9 -12
- package/src/tools/market-data.ts +1067 -757
- package/src/tools/market-enrichment.ts +3 -3
- package/src/tools/market-fetch.ts +148 -67
- package/src/tools/market-imports.ts +12 -12
- package/src/tools/middleware/sync-middleware.ts +5 -6
- package/src/tools/performance.ts +185 -302
- package/src/tools/profile-analysis.ts +52 -66
- package/src/tools/profiles.ts +106 -69
- package/src/tools/regime-advisor.ts +20 -45
- package/src/tools/replay.ts +81 -77
- package/src/tools/reports/discrepancies.ts +298 -328
- package/src/tools/reports/fields.ts +7 -25
- package/src/tools/reports/helpers.ts +18 -49
- package/src/tools/reports/predictive.ts +27 -70
- package/src/tools/reports/slippage-trends.ts +315 -345
- package/src/tools/reports/slippage.ts +1 -4
- package/src/tools/reports/strategy-matches.ts +399 -441
- package/src/tools/schema.ts +43 -40
- package/src/tools/shared/filters.ts +3 -9
- package/src/tools/snapshot.ts +9 -30
- package/src/tools/sql.ts +15 -14
- package/src/tools/tickers.ts +1 -4
- package/src/utils/batch-exit-analysis.ts +31 -42
- package/src/utils/black-scholes.ts +39 -29
- package/src/utils/block-loader.ts +68 -82
- package/src/utils/calibration-probe.ts +1 -2
- package/src/utils/chain-loader.ts +3 -3
- package/src/utils/csv-discovery.ts +16 -22
- package/src/utils/data-quality.ts +24 -36
- package/src/utils/exit-triggers.ts +91 -96
- package/src/utils/field-timing.ts +94 -79
- package/src/utils/filter-predicates.ts +13 -9
- package/src/utils/flatfile-importer.ts +94 -64
- package/src/utils/greeks-decomposition.ts +152 -100
- package/src/utils/iv-solver-pool.ts +55 -25
- package/src/utils/iv-solver-worker.ts +5 -5
- package/src/utils/market-enricher.ts +528 -497
- package/src/utils/market-importer.ts +31 -12
- package/src/utils/market-provider.ts +21 -23
- package/src/utils/massive-tier.ts +5 -7
- package/src/utils/migrate-option-data-helpers.ts +2 -8
- package/src/utils/option-quote-greeks.ts +25 -31
- package/src/utils/option-time.ts +4 -8
- package/src/utils/output-formatter.ts +1 -4
- package/src/utils/provider-capabilities.ts +1 -4
- package/src/utils/providers/massive.ts +59 -93
- package/src/utils/providers/thetadata/backfill.ts +14 -23
- package/src/utils/providers/thetadata/client.ts +12 -8
- package/src/utils/providers/thetadata/decode.ts +2 -20
- package/src/utils/providers/thetadata/endpoints.ts +32 -40
- package/src/utils/providers/thetadata/join.ts +11 -10
- package/src/utils/providers/thetadata/proto.ts +12 -10
- package/src/utils/providers/thetadata/quote-mid-greeks.ts +5 -5
- package/src/utils/providers/thetadata.ts +11 -10
- package/src/utils/quote-enricher.ts +4 -4
- package/src/utils/quote-parquet-projection.ts +3 -11
- package/src/utils/sample-date-selector.ts +3 -5
- package/src/utils/schema-metadata.ts +102 -70
- package/src/utils/ticker.ts +5 -9
- package/src/utils/trade-replay.ts +77 -68
- package/dist/chunk-4BLCXNQ6.js.map +0 -1
- package/dist/chunk-BKQ4PM4Y.js.map +0 -1
- package/dist/chunk-FGZH632F.js.map +0 -1
- package/dist/chunk-LDKTV7GW.js.map +0 -1
- package/dist/chunk-PRAYH3RT.js.map +0 -1
- package/dist/chunk-W2PP3LEH.js.map +0 -1
- package/dist/chunk-XXYOUIZY.js.map +0 -1
- package/dist/daily-log-processor-6MWJ23JK.js +0 -9
- package/dist/market-provider-VDRJUEF2.js +0 -16
- package/dist/trade-processor-NHU4VWRX.js +0 -9
- package/server/chunk-5EBXHT6C.js.map +0 -1
- package/server/chunk-72GKJE2U.js.map +0 -1
- package/server/chunk-CSDVJPBB.js.map +0 -1
- package/server/chunk-FBNDMCT5.js.map +0 -1
- package/server/chunk-NRFXAJF7.js.map +0 -1
- package/server/chunk-NZO6PT64.js.map +0 -1
- package/server/chunk-PNKG7RY7.js.map +0 -1
- package/server/chunk-WA5AAPCH.js.map +0 -1
- package/server/config-6IZXEFEX.js.map +0 -1
- package/server/daily-log-processor-Y3PVSVBM.js +0 -10
- package/server/market-provider-VOYYVYWT.js +0 -17
- package/server/trade-processor-JWVS37KM.js +0 -10
- /package/dist/{daily-log-processor-6MWJ23JK.js.map → daily-log-processor-BY3ISY6K.js.map} +0 -0
- /package/dist/{daily-logs-store-D3QC2XPV.js.map → daily-logs-store-3C3OTGPK.js.map} +0 -0
- /package/dist/{market-provider-VDRJUEF2.js.map → market-provider-H3ARIVZ4.js.map} +0 -0
- /package/dist/{proto-3HZTCWK4.js.map → proto-V23GIZG2.js.map} +0 -0
- /package/dist/{sync-PO4IPCYV.js.map → sync-EVLKB3ZJ.js.map} +0 -0
- /package/dist/{trade-processor-NHU4VWRX.js.map → trade-processor-EYA3I3XB.js.map} +0 -0
- /package/dist/{trades-store-LOL3FQSF.js.map → trades-store-R3NL25T2.js.map} +0 -0
- /package/server/{daily-log-processor-Y3PVSVBM.js.map → daily-log-processor-ENEUT22A.js.map} +0 -0
- /package/server/{daily-logs-store-NU7M4L5C.js.map → daily-logs-store-YFNXTB7J.js.map} +0 -0
- /package/server/{market-provider-VOYYVYWT.js.map → market-provider-B437HKLW.js.map} +0 -0
- /package/server/{proto-DWRZJO4E.js.map → proto-YZ4TLX2N.js.map} +0 -0
- /package/server/{sync-QFI5L7S7.js.map → sync-V25UQJA3.js.map} +0 -0
- /package/server/{trade-processor-JWVS37KM.js.map → trade-processor-L3PIQ5TG.js.map} +0 -0
- /package/server/{trades-store-VY26MWER.js.map → trades-store-RTTEYMXH.js.map} +0 -0
package/src/test-exports.ts
CHANGED
|
@@ -15,47 +15,63 @@ export {
|
|
|
15
15
|
type CsvMappings,
|
|
16
16
|
type ImportCsvResult,
|
|
17
17
|
type ImportCsvOptions,
|
|
18
|
-
} from
|
|
18
|
+
} from "./utils/block-loader.ts";
|
|
19
19
|
|
|
20
20
|
// Export CSV discovery utilities for unit testing
|
|
21
|
-
export {
|
|
21
|
+
export {
|
|
22
|
+
detectCsvType,
|
|
23
|
+
discoverCsvFiles,
|
|
24
|
+
logCsvDiscoveryWarning,
|
|
25
|
+
type CsvType,
|
|
26
|
+
} from "./utils/csv-discovery.ts";
|
|
22
27
|
|
|
23
28
|
// Export PortfolioStatsCalculator for testing block_diff logic
|
|
24
|
-
export { PortfolioStatsCalculator } from
|
|
29
|
+
export { PortfolioStatsCalculator } from "@tradeblocks/lib";
|
|
25
30
|
|
|
26
31
|
// Export correlation and tail-risk utilities for testing strategy_similarity
|
|
27
|
-
export { calculateCorrelationMatrix, performTailRiskAnalysis } from
|
|
32
|
+
export { calculateCorrelationMatrix, performTailRiskAnalysis } from "@tradeblocks/lib";
|
|
28
33
|
|
|
29
34
|
// Export sync layer for integration testing
|
|
30
|
-
export {
|
|
31
|
-
syncAllBlocks,
|
|
32
|
-
syncBlock,
|
|
33
|
-
type SyncResult,
|
|
34
|
-
type BlockSyncResult,
|
|
35
|
-
} from './sync/index.ts';
|
|
35
|
+
export { syncAllBlocks, syncBlock, type SyncResult, type BlockSyncResult } from "./sync/index.ts";
|
|
36
36
|
|
|
37
37
|
// Export DuckDB connection utilities for integration testing
|
|
38
|
-
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
export {
|
|
39
|
+
getConnection,
|
|
40
|
+
getReadOnlyConnection,
|
|
41
|
+
closeConnection,
|
|
42
|
+
isConnected,
|
|
43
|
+
getConnectionMode,
|
|
44
|
+
upgradeToReadWrite,
|
|
45
|
+
downgradeToReadOnly,
|
|
46
|
+
getCurrentConnection,
|
|
47
|
+
openMarketOnlyConnection,
|
|
48
|
+
openMarketParquetConnection,
|
|
49
|
+
openMarketReadOnlyConnection,
|
|
50
|
+
} from "./db/connection.ts";
|
|
51
|
+
export type {
|
|
52
|
+
MarketOnlyConnection,
|
|
53
|
+
MarketParquetConnection,
|
|
54
|
+
MarketReadOnlyConnection,
|
|
55
|
+
} from "./db/connection.ts";
|
|
56
|
+
export { setDataRoot, getDataRoot, resetDataRoot } from "./db/data-root.ts";
|
|
57
|
+
export { yesterdayET } from "./utils/trading-dates.ts";
|
|
42
58
|
export {
|
|
43
59
|
resolveCanonicalMarketFile,
|
|
44
60
|
resolveCanonicalMarketPartitionDir,
|
|
45
61
|
resolveCanonicalMarketPartitionPath,
|
|
46
62
|
resolveCanonicalMarketPartitionFile,
|
|
47
63
|
canonicalMarketTableName,
|
|
48
|
-
} from
|
|
64
|
+
} from "./db/market-datasets.ts";
|
|
49
65
|
|
|
50
66
|
// Export market schema utilities for integration testing
|
|
51
|
-
export { ensureMutableMarketTables, ensureMarketDataTables } from
|
|
67
|
+
export { ensureMutableMarketTables, ensureMarketDataTables } from "./db/market-schemas.ts";
|
|
52
68
|
|
|
53
69
|
// Export shared filter utilities for testing
|
|
54
70
|
export {
|
|
55
71
|
filterByStrategy,
|
|
56
72
|
filterByDateRange,
|
|
57
73
|
filterDailyLogsByDateRange,
|
|
58
|
-
} from
|
|
74
|
+
} from "./tools/shared/filters.ts";
|
|
59
75
|
|
|
60
76
|
// Export field timing utilities for testing
|
|
61
77
|
export {
|
|
@@ -70,27 +86,24 @@ export {
|
|
|
70
86
|
buildLookaheadFreeQuery,
|
|
71
87
|
buildOutcomeQuery,
|
|
72
88
|
buildVixJoinClause,
|
|
73
|
-
} from
|
|
89
|
+
} from "./utils/field-timing.ts";
|
|
74
90
|
|
|
75
91
|
// Export data availability helper for testing
|
|
76
|
-
export {
|
|
77
|
-
checkDataAvailability,
|
|
78
|
-
type DataAvailabilityReport,
|
|
79
|
-
} from './utils/data-availability.ts';
|
|
92
|
+
export { checkDataAvailability, type DataAvailabilityReport } from "./utils/data-availability.ts";
|
|
80
93
|
export {
|
|
81
94
|
queryCoverage,
|
|
82
95
|
scoreDataQuality,
|
|
83
96
|
formatCoverageReport,
|
|
84
97
|
type DataQualityInput,
|
|
85
98
|
type CoverageResult,
|
|
86
|
-
} from
|
|
99
|
+
} from "./utils/data-quality.ts";
|
|
87
100
|
|
|
88
101
|
// Export intraday timing utilities for testing
|
|
89
|
-
export { computeIntradayTimingFields } from
|
|
102
|
+
export { computeIntradayTimingFields } from "./utils/market-enricher.ts";
|
|
90
103
|
|
|
91
104
|
// Export schema metadata for classification completeness tests
|
|
92
|
-
export { SCHEMA_DESCRIPTIONS } from
|
|
93
|
-
export type { ColumnDescription } from
|
|
105
|
+
export { SCHEMA_DESCRIPTIONS } from "./utils/schema-metadata.ts";
|
|
106
|
+
export type { ColumnDescription } from "./utils/schema-metadata.ts";
|
|
94
107
|
|
|
95
108
|
// Export market import utilities for integration testing
|
|
96
109
|
export {
|
|
@@ -102,14 +115,14 @@ export {
|
|
|
102
115
|
type ImportMarketCsvParams,
|
|
103
116
|
type ImportFromDatabaseParams,
|
|
104
117
|
type ImportSpotResult,
|
|
105
|
-
} from
|
|
118
|
+
} from "./utils/market-importer.ts";
|
|
106
119
|
|
|
107
120
|
// Export market import metadata helpers for integration testing
|
|
108
121
|
export {
|
|
109
122
|
type MarketImportMetadata,
|
|
110
123
|
getMarketImportMetadata,
|
|
111
124
|
upsertMarketImportMetadata,
|
|
112
|
-
} from
|
|
125
|
+
} from "./sync/metadata.ts";
|
|
113
126
|
|
|
114
127
|
// Export market enricher indicator functions for unit testing
|
|
115
128
|
export {
|
|
@@ -129,7 +142,7 @@ export {
|
|
|
129
142
|
computeIVP,
|
|
130
143
|
type ContextRow,
|
|
131
144
|
type EnrichedContextRow,
|
|
132
|
-
} from
|
|
145
|
+
} from "./utils/market-enricher.ts";
|
|
133
146
|
|
|
134
147
|
// Export market enrichment utilities for integration testing
|
|
135
148
|
export {
|
|
@@ -138,7 +151,7 @@ export {
|
|
|
138
151
|
type EnrichmentResult,
|
|
139
152
|
type EnrichmentOptions,
|
|
140
153
|
type TierStatus,
|
|
141
|
-
} from
|
|
154
|
+
} from "./utils/market-enricher.ts";
|
|
142
155
|
|
|
143
156
|
// Export strategy profile types and CRUD functions for integration testing
|
|
144
157
|
export type {
|
|
@@ -149,18 +162,18 @@ export type {
|
|
|
149
162
|
ExitRule,
|
|
150
163
|
KeyMetrics,
|
|
151
164
|
PositionSizing,
|
|
152
|
-
} from
|
|
165
|
+
} from "./models/strategy-profile.ts";
|
|
153
166
|
export {
|
|
154
167
|
ensureProfilesSchema,
|
|
155
168
|
upsertProfile,
|
|
156
169
|
getProfile,
|
|
157
170
|
listProfiles,
|
|
158
171
|
deleteProfile,
|
|
159
|
-
} from
|
|
172
|
+
} from "./db/profile-schemas.ts";
|
|
160
173
|
|
|
161
174
|
// Export analysis utility modules for unit testing
|
|
162
|
-
export { computeSliceStats, type SliceStats } from
|
|
163
|
-
export { buildFilterPredicate, type FilterPredicate } from
|
|
175
|
+
export { computeSliceStats, type SliceStats } from "./utils/analysis-stats.ts";
|
|
176
|
+
export { buildFilterPredicate, type FilterPredicate } from "./utils/filter-predicates.ts";
|
|
164
177
|
|
|
165
178
|
// Export profile tool handlers and schemas for integration testing
|
|
166
179
|
export {
|
|
@@ -172,7 +185,7 @@ export {
|
|
|
172
185
|
getStrategyProfileSchema,
|
|
173
186
|
listProfilesSchema,
|
|
174
187
|
deleteProfileSchema,
|
|
175
|
-
} from
|
|
188
|
+
} from "./tools/profiles.ts";
|
|
176
189
|
|
|
177
190
|
// Export profile analysis tool handlers and schemas for integration testing
|
|
178
191
|
export {
|
|
@@ -182,13 +195,13 @@ export {
|
|
|
182
195
|
analyzeStructureFitSchema,
|
|
183
196
|
validateEntryFiltersSchema,
|
|
184
197
|
portfolioStructureMapSchema,
|
|
185
|
-
} from
|
|
198
|
+
} from "./tools/profile-analysis.ts";
|
|
186
199
|
|
|
187
200
|
// Export regime advisor tool handler and schema for integration testing
|
|
188
201
|
export {
|
|
189
202
|
handleRegimeAllocationAdvisor,
|
|
190
203
|
regimeAllocationAdvisorSchema,
|
|
191
|
-
} from
|
|
204
|
+
} from "./tools/regime-advisor.ts";
|
|
192
205
|
|
|
193
206
|
// Export market data provider interface and types
|
|
194
207
|
export {
|
|
@@ -201,14 +214,14 @@ export {
|
|
|
201
214
|
type FetchSnapshotOptions,
|
|
202
215
|
type FetchSnapshotResult,
|
|
203
216
|
type MarketDataProvider,
|
|
204
|
-
} from
|
|
217
|
+
} from "./utils/market-provider.ts";
|
|
205
218
|
export {
|
|
206
219
|
resolveMassiveDataTier,
|
|
207
220
|
resolveProviderCapabilities,
|
|
208
221
|
getResolvedProviderCapabilities,
|
|
209
222
|
type MassiveDataTier,
|
|
210
223
|
type ResolvedProviderCapabilities,
|
|
211
|
-
} from
|
|
224
|
+
} from "./utils/provider-capabilities.ts";
|
|
212
225
|
|
|
213
226
|
// Export Massive provider internals for provider-specific tests
|
|
214
227
|
export {
|
|
@@ -229,7 +242,7 @@ export {
|
|
|
229
242
|
type MassiveAggregateResponse,
|
|
230
243
|
type MassiveQuote,
|
|
231
244
|
type MassiveQuotesResponse,
|
|
232
|
-
} from
|
|
245
|
+
} from "./utils/providers/massive.ts";
|
|
233
246
|
|
|
234
247
|
// Export trade replay utilities for unit testing
|
|
235
248
|
export {
|
|
@@ -245,14 +258,10 @@ export {
|
|
|
245
258
|
type ParsedLeg,
|
|
246
259
|
type ParsedLegOO,
|
|
247
260
|
type GreeksConfig,
|
|
248
|
-
} from
|
|
261
|
+
} from "./utils/trade-replay.ts";
|
|
249
262
|
|
|
250
263
|
// Export trade replay tool handler and schema for integration testing
|
|
251
|
-
export {
|
|
252
|
-
handleReplayTrade,
|
|
253
|
-
replayTradeSchema,
|
|
254
|
-
resolveOODateRange,
|
|
255
|
-
} from './tools/replay.ts';
|
|
264
|
+
export { handleReplayTrade, replayTradeSchema, resolveOODateRange } from "./tools/replay.ts";
|
|
256
265
|
|
|
257
266
|
// Export Black-Scholes and Bachelier greeks computation for unit testing
|
|
258
267
|
export {
|
|
@@ -273,9 +282,9 @@ export {
|
|
|
273
282
|
BACHELIER_DTE_THRESHOLD,
|
|
274
283
|
computeLegGreeks,
|
|
275
284
|
type GreeksResult,
|
|
276
|
-
} from
|
|
285
|
+
} from "./utils/black-scholes.ts";
|
|
277
286
|
|
|
278
|
-
export { computeFractionalDte } from
|
|
287
|
+
export { computeFractionalDte } from "./utils/option-time.ts";
|
|
279
288
|
export {
|
|
280
289
|
applyQuoteGreeks,
|
|
281
290
|
applyQuoteGreeksParallel,
|
|
@@ -283,22 +292,27 @@ export {
|
|
|
283
292
|
OPTION_QUOTE_GREEKS_REVISION,
|
|
284
293
|
type QuoteGreeksMode,
|
|
285
294
|
type QuoteGreeksSource,
|
|
286
|
-
} from
|
|
295
|
+
} from "./utils/option-quote-greeks.ts";
|
|
287
296
|
export {
|
|
288
297
|
IvSolverPool,
|
|
289
298
|
getSharedIvSolverPool,
|
|
290
299
|
destroySharedIvSolverPool,
|
|
291
300
|
type IvSolveJob,
|
|
292
301
|
type IvSolveJobResult,
|
|
293
|
-
} from
|
|
302
|
+
} from "./utils/iv-solver-pool.ts";
|
|
294
303
|
export {
|
|
295
304
|
describeReadParquetColumns,
|
|
296
305
|
quoteParquetCanonicalProjection,
|
|
297
306
|
readParquetFilesSql,
|
|
298
|
-
} from
|
|
307
|
+
} from "./utils/quote-parquet-projection.ts";
|
|
299
308
|
|
|
300
309
|
// Export parquet-writer utility functions for unit testing
|
|
301
|
-
export {
|
|
310
|
+
export {
|
|
311
|
+
isParquetMode,
|
|
312
|
+
writeParquetAtomic,
|
|
313
|
+
writeParquetPartition,
|
|
314
|
+
resolveMarketDir,
|
|
315
|
+
} from "./db/parquet-writer.ts";
|
|
302
316
|
|
|
303
317
|
// Export json-store utility for unit testing
|
|
304
318
|
export {
|
|
@@ -307,19 +321,16 @@ export {
|
|
|
307
321
|
deleteJsonFile,
|
|
308
322
|
listJsonFiles,
|
|
309
323
|
toFileSlug,
|
|
310
|
-
} from
|
|
324
|
+
} from "./db/json-store.ts";
|
|
311
325
|
|
|
312
326
|
// Export Massive snapshot schemas for unit testing
|
|
313
327
|
export {
|
|
314
328
|
MassiveSnapshotResponseSchema,
|
|
315
329
|
MassiveSnapshotContractSchema,
|
|
316
|
-
} from
|
|
330
|
+
} from "./utils/providers/massive.ts";
|
|
317
331
|
|
|
318
332
|
// Export snapshot tool handler and schema for integration testing
|
|
319
|
-
export {
|
|
320
|
-
handleGetOptionSnapshot,
|
|
321
|
-
getOptionSnapshotSchema,
|
|
322
|
-
} from './tools/snapshot.ts';
|
|
333
|
+
export { handleGetOptionSnapshot, getOptionSnapshotSchema } from "./tools/snapshot.ts";
|
|
323
334
|
|
|
324
335
|
// Export greeks decomposition utilities for unit testing
|
|
325
336
|
export {
|
|
@@ -331,7 +342,7 @@ export {
|
|
|
331
342
|
type LegGroupVega,
|
|
332
343
|
type LegGroupDef,
|
|
333
344
|
type FactorName,
|
|
334
|
-
} from
|
|
345
|
+
} from "./utils/greeks-decomposition.ts";
|
|
335
346
|
|
|
336
347
|
// Export exit trigger analysis utilities for unit testing
|
|
337
348
|
export {
|
|
@@ -343,7 +354,7 @@ export {
|
|
|
343
354
|
type TriggerType,
|
|
344
355
|
type LegGroupConfig,
|
|
345
356
|
type LegGroupResult,
|
|
346
|
-
} from
|
|
357
|
+
} from "./utils/exit-triggers.ts";
|
|
347
358
|
|
|
348
359
|
// Export exit analysis tool handlers and schemas for integration testing
|
|
349
360
|
export {
|
|
@@ -351,7 +362,7 @@ export {
|
|
|
351
362
|
handleDecomposeGreeks,
|
|
352
363
|
analyzeExitTriggersSchema,
|
|
353
364
|
decomposeGreeksSchema,
|
|
354
|
-
} from
|
|
365
|
+
} from "./tools/exit-analysis.ts";
|
|
355
366
|
|
|
356
367
|
// Export batch exit analysis engine for unit testing
|
|
357
368
|
export {
|
|
@@ -365,26 +376,23 @@ export {
|
|
|
365
376
|
type AggregateStats,
|
|
366
377
|
type TriggerAttribution,
|
|
367
378
|
type BaselineMode,
|
|
368
|
-
} from
|
|
379
|
+
} from "./utils/batch-exit-analysis.ts";
|
|
369
380
|
|
|
370
381
|
// Export batch exit analysis tool handler and schema for integration testing
|
|
371
|
-
export {
|
|
372
|
-
handleBatchExitAnalysis,
|
|
373
|
-
batchExitAnalysisSchema,
|
|
374
|
-
} from './tools/batch-exit-analysis.ts';
|
|
382
|
+
export { handleBatchExitAnalysis, batchExitAnalysisSchema } from "./tools/batch-exit-analysis.ts";
|
|
375
383
|
|
|
376
384
|
// Export quote enricher pure functions for unit testing
|
|
377
|
-
export { shouldSkipEnrichment, buildEnrichmentPlan } from
|
|
378
|
-
export type { EnrichmentPlanInput } from
|
|
385
|
+
export { shouldSkipEnrichment, buildEnrichmentPlan } from "./utils/quote-enricher.ts";
|
|
386
|
+
export type { EnrichmentPlanInput } from "./utils/quote-enricher.ts";
|
|
379
387
|
|
|
380
388
|
// SQL tool validator — unit-tested for path-gate + hard-block rules
|
|
381
|
-
export { validateQuery, isUnderDataRoot } from
|
|
389
|
+
export { validateQuery, isUnderDataRoot } from "./tools/sql.ts";
|
|
382
390
|
|
|
383
391
|
// Chain loader pure functions (unit testing)
|
|
384
|
-
export { filterChain } from
|
|
392
|
+
export { filterChain } from "./utils/chain-loader.ts";
|
|
385
393
|
|
|
386
394
|
// Provider classes for capability-resolution testing
|
|
387
|
-
export { ThetaDataProvider } from
|
|
395
|
+
export { ThetaDataProvider } from "./utils/providers/thetadata.ts";
|
|
388
396
|
|
|
389
397
|
// ThetaData MDDS provider internals (unit testing)
|
|
390
398
|
export {
|
|
@@ -413,7 +421,7 @@ export {
|
|
|
413
421
|
stockHistoryEod,
|
|
414
422
|
stockHistoryOhlc,
|
|
415
423
|
thetaTimestampToEtMinute,
|
|
416
|
-
} from
|
|
424
|
+
} from "./utils/providers/thetadata/index.ts";
|
|
417
425
|
|
|
418
426
|
// ThetaData MDDS backfill preflight helpers
|
|
419
427
|
export {
|
|
@@ -432,7 +440,7 @@ export {
|
|
|
432
440
|
makeBackfillRunId,
|
|
433
441
|
parseBackfillOccTicker,
|
|
434
442
|
projectBackfillWallTimeHours,
|
|
435
|
-
} from
|
|
443
|
+
} from "./utils/providers/thetadata/backfill.ts";
|
|
436
444
|
export type {
|
|
437
445
|
BackfillBandRequestCountInput,
|
|
438
446
|
BackfillConcreteFallback,
|
|
@@ -445,10 +453,10 @@ export type {
|
|
|
445
453
|
BackfillRequestCountInput,
|
|
446
454
|
BackfillRewriteSelectInput,
|
|
447
455
|
BackfillStagedGreekRow,
|
|
448
|
-
} from
|
|
456
|
+
} from "./utils/providers/thetadata/backfill.ts";
|
|
449
457
|
|
|
450
458
|
// Parquet view registration (integration testing)
|
|
451
|
-
export { createMarketParquetViews } from
|
|
459
|
+
export { createMarketParquetViews } from "./db/market-views.ts";
|
|
452
460
|
|
|
453
461
|
// Greeks attribution (v2.3)
|
|
454
462
|
export {
|
|
@@ -460,13 +468,13 @@ export {
|
|
|
460
468
|
type AttributionSummaryResult,
|
|
461
469
|
type AttributionInstanceResult,
|
|
462
470
|
type AttributionStepEntry,
|
|
463
|
-
} from
|
|
471
|
+
} from "./tools/greeks-attribution.ts";
|
|
464
472
|
|
|
465
473
|
export {
|
|
466
474
|
handleGetGreeksAttribution,
|
|
467
475
|
getGreeksAttributionSchema,
|
|
468
476
|
filterSparseSteps,
|
|
469
|
-
} from
|
|
477
|
+
} from "./tools/greeks-attribution.ts";
|
|
470
478
|
|
|
471
479
|
// Export json-adapters for integration testing
|
|
472
480
|
export {
|
|
@@ -482,11 +490,11 @@ export {
|
|
|
482
490
|
upsertMarketImportMetadataJson,
|
|
483
491
|
getFlatImportLogJson,
|
|
484
492
|
upsertFlatImportLogJson,
|
|
485
|
-
} from
|
|
486
|
-
export type { FlatImportLogEntry } from
|
|
493
|
+
} from "./db/json-adapters.ts";
|
|
494
|
+
export type { FlatImportLogEntry } from "./db/json-adapters.ts";
|
|
487
495
|
|
|
488
496
|
// Export json-migration for integration testing
|
|
489
|
-
export { migrateMetadataToJson, type MigrationResult } from
|
|
497
|
+
export { migrateMetadataToJson, type MigrationResult } from "./db/json-migration.ts";
|
|
490
498
|
|
|
491
499
|
// ============================================================================
|
|
492
500
|
// Market Data — store interfaces, registry, datasets
|
|
@@ -501,21 +509,21 @@ export {
|
|
|
501
509
|
ChainStore,
|
|
502
510
|
QuoteStore,
|
|
503
511
|
createMarketStores,
|
|
504
|
-
} from
|
|
512
|
+
} from "./market/stores/index.ts";
|
|
505
513
|
export type {
|
|
506
514
|
StoreContext,
|
|
507
515
|
MarketStores,
|
|
508
516
|
EnrichedReadOpts,
|
|
509
517
|
QuoteRow,
|
|
510
518
|
CoverageReport,
|
|
511
|
-
} from
|
|
512
|
-
export type { BarRow as MarketStoreBarRow, ContractRow } from
|
|
519
|
+
} from "./market/stores/index.ts";
|
|
520
|
+
export type { BarRow as MarketStoreBarRow, ContractRow } from "./market/stores/index.ts";
|
|
513
521
|
|
|
514
522
|
// Ticker registry + resolver + loader + schemas
|
|
515
|
-
export { extractRoot, rootToUnderlying } from
|
|
516
|
-
export { TickerRegistry } from
|
|
517
|
-
export type { TickerEntry, EntrySource } from
|
|
518
|
-
export { loadRegistry, saveUserOverride } from
|
|
523
|
+
export { extractRoot, rootToUnderlying } from "./market/tickers/resolver.ts";
|
|
524
|
+
export { TickerRegistry } from "./market/tickers/registry.ts";
|
|
525
|
+
export type { TickerEntry, EntrySource } from "./market/tickers/registry.ts";
|
|
526
|
+
export { loadRegistry, saveUserOverride } from "./market/tickers/loader.ts";
|
|
519
527
|
export {
|
|
520
528
|
UnderlyingsFileSchema,
|
|
521
529
|
registerUnderlyingSchema,
|
|
@@ -523,13 +531,13 @@ export {
|
|
|
523
531
|
listUnderlyingsSchema,
|
|
524
532
|
resolveRootSchema,
|
|
525
533
|
TICKER_RE,
|
|
526
|
-
} from
|
|
534
|
+
} from "./market/tickers/schemas.ts";
|
|
527
535
|
|
|
528
536
|
// Parquet writer multi-level options type
|
|
529
537
|
// Note: the value-level parquet-writer re-exports above already cover the
|
|
530
538
|
// runtime symbols; this line adds the type alias for the multi-level
|
|
531
539
|
// overload so tests can type-check against the V3 shape.
|
|
532
|
-
export type { WriteParquetPartitionOptsV3 } from
|
|
540
|
+
export type { WriteParquetPartitionOptsV3 } from "./db/parquet-writer.ts";
|
|
533
541
|
|
|
534
542
|
// Dataset registry + per-dataset helpers
|
|
535
543
|
export {
|
|
@@ -540,8 +548,8 @@ export {
|
|
|
540
548
|
writeOiDailyPartition,
|
|
541
549
|
writeEnrichedTickerFile,
|
|
542
550
|
writeEnrichedContext,
|
|
543
|
-
} from
|
|
544
|
-
export type { DatasetDef } from
|
|
551
|
+
} from "./db/market-datasets.ts";
|
|
552
|
+
export type { DatasetDef } from "./db/market-datasets.ts";
|
|
545
553
|
|
|
546
554
|
// Ticker MCP tool handlers — schemas re-exported from tickers/schemas.ts above
|
|
547
555
|
export {
|
|
@@ -550,7 +558,7 @@ export {
|
|
|
550
558
|
handleUnregisterUnderlying,
|
|
551
559
|
handleListUnderlyings,
|
|
552
560
|
handleResolveRoot,
|
|
553
|
-
} from
|
|
561
|
+
} from "./tools/tickers.ts";
|
|
554
562
|
|
|
555
563
|
// ============================================================================
|
|
556
564
|
// Pure helpers + watermark adapter
|
|
@@ -564,17 +572,17 @@ export {
|
|
|
564
572
|
buildReadBarsSQL,
|
|
565
573
|
buildReadDailyBarsSQL,
|
|
566
574
|
buildReadRthOpensSQL,
|
|
567
|
-
} from
|
|
568
|
-
export type { BuiltSQL } from
|
|
569
|
-
export { buildReadEnrichedSQL } from
|
|
570
|
-
export type { BuildReadEnrichedArgs } from
|
|
571
|
-
export { buildReadChainSQL } from
|
|
572
|
-
export { buildReadQuotesSQL } from
|
|
573
|
-
export { rthDailyAggregateSubquery } from
|
|
574
|
-
export type { RthWindowOpts } from
|
|
575
|
+
} from "./market/stores/spot-sql.ts";
|
|
576
|
+
export type { BuiltSQL } from "./market/stores/spot-sql.ts";
|
|
577
|
+
export { buildReadEnrichedSQL } from "./market/stores/enriched-sql.ts";
|
|
578
|
+
export type { BuildReadEnrichedArgs } from "./market/stores/enriched-sql.ts";
|
|
579
|
+
export { buildReadChainSQL } from "./market/stores/chain-sql.ts";
|
|
580
|
+
export { buildReadQuotesSQL } from "./market/stores/quote-sql.ts";
|
|
581
|
+
export { rthDailyAggregateSubquery } from "./market/stores/rth-aggregation.ts";
|
|
582
|
+
export type { RthWindowOpts } from "./market/stores/rth-aggregation.ts";
|
|
575
583
|
|
|
576
584
|
// Shared coverage helper
|
|
577
|
-
export { listPartitionValues } from
|
|
585
|
+
export { listPartitionValues } from "./market/stores/coverage.ts";
|
|
578
586
|
|
|
579
587
|
// Enrichment watermark adapter
|
|
580
588
|
export {
|
|
@@ -582,8 +590,8 @@ export {
|
|
|
582
590
|
loadEnrichmentWatermarks,
|
|
583
591
|
getEnrichedThrough,
|
|
584
592
|
upsertEnrichedThrough,
|
|
585
|
-
} from
|
|
586
|
-
export type { EnrichmentWatermarks } from
|
|
593
|
+
} from "./db/json-adapters.ts";
|
|
594
|
+
export type { EnrichmentWatermarks } from "./db/json-adapters.ts";
|
|
587
595
|
|
|
588
596
|
// Schema ensure functions are re-exported earlier in this file via
|
|
589
597
|
// `ensureMutableMarketTables, ensureMarketDataTables` near the top; do NOT
|
|
@@ -597,19 +605,19 @@ export type { EnrichmentWatermarks } from './db/json-adapters.ts';
|
|
|
597
605
|
// ============================================================================
|
|
598
606
|
|
|
599
607
|
// Concrete Spot store pair
|
|
600
|
-
export { ParquetSpotStore } from
|
|
601
|
-
export { DuckdbSpotStore } from
|
|
608
|
+
export { ParquetSpotStore } from "./market/stores/parquet-spot-store.ts";
|
|
609
|
+
export { DuckdbSpotStore } from "./market/stores/duckdb-spot-store.ts";
|
|
602
610
|
|
|
603
611
|
// Concrete Chain store pair
|
|
604
|
-
export { ParquetChainStore } from
|
|
605
|
-
export { DuckdbChainStore } from
|
|
612
|
+
export { ParquetChainStore } from "./market/stores/parquet-chain-store.ts";
|
|
613
|
+
export { DuckdbChainStore } from "./market/stores/duckdb-chain-store.ts";
|
|
606
614
|
|
|
607
615
|
// Concrete Quote store pair
|
|
608
|
-
export { ParquetQuoteStore } from
|
|
609
|
-
export { DuckdbQuoteStore } from
|
|
616
|
+
export { ParquetQuoteStore } from "./market/stores/parquet-quote-store.ts";
|
|
617
|
+
export { DuckdbQuoteStore } from "./market/stores/duckdb-quote-store.ts";
|
|
610
618
|
|
|
611
619
|
// Daily open-interest store
|
|
612
|
-
export { ParquetOiDailyStore } from
|
|
620
|
+
export { ParquetOiDailyStore } from "./market/stores/parquet-oi-daily-store.ts";
|
|
613
621
|
|
|
614
622
|
// ============================================================================
|
|
615
623
|
// Concrete Enriched stores
|
|
@@ -621,8 +629,8 @@ export { ParquetOiDailyStore } from './market/stores/parquet-oi-daily-store.ts';
|
|
|
621
629
|
// ============================================================================
|
|
622
630
|
|
|
623
631
|
// Concrete Enriched store pair
|
|
624
|
-
export { ParquetEnrichedStore } from
|
|
625
|
-
export { DuckdbEnrichedStore } from
|
|
632
|
+
export { ParquetEnrichedStore } from "./market/stores/parquet-enriched-store.ts";
|
|
633
|
+
export { DuckdbEnrichedStore } from "./market/stores/duckdb-enriched-store.ts";
|
|
626
634
|
|
|
627
635
|
// ============================================================================
|
|
628
636
|
// Ingestor exports
|
|
@@ -660,8 +668,8 @@ export {
|
|
|
660
668
|
buildOptionChainSelectQuery,
|
|
661
669
|
buildOptionQuoteSelectQuery,
|
|
662
670
|
LEVERAGED_ETFS,
|
|
663
|
-
} from
|
|
664
|
-
export type { GroupResult } from
|
|
671
|
+
} from "./utils/migrate-option-data-helpers.ts";
|
|
672
|
+
export type { GroupResult } from "./utils/migrate-option-data-helpers.ts";
|
|
665
673
|
|
|
666
674
|
// ============================================================================
|
|
667
675
|
// Spot backfill + enrichment-rebuild support
|
|
@@ -673,19 +681,15 @@ export {
|
|
|
673
681
|
PHASE_5_FIXTURE_SEED,
|
|
674
682
|
PHASE_5_KNOWN_EVENTS,
|
|
675
683
|
PHASE_5_STRUCTURAL_DATES,
|
|
676
|
-
} from
|
|
677
|
-
export type { SampleDate } from
|
|
684
|
+
} from "./utils/sample-date-selector.ts";
|
|
685
|
+
export type { SampleDate } from "./utils/sample-date-selector.ts";
|
|
678
686
|
export {
|
|
679
687
|
compareFields,
|
|
680
688
|
compareRow,
|
|
681
689
|
DOUBLE_EPSILON,
|
|
682
690
|
ENRICHED_FIELD_TYPES,
|
|
683
691
|
CONTEXT_FIELD_TYPES,
|
|
684
|
-
} from
|
|
685
|
-
export type {
|
|
686
|
-
|
|
687
|
-
FieldDiff,
|
|
688
|
-
RowDiff,
|
|
689
|
-
} from './utils/enrichment-verification.ts';
|
|
690
|
-
export { calibrateProviderFetch } from './utils/calibration-probe.ts';
|
|
692
|
+
} from "./utils/enrichment-verification.ts";
|
|
693
|
+
export type { FieldType, FieldDiff, RowDiff } from "./utils/enrichment-verification.ts";
|
|
694
|
+
export { calibrateProviderFetch } from "./utils/calibration-probe.ts";
|
|
691
695
|
// ============================================================================
|