backtest-kit 5.6.1 → 5.6.2
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/build/index.cjs +126 -67
- package/build/index.mjs +126 -67
- package/package.json +1 -1
- package/types.d.ts +109 -0
package/build/index.cjs
CHANGED
|
@@ -443,6 +443,91 @@ const GLOBAL_CONFIG = {
|
|
|
443
443
|
* Binance requirement
|
|
444
444
|
*/
|
|
445
445
|
CC_AGGREGATED_TRADES_MAX_MINUTES: 60,
|
|
446
|
+
/**
|
|
447
|
+
* Maximum number of events to keep in backtest markdown report storage.
|
|
448
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
449
|
+
*
|
|
450
|
+
* Default: 250 events
|
|
451
|
+
*/
|
|
452
|
+
CC_MAX_BACKTEST_MARKDOWN_ROWS: 250,
|
|
453
|
+
/**
|
|
454
|
+
* Maximum number of events to keep in breakeven markdown report storage.
|
|
455
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
456
|
+
*
|
|
457
|
+
* Default: 250 events
|
|
458
|
+
*/
|
|
459
|
+
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: 250,
|
|
460
|
+
/**
|
|
461
|
+
* Maximum number of events to keep in heatmap markdown report storage.
|
|
462
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
463
|
+
*
|
|
464
|
+
* Default: 250 events
|
|
465
|
+
*/
|
|
466
|
+
CC_MAX_HEATMAP_MARKDOWN_ROWS: 250,
|
|
467
|
+
/**
|
|
468
|
+
* Maximum number of events to keep in highest profit markdown report storage.
|
|
469
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
470
|
+
*
|
|
471
|
+
* Default: 250 events
|
|
472
|
+
*/
|
|
473
|
+
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: 250,
|
|
474
|
+
/**
|
|
475
|
+
* Maximum number of events to keep in live markdown report storage.
|
|
476
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
477
|
+
*
|
|
478
|
+
* Default: 250 events
|
|
479
|
+
*/
|
|
480
|
+
CC_MAX_LIVE_MARKDOWN_ROWS: 250,
|
|
481
|
+
/**
|
|
482
|
+
* Maximum number of events to keep in partial markdown report storage.
|
|
483
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
484
|
+
*
|
|
485
|
+
* Default: 250 events
|
|
486
|
+
*/
|
|
487
|
+
CC_MAX_PARTIAL_MARKDOWN_ROWS: 250,
|
|
488
|
+
/**
|
|
489
|
+
* Maximum number of events to keep in risk markdown report storage.
|
|
490
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
491
|
+
*
|
|
492
|
+
* Default: 250 events
|
|
493
|
+
*/
|
|
494
|
+
CC_MAX_RISK_MARKDOWN_ROWS: 250,
|
|
495
|
+
/**
|
|
496
|
+
* Maximum number of events to keep in schedule markdown report storage.
|
|
497
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
498
|
+
*
|
|
499
|
+
* Default: 250 events
|
|
500
|
+
*/
|
|
501
|
+
CC_MAX_SCHEDULE_MARKDOWN_ROWS: 250,
|
|
502
|
+
/**
|
|
503
|
+
* Maximum number of events to keep in strategy markdown report storage.
|
|
504
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
505
|
+
*
|
|
506
|
+
* Default: 250 events
|
|
507
|
+
*/
|
|
508
|
+
CC_MAX_STRATEGY_MARKDOWN_ROWS: 250,
|
|
509
|
+
/**
|
|
510
|
+
* Maximum number of events to keep in sync markdown report storage.
|
|
511
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
512
|
+
*
|
|
513
|
+
* Default: 250 events
|
|
514
|
+
*/
|
|
515
|
+
CC_MAX_SYNC_MARKDOWN_ROWS: 250,
|
|
516
|
+
/**
|
|
517
|
+
* Number of top strategies to include in the walker comparison table.
|
|
518
|
+
*
|
|
519
|
+
* Default: 10 strategies
|
|
520
|
+
*/
|
|
521
|
+
CC_WALKER_MARKDOWN_TOP_N: 10,
|
|
522
|
+
/**
|
|
523
|
+
* Maximum number of performance metric events to keep in storage.
|
|
524
|
+
* Older events are removed when this limit is exceeded.
|
|
525
|
+
* Higher than other report event limits because performance metrics are lightweight
|
|
526
|
+
* and benefit from larger sample sizes for accurate statistical analysis.
|
|
527
|
+
*
|
|
528
|
+
* Default: 10000 events
|
|
529
|
+
*/
|
|
530
|
+
CC_MAX_PERFORMANCE_MARKDOWN_ROWS: 10000,
|
|
446
531
|
/**
|
|
447
532
|
* Maximum number of notifications to keep in storage.
|
|
448
533
|
* Older notifications are removed when this limit is exceeded.
|
|
@@ -18519,7 +18604,7 @@ const highest_profit_columns = [
|
|
|
18519
18604
|
},
|
|
18520
18605
|
{
|
|
18521
18606
|
key: "currentPrice",
|
|
18522
|
-
label: "
|
|
18607
|
+
label: "Peak Price",
|
|
18523
18608
|
format: (data) => `${data.currentPrice.toFixed(8)} USD`,
|
|
18524
18609
|
isVisible: () => true,
|
|
18525
18610
|
},
|
|
@@ -19335,8 +19420,6 @@ function isUnsafe$3(value) {
|
|
|
19335
19420
|
}
|
|
19336
19421
|
return false;
|
|
19337
19422
|
}
|
|
19338
|
-
/** Maximum number of signals to store in backtest reports */
|
|
19339
|
-
const MAX_EVENTS$a = 250;
|
|
19340
19423
|
/**
|
|
19341
19424
|
* Storage class for accumulating closed signals per strategy.
|
|
19342
19425
|
* Maintains a list of all closed signals and provides methods to generate reports.
|
|
@@ -19357,8 +19440,8 @@ let ReportStorage$9 = class ReportStorage {
|
|
|
19357
19440
|
*/
|
|
19358
19441
|
addSignal(data) {
|
|
19359
19442
|
this._signalList.unshift(data);
|
|
19360
|
-
// Trim queue if exceeded
|
|
19361
|
-
if (this._signalList.length >
|
|
19443
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_BACKTEST_MARKDOWN_ROWS
|
|
19444
|
+
if (this._signalList.length > GLOBAL_CONFIG.CC_MAX_BACKTEST_MARKDOWN_ROWS) {
|
|
19362
19445
|
this._signalList.pop();
|
|
19363
19446
|
}
|
|
19364
19447
|
}
|
|
@@ -19793,8 +19876,6 @@ function isUnsafe$2(value) {
|
|
|
19793
19876
|
}
|
|
19794
19877
|
return false;
|
|
19795
19878
|
}
|
|
19796
|
-
/** Maximum number of events to store in live trading reports */
|
|
19797
|
-
const MAX_EVENTS$9 = 250;
|
|
19798
19879
|
/**
|
|
19799
19880
|
* Storage class for accumulating all tick events per strategy.
|
|
19800
19881
|
* Maintains a chronological list of all events (idle, opened, active, closed).
|
|
@@ -19831,7 +19912,7 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19831
19912
|
}
|
|
19832
19913
|
{
|
|
19833
19914
|
this._eventList.unshift(newEvent);
|
|
19834
|
-
if (this._eventList.length >
|
|
19915
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19835
19916
|
this._eventList.pop();
|
|
19836
19917
|
}
|
|
19837
19918
|
}
|
|
@@ -19860,8 +19941,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19860
19941
|
pendingAt: data.signal.pendingAt,
|
|
19861
19942
|
scheduledAt: data.signal.scheduledAt,
|
|
19862
19943
|
});
|
|
19863
|
-
// Trim queue if exceeded
|
|
19864
|
-
if (this._eventList.length >
|
|
19944
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
19945
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19865
19946
|
this._eventList.pop();
|
|
19866
19947
|
}
|
|
19867
19948
|
}
|
|
@@ -19904,8 +19985,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19904
19985
|
}
|
|
19905
19986
|
// If no previous active event found, add new event
|
|
19906
19987
|
this._eventList.unshift(newEvent);
|
|
19907
|
-
// Trim queue if exceeded
|
|
19908
|
-
if (this._eventList.length >
|
|
19988
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
19989
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19909
19990
|
this._eventList.pop();
|
|
19910
19991
|
}
|
|
19911
19992
|
}
|
|
@@ -19941,8 +20022,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19941
20022
|
scheduledAt: data.signal.scheduledAt,
|
|
19942
20023
|
};
|
|
19943
20024
|
this._eventList.unshift(newEvent);
|
|
19944
|
-
// Trim queue if exceeded
|
|
19945
|
-
if (this._eventList.length >
|
|
20025
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20026
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19946
20027
|
this._eventList.pop();
|
|
19947
20028
|
}
|
|
19948
20029
|
}
|
|
@@ -19969,8 +20050,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19969
20050
|
totalPartials: data.signal.totalPartials,
|
|
19970
20051
|
scheduledAt: data.signal.scheduledAt,
|
|
19971
20052
|
});
|
|
19972
|
-
// Trim queue if exceeded
|
|
19973
|
-
if (this._eventList.length >
|
|
20053
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20054
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19974
20055
|
this._eventList.pop();
|
|
19975
20056
|
}
|
|
19976
20057
|
}
|
|
@@ -20012,8 +20093,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
20012
20093
|
}
|
|
20013
20094
|
// If no previous waiting event found, add new event
|
|
20014
20095
|
this._eventList.unshift(newEvent);
|
|
20015
|
-
// Trim queue if exceeded
|
|
20016
|
-
if (this._eventList.length >
|
|
20096
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20097
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
20017
20098
|
this._eventList.pop();
|
|
20018
20099
|
}
|
|
20019
20100
|
}
|
|
@@ -20041,8 +20122,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
20041
20122
|
cancelReason: data.reason,
|
|
20042
20123
|
scheduledAt: data.signal.scheduledAt,
|
|
20043
20124
|
});
|
|
20044
|
-
// Trim queue if exceeded
|
|
20045
|
-
if (this._eventList.length >
|
|
20125
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20126
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
20046
20127
|
this._eventList.pop();
|
|
20047
20128
|
}
|
|
20048
20129
|
}
|
|
@@ -20496,8 +20577,6 @@ const CREATE_FILE_NAME_FN$9 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
20496
20577
|
parts.push("live");
|
|
20497
20578
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
20498
20579
|
};
|
|
20499
|
-
/** Maximum number of events to store in schedule reports */
|
|
20500
|
-
const MAX_EVENTS$8 = 250;
|
|
20501
20580
|
/**
|
|
20502
20581
|
* Storage class for accumulating scheduled signal events per strategy.
|
|
20503
20582
|
* Maintains a chronological list of scheduled and cancelled events.
|
|
@@ -20537,8 +20616,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20537
20616
|
pnl: data.signal.pnl,
|
|
20538
20617
|
scheduledAt: data.signal.scheduledAt,
|
|
20539
20618
|
});
|
|
20540
|
-
// Trim queue if exceeded
|
|
20541
|
-
if (this._eventList.length >
|
|
20619
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20620
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20542
20621
|
this._eventList.pop();
|
|
20543
20622
|
}
|
|
20544
20623
|
}
|
|
@@ -20573,8 +20652,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20573
20652
|
scheduledAt: data.signal.scheduledAt,
|
|
20574
20653
|
};
|
|
20575
20654
|
this._eventList.unshift(newEvent);
|
|
20576
|
-
// Trim queue if exceeded
|
|
20577
|
-
if (this._eventList.length >
|
|
20655
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20656
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20578
20657
|
this._eventList.pop();
|
|
20579
20658
|
}
|
|
20580
20659
|
}
|
|
@@ -20611,8 +20690,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20611
20690
|
scheduledAt: data.signal.scheduledAt,
|
|
20612
20691
|
};
|
|
20613
20692
|
this._eventList.unshift(newEvent);
|
|
20614
|
-
// Trim queue if exceeded
|
|
20615
|
-
if (this._eventList.length >
|
|
20693
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20694
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20616
20695
|
this._eventList.pop();
|
|
20617
20696
|
}
|
|
20618
20697
|
}
|
|
@@ -21019,8 +21098,6 @@ function percentile(sortedArray, p) {
|
|
|
21019
21098
|
const index = Math.ceil((sortedArray.length * p) / 100) - 1;
|
|
21020
21099
|
return sortedArray[Math.max(0, index)];
|
|
21021
21100
|
}
|
|
21022
|
-
/** Maximum number of performance events to store per strategy */
|
|
21023
|
-
const MAX_EVENTS$7 = 10000;
|
|
21024
21101
|
/**
|
|
21025
21102
|
* Storage class for accumulating performance metrics per strategy.
|
|
21026
21103
|
* Maintains a list of all performance events and provides aggregated statistics.
|
|
@@ -21041,8 +21118,8 @@ class PerformanceStorage {
|
|
|
21041
21118
|
*/
|
|
21042
21119
|
addEvent(event) {
|
|
21043
21120
|
this._events.unshift(event);
|
|
21044
|
-
// Trim queue if exceeded
|
|
21045
|
-
if (this._events.length >
|
|
21121
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PERFORMANCE_MARKDOWN_ROWS (keep most recent)
|
|
21122
|
+
if (this._events.length > GLOBAL_CONFIG.CC_MAX_PERFORMANCE_MARKDOWN_ROWS) {
|
|
21046
21123
|
this._events.pop();
|
|
21047
21124
|
}
|
|
21048
21125
|
}
|
|
@@ -21510,7 +21587,7 @@ let ReportStorage$6 = class ReportStorage {
|
|
|
21510
21587
|
* @param columns - Column configuration for formatting the strategy comparison table
|
|
21511
21588
|
* @returns Markdown formatted comparison table
|
|
21512
21589
|
*/
|
|
21513
|
-
async getComparisonTable(topN =
|
|
21590
|
+
async getComparisonTable(topN = GLOBAL_CONFIG.CC_WALKER_MARKDOWN_TOP_N, columns = COLUMN_CONFIG.walker_strategy_columns) {
|
|
21514
21591
|
if (this._strategyResults.length === 0) {
|
|
21515
21592
|
return "No strategy results available.";
|
|
21516
21593
|
}
|
|
@@ -21612,7 +21689,7 @@ let ReportStorage$6 = class ReportStorage {
|
|
|
21612
21689
|
"",
|
|
21613
21690
|
"## Top Strategies Comparison",
|
|
21614
21691
|
"",
|
|
21615
|
-
await this.getComparisonTable(
|
|
21692
|
+
await this.getComparisonTable(GLOBAL_CONFIG.CC_WALKER_MARKDOWN_TOP_N, strategyColumns),
|
|
21616
21693
|
"",
|
|
21617
21694
|
"## All Signals (PNL Table)",
|
|
21618
21695
|
"",
|
|
@@ -21910,8 +21987,6 @@ function isUnsafe(value) {
|
|
|
21910
21987
|
}
|
|
21911
21988
|
return false;
|
|
21912
21989
|
}
|
|
21913
|
-
/** Maximum number of signals to store per symbol in heatmap reports */
|
|
21914
|
-
const MAX_EVENTS$6 = 250;
|
|
21915
21990
|
/**
|
|
21916
21991
|
* Storage class for accumulating closed signals per strategy and generating heatmap.
|
|
21917
21992
|
* Maintains symbol-level statistics and provides portfolio-wide metrics.
|
|
@@ -21936,8 +22011,8 @@ class HeatmapStorage {
|
|
|
21936
22011
|
}
|
|
21937
22012
|
const signals = this.symbolData.get(symbol);
|
|
21938
22013
|
signals.unshift(data);
|
|
21939
|
-
// Trim queue if exceeded
|
|
21940
|
-
if (signals.length >
|
|
22014
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_HEATMAP_MARKDOWN_ROWS per symbol
|
|
22015
|
+
if (signals.length > GLOBAL_CONFIG.CC_MAX_HEATMAP_MARKDOWN_ROWS) {
|
|
21941
22016
|
signals.pop();
|
|
21942
22017
|
}
|
|
21943
22018
|
}
|
|
@@ -23709,8 +23784,6 @@ const CREATE_FILE_NAME_FN$5 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
23709
23784
|
parts.push("live");
|
|
23710
23785
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
23711
23786
|
};
|
|
23712
|
-
/** Maximum number of events to store in partial reports */
|
|
23713
|
-
const MAX_EVENTS$5 = 250;
|
|
23714
23787
|
/**
|
|
23715
23788
|
* Storage class for accumulating partial profit/loss events per symbol-strategy pair.
|
|
23716
23789
|
* Maintains a chronological list of profit and loss level events.
|
|
@@ -23757,8 +23830,8 @@ let ReportStorage$5 = class ReportStorage {
|
|
|
23757
23830
|
scheduledAt: data.scheduledAt,
|
|
23758
23831
|
backtest,
|
|
23759
23832
|
});
|
|
23760
|
-
// Trim queue if exceeded
|
|
23761
|
-
if (this._eventList.length >
|
|
23833
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS
|
|
23834
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS) {
|
|
23762
23835
|
this._eventList.pop();
|
|
23763
23836
|
}
|
|
23764
23837
|
}
|
|
@@ -23795,8 +23868,8 @@ let ReportStorage$5 = class ReportStorage {
|
|
|
23795
23868
|
scheduledAt: data.scheduledAt,
|
|
23796
23869
|
backtest,
|
|
23797
23870
|
});
|
|
23798
|
-
// Trim queue if exceeded
|
|
23799
|
-
if (this._eventList.length >
|
|
23871
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS
|
|
23872
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS) {
|
|
23800
23873
|
this._eventList.pop();
|
|
23801
23874
|
}
|
|
23802
23875
|
}
|
|
@@ -24852,8 +24925,6 @@ const CREATE_FILE_NAME_FN$4 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
24852
24925
|
parts.push("live");
|
|
24853
24926
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
24854
24927
|
};
|
|
24855
|
-
/** Maximum number of events to store in breakeven reports */
|
|
24856
|
-
const MAX_EVENTS$4 = 250;
|
|
24857
24928
|
/**
|
|
24858
24929
|
* Storage class for accumulating breakeven events per symbol-strategy pair.
|
|
24859
24930
|
* Maintains a chronological list of breakeven events.
|
|
@@ -24898,8 +24969,8 @@ let ReportStorage$4 = class ReportStorage {
|
|
|
24898
24969
|
scheduledAt: data.scheduledAt,
|
|
24899
24970
|
backtest,
|
|
24900
24971
|
});
|
|
24901
|
-
// Trim queue if exceeded
|
|
24902
|
-
if (this._eventList.length >
|
|
24972
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_BREAKEVEN_MARKDOWN_ROWS
|
|
24973
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_BREAKEVEN_MARKDOWN_ROWS) {
|
|
24903
24974
|
this._eventList.pop();
|
|
24904
24975
|
}
|
|
24905
24976
|
}
|
|
@@ -25528,8 +25599,6 @@ const CREATE_FILE_NAME_FN$3 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
25528
25599
|
parts.push("live");
|
|
25529
25600
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
25530
25601
|
};
|
|
25531
|
-
/** Maximum number of events to store in risk reports */
|
|
25532
|
-
const MAX_EVENTS$3 = 250;
|
|
25533
25602
|
/**
|
|
25534
25603
|
* Storage class for accumulating risk rejection events per symbol-strategy pair.
|
|
25535
25604
|
* Maintains a chronological list of rejected signals due to risk limits.
|
|
@@ -25550,8 +25619,8 @@ let ReportStorage$3 = class ReportStorage {
|
|
|
25550
25619
|
*/
|
|
25551
25620
|
addRejectionEvent(event) {
|
|
25552
25621
|
this._eventList.unshift(event);
|
|
25553
|
-
// Trim queue if exceeded
|
|
25554
|
-
if (this._eventList.length >
|
|
25622
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_RISK_MARKDOWN_ROWS
|
|
25623
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_RISK_MARKDOWN_ROWS) {
|
|
25555
25624
|
this._eventList.pop();
|
|
25556
25625
|
}
|
|
25557
25626
|
}
|
|
@@ -28644,16 +28713,10 @@ const CREATE_FILE_NAME_FN$2 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
28644
28713
|
parts.push("live");
|
|
28645
28714
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
28646
28715
|
};
|
|
28647
|
-
/**
|
|
28648
|
-
* Maximum number of events to store per symbol-strategy pair.
|
|
28649
|
-
* Older events are discarded when this limit is exceeded.
|
|
28650
|
-
* @internal
|
|
28651
|
-
*/
|
|
28652
|
-
const MAX_EVENTS$2 = 250;
|
|
28653
28716
|
/**
|
|
28654
28717
|
* In-memory storage for accumulating strategy events per symbol-strategy pair.
|
|
28655
28718
|
*
|
|
28656
|
-
* Maintains a rolling window of the most recent events (up to
|
|
28719
|
+
* Maintains a rolling window of the most recent events (up to GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS),
|
|
28657
28720
|
* with newer events added to the front of the list. Provides methods to:
|
|
28658
28721
|
* - Add new events (FIFO queue with max size)
|
|
28659
28722
|
* - Retrieve aggregated statistics
|
|
@@ -28682,13 +28745,13 @@ let ReportStorage$2 = class ReportStorage {
|
|
|
28682
28745
|
* Adds a new event to the storage.
|
|
28683
28746
|
*
|
|
28684
28747
|
* Events are added to the front of the list (most recent first).
|
|
28685
|
-
* If the list exceeds
|
|
28748
|
+
* If the list exceeds GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS, the oldest event is removed.
|
|
28686
28749
|
*
|
|
28687
28750
|
* @param event - The strategy event to store
|
|
28688
28751
|
*/
|
|
28689
28752
|
addEvent(event) {
|
|
28690
28753
|
this._eventList.unshift(event);
|
|
28691
|
-
if (this._eventList.length >
|
|
28754
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS) {
|
|
28692
28755
|
this._eventList.pop();
|
|
28693
28756
|
}
|
|
28694
28757
|
}
|
|
@@ -29559,8 +29622,6 @@ const CREATE_FILE_NAME_FN$1 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
29559
29622
|
parts.push("live");
|
|
29560
29623
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
29561
29624
|
};
|
|
29562
|
-
/** Maximum number of events to store in sync reports */
|
|
29563
|
-
const MAX_EVENTS$1 = 250;
|
|
29564
29625
|
/**
|
|
29565
29626
|
* Storage class for accumulating signal sync events per symbol-strategy-exchange-frame-backtest combination.
|
|
29566
29627
|
* Maintains a chronological list of signal-open and signal-close events.
|
|
@@ -29575,7 +29636,7 @@ let ReportStorage$1 = class ReportStorage {
|
|
|
29575
29636
|
}
|
|
29576
29637
|
addEvent(event) {
|
|
29577
29638
|
this._eventList.unshift(event);
|
|
29578
|
-
if (this._eventList.length >
|
|
29639
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SYNC_MARKDOWN_ROWS) {
|
|
29579
29640
|
this._eventList.pop();
|
|
29580
29641
|
}
|
|
29581
29642
|
}
|
|
@@ -29778,8 +29839,6 @@ const CREATE_FILE_NAME_FN = (symbol, strategyName, exchangeName, frameName, time
|
|
|
29778
29839
|
parts.push("live");
|
|
29779
29840
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
29780
29841
|
};
|
|
29781
|
-
/** Maximum number of events to store per combination */
|
|
29782
|
-
const MAX_EVENTS = 250;
|
|
29783
29842
|
/**
|
|
29784
29843
|
* Accumulates highest profit events per symbol-strategy-exchange-frame combination.
|
|
29785
29844
|
*/
|
|
@@ -29808,7 +29867,7 @@ class ReportStorage {
|
|
|
29808
29867
|
priceStopLoss: data.priceStopLoss,
|
|
29809
29868
|
backtest,
|
|
29810
29869
|
});
|
|
29811
|
-
if (this._eventList.length >
|
|
29870
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS) {
|
|
29812
29871
|
this._eventList.pop();
|
|
29813
29872
|
}
|
|
29814
29873
|
}
|
package/build/index.mjs
CHANGED
|
@@ -423,6 +423,91 @@ const GLOBAL_CONFIG = {
|
|
|
423
423
|
* Binance requirement
|
|
424
424
|
*/
|
|
425
425
|
CC_AGGREGATED_TRADES_MAX_MINUTES: 60,
|
|
426
|
+
/**
|
|
427
|
+
* Maximum number of events to keep in backtest markdown report storage.
|
|
428
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
429
|
+
*
|
|
430
|
+
* Default: 250 events
|
|
431
|
+
*/
|
|
432
|
+
CC_MAX_BACKTEST_MARKDOWN_ROWS: 250,
|
|
433
|
+
/**
|
|
434
|
+
* Maximum number of events to keep in breakeven markdown report storage.
|
|
435
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
436
|
+
*
|
|
437
|
+
* Default: 250 events
|
|
438
|
+
*/
|
|
439
|
+
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: 250,
|
|
440
|
+
/**
|
|
441
|
+
* Maximum number of events to keep in heatmap markdown report storage.
|
|
442
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
443
|
+
*
|
|
444
|
+
* Default: 250 events
|
|
445
|
+
*/
|
|
446
|
+
CC_MAX_HEATMAP_MARKDOWN_ROWS: 250,
|
|
447
|
+
/**
|
|
448
|
+
* Maximum number of events to keep in highest profit markdown report storage.
|
|
449
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
450
|
+
*
|
|
451
|
+
* Default: 250 events
|
|
452
|
+
*/
|
|
453
|
+
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: 250,
|
|
454
|
+
/**
|
|
455
|
+
* Maximum number of events to keep in live markdown report storage.
|
|
456
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
457
|
+
*
|
|
458
|
+
* Default: 250 events
|
|
459
|
+
*/
|
|
460
|
+
CC_MAX_LIVE_MARKDOWN_ROWS: 250,
|
|
461
|
+
/**
|
|
462
|
+
* Maximum number of events to keep in partial markdown report storage.
|
|
463
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
464
|
+
*
|
|
465
|
+
* Default: 250 events
|
|
466
|
+
*/
|
|
467
|
+
CC_MAX_PARTIAL_MARKDOWN_ROWS: 250,
|
|
468
|
+
/**
|
|
469
|
+
* Maximum number of events to keep in risk markdown report storage.
|
|
470
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
471
|
+
*
|
|
472
|
+
* Default: 250 events
|
|
473
|
+
*/
|
|
474
|
+
CC_MAX_RISK_MARKDOWN_ROWS: 250,
|
|
475
|
+
/**
|
|
476
|
+
* Maximum number of events to keep in schedule markdown report storage.
|
|
477
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
478
|
+
*
|
|
479
|
+
* Default: 250 events
|
|
480
|
+
*/
|
|
481
|
+
CC_MAX_SCHEDULE_MARKDOWN_ROWS: 250,
|
|
482
|
+
/**
|
|
483
|
+
* Maximum number of events to keep in strategy markdown report storage.
|
|
484
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
485
|
+
*
|
|
486
|
+
* Default: 250 events
|
|
487
|
+
*/
|
|
488
|
+
CC_MAX_STRATEGY_MARKDOWN_ROWS: 250,
|
|
489
|
+
/**
|
|
490
|
+
* Maximum number of events to keep in sync markdown report storage.
|
|
491
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
492
|
+
*
|
|
493
|
+
* Default: 250 events
|
|
494
|
+
*/
|
|
495
|
+
CC_MAX_SYNC_MARKDOWN_ROWS: 250,
|
|
496
|
+
/**
|
|
497
|
+
* Number of top strategies to include in the walker comparison table.
|
|
498
|
+
*
|
|
499
|
+
* Default: 10 strategies
|
|
500
|
+
*/
|
|
501
|
+
CC_WALKER_MARKDOWN_TOP_N: 10,
|
|
502
|
+
/**
|
|
503
|
+
* Maximum number of performance metric events to keep in storage.
|
|
504
|
+
* Older events are removed when this limit is exceeded.
|
|
505
|
+
* Higher than other report event limits because performance metrics are lightweight
|
|
506
|
+
* and benefit from larger sample sizes for accurate statistical analysis.
|
|
507
|
+
*
|
|
508
|
+
* Default: 10000 events
|
|
509
|
+
*/
|
|
510
|
+
CC_MAX_PERFORMANCE_MARKDOWN_ROWS: 10000,
|
|
426
511
|
/**
|
|
427
512
|
* Maximum number of notifications to keep in storage.
|
|
428
513
|
* Older notifications are removed when this limit is exceeded.
|
|
@@ -18499,7 +18584,7 @@ const highest_profit_columns = [
|
|
|
18499
18584
|
},
|
|
18500
18585
|
{
|
|
18501
18586
|
key: "currentPrice",
|
|
18502
|
-
label: "
|
|
18587
|
+
label: "Peak Price",
|
|
18503
18588
|
format: (data) => `${data.currentPrice.toFixed(8)} USD`,
|
|
18504
18589
|
isVisible: () => true,
|
|
18505
18590
|
},
|
|
@@ -19315,8 +19400,6 @@ function isUnsafe$3(value) {
|
|
|
19315
19400
|
}
|
|
19316
19401
|
return false;
|
|
19317
19402
|
}
|
|
19318
|
-
/** Maximum number of signals to store in backtest reports */
|
|
19319
|
-
const MAX_EVENTS$a = 250;
|
|
19320
19403
|
/**
|
|
19321
19404
|
* Storage class for accumulating closed signals per strategy.
|
|
19322
19405
|
* Maintains a list of all closed signals and provides methods to generate reports.
|
|
@@ -19337,8 +19420,8 @@ let ReportStorage$9 = class ReportStorage {
|
|
|
19337
19420
|
*/
|
|
19338
19421
|
addSignal(data) {
|
|
19339
19422
|
this._signalList.unshift(data);
|
|
19340
|
-
// Trim queue if exceeded
|
|
19341
|
-
if (this._signalList.length >
|
|
19423
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_BACKTEST_MARKDOWN_ROWS
|
|
19424
|
+
if (this._signalList.length > GLOBAL_CONFIG.CC_MAX_BACKTEST_MARKDOWN_ROWS) {
|
|
19342
19425
|
this._signalList.pop();
|
|
19343
19426
|
}
|
|
19344
19427
|
}
|
|
@@ -19773,8 +19856,6 @@ function isUnsafe$2(value) {
|
|
|
19773
19856
|
}
|
|
19774
19857
|
return false;
|
|
19775
19858
|
}
|
|
19776
|
-
/** Maximum number of events to store in live trading reports */
|
|
19777
|
-
const MAX_EVENTS$9 = 250;
|
|
19778
19859
|
/**
|
|
19779
19860
|
* Storage class for accumulating all tick events per strategy.
|
|
19780
19861
|
* Maintains a chronological list of all events (idle, opened, active, closed).
|
|
@@ -19811,7 +19892,7 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19811
19892
|
}
|
|
19812
19893
|
{
|
|
19813
19894
|
this._eventList.unshift(newEvent);
|
|
19814
|
-
if (this._eventList.length >
|
|
19895
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19815
19896
|
this._eventList.pop();
|
|
19816
19897
|
}
|
|
19817
19898
|
}
|
|
@@ -19840,8 +19921,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19840
19921
|
pendingAt: data.signal.pendingAt,
|
|
19841
19922
|
scheduledAt: data.signal.scheduledAt,
|
|
19842
19923
|
});
|
|
19843
|
-
// Trim queue if exceeded
|
|
19844
|
-
if (this._eventList.length >
|
|
19924
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
19925
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19845
19926
|
this._eventList.pop();
|
|
19846
19927
|
}
|
|
19847
19928
|
}
|
|
@@ -19884,8 +19965,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19884
19965
|
}
|
|
19885
19966
|
// If no previous active event found, add new event
|
|
19886
19967
|
this._eventList.unshift(newEvent);
|
|
19887
|
-
// Trim queue if exceeded
|
|
19888
|
-
if (this._eventList.length >
|
|
19968
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
19969
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19889
19970
|
this._eventList.pop();
|
|
19890
19971
|
}
|
|
19891
19972
|
}
|
|
@@ -19921,8 +20002,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19921
20002
|
scheduledAt: data.signal.scheduledAt,
|
|
19922
20003
|
};
|
|
19923
20004
|
this._eventList.unshift(newEvent);
|
|
19924
|
-
// Trim queue if exceeded
|
|
19925
|
-
if (this._eventList.length >
|
|
20005
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20006
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19926
20007
|
this._eventList.pop();
|
|
19927
20008
|
}
|
|
19928
20009
|
}
|
|
@@ -19949,8 +20030,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19949
20030
|
totalPartials: data.signal.totalPartials,
|
|
19950
20031
|
scheduledAt: data.signal.scheduledAt,
|
|
19951
20032
|
});
|
|
19952
|
-
// Trim queue if exceeded
|
|
19953
|
-
if (this._eventList.length >
|
|
20033
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20034
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19954
20035
|
this._eventList.pop();
|
|
19955
20036
|
}
|
|
19956
20037
|
}
|
|
@@ -19992,8 +20073,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
19992
20073
|
}
|
|
19993
20074
|
// If no previous waiting event found, add new event
|
|
19994
20075
|
this._eventList.unshift(newEvent);
|
|
19995
|
-
// Trim queue if exceeded
|
|
19996
|
-
if (this._eventList.length >
|
|
20076
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20077
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
19997
20078
|
this._eventList.pop();
|
|
19998
20079
|
}
|
|
19999
20080
|
}
|
|
@@ -20021,8 +20102,8 @@ let ReportStorage$8 = class ReportStorage {
|
|
|
20021
20102
|
cancelReason: data.reason,
|
|
20022
20103
|
scheduledAt: data.signal.scheduledAt,
|
|
20023
20104
|
});
|
|
20024
|
-
// Trim queue if exceeded
|
|
20025
|
-
if (this._eventList.length >
|
|
20105
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS
|
|
20106
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_LIVE_MARKDOWN_ROWS) {
|
|
20026
20107
|
this._eventList.pop();
|
|
20027
20108
|
}
|
|
20028
20109
|
}
|
|
@@ -20476,8 +20557,6 @@ const CREATE_FILE_NAME_FN$9 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
20476
20557
|
parts.push("live");
|
|
20477
20558
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
20478
20559
|
};
|
|
20479
|
-
/** Maximum number of events to store in schedule reports */
|
|
20480
|
-
const MAX_EVENTS$8 = 250;
|
|
20481
20560
|
/**
|
|
20482
20561
|
* Storage class for accumulating scheduled signal events per strategy.
|
|
20483
20562
|
* Maintains a chronological list of scheduled and cancelled events.
|
|
@@ -20517,8 +20596,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20517
20596
|
pnl: data.signal.pnl,
|
|
20518
20597
|
scheduledAt: data.signal.scheduledAt,
|
|
20519
20598
|
});
|
|
20520
|
-
// Trim queue if exceeded
|
|
20521
|
-
if (this._eventList.length >
|
|
20599
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20600
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20522
20601
|
this._eventList.pop();
|
|
20523
20602
|
}
|
|
20524
20603
|
}
|
|
@@ -20553,8 +20632,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20553
20632
|
scheduledAt: data.signal.scheduledAt,
|
|
20554
20633
|
};
|
|
20555
20634
|
this._eventList.unshift(newEvent);
|
|
20556
|
-
// Trim queue if exceeded
|
|
20557
|
-
if (this._eventList.length >
|
|
20635
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20636
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20558
20637
|
this._eventList.pop();
|
|
20559
20638
|
}
|
|
20560
20639
|
}
|
|
@@ -20591,8 +20670,8 @@ let ReportStorage$7 = class ReportStorage {
|
|
|
20591
20670
|
scheduledAt: data.signal.scheduledAt,
|
|
20592
20671
|
};
|
|
20593
20672
|
this._eventList.unshift(newEvent);
|
|
20594
|
-
// Trim queue if exceeded
|
|
20595
|
-
if (this._eventList.length >
|
|
20673
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS
|
|
20674
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SCHEDULE_MARKDOWN_ROWS) {
|
|
20596
20675
|
this._eventList.pop();
|
|
20597
20676
|
}
|
|
20598
20677
|
}
|
|
@@ -20999,8 +21078,6 @@ function percentile(sortedArray, p) {
|
|
|
20999
21078
|
const index = Math.ceil((sortedArray.length * p) / 100) - 1;
|
|
21000
21079
|
return sortedArray[Math.max(0, index)];
|
|
21001
21080
|
}
|
|
21002
|
-
/** Maximum number of performance events to store per strategy */
|
|
21003
|
-
const MAX_EVENTS$7 = 10000;
|
|
21004
21081
|
/**
|
|
21005
21082
|
* Storage class for accumulating performance metrics per strategy.
|
|
21006
21083
|
* Maintains a list of all performance events and provides aggregated statistics.
|
|
@@ -21021,8 +21098,8 @@ class PerformanceStorage {
|
|
|
21021
21098
|
*/
|
|
21022
21099
|
addEvent(event) {
|
|
21023
21100
|
this._events.unshift(event);
|
|
21024
|
-
// Trim queue if exceeded
|
|
21025
|
-
if (this._events.length >
|
|
21101
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PERFORMANCE_MARKDOWN_ROWS (keep most recent)
|
|
21102
|
+
if (this._events.length > GLOBAL_CONFIG.CC_MAX_PERFORMANCE_MARKDOWN_ROWS) {
|
|
21026
21103
|
this._events.pop();
|
|
21027
21104
|
}
|
|
21028
21105
|
}
|
|
@@ -21490,7 +21567,7 @@ let ReportStorage$6 = class ReportStorage {
|
|
|
21490
21567
|
* @param columns - Column configuration for formatting the strategy comparison table
|
|
21491
21568
|
* @returns Markdown formatted comparison table
|
|
21492
21569
|
*/
|
|
21493
|
-
async getComparisonTable(topN =
|
|
21570
|
+
async getComparisonTable(topN = GLOBAL_CONFIG.CC_WALKER_MARKDOWN_TOP_N, columns = COLUMN_CONFIG.walker_strategy_columns) {
|
|
21494
21571
|
if (this._strategyResults.length === 0) {
|
|
21495
21572
|
return "No strategy results available.";
|
|
21496
21573
|
}
|
|
@@ -21592,7 +21669,7 @@ let ReportStorage$6 = class ReportStorage {
|
|
|
21592
21669
|
"",
|
|
21593
21670
|
"## Top Strategies Comparison",
|
|
21594
21671
|
"",
|
|
21595
|
-
await this.getComparisonTable(
|
|
21672
|
+
await this.getComparisonTable(GLOBAL_CONFIG.CC_WALKER_MARKDOWN_TOP_N, strategyColumns),
|
|
21596
21673
|
"",
|
|
21597
21674
|
"## All Signals (PNL Table)",
|
|
21598
21675
|
"",
|
|
@@ -21890,8 +21967,6 @@ function isUnsafe(value) {
|
|
|
21890
21967
|
}
|
|
21891
21968
|
return false;
|
|
21892
21969
|
}
|
|
21893
|
-
/** Maximum number of signals to store per symbol in heatmap reports */
|
|
21894
|
-
const MAX_EVENTS$6 = 250;
|
|
21895
21970
|
/**
|
|
21896
21971
|
* Storage class for accumulating closed signals per strategy and generating heatmap.
|
|
21897
21972
|
* Maintains symbol-level statistics and provides portfolio-wide metrics.
|
|
@@ -21916,8 +21991,8 @@ class HeatmapStorage {
|
|
|
21916
21991
|
}
|
|
21917
21992
|
const signals = this.symbolData.get(symbol);
|
|
21918
21993
|
signals.unshift(data);
|
|
21919
|
-
// Trim queue if exceeded
|
|
21920
|
-
if (signals.length >
|
|
21994
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_HEATMAP_MARKDOWN_ROWS per symbol
|
|
21995
|
+
if (signals.length > GLOBAL_CONFIG.CC_MAX_HEATMAP_MARKDOWN_ROWS) {
|
|
21921
21996
|
signals.pop();
|
|
21922
21997
|
}
|
|
21923
21998
|
}
|
|
@@ -23689,8 +23764,6 @@ const CREATE_FILE_NAME_FN$5 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
23689
23764
|
parts.push("live");
|
|
23690
23765
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
23691
23766
|
};
|
|
23692
|
-
/** Maximum number of events to store in partial reports */
|
|
23693
|
-
const MAX_EVENTS$5 = 250;
|
|
23694
23767
|
/**
|
|
23695
23768
|
* Storage class for accumulating partial profit/loss events per symbol-strategy pair.
|
|
23696
23769
|
* Maintains a chronological list of profit and loss level events.
|
|
@@ -23737,8 +23810,8 @@ let ReportStorage$5 = class ReportStorage {
|
|
|
23737
23810
|
scheduledAt: data.scheduledAt,
|
|
23738
23811
|
backtest,
|
|
23739
23812
|
});
|
|
23740
|
-
// Trim queue if exceeded
|
|
23741
|
-
if (this._eventList.length >
|
|
23813
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS
|
|
23814
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS) {
|
|
23742
23815
|
this._eventList.pop();
|
|
23743
23816
|
}
|
|
23744
23817
|
}
|
|
@@ -23775,8 +23848,8 @@ let ReportStorage$5 = class ReportStorage {
|
|
|
23775
23848
|
scheduledAt: data.scheduledAt,
|
|
23776
23849
|
backtest,
|
|
23777
23850
|
});
|
|
23778
|
-
// Trim queue if exceeded
|
|
23779
|
-
if (this._eventList.length >
|
|
23851
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS
|
|
23852
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_PARTIAL_MARKDOWN_ROWS) {
|
|
23780
23853
|
this._eventList.pop();
|
|
23781
23854
|
}
|
|
23782
23855
|
}
|
|
@@ -24832,8 +24905,6 @@ const CREATE_FILE_NAME_FN$4 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
24832
24905
|
parts.push("live");
|
|
24833
24906
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
24834
24907
|
};
|
|
24835
|
-
/** Maximum number of events to store in breakeven reports */
|
|
24836
|
-
const MAX_EVENTS$4 = 250;
|
|
24837
24908
|
/**
|
|
24838
24909
|
* Storage class for accumulating breakeven events per symbol-strategy pair.
|
|
24839
24910
|
* Maintains a chronological list of breakeven events.
|
|
@@ -24878,8 +24949,8 @@ let ReportStorage$4 = class ReportStorage {
|
|
|
24878
24949
|
scheduledAt: data.scheduledAt,
|
|
24879
24950
|
backtest,
|
|
24880
24951
|
});
|
|
24881
|
-
// Trim queue if exceeded
|
|
24882
|
-
if (this._eventList.length >
|
|
24952
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_BREAKEVEN_MARKDOWN_ROWS
|
|
24953
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_BREAKEVEN_MARKDOWN_ROWS) {
|
|
24883
24954
|
this._eventList.pop();
|
|
24884
24955
|
}
|
|
24885
24956
|
}
|
|
@@ -25508,8 +25579,6 @@ const CREATE_FILE_NAME_FN$3 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
25508
25579
|
parts.push("live");
|
|
25509
25580
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
25510
25581
|
};
|
|
25511
|
-
/** Maximum number of events to store in risk reports */
|
|
25512
|
-
const MAX_EVENTS$3 = 250;
|
|
25513
25582
|
/**
|
|
25514
25583
|
* Storage class for accumulating risk rejection events per symbol-strategy pair.
|
|
25515
25584
|
* Maintains a chronological list of rejected signals due to risk limits.
|
|
@@ -25530,8 +25599,8 @@ let ReportStorage$3 = class ReportStorage {
|
|
|
25530
25599
|
*/
|
|
25531
25600
|
addRejectionEvent(event) {
|
|
25532
25601
|
this._eventList.unshift(event);
|
|
25533
|
-
// Trim queue if exceeded
|
|
25534
|
-
if (this._eventList.length >
|
|
25602
|
+
// Trim queue if exceeded GLOBAL_CONFIG.CC_MAX_RISK_MARKDOWN_ROWS
|
|
25603
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_RISK_MARKDOWN_ROWS) {
|
|
25535
25604
|
this._eventList.pop();
|
|
25536
25605
|
}
|
|
25537
25606
|
}
|
|
@@ -28624,16 +28693,10 @@ const CREATE_FILE_NAME_FN$2 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
28624
28693
|
parts.push("live");
|
|
28625
28694
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
28626
28695
|
};
|
|
28627
|
-
/**
|
|
28628
|
-
* Maximum number of events to store per symbol-strategy pair.
|
|
28629
|
-
* Older events are discarded when this limit is exceeded.
|
|
28630
|
-
* @internal
|
|
28631
|
-
*/
|
|
28632
|
-
const MAX_EVENTS$2 = 250;
|
|
28633
28696
|
/**
|
|
28634
28697
|
* In-memory storage for accumulating strategy events per symbol-strategy pair.
|
|
28635
28698
|
*
|
|
28636
|
-
* Maintains a rolling window of the most recent events (up to
|
|
28699
|
+
* Maintains a rolling window of the most recent events (up to GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS),
|
|
28637
28700
|
* with newer events added to the front of the list. Provides methods to:
|
|
28638
28701
|
* - Add new events (FIFO queue with max size)
|
|
28639
28702
|
* - Retrieve aggregated statistics
|
|
@@ -28662,13 +28725,13 @@ let ReportStorage$2 = class ReportStorage {
|
|
|
28662
28725
|
* Adds a new event to the storage.
|
|
28663
28726
|
*
|
|
28664
28727
|
* Events are added to the front of the list (most recent first).
|
|
28665
|
-
* If the list exceeds
|
|
28728
|
+
* If the list exceeds GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS, the oldest event is removed.
|
|
28666
28729
|
*
|
|
28667
28730
|
* @param event - The strategy event to store
|
|
28668
28731
|
*/
|
|
28669
28732
|
addEvent(event) {
|
|
28670
28733
|
this._eventList.unshift(event);
|
|
28671
|
-
if (this._eventList.length >
|
|
28734
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_STRATEGY_MARKDOWN_ROWS) {
|
|
28672
28735
|
this._eventList.pop();
|
|
28673
28736
|
}
|
|
28674
28737
|
}
|
|
@@ -29539,8 +29602,6 @@ const CREATE_FILE_NAME_FN$1 = (symbol, strategyName, exchangeName, frameName, ti
|
|
|
29539
29602
|
parts.push("live");
|
|
29540
29603
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
29541
29604
|
};
|
|
29542
|
-
/** Maximum number of events to store in sync reports */
|
|
29543
|
-
const MAX_EVENTS$1 = 250;
|
|
29544
29605
|
/**
|
|
29545
29606
|
* Storage class for accumulating signal sync events per symbol-strategy-exchange-frame-backtest combination.
|
|
29546
29607
|
* Maintains a chronological list of signal-open and signal-close events.
|
|
@@ -29555,7 +29616,7 @@ let ReportStorage$1 = class ReportStorage {
|
|
|
29555
29616
|
}
|
|
29556
29617
|
addEvent(event) {
|
|
29557
29618
|
this._eventList.unshift(event);
|
|
29558
|
-
if (this._eventList.length >
|
|
29619
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_SYNC_MARKDOWN_ROWS) {
|
|
29559
29620
|
this._eventList.pop();
|
|
29560
29621
|
}
|
|
29561
29622
|
}
|
|
@@ -29758,8 +29819,6 @@ const CREATE_FILE_NAME_FN = (symbol, strategyName, exchangeName, frameName, time
|
|
|
29758
29819
|
parts.push("live");
|
|
29759
29820
|
return `${parts.join("_")}-${timestamp}.md`;
|
|
29760
29821
|
};
|
|
29761
|
-
/** Maximum number of events to store per combination */
|
|
29762
|
-
const MAX_EVENTS = 250;
|
|
29763
29822
|
/**
|
|
29764
29823
|
* Accumulates highest profit events per symbol-strategy-exchange-frame combination.
|
|
29765
29824
|
*/
|
|
@@ -29788,7 +29847,7 @@ class ReportStorage {
|
|
|
29788
29847
|
priceStopLoss: data.priceStopLoss,
|
|
29789
29848
|
backtest,
|
|
29790
29849
|
});
|
|
29791
|
-
if (this._eventList.length >
|
|
29850
|
+
if (this._eventList.length > GLOBAL_CONFIG.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS) {
|
|
29792
29851
|
this._eventList.pop();
|
|
29793
29852
|
}
|
|
29794
29853
|
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -5565,6 +5565,91 @@ declare const GLOBAL_CONFIG: {
|
|
|
5565
5565
|
* Binance requirement
|
|
5566
5566
|
*/
|
|
5567
5567
|
CC_AGGREGATED_TRADES_MAX_MINUTES: number;
|
|
5568
|
+
/**
|
|
5569
|
+
* Maximum number of events to keep in backtest markdown report storage.
|
|
5570
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5571
|
+
*
|
|
5572
|
+
* Default: 250 events
|
|
5573
|
+
*/
|
|
5574
|
+
CC_MAX_BACKTEST_MARKDOWN_ROWS: number;
|
|
5575
|
+
/**
|
|
5576
|
+
* Maximum number of events to keep in breakeven markdown report storage.
|
|
5577
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5578
|
+
*
|
|
5579
|
+
* Default: 250 events
|
|
5580
|
+
*/
|
|
5581
|
+
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: number;
|
|
5582
|
+
/**
|
|
5583
|
+
* Maximum number of events to keep in heatmap markdown report storage.
|
|
5584
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5585
|
+
*
|
|
5586
|
+
* Default: 250 events
|
|
5587
|
+
*/
|
|
5588
|
+
CC_MAX_HEATMAP_MARKDOWN_ROWS: number;
|
|
5589
|
+
/**
|
|
5590
|
+
* Maximum number of events to keep in highest profit markdown report storage.
|
|
5591
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5592
|
+
*
|
|
5593
|
+
* Default: 250 events
|
|
5594
|
+
*/
|
|
5595
|
+
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
5596
|
+
/**
|
|
5597
|
+
* Maximum number of events to keep in live markdown report storage.
|
|
5598
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5599
|
+
*
|
|
5600
|
+
* Default: 250 events
|
|
5601
|
+
*/
|
|
5602
|
+
CC_MAX_LIVE_MARKDOWN_ROWS: number;
|
|
5603
|
+
/**
|
|
5604
|
+
* Maximum number of events to keep in partial markdown report storage.
|
|
5605
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5606
|
+
*
|
|
5607
|
+
* Default: 250 events
|
|
5608
|
+
*/
|
|
5609
|
+
CC_MAX_PARTIAL_MARKDOWN_ROWS: number;
|
|
5610
|
+
/**
|
|
5611
|
+
* Maximum number of events to keep in risk markdown report storage.
|
|
5612
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5613
|
+
*
|
|
5614
|
+
* Default: 250 events
|
|
5615
|
+
*/
|
|
5616
|
+
CC_MAX_RISK_MARKDOWN_ROWS: number;
|
|
5617
|
+
/**
|
|
5618
|
+
* Maximum number of events to keep in schedule markdown report storage.
|
|
5619
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5620
|
+
*
|
|
5621
|
+
* Default: 250 events
|
|
5622
|
+
*/
|
|
5623
|
+
CC_MAX_SCHEDULE_MARKDOWN_ROWS: number;
|
|
5624
|
+
/**
|
|
5625
|
+
* Maximum number of events to keep in strategy markdown report storage.
|
|
5626
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5627
|
+
*
|
|
5628
|
+
* Default: 250 events
|
|
5629
|
+
*/
|
|
5630
|
+
CC_MAX_STRATEGY_MARKDOWN_ROWS: number;
|
|
5631
|
+
/**
|
|
5632
|
+
* Maximum number of events to keep in sync markdown report storage.
|
|
5633
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5634
|
+
*
|
|
5635
|
+
* Default: 250 events
|
|
5636
|
+
*/
|
|
5637
|
+
CC_MAX_SYNC_MARKDOWN_ROWS: number;
|
|
5638
|
+
/**
|
|
5639
|
+
* Number of top strategies to include in the walker comparison table.
|
|
5640
|
+
*
|
|
5641
|
+
* Default: 10 strategies
|
|
5642
|
+
*/
|
|
5643
|
+
CC_WALKER_MARKDOWN_TOP_N: number;
|
|
5644
|
+
/**
|
|
5645
|
+
* Maximum number of performance metric events to keep in storage.
|
|
5646
|
+
* Older events are removed when this limit is exceeded.
|
|
5647
|
+
* Higher than other report event limits because performance metrics are lightweight
|
|
5648
|
+
* and benefit from larger sample sizes for accurate statistical analysis.
|
|
5649
|
+
*
|
|
5650
|
+
* Default: 10000 events
|
|
5651
|
+
*/
|
|
5652
|
+
CC_MAX_PERFORMANCE_MARKDOWN_ROWS: number;
|
|
5568
5653
|
/**
|
|
5569
5654
|
* Maximum number of notifications to keep in storage.
|
|
5570
5655
|
* Older notifications are removed when this limit is exceeded.
|
|
@@ -5727,6 +5812,18 @@ declare function getConfig(): {
|
|
|
5727
5812
|
CC_ORDER_BOOK_TIME_OFFSET_MINUTES: number;
|
|
5728
5813
|
CC_ORDER_BOOK_MAX_DEPTH_LEVELS: number;
|
|
5729
5814
|
CC_AGGREGATED_TRADES_MAX_MINUTES: number;
|
|
5815
|
+
CC_MAX_BACKTEST_MARKDOWN_ROWS: number;
|
|
5816
|
+
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: number;
|
|
5817
|
+
CC_MAX_HEATMAP_MARKDOWN_ROWS: number;
|
|
5818
|
+
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
5819
|
+
CC_MAX_LIVE_MARKDOWN_ROWS: number;
|
|
5820
|
+
CC_MAX_PARTIAL_MARKDOWN_ROWS: number;
|
|
5821
|
+
CC_MAX_RISK_MARKDOWN_ROWS: number;
|
|
5822
|
+
CC_MAX_SCHEDULE_MARKDOWN_ROWS: number;
|
|
5823
|
+
CC_MAX_STRATEGY_MARKDOWN_ROWS: number;
|
|
5824
|
+
CC_MAX_SYNC_MARKDOWN_ROWS: number;
|
|
5825
|
+
CC_WALKER_MARKDOWN_TOP_N: number;
|
|
5826
|
+
CC_MAX_PERFORMANCE_MARKDOWN_ROWS: number;
|
|
5730
5827
|
CC_MAX_NOTIFICATIONS: number;
|
|
5731
5828
|
CC_MAX_SIGNALS: number;
|
|
5732
5829
|
CC_MAX_LOG_LINES: number;
|
|
@@ -5769,6 +5866,18 @@ declare function getDefaultConfig(): Readonly<{
|
|
|
5769
5866
|
CC_ORDER_BOOK_TIME_OFFSET_MINUTES: number;
|
|
5770
5867
|
CC_ORDER_BOOK_MAX_DEPTH_LEVELS: number;
|
|
5771
5868
|
CC_AGGREGATED_TRADES_MAX_MINUTES: number;
|
|
5869
|
+
CC_MAX_BACKTEST_MARKDOWN_ROWS: number;
|
|
5870
|
+
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: number;
|
|
5871
|
+
CC_MAX_HEATMAP_MARKDOWN_ROWS: number;
|
|
5872
|
+
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
5873
|
+
CC_MAX_LIVE_MARKDOWN_ROWS: number;
|
|
5874
|
+
CC_MAX_PARTIAL_MARKDOWN_ROWS: number;
|
|
5875
|
+
CC_MAX_RISK_MARKDOWN_ROWS: number;
|
|
5876
|
+
CC_MAX_SCHEDULE_MARKDOWN_ROWS: number;
|
|
5877
|
+
CC_MAX_STRATEGY_MARKDOWN_ROWS: number;
|
|
5878
|
+
CC_MAX_SYNC_MARKDOWN_ROWS: number;
|
|
5879
|
+
CC_WALKER_MARKDOWN_TOP_N: number;
|
|
5880
|
+
CC_MAX_PERFORMANCE_MARKDOWN_ROWS: number;
|
|
5772
5881
|
CC_MAX_NOTIFICATIONS: number;
|
|
5773
5882
|
CC_MAX_SIGNALS: number;
|
|
5774
5883
|
CC_MAX_LOG_LINES: number;
|