tradeblocks-mcp 4.3.0 → 4.5.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 +57 -0
- package/dist/{chunk-TLX7IBCM.js → chunk-6IUDE55E.js} +6 -6
- package/dist/{chunk-TLX7IBCM.js.map → chunk-6IUDE55E.js.map} +1 -1
- package/dist/{chunk-35RVWZGT.js → chunk-BF4WFIP7.js} +13 -1
- package/dist/chunk-BF4WFIP7.js.map +1 -0
- package/dist/{chunk-ENXBPJ7Y.js → chunk-UOGG5TZQ.js} +31 -23
- package/dist/{chunk-ENXBPJ7Y.js.map → chunk-UOGG5TZQ.js.map} +1 -1
- package/dist/{daily-logs-store-FZRIGYUX.js → daily-logs-store-5KPMLDUC.js} +2 -2
- package/dist/{daily-logs-store-MEZ5S3BR.js → daily-logs-store-SG6AD3G5.js} +2 -2
- package/dist/market/provenance/index.js +1 -1
- package/dist/{sync-EW33QZPD.js → sync-R7BQBTN4.js} +3 -3
- package/dist/test-exports.js +131 -126
- package/dist/test-exports.js.map +1 -1
- package/dist/{trades-store-PNLPRYRJ.js → trades-store-6WI7G5OY.js} +2 -2
- package/dist/{trades-store-3TOLBL2W.js → trades-store-JEXOYGOE.js} +2 -2
- package/package.json +1 -1
- package/server/{chunk-YIWLVX7Z.js → chunk-2T44OXWR.js} +312 -255
- package/server/chunk-2T44OXWR.js.map +1 -0
- package/server/{chunk-PDSUY2X2.js → chunk-C7HUTUSW.js} +31 -23
- package/server/{chunk-PDSUY2X2.js.map → chunk-C7HUTUSW.js.map} +1 -1
- package/server/{daily-logs-store-LRVO7COL.js → daily-logs-store-WTOHFVK2.js} +2 -2
- package/server/index.js +815 -347
- package/server/index.js.map +1 -1
- package/server/{sync-2POG6KA6.js → sync-RZHKNM7E.js} +3 -3
- package/server/{trades-store-MXUZLSF5.js → trades-store-4SMROY7M.js} +2 -2
- package/src/db/dataset-schemas.ts +5 -2
- package/src/tools/analysis.ts +5 -3
- package/src/tools/batch-exit-analysis.ts +3 -3
- package/src/tools/blocks/analysis.ts +1 -1
- package/src/tools/blocks/similarity.ts +1 -1
- package/src/tools/profile-analysis.ts +11 -6
- package/src/tools/reports/fields.ts +1 -1
- package/src/tools/reports/helpers.ts +2 -1
- package/src/tools/reports/predictive.ts +304 -197
- package/src/tools/shared/field-analysis.ts +39 -25
- package/src/tools/shared/filter-objective.ts +10 -3
- package/src/utils/filter-curve.ts +466 -0
- package/src/utils/trade-analysis-fields.ts +8 -2
- package/dist/chunk-35RVWZGT.js.map +0 -1
- package/server/chunk-YIWLVX7Z.js.map +0 -1
- /package/dist/{daily-logs-store-FZRIGYUX.js.map → daily-logs-store-5KPMLDUC.js.map} +0 -0
- /package/dist/{daily-logs-store-MEZ5S3BR.js.map → daily-logs-store-SG6AD3G5.js.map} +0 -0
- /package/dist/{sync-EW33QZPD.js.map → sync-R7BQBTN4.js.map} +0 -0
- /package/dist/{trades-store-3TOLBL2W.js.map → trades-store-6WI7G5OY.js.map} +0 -0
- /package/dist/{trades-store-PNLPRYRJ.js.map → trades-store-JEXOYGOE.js.map} +0 -0
- /package/server/{daily-logs-store-LRVO7COL.js.map → daily-logs-store-WTOHFVK2.js.map} +0 -0
- /package/server/{sync-2POG6KA6.js.map → sync-RZHKNM7E.js.map} +0 -0
- /package/server/{trades-store-MXUZLSF5.js.map → trades-store-4SMROY7M.js.map} +0 -0
package/README.md
CHANGED
|
@@ -549,6 +549,63 @@ Field-based `suggest_filters` retains all-trade `currentStats` and reports per-f
|
|
|
549
549
|
Suggestions compare against those covered populations; `filter_curve.baseline`
|
|
550
550
|
reports the same covered and uncovered counts and P&L.
|
|
551
551
|
|
|
552
|
+
New in 4.4.0: [filter statistics](../../releases/v4.4.0.md) for asking whether a
|
|
553
|
+
chosen filter survives a full threshold search, with explicit assumptions and work caps.
|
|
554
|
+
|
|
555
|
+
`find_predictive_fields.method` selects `pearson` (default), `spearman`, or `kendall`
|
|
556
|
+
(tau-b with ties). Explicit requests name their method; omission preserves the Pearson
|
|
557
|
+
response. Ranking uses the chosen coefficient on the same causal entry-time values,
|
|
558
|
+
including `maxMissedSessions` refusals.
|
|
559
|
+
Kendall admits up to 75 million estimated pairs across fields, using each field's
|
|
560
|
+
valid field/target coverage after strategy/date filtering. It refuses by name
|
|
561
|
+
(`kendall_pair_work_limit`) before quadratic calculations. A 1,100-trade block with
|
|
562
|
+
100 fully covered fields passes (60,445,000 pairs); a 20,000-trade field is refused.
|
|
563
|
+
Pearson and Spearman retain their existing behavior.
|
|
564
|
+
|
|
565
|
+
`filter_curve` accepts either the existing `field` or up to 10 distinct `fields`.
|
|
566
|
+
Multi-field calls, an explicit `objective` (`totalPl` or `winRate`), or opt-in
|
|
567
|
+
`permutation: { iterations: 499, block: "month", seed: 42 }` add the best threshold
|
|
568
|
+
and per-year kept/removed stability. Permutation shuffles whole calendar-month outcome
|
|
569
|
+
blocks and reruns the complete threshold sweep, not just the selected threshold.
|
|
570
|
+
It reports add-one raw p-values and Holm-adjusted p-values across requested fields.
|
|
571
|
+
Single-field calls without these options retain their old outputs.
|
|
572
|
+
At least 30 covered trades and 8 observed months are required; refusals are named.
|
|
573
|
+
Iterations are capped at 499. Only permutation requests limit threshold and percentile
|
|
574
|
+
arrays to 100 entries, with a named `permutation_candidate_limit` refusal.
|
|
575
|
+
Without permutation, larger arrays retain their previous schema acceptance.
|
|
576
|
+
Sort-aware work admission caps permutation at 30 million units per field and
|
|
577
|
+
90 million per request, refusing the whole request before any sweeps. At 1,100 trades,
|
|
578
|
+
55 months, 499 iterations and default thresholds, the largest admitted family is
|
|
579
|
+
3 fully covered fields (87,751,152 estimated units); 4 fields exceed the cap.
|
|
580
|
+
Field, objective and mode choices across separate requests are outside the Holm family.
|
|
581
|
+
Monthly blocks retain within-month dependence, not cross-month dependence; block
|
|
582
|
+
exchangeability is an assumption. See [the full contract](../../docs/mcp-tools.md#filter-curve-significance-and-stability).
|
|
583
|
+
|
|
584
|
+
In 4.5.0, `unit: "day"` aggregates entry-date P&L before scoring and month
|
|
585
|
+
permutation; win rate counts profitable days. A field varying within a day is
|
|
586
|
+
refused as `day_field_varies`, with the varying dates. Cheap request/work admission
|
|
587
|
+
precedes causal field resolution and counts the chosen unit conservatively before
|
|
588
|
+
coverage. Omitted `unit` retains trade-mode outputs.
|
|
589
|
+
Day mode also offers `sharpe` (daily dollar P&L, rf=0, sample std, √252),
|
|
590
|
+
`mar` (calendar-day CAGR / drawdown fraction of observed starting capital), and
|
|
591
|
+
`maxDrawdown` (dollar drawdown reduction; smaller is better). Filtered dates are
|
|
592
|
+
flat. Trade units refuse these objectives; MAR additionally refuses missing capital.
|
|
593
|
+
`objectiveMetadata` documents definitions and undefined cases. This dollar-P&L
|
|
594
|
+
Sharpe intentionally differs from the capital-based portfolio return Sharpe.
|
|
595
|
+
`groupBy: "regime.label"` adds chosen-threshold `perGroup` rows in either unit,
|
|
596
|
+
with the same covered baseline/kept/removed shape as `perYear`. Numeric groups use
|
|
597
|
+
`bins` or shared regime-analysis quartiles; categorical groups use values.
|
|
598
|
+
Missing values form an explicit uncovered group, small groups stay flagged,
|
|
599
|
+
and within-day varying groups refuse as `day_group_varies`. Group values honor
|
|
600
|
+
the same causal availability and optional freshness limit.
|
|
601
|
+
|
|
602
|
+
Missing groups use `group: null`, `groupValue: null`, `uncoveredGroup: true`, distinct
|
|
603
|
+
from a real `"uncovered"` category. Varchar market fields such as `Trend_Direction`
|
|
604
|
+
are now categorical for filter suggestions and regime analysis. Explicit-field
|
|
605
|
+
tools resolve only consumed fields without changing their timing or values. See the
|
|
606
|
+
[4.5.0 release notes](../../releases/v4.5.0.md) for the timings, MAR capital/window
|
|
607
|
+
policy and the under-90-day per-year/per-group `marUnstable` guard.
|
|
608
|
+
|
|
552
609
|
`suggest_filters` defaults to `objective: "totalPl"`: only positive P&L improvements,
|
|
553
610
|
ranked by P&L improvement with win-rate gain as tie-breaker. `objective: "winRate"`
|
|
554
611
|
admits/ranks by win-rate gain with P&L tie-breaks. `minImprovementPct` (default 3
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getNetPl,
|
|
7
7
|
getRiskFreeRate,
|
|
8
8
|
resolveTreasuryRateByKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UOGG5TZQ.js";
|
|
10
10
|
import {
|
|
11
11
|
PlBasis
|
|
12
12
|
} from "./chunk-BH6SQOWF.js";
|
|
@@ -3790,7 +3790,7 @@ async function openReadWriteConnection(dbPath, threads, memoryLimit) {
|
|
|
3790
3790
|
await createMarketParquetViews(connection, dataRoot);
|
|
3791
3791
|
await ensureMarketDataTables(connection);
|
|
3792
3792
|
try {
|
|
3793
|
-
const blocksDir = (await import("./sync-
|
|
3793
|
+
const blocksDir = (await import("./sync-R7BQBTN4.js")).getBlocksDir(dataRoot);
|
|
3794
3794
|
await migrateMetadataToJson(connection, dataRoot, blocksDir);
|
|
3795
3795
|
} catch (err) {
|
|
3796
3796
|
console.warn(
|
|
@@ -20622,7 +20622,7 @@ function calculateCorrelationMatrix(trades, options = {}) {
|
|
|
20622
20622
|
}
|
|
20623
20623
|
let correlation;
|
|
20624
20624
|
if (method === "pearson") {
|
|
20625
|
-
correlation =
|
|
20625
|
+
correlation = pearsonCorrelation(returns1, returns2);
|
|
20626
20626
|
} else if (method === "spearman") {
|
|
20627
20627
|
correlation = spearmanCorrelation(returns1, returns2);
|
|
20628
20628
|
} else {
|
|
@@ -20635,7 +20635,7 @@ function calculateCorrelationMatrix(trades, options = {}) {
|
|
|
20635
20635
|
}
|
|
20636
20636
|
return { strategies, correlationData, sampleSizes };
|
|
20637
20637
|
}
|
|
20638
|
-
function
|
|
20638
|
+
function pearsonCorrelation(x, y) {
|
|
20639
20639
|
if (x.length !== y.length || x.length === 0) return 0;
|
|
20640
20640
|
const meanX = mean(x);
|
|
20641
20641
|
const meanY = mean(y);
|
|
@@ -20657,7 +20657,7 @@ function spearmanCorrelation(x, y) {
|
|
|
20657
20657
|
if (x.length !== y.length || x.length === 0) return 0;
|
|
20658
20658
|
const rankX = getRanks(x);
|
|
20659
20659
|
const rankY = getRanks(y);
|
|
20660
|
-
return
|
|
20660
|
+
return pearsonCorrelation(rankX, rankY);
|
|
20661
20661
|
}
|
|
20662
20662
|
function kendallCorrelation(x, y) {
|
|
20663
20663
|
if (x.length !== y.length || x.length === 0) return 0;
|
|
@@ -23270,4 +23270,4 @@ decimal.js/decimal.mjs:
|
|
|
23270
23270
|
* MIT Licence
|
|
23271
23271
|
*)
|
|
23272
23272
|
*/
|
|
23273
|
-
//# sourceMappingURL=chunk-
|
|
23273
|
+
//# sourceMappingURL=chunk-6IUDE55E.js.map
|