backtest-kit 1.4.9 → 1.4.10
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 +12 -14
- package/build/index.mjs +12 -14
- package/package.json +1 -1
- package/types.d.ts +16 -10
package/build/index.cjs
CHANGED
|
@@ -3128,13 +3128,12 @@ class StrategyConnectionService {
|
|
|
3128
3128
|
* @param strategyName - Name of strategy to stop
|
|
3129
3129
|
* @returns Promise that resolves when stop flag is set
|
|
3130
3130
|
*/
|
|
3131
|
-
this.stop = async (
|
|
3131
|
+
this.stop = async (ctx) => {
|
|
3132
3132
|
this.loggerService.log("strategyConnectionService stop", {
|
|
3133
|
-
|
|
3134
|
-
strategyName,
|
|
3133
|
+
ctx
|
|
3135
3134
|
});
|
|
3136
|
-
const strategy = this.getStrategy(symbol, strategyName);
|
|
3137
|
-
await strategy.stop(symbol, strategyName);
|
|
3135
|
+
const strategy = this.getStrategy(ctx.symbol, ctx.strategyName);
|
|
3136
|
+
await strategy.stop(ctx.symbol, ctx.strategyName);
|
|
3138
3137
|
};
|
|
3139
3138
|
/**
|
|
3140
3139
|
* Clears the memoized ClientStrategy instance from cache.
|
|
@@ -4065,13 +4064,12 @@ class StrategyGlobalService {
|
|
|
4065
4064
|
* @param strategyName - Name of strategy to stop
|
|
4066
4065
|
* @returns Promise that resolves when stop flag is set
|
|
4067
4066
|
*/
|
|
4068
|
-
this.stop = async (
|
|
4067
|
+
this.stop = async (ctx) => {
|
|
4069
4068
|
this.loggerService.log("strategyGlobalService stop", {
|
|
4070
|
-
|
|
4071
|
-
strategyName,
|
|
4069
|
+
ctx,
|
|
4072
4070
|
});
|
|
4073
|
-
await this.validate(symbol, strategyName);
|
|
4074
|
-
return await this.strategyConnectionService.stop(
|
|
4071
|
+
await this.validate(ctx.symbol, ctx.strategyName);
|
|
4072
|
+
return await this.strategyConnectionService.stop(ctx);
|
|
4075
4073
|
};
|
|
4076
4074
|
/**
|
|
4077
4075
|
* Clears the memoized ClientStrategy instance from cache.
|
|
@@ -5084,7 +5082,7 @@ class LiveLogicPrivateService {
|
|
|
5084
5082
|
await functoolsKit.sleep(TICK_TTL);
|
|
5085
5083
|
continue;
|
|
5086
5084
|
}
|
|
5087
|
-
// Yield opened, closed
|
|
5085
|
+
// Yield opened, closed results
|
|
5088
5086
|
yield result;
|
|
5089
5087
|
await functoolsKit.sleep(TICK_TTL);
|
|
5090
5088
|
}
|
|
@@ -12606,7 +12604,7 @@ class BacktestUtils {
|
|
|
12606
12604
|
};
|
|
12607
12605
|
task().catch((error) => exitEmitter.next(new Error(functoolsKit.getErrorMessage(error))));
|
|
12608
12606
|
return () => {
|
|
12609
|
-
backtest$1.strategyGlobalService.stop(symbol, context.strategyName);
|
|
12607
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName: context.strategyName });
|
|
12610
12608
|
backtest$1.strategyGlobalService
|
|
12611
12609
|
.getPendingSignal(symbol, context.strategyName)
|
|
12612
12610
|
.then(async (pendingSignal) => {
|
|
@@ -12819,7 +12817,7 @@ class LiveUtils {
|
|
|
12819
12817
|
};
|
|
12820
12818
|
task().catch((error) => exitEmitter.next(new Error(functoolsKit.getErrorMessage(error))));
|
|
12821
12819
|
return () => {
|
|
12822
|
-
backtest$1.strategyGlobalService.stop(symbol, context.strategyName);
|
|
12820
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName: context.strategyName });
|
|
12823
12821
|
backtest$1.strategyGlobalService
|
|
12824
12822
|
.getPendingSignal(symbol, context.strategyName)
|
|
12825
12823
|
.then(async (pendingSignal) => {
|
|
@@ -13251,7 +13249,7 @@ class WalkerUtils {
|
|
|
13251
13249
|
task().catch((error) => exitEmitter.next(new Error(functoolsKit.getErrorMessage(error))));
|
|
13252
13250
|
return () => {
|
|
13253
13251
|
for (const strategyName of walkerSchema.strategies) {
|
|
13254
|
-
backtest$1.strategyGlobalService.stop(symbol, strategyName);
|
|
13252
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName });
|
|
13255
13253
|
walkerStopSubject.next({ symbol, strategyName });
|
|
13256
13254
|
}
|
|
13257
13255
|
if (!isDone) {
|
package/build/index.mjs
CHANGED
|
@@ -3126,13 +3126,12 @@ class StrategyConnectionService {
|
|
|
3126
3126
|
* @param strategyName - Name of strategy to stop
|
|
3127
3127
|
* @returns Promise that resolves when stop flag is set
|
|
3128
3128
|
*/
|
|
3129
|
-
this.stop = async (
|
|
3129
|
+
this.stop = async (ctx) => {
|
|
3130
3130
|
this.loggerService.log("strategyConnectionService stop", {
|
|
3131
|
-
|
|
3132
|
-
strategyName,
|
|
3131
|
+
ctx
|
|
3133
3132
|
});
|
|
3134
|
-
const strategy = this.getStrategy(symbol, strategyName);
|
|
3135
|
-
await strategy.stop(symbol, strategyName);
|
|
3133
|
+
const strategy = this.getStrategy(ctx.symbol, ctx.strategyName);
|
|
3134
|
+
await strategy.stop(ctx.symbol, ctx.strategyName);
|
|
3136
3135
|
};
|
|
3137
3136
|
/**
|
|
3138
3137
|
* Clears the memoized ClientStrategy instance from cache.
|
|
@@ -4063,13 +4062,12 @@ class StrategyGlobalService {
|
|
|
4063
4062
|
* @param strategyName - Name of strategy to stop
|
|
4064
4063
|
* @returns Promise that resolves when stop flag is set
|
|
4065
4064
|
*/
|
|
4066
|
-
this.stop = async (
|
|
4065
|
+
this.stop = async (ctx) => {
|
|
4067
4066
|
this.loggerService.log("strategyGlobalService stop", {
|
|
4068
|
-
|
|
4069
|
-
strategyName,
|
|
4067
|
+
ctx,
|
|
4070
4068
|
});
|
|
4071
|
-
await this.validate(symbol, strategyName);
|
|
4072
|
-
return await this.strategyConnectionService.stop(
|
|
4069
|
+
await this.validate(ctx.symbol, ctx.strategyName);
|
|
4070
|
+
return await this.strategyConnectionService.stop(ctx);
|
|
4073
4071
|
};
|
|
4074
4072
|
/**
|
|
4075
4073
|
* Clears the memoized ClientStrategy instance from cache.
|
|
@@ -5082,7 +5080,7 @@ class LiveLogicPrivateService {
|
|
|
5082
5080
|
await sleep(TICK_TTL);
|
|
5083
5081
|
continue;
|
|
5084
5082
|
}
|
|
5085
|
-
// Yield opened, closed
|
|
5083
|
+
// Yield opened, closed results
|
|
5086
5084
|
yield result;
|
|
5087
5085
|
await sleep(TICK_TTL);
|
|
5088
5086
|
}
|
|
@@ -12604,7 +12602,7 @@ class BacktestUtils {
|
|
|
12604
12602
|
};
|
|
12605
12603
|
task().catch((error) => exitEmitter.next(new Error(getErrorMessage(error))));
|
|
12606
12604
|
return () => {
|
|
12607
|
-
backtest$1.strategyGlobalService.stop(symbol, context.strategyName);
|
|
12605
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName: context.strategyName });
|
|
12608
12606
|
backtest$1.strategyGlobalService
|
|
12609
12607
|
.getPendingSignal(symbol, context.strategyName)
|
|
12610
12608
|
.then(async (pendingSignal) => {
|
|
@@ -12817,7 +12815,7 @@ class LiveUtils {
|
|
|
12817
12815
|
};
|
|
12818
12816
|
task().catch((error) => exitEmitter.next(new Error(getErrorMessage(error))));
|
|
12819
12817
|
return () => {
|
|
12820
|
-
backtest$1.strategyGlobalService.stop(symbol, context.strategyName);
|
|
12818
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName: context.strategyName });
|
|
12821
12819
|
backtest$1.strategyGlobalService
|
|
12822
12820
|
.getPendingSignal(symbol, context.strategyName)
|
|
12823
12821
|
.then(async (pendingSignal) => {
|
|
@@ -13249,7 +13247,7 @@ class WalkerUtils {
|
|
|
13249
13247
|
task().catch((error) => exitEmitter.next(new Error(getErrorMessage(error))));
|
|
13250
13248
|
return () => {
|
|
13251
13249
|
for (const strategyName of walkerSchema.strategies) {
|
|
13252
|
-
backtest$1.strategyGlobalService.stop(symbol, strategyName);
|
|
13250
|
+
backtest$1.strategyGlobalService.stop({ symbol, strategyName });
|
|
13253
13251
|
walkerStopSubject.next({ symbol, strategyName });
|
|
13254
13252
|
}
|
|
13255
13253
|
if (!isDone) {
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -5063,7 +5063,7 @@ declare class BacktestUtils {
|
|
|
5063
5063
|
strategyName: string;
|
|
5064
5064
|
exchangeName: string;
|
|
5065
5065
|
frameName: string;
|
|
5066
|
-
}) => AsyncGenerator<
|
|
5066
|
+
}) => AsyncGenerator<IStrategyBacktestResult, void, unknown>;
|
|
5067
5067
|
/**
|
|
5068
5068
|
* Runs backtest in background without yielding results.
|
|
5069
5069
|
*
|
|
@@ -5198,7 +5198,7 @@ declare class LiveUtils {
|
|
|
5198
5198
|
run: (symbol: string, context: {
|
|
5199
5199
|
strategyName: string;
|
|
5200
5200
|
exchangeName: string;
|
|
5201
|
-
}) => AsyncGenerator<
|
|
5201
|
+
}) => AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed, void, unknown>;
|
|
5202
5202
|
/**
|
|
5203
5203
|
* Runs live trading in background without yielding results.
|
|
5204
5204
|
*
|
|
@@ -6520,7 +6520,10 @@ declare class StrategyConnectionService {
|
|
|
6520
6520
|
* @param strategyName - Name of strategy to stop
|
|
6521
6521
|
* @returns Promise that resolves when stop flag is set
|
|
6522
6522
|
*/
|
|
6523
|
-
stop: (
|
|
6523
|
+
stop: (ctx: {
|
|
6524
|
+
symbol: string;
|
|
6525
|
+
strategyName: StrategyName;
|
|
6526
|
+
}) => Promise<void>;
|
|
6524
6527
|
/**
|
|
6525
6528
|
* Clears the memoized ClientStrategy instance from cache.
|
|
6526
6529
|
*
|
|
@@ -6988,7 +6991,10 @@ declare class StrategyGlobalService {
|
|
|
6988
6991
|
* @param strategyName - Name of strategy to stop
|
|
6989
6992
|
* @returns Promise that resolves when stop flag is set
|
|
6990
6993
|
*/
|
|
6991
|
-
stop: (
|
|
6994
|
+
stop: (ctx: {
|
|
6995
|
+
symbol: string;
|
|
6996
|
+
strategyName: StrategyName;
|
|
6997
|
+
}) => Promise<void>;
|
|
6992
6998
|
/**
|
|
6993
6999
|
* Clears the memoized ClientStrategy instance from cache.
|
|
6994
7000
|
*
|
|
@@ -7451,7 +7457,7 @@ declare class BacktestLogicPrivateService {
|
|
|
7451
7457
|
* }
|
|
7452
7458
|
* ```
|
|
7453
7459
|
*/
|
|
7454
|
-
run(symbol: string): AsyncGenerator<
|
|
7460
|
+
run(symbol: string): AsyncGenerator<IStrategyBacktestResult, void, unknown>;
|
|
7455
7461
|
}
|
|
7456
7462
|
|
|
7457
7463
|
/**
|
|
@@ -7496,7 +7502,7 @@ declare class LiveLogicPrivateService {
|
|
|
7496
7502
|
* }
|
|
7497
7503
|
* ```
|
|
7498
7504
|
*/
|
|
7499
|
-
run(symbol: string): AsyncGenerator<
|
|
7505
|
+
run(symbol: string): AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed, void, unknown>;
|
|
7500
7506
|
}
|
|
7501
7507
|
|
|
7502
7508
|
/**
|
|
@@ -7590,7 +7596,7 @@ declare class BacktestLogicPublicService {
|
|
|
7590
7596
|
strategyName: string;
|
|
7591
7597
|
exchangeName: string;
|
|
7592
7598
|
frameName: string;
|
|
7593
|
-
}) => AsyncGenerator<
|
|
7599
|
+
}) => AsyncGenerator<IStrategyBacktestResult, void, unknown>;
|
|
7594
7600
|
}
|
|
7595
7601
|
|
|
7596
7602
|
/**
|
|
@@ -7641,7 +7647,7 @@ declare class LiveLogicPublicService {
|
|
|
7641
7647
|
run: (symbol: string, context: {
|
|
7642
7648
|
strategyName: string;
|
|
7643
7649
|
exchangeName: string;
|
|
7644
|
-
}) => AsyncGenerator<
|
|
7650
|
+
}) => AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed, void, unknown>;
|
|
7645
7651
|
}
|
|
7646
7652
|
|
|
7647
7653
|
/**
|
|
@@ -7709,7 +7715,7 @@ declare class LiveCommandService {
|
|
|
7709
7715
|
run: (symbol: string, context: {
|
|
7710
7716
|
strategyName: string;
|
|
7711
7717
|
exchangeName: string;
|
|
7712
|
-
}) => AsyncGenerator<
|
|
7718
|
+
}) => AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed, void, unknown>;
|
|
7713
7719
|
}
|
|
7714
7720
|
|
|
7715
7721
|
/**
|
|
@@ -7737,7 +7743,7 @@ declare class BacktestCommandService {
|
|
|
7737
7743
|
strategyName: string;
|
|
7738
7744
|
exchangeName: string;
|
|
7739
7745
|
frameName: string;
|
|
7740
|
-
}) => AsyncGenerator<
|
|
7746
|
+
}) => AsyncGenerator<IStrategyBacktestResult, void, unknown>;
|
|
7741
7747
|
}
|
|
7742
7748
|
|
|
7743
7749
|
/**
|