@tradejs/cli 3.1.29-beta.296 → 3.1.29-beta.297
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/dist/cli.js +423 -213
- package/dist/lib/coinMarketCapContextBackfill.js +21 -5
- package/dist/lib/derivativesContextBackfill.js +14 -0
- package/dist/lib/marketContextPrepare.js +21 -5
- package/dist/scripts/backtest.js +21 -5
- package/dist/scripts/coverageBackfill.js +1731 -0
- package/dist/scripts/replay.js +21 -5
- package/dist/scripts/replayRunner.js +21 -5
- package/dist/scripts/replayRuntimeEvidence.js +4 -1
- package/dist/scripts/runtimeParity.js +21 -5
- package/dist/scripts/signals.js +21 -5
- package/dist/scripts/signalsDaemon.js +21 -5
- package/package.json +7 -7
|
@@ -799,11 +799,27 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
799
799
|
toMs
|
|
800
800
|
})
|
|
801
801
|
);
|
|
802
|
-
const
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
802
|
+
const ready = (dataset, existing) => params.repairDataset ? params.repairDataset !== dataset : existing;
|
|
803
|
+
const globalDailyReady = ready(
|
|
804
|
+
"cmc-global-1d",
|
|
805
|
+
globalDailyCached || globalDailyBackfillCovered
|
|
806
|
+
);
|
|
807
|
+
const referencesDailyReady = ready(
|
|
808
|
+
"cmc-reference_asset-1d",
|
|
809
|
+
referencesDailyCached || referencesDailyBackfillCovered
|
|
810
|
+
);
|
|
811
|
+
const exchangeLiquidityReady = ready(
|
|
812
|
+
"cmc-exchange_liquidity-1d",
|
|
813
|
+
exchangeLiquidityCached || !exchangeLiquidityEnabled || exchangeLiquidityBackfillCovered
|
|
814
|
+
);
|
|
815
|
+
const fearGreedReady = ready(
|
|
816
|
+
"cmc-fear_greed-1d",
|
|
817
|
+
fearGreedCached || !fearGreedEnabled || fearGreedBackfillCovered
|
|
818
|
+
);
|
|
819
|
+
const indexesReady = ready(
|
|
820
|
+
"cmc-index-1d",
|
|
821
|
+
indexesCached || indexesBackfillCovered
|
|
822
|
+
);
|
|
807
823
|
let globalStatus = resolveBackfillStatus({
|
|
808
824
|
cached: globalDailyCached,
|
|
809
825
|
covered: globalDailyBackfillCovered
|
|
@@ -39,6 +39,7 @@ __export(derivativesContextBackfill_exports, {
|
|
|
39
39
|
isBacktestDerivativesContextEnabled: () => isBacktestDerivativesContextEnabled,
|
|
40
40
|
isDerivativesTargetContextEnabled: () => isDerivativesTargetContextEnabled,
|
|
41
41
|
isSignalsDerivativesContextEnabled: () => isSignalsDerivativesContextEnabled,
|
|
42
|
+
resolveCoinalyzeBackfillMarket: () => resolveCoinalyzeBackfillMarket,
|
|
42
43
|
resolveDerivativesContextBackfillSymbols: () => resolveDerivativesContextBackfillSymbols,
|
|
43
44
|
resolveDerivativesContextBackfillWindow: () => resolveDerivativesContextBackfillWindow,
|
|
44
45
|
resolveDerivativesContextFetchFromMs: () => resolveDerivativesContextFetchFromMs,
|
|
@@ -481,6 +482,18 @@ var buildMatches = (tickers, markets, exchangePriority) => {
|
|
|
481
482
|
}
|
|
482
483
|
return { matches, unmatched };
|
|
483
484
|
};
|
|
485
|
+
async function resolveCoinalyzeBackfillMarket(userName, symbol) {
|
|
486
|
+
const apiKey = await getCoinalyzeApiKey(userName);
|
|
487
|
+
if (!apiKey) throw new Error("Missing Coinalyze API key.");
|
|
488
|
+
const markets = (await fetchCoinalyzeMarkets(apiKey)).filter(
|
|
489
|
+
(market) => market.quote_asset?.toUpperCase() === "USDT" && market.is_perpetual
|
|
490
|
+
);
|
|
491
|
+
const priority = parseList(
|
|
492
|
+
process.env.COINALYZE_EXCHANGE_PRIORITY || process.env.DERIVATIVES_CONTEXT_EXCHANGE_PRIORITY || "A,6,0"
|
|
493
|
+
);
|
|
494
|
+
const { matches } = buildMatches([symbol], markets, priority);
|
|
495
|
+
return { apiKey, marketSymbol: matches[0]?.marketSymbol };
|
|
496
|
+
}
|
|
484
497
|
var normalizeMetricPoint = (metric, point) => {
|
|
485
498
|
if (metric === "oi") {
|
|
486
499
|
return {
|
|
@@ -1042,6 +1055,7 @@ var backfillDerivativesContextForSignals = async (params) => backfillDerivatives
|
|
|
1042
1055
|
isBacktestDerivativesContextEnabled,
|
|
1043
1056
|
isDerivativesTargetContextEnabled,
|
|
1044
1057
|
isSignalsDerivativesContextEnabled,
|
|
1058
|
+
resolveCoinalyzeBackfillMarket,
|
|
1045
1059
|
resolveDerivativesContextBackfillSymbols,
|
|
1046
1060
|
resolveDerivativesContextBackfillWindow,
|
|
1047
1061
|
resolveDerivativesContextFetchFromMs,
|
|
@@ -2569,11 +2569,27 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
2569
2569
|
toMs
|
|
2570
2570
|
})
|
|
2571
2571
|
);
|
|
2572
|
-
const
|
|
2573
|
-
const
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2572
|
+
const ready = (dataset, existing) => params.repairDataset ? params.repairDataset !== dataset : existing;
|
|
2573
|
+
const globalDailyReady = ready(
|
|
2574
|
+
"cmc-global-1d",
|
|
2575
|
+
globalDailyCached || globalDailyBackfillCovered
|
|
2576
|
+
);
|
|
2577
|
+
const referencesDailyReady = ready(
|
|
2578
|
+
"cmc-reference_asset-1d",
|
|
2579
|
+
referencesDailyCached || referencesDailyBackfillCovered
|
|
2580
|
+
);
|
|
2581
|
+
const exchangeLiquidityReady = ready(
|
|
2582
|
+
"cmc-exchange_liquidity-1d",
|
|
2583
|
+
exchangeLiquidityCached || !exchangeLiquidityEnabled || exchangeLiquidityBackfillCovered
|
|
2584
|
+
);
|
|
2585
|
+
const fearGreedReady = ready(
|
|
2586
|
+
"cmc-fear_greed-1d",
|
|
2587
|
+
fearGreedCached || !fearGreedEnabled || fearGreedBackfillCovered
|
|
2588
|
+
);
|
|
2589
|
+
const indexesReady = ready(
|
|
2590
|
+
"cmc-index-1d",
|
|
2591
|
+
indexesCached || indexesBackfillCovered
|
|
2592
|
+
);
|
|
2577
2593
|
let globalStatus = resolveBackfillStatus({
|
|
2578
2594
|
cached: globalDailyCached,
|
|
2579
2595
|
covered: globalDailyBackfillCovered
|
package/dist/scripts/backtest.js
CHANGED
|
@@ -2679,11 +2679,27 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
2679
2679
|
toMs
|
|
2680
2680
|
})
|
|
2681
2681
|
);
|
|
2682
|
-
const
|
|
2683
|
-
const
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2682
|
+
const ready = (dataset, existing) => params.repairDataset ? params.repairDataset !== dataset : existing;
|
|
2683
|
+
const globalDailyReady = ready(
|
|
2684
|
+
"cmc-global-1d",
|
|
2685
|
+
globalDailyCached || globalDailyBackfillCovered
|
|
2686
|
+
);
|
|
2687
|
+
const referencesDailyReady = ready(
|
|
2688
|
+
"cmc-reference_asset-1d",
|
|
2689
|
+
referencesDailyCached || referencesDailyBackfillCovered
|
|
2690
|
+
);
|
|
2691
|
+
const exchangeLiquidityReady = ready(
|
|
2692
|
+
"cmc-exchange_liquidity-1d",
|
|
2693
|
+
exchangeLiquidityCached || !exchangeLiquidityEnabled || exchangeLiquidityBackfillCovered
|
|
2694
|
+
);
|
|
2695
|
+
const fearGreedReady = ready(
|
|
2696
|
+
"cmc-fear_greed-1d",
|
|
2697
|
+
fearGreedCached || !fearGreedEnabled || fearGreedBackfillCovered
|
|
2698
|
+
);
|
|
2699
|
+
const indexesReady = ready(
|
|
2700
|
+
"cmc-index-1d",
|
|
2701
|
+
indexesCached || indexesBackfillCovered
|
|
2702
|
+
);
|
|
2687
2703
|
let globalStatus = resolveBackfillStatus({
|
|
2688
2704
|
cached: globalDailyCached,
|
|
2689
2705
|
covered: globalDailyBackfillCovered
|