backtest-kit 12.2.0 → 12.4.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/build/index.cjs +24 -2
- package/build/index.mjs +24 -2
- package/package.json +1 -1
- package/types.d.ts +4 -0
package/build/index.cjs
CHANGED
|
@@ -12383,6 +12383,10 @@ const CREATE_COMMIT_SCHEDULE_PING_FN = (self) => functoolsKit.trycatch(async (sy
|
|
|
12383
12383
|
backtest,
|
|
12384
12384
|
timestamp,
|
|
12385
12385
|
};
|
|
12386
|
+
{
|
|
12387
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12388
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12389
|
+
}
|
|
12386
12390
|
await schedulePingSubject.next(event);
|
|
12387
12391
|
await self.actionCoreService.pingScheduled(backtest, event, { strategyName, exchangeName, frameName: data.frameName });
|
|
12388
12392
|
}, {
|
|
@@ -12417,6 +12421,10 @@ const CREATE_COMMIT_IDLE_PING_FN = (self) => functoolsKit.trycatch(async (symbol
|
|
|
12417
12421
|
backtest,
|
|
12418
12422
|
timestamp,
|
|
12419
12423
|
};
|
|
12424
|
+
{
|
|
12425
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: frameName }, backtest);
|
|
12426
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: frameName }, backtest);
|
|
12427
|
+
}
|
|
12420
12428
|
await idlePingSubject.next(event);
|
|
12421
12429
|
await self.actionCoreService.pingIdle(backtest, event, { strategyName, exchangeName, frameName });
|
|
12422
12430
|
}, {
|
|
@@ -12451,6 +12459,10 @@ const CREATE_COMMIT_ACTIVE_PING_FN = (self) => functoolsKit.trycatch(async (symb
|
|
|
12451
12459
|
backtest,
|
|
12452
12460
|
timestamp,
|
|
12453
12461
|
};
|
|
12462
|
+
{
|
|
12463
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12464
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12465
|
+
}
|
|
12454
12466
|
await activePingSubject.next(event);
|
|
12455
12467
|
await self.actionCoreService.pingActive(backtest, event, { strategyName, exchangeName, frameName: data.frameName });
|
|
12456
12468
|
}, {
|
|
@@ -13048,8 +13060,8 @@ class StrategyConnectionService {
|
|
|
13048
13060
|
await strategy.waitForInit();
|
|
13049
13061
|
const tick = await strategy.tick(symbol, context.strategyName);
|
|
13050
13062
|
{
|
|
13051
|
-
this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
|
|
13052
|
-
this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
|
|
13063
|
+
await this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
|
|
13064
|
+
await this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
|
|
13053
13065
|
}
|
|
13054
13066
|
{
|
|
13055
13067
|
await CALL_SIGNAL_EMIT_FN(this, tick, context, backtest, symbol);
|
|
@@ -19595,6 +19607,10 @@ const RUN_INFINITY_CHUNK_LOOP_FN = async (self, symbol, when, context, initialRe
|
|
|
19595
19607
|
if (chunkResult.action !== "active") {
|
|
19596
19608
|
return chunkResult;
|
|
19597
19609
|
}
|
|
19610
|
+
{
|
|
19611
|
+
await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
|
|
19612
|
+
await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
|
|
19613
|
+
}
|
|
19598
19614
|
lastChunkCandles = chunkCandles;
|
|
19599
19615
|
backtestResult = chunkResult;
|
|
19600
19616
|
chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
|
|
@@ -19775,6 +19791,10 @@ const RUN_OPENED_CHUNK_LOOP_FN = async (self, symbol, when, context, bufferStart
|
|
|
19775
19791
|
if (chunkResult.action !== "active") {
|
|
19776
19792
|
return chunkResult;
|
|
19777
19793
|
}
|
|
19794
|
+
{
|
|
19795
|
+
await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
|
|
19796
|
+
await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
|
|
19797
|
+
}
|
|
19778
19798
|
lastChunkCandles = chunkCandles;
|
|
19779
19799
|
chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
|
|
19780
19800
|
}
|
|
@@ -19865,6 +19885,8 @@ class BacktestLogicPrivateService {
|
|
|
19865
19885
|
this.frameCoreService = inject(TYPES.frameCoreService);
|
|
19866
19886
|
this.methodContextService = inject(TYPES.methodContextService);
|
|
19867
19887
|
this.actionCoreService = inject(TYPES.actionCoreService);
|
|
19888
|
+
this.timeMetaService = inject(TYPES.timeMetaService);
|
|
19889
|
+
this.priceMetaService = inject(TYPES.priceMetaService);
|
|
19868
19890
|
}
|
|
19869
19891
|
/**
|
|
19870
19892
|
* Runs backtest for a symbol, streaming closed signals as async generator.
|
package/build/index.mjs
CHANGED
|
@@ -12363,6 +12363,10 @@ const CREATE_COMMIT_SCHEDULE_PING_FN = (self) => trycatch(async (symbol, strateg
|
|
|
12363
12363
|
backtest,
|
|
12364
12364
|
timestamp,
|
|
12365
12365
|
};
|
|
12366
|
+
{
|
|
12367
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12368
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12369
|
+
}
|
|
12366
12370
|
await schedulePingSubject.next(event);
|
|
12367
12371
|
await self.actionCoreService.pingScheduled(backtest, event, { strategyName, exchangeName, frameName: data.frameName });
|
|
12368
12372
|
}, {
|
|
@@ -12397,6 +12401,10 @@ const CREATE_COMMIT_IDLE_PING_FN = (self) => trycatch(async (symbol, strategyNam
|
|
|
12397
12401
|
backtest,
|
|
12398
12402
|
timestamp,
|
|
12399
12403
|
};
|
|
12404
|
+
{
|
|
12405
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: frameName }, backtest);
|
|
12406
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: frameName }, backtest);
|
|
12407
|
+
}
|
|
12400
12408
|
await idlePingSubject.next(event);
|
|
12401
12409
|
await self.actionCoreService.pingIdle(backtest, event, { strategyName, exchangeName, frameName });
|
|
12402
12410
|
}, {
|
|
@@ -12431,6 +12439,10 @@ const CREATE_COMMIT_ACTIVE_PING_FN = (self) => trycatch(async (symbol, strategyN
|
|
|
12431
12439
|
backtest,
|
|
12432
12440
|
timestamp,
|
|
12433
12441
|
};
|
|
12442
|
+
{
|
|
12443
|
+
await self.priceMetaService.next(symbol, currentPrice, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12444
|
+
await self.timeMetaService.next(symbol, timestamp, { strategyName, exchangeName, frameName: data.frameName }, backtest);
|
|
12445
|
+
}
|
|
12434
12446
|
await activePingSubject.next(event);
|
|
12435
12447
|
await self.actionCoreService.pingActive(backtest, event, { strategyName, exchangeName, frameName: data.frameName });
|
|
12436
12448
|
}, {
|
|
@@ -13028,8 +13040,8 @@ class StrategyConnectionService {
|
|
|
13028
13040
|
await strategy.waitForInit();
|
|
13029
13041
|
const tick = await strategy.tick(symbol, context.strategyName);
|
|
13030
13042
|
{
|
|
13031
|
-
this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
|
|
13032
|
-
this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
|
|
13043
|
+
await this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
|
|
13044
|
+
await this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
|
|
13033
13045
|
}
|
|
13034
13046
|
{
|
|
13035
13047
|
await CALL_SIGNAL_EMIT_FN(this, tick, context, backtest, symbol);
|
|
@@ -19575,6 +19587,10 @@ const RUN_INFINITY_CHUNK_LOOP_FN = async (self, symbol, when, context, initialRe
|
|
|
19575
19587
|
if (chunkResult.action !== "active") {
|
|
19576
19588
|
return chunkResult;
|
|
19577
19589
|
}
|
|
19590
|
+
{
|
|
19591
|
+
await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
|
|
19592
|
+
await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
|
|
19593
|
+
}
|
|
19578
19594
|
lastChunkCandles = chunkCandles;
|
|
19579
19595
|
backtestResult = chunkResult;
|
|
19580
19596
|
chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
|
|
@@ -19755,6 +19771,10 @@ const RUN_OPENED_CHUNK_LOOP_FN = async (self, symbol, when, context, bufferStart
|
|
|
19755
19771
|
if (chunkResult.action !== "active") {
|
|
19756
19772
|
return chunkResult;
|
|
19757
19773
|
}
|
|
19774
|
+
{
|
|
19775
|
+
await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
|
|
19776
|
+
await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
|
|
19777
|
+
}
|
|
19758
19778
|
lastChunkCandles = chunkCandles;
|
|
19759
19779
|
chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
|
|
19760
19780
|
}
|
|
@@ -19845,6 +19865,8 @@ class BacktestLogicPrivateService {
|
|
|
19845
19865
|
this.frameCoreService = inject(TYPES.frameCoreService);
|
|
19846
19866
|
this.methodContextService = inject(TYPES.methodContextService);
|
|
19847
19867
|
this.actionCoreService = inject(TYPES.actionCoreService);
|
|
19868
|
+
this.timeMetaService = inject(TYPES.timeMetaService);
|
|
19869
|
+
this.priceMetaService = inject(TYPES.priceMetaService);
|
|
19848
19870
|
}
|
|
19849
19871
|
/**
|
|
19850
19872
|
* Runs backtest for a symbol, streaming closed signals as async generator.
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -34491,6 +34491,8 @@ declare class BacktestLogicPrivateService {
|
|
|
34491
34491
|
readonly context: IMethodContext;
|
|
34492
34492
|
};
|
|
34493
34493
|
readonly actionCoreService: ActionCoreService;
|
|
34494
|
+
readonly timeMetaService: TimeMetaService;
|
|
34495
|
+
readonly priceMetaService: PriceMetaService;
|
|
34494
34496
|
/**
|
|
34495
34497
|
* Runs backtest for a symbol, streaming closed signals as async generator.
|
|
34496
34498
|
*
|
|
@@ -34582,6 +34584,8 @@ type IBacktestLogicPrivateService = Omit<BacktestLogicPrivateService, keyof {
|
|
|
34582
34584
|
frameCoreService: never;
|
|
34583
34585
|
actionCoreService: never;
|
|
34584
34586
|
methodContextService: never;
|
|
34587
|
+
priceMetaService: never;
|
|
34588
|
+
timeMetaService: never;
|
|
34585
34589
|
}>;
|
|
34586
34590
|
/**
|
|
34587
34591
|
* Type definition for BacktestLogicPublicService.
|