backtest-kit 1.5.12 → 1.5.14
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 +444 -97
- package/build/index.mjs +443 -98
- package/package.json +1 -1
- package/types.d.ts +280 -27
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -13,10 +13,30 @@ declare const GLOBAL_CONFIG: {
|
|
|
13
13
|
* Default: 5 candles (last 5 minutes when using 1m interval)
|
|
14
14
|
*/
|
|
15
15
|
CC_AVG_PRICE_CANDLES_COUNT: number;
|
|
16
|
+
/**
|
|
17
|
+
* Slippage percentage applied to entry and exit prices.
|
|
18
|
+
* Simulates market impact and order book depth.
|
|
19
|
+
* Applied twice (entry and exit) for realistic execution simulation.
|
|
20
|
+
* Default: 0.1% per transaction
|
|
21
|
+
*/
|
|
22
|
+
CC_PERCENT_SLIPPAGE: number;
|
|
23
|
+
/**
|
|
24
|
+
* Fee percentage charged per transaction.
|
|
25
|
+
* Applied twice (entry and exit) for total fee calculation.
|
|
26
|
+
* Default: 0.1% per transaction (total 0.2%)
|
|
27
|
+
*/
|
|
28
|
+
CC_PERCENT_FEE: number;
|
|
16
29
|
/**
|
|
17
30
|
* Minimum TakeProfit distance from priceOpen (percentage)
|
|
18
|
-
* Must be greater than
|
|
19
|
-
*
|
|
31
|
+
* Must be greater than (slippage + fees) to ensure profitable trades
|
|
32
|
+
*
|
|
33
|
+
* Calculation:
|
|
34
|
+
* - Slippage effect: ~0.2% (0.1% × 2 transactions)
|
|
35
|
+
* - Fees: 0.2% (0.1% × 2 transactions)
|
|
36
|
+
* - Minimum profit buffer: 0.1%
|
|
37
|
+
* - Total: 0.5%
|
|
38
|
+
*
|
|
39
|
+
* Default: 0.5% (covers all costs + minimum profit margin)
|
|
20
40
|
*/
|
|
21
41
|
CC_MIN_TAKEPROFIT_DISTANCE_PERCENT: number;
|
|
22
42
|
/**
|
|
@@ -135,10 +155,11 @@ interface ILogger {
|
|
|
135
155
|
* });
|
|
136
156
|
* ```
|
|
137
157
|
*/
|
|
138
|
-
declare function setLogger(logger: ILogger):
|
|
158
|
+
declare function setLogger(logger: ILogger): void;
|
|
139
159
|
/**
|
|
140
160
|
* Sets global configuration parameters for the framework.
|
|
141
161
|
* @param config - Partial configuration object to override default settings
|
|
162
|
+
* @param _unsafe - Skip config validations - required for testbed
|
|
142
163
|
*
|
|
143
164
|
* @example
|
|
144
165
|
* ```typescript
|
|
@@ -147,7 +168,65 @@ declare function setLogger(logger: ILogger): Promise<void>;
|
|
|
147
168
|
* });
|
|
148
169
|
* ```
|
|
149
170
|
*/
|
|
150
|
-
declare function setConfig(config: Partial<GlobalConfig
|
|
171
|
+
declare function setConfig(config: Partial<GlobalConfig>, _unsafe?: boolean): void;
|
|
172
|
+
/**
|
|
173
|
+
* Retrieves a copy of the current global configuration.
|
|
174
|
+
*
|
|
175
|
+
* Returns a shallow copy of the current GLOBAL_CONFIG to prevent accidental mutations.
|
|
176
|
+
* Use this to inspect the current configuration state without modifying it.
|
|
177
|
+
*
|
|
178
|
+
* @returns {GlobalConfig} A copy of the current global configuration object
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* const currentConfig = getConfig();
|
|
183
|
+
* console.log(currentConfig.CC_SCHEDULE_AWAIT_MINUTES);
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
declare function getConfig(): {
|
|
187
|
+
CC_SCHEDULE_AWAIT_MINUTES: number;
|
|
188
|
+
CC_AVG_PRICE_CANDLES_COUNT: number;
|
|
189
|
+
CC_PERCENT_SLIPPAGE: number;
|
|
190
|
+
CC_PERCENT_FEE: number;
|
|
191
|
+
CC_MIN_TAKEPROFIT_DISTANCE_PERCENT: number;
|
|
192
|
+
CC_MIN_STOPLOSS_DISTANCE_PERCENT: number;
|
|
193
|
+
CC_MAX_STOPLOSS_DISTANCE_PERCENT: number;
|
|
194
|
+
CC_MAX_SIGNAL_LIFETIME_MINUTES: number;
|
|
195
|
+
CC_MAX_SIGNAL_GENERATION_SECONDS: number;
|
|
196
|
+
CC_GET_CANDLES_RETRY_COUNT: number;
|
|
197
|
+
CC_GET_CANDLES_RETRY_DELAY_MS: number;
|
|
198
|
+
CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR: number;
|
|
199
|
+
CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN: number;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves the default configuration object for the framework.
|
|
203
|
+
*
|
|
204
|
+
* Returns a reference to the default configuration with all preset values.
|
|
205
|
+
* Use this to see what configuration options are available and their default values.
|
|
206
|
+
*
|
|
207
|
+
* @returns {GlobalConfig} The default configuration object
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const defaultConfig = getDefaultConfig();
|
|
212
|
+
* console.log(defaultConfig.CC_SCHEDULE_AWAIT_MINUTES);
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
declare function getDefaultConfig(): Readonly<{
|
|
216
|
+
CC_SCHEDULE_AWAIT_MINUTES: number;
|
|
217
|
+
CC_AVG_PRICE_CANDLES_COUNT: number;
|
|
218
|
+
CC_PERCENT_SLIPPAGE: number;
|
|
219
|
+
CC_PERCENT_FEE: number;
|
|
220
|
+
CC_MIN_TAKEPROFIT_DISTANCE_PERCENT: number;
|
|
221
|
+
CC_MIN_STOPLOSS_DISTANCE_PERCENT: number;
|
|
222
|
+
CC_MAX_STOPLOSS_DISTANCE_PERCENT: number;
|
|
223
|
+
CC_MAX_SIGNAL_LIFETIME_MINUTES: number;
|
|
224
|
+
CC_MAX_SIGNAL_GENERATION_SECONDS: number;
|
|
225
|
+
CC_GET_CANDLES_RETRY_COUNT: number;
|
|
226
|
+
CC_GET_CANDLES_RETRY_DELAY_MS: number;
|
|
227
|
+
CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR: number;
|
|
228
|
+
CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN: number;
|
|
229
|
+
}>;
|
|
151
230
|
|
|
152
231
|
/**
|
|
153
232
|
* Execution context containing runtime parameters for strategy/exchange operations.
|
|
@@ -462,6 +541,8 @@ declare const MethodContextService: (new () => {
|
|
|
462
541
|
interface IRiskCheckArgs {
|
|
463
542
|
/** Trading pair symbol (e.g., "BTCUSDT") */
|
|
464
543
|
symbol: string;
|
|
544
|
+
/** Pending signal to apply */
|
|
545
|
+
pendingSignal: ISignalDto;
|
|
465
546
|
/** Strategy name requesting to open a position */
|
|
466
547
|
strategyName: StrategyName;
|
|
467
548
|
/** Exchange name */
|
|
@@ -498,6 +579,8 @@ interface IRiskCallbacks {
|
|
|
498
579
|
* Extends IRiskCheckArgs with portfolio state data.
|
|
499
580
|
*/
|
|
500
581
|
interface IRiskValidationPayload extends IRiskCheckArgs {
|
|
582
|
+
/** Pending signal to apply */
|
|
583
|
+
pendingSignal: ISignalDto;
|
|
501
584
|
/** Number of currently active positions across all strategies */
|
|
502
585
|
activePositionCount: number;
|
|
503
586
|
/** List of currently active positions across all strategies */
|
|
@@ -7150,7 +7233,7 @@ declare class RiskConnectionService {
|
|
|
7150
7233
|
*
|
|
7151
7234
|
* Used internally by BacktestLogicPrivateService and LiveLogicPrivateService.
|
|
7152
7235
|
*/
|
|
7153
|
-
declare class
|
|
7236
|
+
declare class ExchangeCoreService {
|
|
7154
7237
|
private readonly loggerService;
|
|
7155
7238
|
private readonly exchangeConnectionService;
|
|
7156
7239
|
private readonly methodContextService;
|
|
@@ -7224,7 +7307,7 @@ declare class ExchangeGlobalService {
|
|
|
7224
7307
|
*
|
|
7225
7308
|
* Used internally by BacktestLogicPrivateService and LiveLogicPrivateService.
|
|
7226
7309
|
*/
|
|
7227
|
-
declare class
|
|
7310
|
+
declare class StrategyCoreService {
|
|
7228
7311
|
private readonly loggerService;
|
|
7229
7312
|
private readonly strategyConnectionService;
|
|
7230
7313
|
private readonly strategySchemaService;
|
|
@@ -7321,7 +7404,7 @@ declare class StrategyGlobalService {
|
|
|
7321
7404
|
* Wraps FrameConnectionService for timeframe generation.
|
|
7322
7405
|
* Used internally by BacktestLogicPrivateService.
|
|
7323
7406
|
*/
|
|
7324
|
-
declare class
|
|
7407
|
+
declare class FrameCoreService {
|
|
7325
7408
|
private readonly loggerService;
|
|
7326
7409
|
private readonly frameConnectionService;
|
|
7327
7410
|
private readonly frameValidationService;
|
|
@@ -7745,9 +7828,9 @@ declare class WalkerSchemaService {
|
|
|
7745
7828
|
*/
|
|
7746
7829
|
declare class BacktestLogicPrivateService {
|
|
7747
7830
|
private readonly loggerService;
|
|
7748
|
-
private readonly
|
|
7749
|
-
private readonly
|
|
7750
|
-
private readonly
|
|
7831
|
+
private readonly strategyCoreService;
|
|
7832
|
+
private readonly exchangeCoreService;
|
|
7833
|
+
private readonly frameCoreService;
|
|
7751
7834
|
private readonly methodContextService;
|
|
7752
7835
|
/**
|
|
7753
7836
|
* Runs backtest for a symbol, streaming closed signals as async generator.
|
|
@@ -7784,7 +7867,7 @@ declare class BacktestLogicPrivateService {
|
|
|
7784
7867
|
*/
|
|
7785
7868
|
declare class LiveLogicPrivateService {
|
|
7786
7869
|
private readonly loggerService;
|
|
7787
|
-
private readonly
|
|
7870
|
+
private readonly strategyCoreService;
|
|
7788
7871
|
private readonly methodContextService;
|
|
7789
7872
|
/**
|
|
7790
7873
|
* Runs live trading for a symbol, streaming results as async generator.
|
|
@@ -8194,8 +8277,27 @@ declare class HeatMarkdownService {
|
|
|
8194
8277
|
}
|
|
8195
8278
|
|
|
8196
8279
|
/**
|
|
8197
|
-
*
|
|
8198
|
-
*
|
|
8280
|
+
* Service for managing and validating exchange configurations.
|
|
8281
|
+
*
|
|
8282
|
+
* Maintains a registry of all configured exchanges and validates
|
|
8283
|
+
* their existence before operations. Uses memoization for performance.
|
|
8284
|
+
*
|
|
8285
|
+
* Key features:
|
|
8286
|
+
* - Registry management: addExchange() to register new exchanges
|
|
8287
|
+
* - Validation: validate() ensures exchange exists before use
|
|
8288
|
+
* - Memoization: validation results are cached for performance
|
|
8289
|
+
* - Listing: list() returns all registered exchanges
|
|
8290
|
+
*
|
|
8291
|
+
* @throws {Error} If duplicate exchange name is added
|
|
8292
|
+
* @throws {Error} If unknown exchange is referenced
|
|
8293
|
+
*
|
|
8294
|
+
* @example
|
|
8295
|
+
* ```typescript
|
|
8296
|
+
* const exchangeValidation = new ExchangeValidationService();
|
|
8297
|
+
* exchangeValidation.addExchange("binance", binanceSchema);
|
|
8298
|
+
* exchangeValidation.validate("binance", "backtest"); // OK
|
|
8299
|
+
* exchangeValidation.validate("unknown", "live"); // Throws error
|
|
8300
|
+
* ```
|
|
8199
8301
|
*/
|
|
8200
8302
|
declare class ExchangeValidationService {
|
|
8201
8303
|
/**
|
|
@@ -8231,8 +8333,29 @@ declare class ExchangeValidationService {
|
|
|
8231
8333
|
}
|
|
8232
8334
|
|
|
8233
8335
|
/**
|
|
8234
|
-
*
|
|
8235
|
-
*
|
|
8336
|
+
* Service for managing and validating trading strategy configurations.
|
|
8337
|
+
*
|
|
8338
|
+
* Maintains a registry of all configured strategies, validates their existence
|
|
8339
|
+
* before operations, and ensures associated risk profiles are valid.
|
|
8340
|
+
* Uses memoization for performance.
|
|
8341
|
+
*
|
|
8342
|
+
* Key features:
|
|
8343
|
+
* - Registry management: addStrategy() to register new strategies
|
|
8344
|
+
* - Dual validation: validates both strategy existence and risk profile (if configured)
|
|
8345
|
+
* - Memoization: validation results are cached for performance
|
|
8346
|
+
* - Listing: list() returns all registered strategies
|
|
8347
|
+
*
|
|
8348
|
+
* @throws {Error} If duplicate strategy name is added
|
|
8349
|
+
* @throws {Error} If unknown strategy is referenced
|
|
8350
|
+
* @throws {Error} If strategy's risk profile doesn't exist
|
|
8351
|
+
*
|
|
8352
|
+
* @example
|
|
8353
|
+
* ```typescript
|
|
8354
|
+
* const strategyValidation = new StrategyValidationService();
|
|
8355
|
+
* strategyValidation.addStrategy("momentum-btc", { ...schema, riskName: "conservative" });
|
|
8356
|
+
* strategyValidation.validate("momentum-btc", "backtest"); // Validates strategy + risk
|
|
8357
|
+
* strategyValidation.validate("unknown", "live"); // Throws error
|
|
8358
|
+
* ```
|
|
8236
8359
|
*/
|
|
8237
8360
|
declare class StrategyValidationService {
|
|
8238
8361
|
/**
|
|
@@ -8275,8 +8398,27 @@ declare class StrategyValidationService {
|
|
|
8275
8398
|
}
|
|
8276
8399
|
|
|
8277
8400
|
/**
|
|
8278
|
-
*
|
|
8279
|
-
*
|
|
8401
|
+
* Service for managing and validating frame (timeframe) configurations.
|
|
8402
|
+
*
|
|
8403
|
+
* Maintains a registry of all configured frames and validates
|
|
8404
|
+
* their existence before operations. Uses memoization for performance.
|
|
8405
|
+
*
|
|
8406
|
+
* Key features:
|
|
8407
|
+
* - Registry management: addFrame() to register new timeframes
|
|
8408
|
+
* - Validation: validate() ensures frame exists before use
|
|
8409
|
+
* - Memoization: validation results are cached for performance
|
|
8410
|
+
* - Listing: list() returns all registered frames
|
|
8411
|
+
*
|
|
8412
|
+
* @throws {Error} If duplicate frame name is added
|
|
8413
|
+
* @throws {Error} If unknown frame is referenced
|
|
8414
|
+
*
|
|
8415
|
+
* @example
|
|
8416
|
+
* ```typescript
|
|
8417
|
+
* const frameValidation = new FrameValidationService();
|
|
8418
|
+
* frameValidation.addFrame("2024-Q1", frameSchema);
|
|
8419
|
+
* frameValidation.validate("2024-Q1", "backtest"); // OK
|
|
8420
|
+
* frameValidation.validate("unknown", "live"); // Throws error
|
|
8421
|
+
* ```
|
|
8280
8422
|
*/
|
|
8281
8423
|
declare class FrameValidationService {
|
|
8282
8424
|
/**
|
|
@@ -8312,8 +8454,29 @@ declare class FrameValidationService {
|
|
|
8312
8454
|
}
|
|
8313
8455
|
|
|
8314
8456
|
/**
|
|
8315
|
-
*
|
|
8316
|
-
*
|
|
8457
|
+
* Service for managing and validating walker (parameter sweep) configurations.
|
|
8458
|
+
*
|
|
8459
|
+
* Maintains a registry of all configured walkers and validates
|
|
8460
|
+
* their existence before operations. Uses memoization for performance.
|
|
8461
|
+
*
|
|
8462
|
+
* Walkers define parameter ranges for optimization and hyperparameter tuning.
|
|
8463
|
+
*
|
|
8464
|
+
* Key features:
|
|
8465
|
+
* - Registry management: addWalker() to register new walker configurations
|
|
8466
|
+
* - Validation: validate() ensures walker exists before use
|
|
8467
|
+
* - Memoization: validation results are cached for performance
|
|
8468
|
+
* - Listing: list() returns all registered walkers
|
|
8469
|
+
*
|
|
8470
|
+
* @throws {Error} If duplicate walker name is added
|
|
8471
|
+
* @throws {Error} If unknown walker is referenced
|
|
8472
|
+
*
|
|
8473
|
+
* @example
|
|
8474
|
+
* ```typescript
|
|
8475
|
+
* const walkerValidation = new WalkerValidationService();
|
|
8476
|
+
* walkerValidation.addWalker("rsi-sweep", walkerSchema);
|
|
8477
|
+
* walkerValidation.validate("rsi-sweep", "optimizer"); // OK
|
|
8478
|
+
* walkerValidation.validate("unknown", "optimizer"); // Throws error
|
|
8479
|
+
* ```
|
|
8317
8480
|
*/
|
|
8318
8481
|
declare class WalkerValidationService {
|
|
8319
8482
|
/**
|
|
@@ -8349,8 +8512,27 @@ declare class WalkerValidationService {
|
|
|
8349
8512
|
}
|
|
8350
8513
|
|
|
8351
8514
|
/**
|
|
8352
|
-
*
|
|
8353
|
-
*
|
|
8515
|
+
* Service for managing and validating position sizing configurations.
|
|
8516
|
+
*
|
|
8517
|
+
* Maintains a registry of all configured sizing strategies and validates
|
|
8518
|
+
* their existence before operations. Uses memoization for performance.
|
|
8519
|
+
*
|
|
8520
|
+
* Key features:
|
|
8521
|
+
* - Registry management: addSizing() to register new sizing strategies
|
|
8522
|
+
* - Validation: validate() ensures sizing strategy exists before use
|
|
8523
|
+
* - Memoization: validation results are cached for performance
|
|
8524
|
+
* - Listing: list() returns all registered sizing strategies
|
|
8525
|
+
*
|
|
8526
|
+
* @throws {Error} If duplicate sizing name is added
|
|
8527
|
+
* @throws {Error} If unknown sizing strategy is referenced
|
|
8528
|
+
*
|
|
8529
|
+
* @example
|
|
8530
|
+
* ```typescript
|
|
8531
|
+
* const sizingValidation = new SizingValidationService();
|
|
8532
|
+
* sizingValidation.addSizing("fixed-1000", fixedSizingSchema);
|
|
8533
|
+
* sizingValidation.validate("fixed-1000", "strategy-1"); // OK
|
|
8534
|
+
* sizingValidation.validate("unknown", "strategy-2"); // Throws error
|
|
8535
|
+
* ```
|
|
8354
8536
|
*/
|
|
8355
8537
|
declare class SizingValidationService {
|
|
8356
8538
|
/**
|
|
@@ -8387,8 +8569,27 @@ declare class SizingValidationService {
|
|
|
8387
8569
|
}
|
|
8388
8570
|
|
|
8389
8571
|
/**
|
|
8390
|
-
*
|
|
8391
|
-
*
|
|
8572
|
+
* Service for managing and validating risk management configurations.
|
|
8573
|
+
*
|
|
8574
|
+
* Maintains a registry of all configured risk profiles and validates
|
|
8575
|
+
* their existence before operations. Uses memoization for performance.
|
|
8576
|
+
*
|
|
8577
|
+
* Key features:
|
|
8578
|
+
* - Registry management: addRisk() to register new risk profiles
|
|
8579
|
+
* - Validation: validate() ensures risk profile exists before use
|
|
8580
|
+
* - Memoization: validation results are cached by riskName:source for performance
|
|
8581
|
+
* - Listing: list() returns all registered risk profiles
|
|
8582
|
+
*
|
|
8583
|
+
* @throws {Error} If duplicate risk name is added
|
|
8584
|
+
* @throws {Error} If unknown risk profile is referenced
|
|
8585
|
+
*
|
|
8586
|
+
* @example
|
|
8587
|
+
* ```typescript
|
|
8588
|
+
* const riskValidation = new RiskValidationService();
|
|
8589
|
+
* riskValidation.addRisk("conservative", conservativeSchema);
|
|
8590
|
+
* riskValidation.validate("conservative", "strategy-1"); // OK
|
|
8591
|
+
* riskValidation.validate("unknown", "strategy-2"); // Throws error
|
|
8592
|
+
* ```
|
|
8392
8593
|
*/
|
|
8393
8594
|
declare class RiskValidationService {
|
|
8394
8595
|
/**
|
|
@@ -9019,6 +9220,57 @@ declare class OutlineMarkdownService {
|
|
|
9019
9220
|
dumpSignal: (signalId: ResultId, history: MessageModel[], signal: ISignalDto, outputDir?: string) => Promise<void>;
|
|
9020
9221
|
}
|
|
9021
9222
|
|
|
9223
|
+
/**
|
|
9224
|
+
* Service for validating GLOBAL_CONFIG parameters to ensure mathematical correctness
|
|
9225
|
+
* and prevent unprofitable trading configurations.
|
|
9226
|
+
*
|
|
9227
|
+
* Performs comprehensive validation on:
|
|
9228
|
+
* - **Percentage parameters**: Slippage, fees, and profit margins must be non-negative
|
|
9229
|
+
* - **Economic viability**: Ensures CC_MIN_TAKEPROFIT_DISTANCE_PERCENT covers all trading costs
|
|
9230
|
+
* (slippage + fees) to guarantee profitable trades when TakeProfit is hit
|
|
9231
|
+
* - **Range constraints**: Validates MIN < MAX relationships (e.g., StopLoss distances)
|
|
9232
|
+
* - **Time-based parameters**: Ensures positive integer values for timeouts and lifetimes
|
|
9233
|
+
* - **Candle parameters**: Validates retry counts, delays, and anomaly detection thresholds
|
|
9234
|
+
*
|
|
9235
|
+
* @throws {Error} If any validation fails, throws with detailed breakdown of all errors
|
|
9236
|
+
*
|
|
9237
|
+
* @example
|
|
9238
|
+
* ```typescript
|
|
9239
|
+
* const validator = new ConfigValidationService();
|
|
9240
|
+
* validator.validate(); // Throws if config is invalid
|
|
9241
|
+
* ```
|
|
9242
|
+
*
|
|
9243
|
+
* @example Validation failure output:
|
|
9244
|
+
* ```
|
|
9245
|
+
* GLOBAL_CONFIG validation failed:
|
|
9246
|
+
* 1. CC_MIN_TAKEPROFIT_DISTANCE_PERCENT (0.3%) is too low to cover trading costs.
|
|
9247
|
+
* Required minimum: 0.40%
|
|
9248
|
+
* Breakdown:
|
|
9249
|
+
* - Slippage effect: 0.20% (0.1% × 2 transactions)
|
|
9250
|
+
* - Fees: 0.20% (0.1% × 2 transactions)
|
|
9251
|
+
* All TakeProfit signals will be unprofitable with current settings!
|
|
9252
|
+
* ```
|
|
9253
|
+
*/
|
|
9254
|
+
declare class ConfigValidationService {
|
|
9255
|
+
/**
|
|
9256
|
+
* @private
|
|
9257
|
+
* @readonly
|
|
9258
|
+
* Injected logger service instance
|
|
9259
|
+
*/
|
|
9260
|
+
private readonly loggerService;
|
|
9261
|
+
/**
|
|
9262
|
+
* Validates GLOBAL_CONFIG parameters for mathematical correctness.
|
|
9263
|
+
*
|
|
9264
|
+
* Checks:
|
|
9265
|
+
* 1. CC_MIN_TAKEPROFIT_DISTANCE_PERCENT must cover slippage + fees
|
|
9266
|
+
* 2. All percentage values must be positive
|
|
9267
|
+
* 3. Time/count values must be positive integers
|
|
9268
|
+
*
|
|
9269
|
+
* @throws Error if configuration is invalid
|
|
9270
|
+
*/
|
|
9271
|
+
validate: () => void;
|
|
9272
|
+
}
|
|
9273
|
+
|
|
9022
9274
|
declare const backtest: {
|
|
9023
9275
|
optimizerTemplateService: OptimizerTemplateService;
|
|
9024
9276
|
exchangeValidationService: ExchangeValidationService;
|
|
@@ -9028,6 +9280,7 @@ declare const backtest: {
|
|
|
9028
9280
|
sizingValidationService: SizingValidationService;
|
|
9029
9281
|
riskValidationService: RiskValidationService;
|
|
9030
9282
|
optimizerValidationService: OptimizerValidationService;
|
|
9283
|
+
configValidationService: ConfigValidationService;
|
|
9031
9284
|
backtestMarkdownService: BacktestMarkdownService;
|
|
9032
9285
|
liveMarkdownService: LiveMarkdownService;
|
|
9033
9286
|
scheduleMarkdownService: ScheduleMarkdownService;
|
|
@@ -9045,13 +9298,13 @@ declare const backtest: {
|
|
|
9045
9298
|
liveCommandService: LiveCommandService;
|
|
9046
9299
|
backtestCommandService: BacktestCommandService;
|
|
9047
9300
|
walkerCommandService: WalkerCommandService;
|
|
9048
|
-
exchangeGlobalService: ExchangeGlobalService;
|
|
9049
|
-
strategyGlobalService: StrategyGlobalService;
|
|
9050
|
-
frameGlobalService: FrameGlobalService;
|
|
9051
9301
|
sizingGlobalService: SizingGlobalService;
|
|
9052
9302
|
riskGlobalService: RiskGlobalService;
|
|
9053
9303
|
optimizerGlobalService: OptimizerGlobalService;
|
|
9054
9304
|
partialGlobalService: PartialGlobalService;
|
|
9305
|
+
exchangeCoreService: ExchangeCoreService;
|
|
9306
|
+
strategyCoreService: StrategyCoreService;
|
|
9307
|
+
frameCoreService: FrameCoreService;
|
|
9055
9308
|
exchangeSchemaService: ExchangeSchemaService;
|
|
9056
9309
|
strategySchemaService: StrategySchemaService;
|
|
9057
9310
|
frameSchemaService: FrameSchemaService;
|
|
@@ -9075,4 +9328,4 @@ declare const backtest: {
|
|
|
9075
9328
|
loggerService: LoggerService;
|
|
9076
9329
|
};
|
|
9077
9330
|
|
|
9078
|
-
export { Backtest, type BacktestStatistics, type CandleInterval, Constant, type DoneContract, type EntityId, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type ICandleData, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type IHeatmapStatistics, type IOptimizerCallbacks, type IOptimizerData, type IOptimizerFetchArgs, type IOptimizerFilterArgs, type IOptimizerRange, type IOptimizerSchema, type IOptimizerSource, type IOptimizerStrategy, type IOptimizerTemplate, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStrategyPnL, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, Live, type LiveStatistics, type MessageModel, type MessageRole, MethodContextService, Optimizer, Partial$1 as Partial, type PartialData, type PartialLossContract, type PartialProfitContract, type PartialStatistics, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatistics, PersistBase, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PositionSize, type ProgressBacktestContract, type ProgressOptimizerContract, type ProgressWalkerContract, type RiskData, Schedule, type ScheduleData, type ScheduleStatistics, type SignalData, type SignalInterval, type TPersistBase, type TPersistBaseCtor, Walker, type WalkerContract, type WalkerMetric, type WalkerStatistics, addExchange, addFrame, addOptimizer, addRisk, addSizing, addStrategy, addWalker, dumpSignal, emitters, formatPrice, formatQuantity, getAveragePrice, getCandles, getDate, getMode, backtest as lib, listExchanges, listFrames, listOptimizers, listRisks, listSizings, listStrategies, listWalkers, listenBacktestProgress, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenOptimizerProgress, listenPartialLoss, listenPartialLossOnce, listenPartialProfit, listenPartialProfitOnce, listenPerformance, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, setConfig, setLogger };
|
|
9331
|
+
export { Backtest, type BacktestStatistics, type CandleInterval, Constant, type DoneContract, type EntityId, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type ICandleData, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type IHeatmapStatistics, type IOptimizerCallbacks, type IOptimizerData, type IOptimizerFetchArgs, type IOptimizerFilterArgs, type IOptimizerRange, type IOptimizerSchema, type IOptimizerSource, type IOptimizerStrategy, type IOptimizerTemplate, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStrategyPnL, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, Live, type LiveStatistics, type MessageModel, type MessageRole, MethodContextService, Optimizer, Partial$1 as Partial, type PartialData, type PartialLossContract, type PartialProfitContract, type PartialStatistics, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatistics, PersistBase, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PositionSize, type ProgressBacktestContract, type ProgressOptimizerContract, type ProgressWalkerContract, type RiskData, Schedule, type ScheduleData, type ScheduleStatistics, type SignalData, type SignalInterval, type TPersistBase, type TPersistBaseCtor, Walker, type WalkerContract, type WalkerMetric, type WalkerStatistics, addExchange, addFrame, addOptimizer, addRisk, addSizing, addStrategy, addWalker, dumpSignal, emitters, formatPrice, formatQuantity, getAveragePrice, getCandles, getConfig, getDate, getDefaultConfig, getMode, backtest as lib, listExchanges, listFrames, listOptimizers, listRisks, listSizings, listStrategies, listWalkers, listenBacktestProgress, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenOptimizerProgress, listenPartialLoss, listenPartialLossOnce, listenPartialProfit, listenPartialProfitOnce, listenPerformance, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, setConfig, setLogger };
|