backtest-kit 1.5.13 → 1.5.15
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 +137 -105
- package/build/index.mjs +137 -105
- package/package.json +1 -1
- package/types.d.ts +31 -10
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ declare function setLogger(logger: ILogger): void;
|
|
|
159
159
|
/**
|
|
160
160
|
* Sets global configuration parameters for the framework.
|
|
161
161
|
* @param config - Partial configuration object to override default settings
|
|
162
|
+
* @param _unsafe - Skip config validations - required for testbed
|
|
162
163
|
*
|
|
163
164
|
* @example
|
|
164
165
|
* ```typescript
|
|
@@ -540,6 +541,8 @@ declare const MethodContextService: (new () => {
|
|
|
540
541
|
interface IRiskCheckArgs {
|
|
541
542
|
/** Trading pair symbol (e.g., "BTCUSDT") */
|
|
542
543
|
symbol: string;
|
|
544
|
+
/** Pending signal to apply */
|
|
545
|
+
pendingSignal: ISignalDto;
|
|
543
546
|
/** Strategy name requesting to open a position */
|
|
544
547
|
strategyName: StrategyName;
|
|
545
548
|
/** Exchange name */
|
|
@@ -576,6 +579,8 @@ interface IRiskCallbacks {
|
|
|
576
579
|
* Extends IRiskCheckArgs with portfolio state data.
|
|
577
580
|
*/
|
|
578
581
|
interface IRiskValidationPayload extends IRiskCheckArgs {
|
|
582
|
+
/** Pending signal to apply */
|
|
583
|
+
pendingSignal: ISignalDto;
|
|
579
584
|
/** Number of currently active positions across all strategies */
|
|
580
585
|
activePositionCount: number;
|
|
581
586
|
/** List of currently active positions across all strategies */
|
|
@@ -6703,7 +6708,23 @@ declare class ClientExchange implements IExchange {
|
|
|
6703
6708
|
* @throws Error if no candles available
|
|
6704
6709
|
*/
|
|
6705
6710
|
getAveragePrice(symbol: string): Promise<number>;
|
|
6711
|
+
/**
|
|
6712
|
+
* Formats quantity according to exchange-specific rules for the given symbol.
|
|
6713
|
+
* Applies proper decimal precision and rounding based on symbol's lot size filters.
|
|
6714
|
+
*
|
|
6715
|
+
* @param symbol - Trading pair symbol
|
|
6716
|
+
* @param quantity - Raw quantity to format
|
|
6717
|
+
* @returns Promise resolving to formatted quantity as string
|
|
6718
|
+
*/
|
|
6706
6719
|
formatQuantity(symbol: string, quantity: number): Promise<string>;
|
|
6720
|
+
/**
|
|
6721
|
+
* Formats price according to exchange-specific rules for the given symbol.
|
|
6722
|
+
* Applies proper decimal precision and rounding based on symbol's price filters.
|
|
6723
|
+
*
|
|
6724
|
+
* @param symbol - Trading pair symbol
|
|
6725
|
+
* @param price - Raw price to format
|
|
6726
|
+
* @returns Promise resolving to formatted price as string
|
|
6727
|
+
*/
|
|
6707
6728
|
formatPrice(symbol: string, price: number): Promise<string>;
|
|
6708
6729
|
}
|
|
6709
6730
|
|
|
@@ -7228,7 +7249,7 @@ declare class RiskConnectionService {
|
|
|
7228
7249
|
*
|
|
7229
7250
|
* Used internally by BacktestLogicPrivateService and LiveLogicPrivateService.
|
|
7230
7251
|
*/
|
|
7231
|
-
declare class
|
|
7252
|
+
declare class ExchangeCoreService {
|
|
7232
7253
|
private readonly loggerService;
|
|
7233
7254
|
private readonly exchangeConnectionService;
|
|
7234
7255
|
private readonly methodContextService;
|
|
@@ -7302,7 +7323,7 @@ declare class ExchangeGlobalService {
|
|
|
7302
7323
|
*
|
|
7303
7324
|
* Used internally by BacktestLogicPrivateService and LiveLogicPrivateService.
|
|
7304
7325
|
*/
|
|
7305
|
-
declare class
|
|
7326
|
+
declare class StrategyCoreService {
|
|
7306
7327
|
private readonly loggerService;
|
|
7307
7328
|
private readonly strategyConnectionService;
|
|
7308
7329
|
private readonly strategySchemaService;
|
|
@@ -7399,7 +7420,7 @@ declare class StrategyGlobalService {
|
|
|
7399
7420
|
* Wraps FrameConnectionService for timeframe generation.
|
|
7400
7421
|
* Used internally by BacktestLogicPrivateService.
|
|
7401
7422
|
*/
|
|
7402
|
-
declare class
|
|
7423
|
+
declare class FrameCoreService {
|
|
7403
7424
|
private readonly loggerService;
|
|
7404
7425
|
private readonly frameConnectionService;
|
|
7405
7426
|
private readonly frameValidationService;
|
|
@@ -7823,9 +7844,9 @@ declare class WalkerSchemaService {
|
|
|
7823
7844
|
*/
|
|
7824
7845
|
declare class BacktestLogicPrivateService {
|
|
7825
7846
|
private readonly loggerService;
|
|
7826
|
-
private readonly
|
|
7827
|
-
private readonly
|
|
7828
|
-
private readonly
|
|
7847
|
+
private readonly strategyCoreService;
|
|
7848
|
+
private readonly exchangeCoreService;
|
|
7849
|
+
private readonly frameCoreService;
|
|
7829
7850
|
private readonly methodContextService;
|
|
7830
7851
|
/**
|
|
7831
7852
|
* Runs backtest for a symbol, streaming closed signals as async generator.
|
|
@@ -7862,7 +7883,7 @@ declare class BacktestLogicPrivateService {
|
|
|
7862
7883
|
*/
|
|
7863
7884
|
declare class LiveLogicPrivateService {
|
|
7864
7885
|
private readonly loggerService;
|
|
7865
|
-
private readonly
|
|
7886
|
+
private readonly strategyCoreService;
|
|
7866
7887
|
private readonly methodContextService;
|
|
7867
7888
|
/**
|
|
7868
7889
|
* Runs live trading for a symbol, streaming results as async generator.
|
|
@@ -9293,13 +9314,13 @@ declare const backtest: {
|
|
|
9293
9314
|
liveCommandService: LiveCommandService;
|
|
9294
9315
|
backtestCommandService: BacktestCommandService;
|
|
9295
9316
|
walkerCommandService: WalkerCommandService;
|
|
9296
|
-
exchangeGlobalService: ExchangeGlobalService;
|
|
9297
|
-
strategyGlobalService: StrategyGlobalService;
|
|
9298
|
-
frameGlobalService: FrameGlobalService;
|
|
9299
9317
|
sizingGlobalService: SizingGlobalService;
|
|
9300
9318
|
riskGlobalService: RiskGlobalService;
|
|
9301
9319
|
optimizerGlobalService: OptimizerGlobalService;
|
|
9302
9320
|
partialGlobalService: PartialGlobalService;
|
|
9321
|
+
exchangeCoreService: ExchangeCoreService;
|
|
9322
|
+
strategyCoreService: StrategyCoreService;
|
|
9323
|
+
frameCoreService: FrameCoreService;
|
|
9303
9324
|
exchangeSchemaService: ExchangeSchemaService;
|
|
9304
9325
|
strategySchemaService: StrategySchemaService;
|
|
9305
9326
|
frameSchemaService: FrameSchemaService;
|