backtest-kit 2.0.7 → 2.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -6783,6 +6783,214 @@ declare function getContext(): Promise<IMethodContext>;
6783
6783
  */
6784
6784
  declare function getOrderBook(symbol: string, depth?: number): Promise<IOrderBookData>;
6785
6785
 
6786
+ /**
6787
+ * Commits signal prompt history to the message array.
6788
+ *
6789
+ * Extracts trading context from ExecutionContext and MethodContext,
6790
+ * then adds signal-specific system prompts at the beginning and user prompt
6791
+ * at the end of the history array if they are not empty.
6792
+ *
6793
+ * Context extraction:
6794
+ * - symbol: Provided as parameter for debugging convenience
6795
+ * - backtest mode: From ExecutionContext
6796
+ * - strategyName, exchangeName, frameName: From MethodContext
6797
+ *
6798
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6799
+ * @param history - Message array to append prompts to
6800
+ * @returns Promise that resolves when prompts are added
6801
+ * @throws Error if ExecutionContext or MethodContext is not active
6802
+ *
6803
+ * @example
6804
+ * ```typescript
6805
+ * const messages: MessageModel[] = [];
6806
+ * await commitSignalPromptHistory("BTCUSDT", messages);
6807
+ * // messages now contains system prompts at start and user prompt at end
6808
+ * ```
6809
+ */
6810
+ declare function commitSignalPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6811
+ /**
6812
+ * Commits risk rejection prompt history to the message array.
6813
+ *
6814
+ * Extracts trading context from ExecutionContext and MethodContext,
6815
+ * then adds risk-specific system prompts at the beginning and user prompt
6816
+ * at the end of the history array if they are not empty.
6817
+ *
6818
+ * Context extraction:
6819
+ * - symbol: Provided as parameter for debugging convenience
6820
+ * - backtest mode: From ExecutionContext
6821
+ * - strategyName, exchangeName, frameName: From MethodContext
6822
+ *
6823
+ * Used for AI-powered analysis when signals fail risk validation.
6824
+ *
6825
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6826
+ * @param history - Message array to append prompts to
6827
+ * @returns Promise that resolves when prompts are added
6828
+ * @throws Error if ExecutionContext or MethodContext is not active
6829
+ *
6830
+ * @example
6831
+ * ```typescript
6832
+ * const messages: MessageModel[] = [];
6833
+ * await commitRiskPromptHistory("BTCUSDT", messages);
6834
+ * ```
6835
+ */
6836
+ declare function commitRiskPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6837
+ /**
6838
+ * Commits trailing take-profit prompt history to the message array.
6839
+ *
6840
+ * Extracts trading context from ExecutionContext and MethodContext,
6841
+ * then adds trailing take-profit specific system prompts at the beginning
6842
+ * and user prompt at the end of the history array if they are not empty.
6843
+ *
6844
+ * Context extraction:
6845
+ * - symbol: Provided as parameter for debugging convenience
6846
+ * - backtest mode: From ExecutionContext
6847
+ * - strategyName, exchangeName, frameName: From MethodContext
6848
+ *
6849
+ * Used for AI-powered analysis of trailing take-profit adjustments.
6850
+ *
6851
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6852
+ * @param history - Message array to append prompts to
6853
+ * @returns Promise that resolves when prompts are added
6854
+ * @throws Error if ExecutionContext or MethodContext is not active
6855
+ *
6856
+ * @example
6857
+ * ```typescript
6858
+ * const messages: MessageModel[] = [];
6859
+ * await commitTrailingTakePromptHistory("BTCUSDT", messages);
6860
+ * ```
6861
+ */
6862
+ declare function commitTrailingTakePromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6863
+ /**
6864
+ * Commits trailing stop-loss prompt history to the message array.
6865
+ *
6866
+ * Extracts trading context from ExecutionContext and MethodContext,
6867
+ * then adds trailing stop-loss specific system prompts at the beginning
6868
+ * and user prompt at the end of the history array if they are not empty.
6869
+ *
6870
+ * Context extraction:
6871
+ * - symbol: Provided as parameter for debugging convenience
6872
+ * - backtest mode: From ExecutionContext
6873
+ * - strategyName, exchangeName, frameName: From MethodContext
6874
+ *
6875
+ * Used for AI-powered analysis of trailing stop-loss adjustments.
6876
+ *
6877
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6878
+ * @param history - Message array to append prompts to
6879
+ * @returns Promise that resolves when prompts are added
6880
+ * @throws Error if ExecutionContext or MethodContext is not active
6881
+ *
6882
+ * @example
6883
+ * ```typescript
6884
+ * const messages: MessageModel[] = [];
6885
+ * await commitTrailingStopPromptHistory("BTCUSDT", messages);
6886
+ * ```
6887
+ */
6888
+ declare function commitTrailingStopPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6889
+ /**
6890
+ * Commits partial profit prompt history to the message array.
6891
+ *
6892
+ * Extracts trading context from ExecutionContext and MethodContext,
6893
+ * then adds partial profit specific system prompts at the beginning
6894
+ * and user prompt at the end of the history array if they are not empty.
6895
+ *
6896
+ * Context extraction:
6897
+ * - symbol: Provided as parameter for debugging convenience
6898
+ * - backtest mode: From ExecutionContext
6899
+ * - strategyName, exchangeName, frameName: From MethodContext
6900
+ *
6901
+ * Used for AI-powered analysis of partial profit milestones.
6902
+ *
6903
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6904
+ * @param history - Message array to append prompts to
6905
+ * @returns Promise that resolves when prompts are added
6906
+ * @throws Error if ExecutionContext or MethodContext is not active
6907
+ *
6908
+ * @example
6909
+ * ```typescript
6910
+ * const messages: MessageModel[] = [];
6911
+ * await commitPartialProfitPromptHistory("BTCUSDT", messages);
6912
+ * ```
6913
+ */
6914
+ declare function commitPartialProfitPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6915
+ /**
6916
+ * Commits partial loss prompt history to the message array.
6917
+ *
6918
+ * Extracts trading context from ExecutionContext and MethodContext,
6919
+ * then adds partial loss specific system prompts at the beginning
6920
+ * and user prompt at the end of the history array if they are not empty.
6921
+ *
6922
+ * Context extraction:
6923
+ * - symbol: Provided as parameter for debugging convenience
6924
+ * - backtest mode: From ExecutionContext
6925
+ * - strategyName, exchangeName, frameName: From MethodContext
6926
+ *
6927
+ * Used for AI-powered analysis of partial loss milestones.
6928
+ *
6929
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6930
+ * @param history - Message array to append prompts to
6931
+ * @returns Promise that resolves when prompts are added
6932
+ * @throws Error if ExecutionContext or MethodContext is not active
6933
+ *
6934
+ * @example
6935
+ * ```typescript
6936
+ * const messages: MessageModel[] = [];
6937
+ * await commitPartialLossPromptHistory("BTCUSDT", messages);
6938
+ * ```
6939
+ */
6940
+ declare function commitPartialLossPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6941
+ /**
6942
+ * Commits breakeven prompt history to the message array.
6943
+ *
6944
+ * Extracts trading context from ExecutionContext and MethodContext,
6945
+ * then adds breakeven specific system prompts at the beginning
6946
+ * and user prompt at the end of the history array if they are not empty.
6947
+ *
6948
+ * Context extraction:
6949
+ * - symbol: Provided as parameter for debugging convenience
6950
+ * - backtest mode: From ExecutionContext
6951
+ * - strategyName, exchangeName, frameName: From MethodContext
6952
+ *
6953
+ * Used for AI-powered analysis of breakeven events.
6954
+ *
6955
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6956
+ * @param history - Message array to append prompts to
6957
+ * @returns Promise that resolves when prompts are added
6958
+ * @throws Error if ExecutionContext or MethodContext is not active
6959
+ *
6960
+ * @example
6961
+ * ```typescript
6962
+ * const messages: MessageModel[] = [];
6963
+ * await commitBreakevenPromptHistory("BTCUSDT", messages);
6964
+ * ```
6965
+ */
6966
+ declare function commitBreakevenPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6967
+ /**
6968
+ * Commits schedule cancellation prompt history to the message array.
6969
+ *
6970
+ * Extracts trading context from ExecutionContext and MethodContext,
6971
+ * then adds schedule cancellation specific system prompts at the beginning
6972
+ * and user prompt at the end of the history array if they are not empty.
6973
+ *
6974
+ * Context extraction:
6975
+ * - symbol: Provided as parameter for debugging convenience
6976
+ * - backtest mode: From ExecutionContext
6977
+ * - strategyName, exchangeName, frameName: From MethodContext
6978
+ *
6979
+ * Used for AI-powered analysis of schedule cancellation events.
6980
+ *
6981
+ * @param symbol - Trading symbol (e.g., "BTCUSDT") for debugging convenience
6982
+ * @param history - Message array to append prompts to
6983
+ * @returns Promise that resolves when prompts are added
6984
+ * @throws Error if ExecutionContext or MethodContext is not active
6985
+ *
6986
+ * @example
6987
+ * ```typescript
6988
+ * const messages: MessageModel[] = [];
6989
+ * await commitScheduleCancelPromptHistory("BTCUSDT", messages);
6990
+ * ```
6991
+ */
6992
+ declare function commitScheduleCancelPromptHistory(symbol: string, history: MessageModel[]): Promise<void>;
6993
+
6786
6994
  /**
6787
6995
  * Dumps signal data and LLM conversation history to markdown files.
6788
6996
  * Used by AI-powered strategies to save debug logs for analysis.
@@ -18849,7 +19057,387 @@ declare class RiskReportService {
18849
19057
  unsubscribe: () => Promise<void>;
18850
19058
  }
18851
19059
 
19060
+ /**
19061
+ * Service for managing signal prompts for AI/LLM integrations.
19062
+ *
19063
+ * Provides access to system and user prompts configured in signal.prompt.cjs.
19064
+ * Supports both static prompt arrays and dynamic prompt functions.
19065
+ *
19066
+ * Key responsibilities:
19067
+ * - Lazy-loads prompt configuration from config/prompt/signal.prompt.cjs
19068
+ * - Resolves system prompts (static arrays or async functions)
19069
+ * - Provides user prompt strings
19070
+ * - Falls back to empty prompts if configuration is missing
19071
+ *
19072
+ * Used for AI-powered signal analysis and strategy recommendations.
19073
+ */
19074
+ declare class SignalPromptService {
19075
+ private readonly loggerService;
19076
+ /**
19077
+ * Retrieves system prompts for AI context.
19078
+ *
19079
+ * System prompts can be:
19080
+ * - Static array of strings (returned directly)
19081
+ * - Async/sync function returning string array (executed and awaited)
19082
+ * - Undefined (returns empty array)
19083
+ *
19084
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19085
+ * @param strategyName - Strategy identifier
19086
+ * @param exchangeName - Exchange identifier
19087
+ * @param frameName - Timeframe identifier
19088
+ * @param backtest - Whether running in backtest mode
19089
+ * @returns Promise resolving to array of system prompt strings
19090
+ */
19091
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19092
+ /**
19093
+ * Retrieves user prompt string for AI input.
19094
+ *
19095
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19096
+ * @param strategyName - Strategy identifier
19097
+ * @param exchangeName - Exchange identifier
19098
+ * @param frameName - Timeframe identifier
19099
+ * @param backtest - Whether running in backtest mode
19100
+ * @returns Promise resolving to user prompt string
19101
+ */
19102
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19103
+ }
19104
+
19105
+ /**
19106
+ * Service for managing risk rejection prompts for AI/LLM integrations.
19107
+ *
19108
+ * Provides access to system and user prompts configured in risk.prompt.cjs.
19109
+ * Supports both static prompt arrays and dynamic prompt functions.
19110
+ *
19111
+ * Key responsibilities:
19112
+ * - Lazy-loads prompt configuration from config/prompt/risk.prompt.cjs
19113
+ * - Resolves system prompts (static arrays or async functions)
19114
+ * - Provides user prompt strings
19115
+ * - Falls back to empty prompts if configuration is missing
19116
+ *
19117
+ * Used for AI-powered analysis when signals fail risk validation.
19118
+ * Triggered by: riskRejection() events in ActionBase
19119
+ * Use cases: Analyze rejection reasons, suggest risk adjustments, track rejection patterns
19120
+ */
19121
+ declare class RiskPromptService {
19122
+ private readonly loggerService;
19123
+ /**
19124
+ * Retrieves system prompts for AI context.
19125
+ *
19126
+ * System prompts can be:
19127
+ * - Static array of strings (returned directly)
19128
+ * - Async/sync function returning string array (executed and awaited)
19129
+ * - Undefined (returns empty array)
19130
+ *
19131
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19132
+ * @param strategyName - Strategy identifier
19133
+ * @param exchangeName - Exchange identifier
19134
+ * @param frameName - Timeframe identifier
19135
+ * @param backtest - Whether running in backtest mode
19136
+ * @returns Promise resolving to array of system prompt strings
19137
+ */
19138
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19139
+ /**
19140
+ * Retrieves user prompt string for AI input.
19141
+ *
19142
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19143
+ * @param strategyName - Strategy identifier
19144
+ * @param exchangeName - Exchange identifier
19145
+ * @param frameName - Timeframe identifier
19146
+ * @param backtest - Whether running in backtest mode
19147
+ * @returns Promise resolving to user prompt string
19148
+ */
19149
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19150
+ }
19151
+
19152
+ /**
19153
+ * Service for managing trailing take-profit prompts for AI/LLM integrations.
19154
+ *
19155
+ * Provides access to system and user prompts configured in trailing-take.prompt.cjs.
19156
+ * Supports both static prompt arrays and dynamic prompt functions.
19157
+ *
19158
+ * Key responsibilities:
19159
+ * - Lazy-loads prompt configuration from config/prompt/trailing-take.prompt.cjs
19160
+ * - Resolves system prompts (static arrays or async functions)
19161
+ * - Provides user prompt strings
19162
+ * - Falls back to empty prompts if configuration is missing
19163
+ *
19164
+ * Used for AI-powered analysis of trailing take-profit adjustments.
19165
+ * Use cases: Suggest optimal trailing levels, analyze profit-taking strategies, optimize exit timing
19166
+ */
19167
+ declare class TrailingTakePromptService {
19168
+ private readonly loggerService;
19169
+ /**
19170
+ * Retrieves system prompts for AI context.
19171
+ *
19172
+ * System prompts can be:
19173
+ * - Static array of strings (returned directly)
19174
+ * - Async/sync function returning string array (executed and awaited)
19175
+ * - Undefined (returns empty array)
19176
+ *
19177
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19178
+ * @param strategyName - Strategy identifier
19179
+ * @param exchangeName - Exchange identifier
19180
+ * @param frameName - Timeframe identifier
19181
+ * @param backtest - Whether running in backtest mode
19182
+ * @returns Promise resolving to array of system prompt strings
19183
+ */
19184
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19185
+ /**
19186
+ * Retrieves user prompt string for AI input.
19187
+ *
19188
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19189
+ * @param strategyName - Strategy identifier
19190
+ * @param exchangeName - Exchange identifier
19191
+ * @param frameName - Timeframe identifier
19192
+ * @param backtest - Whether running in backtest mode
19193
+ * @returns Promise resolving to user prompt string
19194
+ */
19195
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19196
+ }
19197
+
19198
+ /**
19199
+ * Service for managing trailing stop-loss prompts for AI/LLM integrations.
19200
+ *
19201
+ * Provides access to system and user prompts configured in trailing-stop.prompt.cjs.
19202
+ * Supports both static prompt arrays and dynamic prompt functions.
19203
+ *
19204
+ * Key responsibilities:
19205
+ * - Lazy-loads prompt configuration from config/prompt/trailing-stop.prompt.cjs
19206
+ * - Resolves system prompts (static arrays or async functions)
19207
+ * - Provides user prompt strings
19208
+ * - Falls back to empty prompts if configuration is missing
19209
+ *
19210
+ * Used for AI-powered analysis of trailing stop-loss adjustments.
19211
+ * Use cases: Suggest optimal trailing distances, analyze risk protection strategies, optimize stop placement
19212
+ */
19213
+ declare class TrailingStopPromptService {
19214
+ private readonly loggerService;
19215
+ /**
19216
+ * Retrieves system prompts for AI context.
19217
+ *
19218
+ * System prompts can be:
19219
+ * - Static array of strings (returned directly)
19220
+ * - Async/sync function returning string array (executed and awaited)
19221
+ * - Undefined (returns empty array)
19222
+ *
19223
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19224
+ * @param strategyName - Strategy identifier
19225
+ * @param exchangeName - Exchange identifier
19226
+ * @param frameName - Timeframe identifier
19227
+ * @param backtest - Whether running in backtest mode
19228
+ * @returns Promise resolving to array of system prompt strings
19229
+ */
19230
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19231
+ /**
19232
+ * Retrieves user prompt string for AI input.
19233
+ *
19234
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19235
+ * @param strategyName - Strategy identifier
19236
+ * @param exchangeName - Exchange identifier
19237
+ * @param frameName - Timeframe identifier
19238
+ * @param backtest - Whether running in backtest mode
19239
+ * @returns Promise resolving to user prompt string
19240
+ */
19241
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19242
+ }
19243
+
19244
+ /**
19245
+ * Service for managing partial profit prompts for AI/LLM integrations.
19246
+ *
19247
+ * Provides access to system and user prompts configured in partial-profit.prompt.cjs.
19248
+ * Supports both static prompt arrays and dynamic prompt functions.
19249
+ *
19250
+ * Key responsibilities:
19251
+ * - Lazy-loads prompt configuration from config/prompt/partial-profit.prompt.cjs
19252
+ * - Resolves system prompts (static arrays or async functions)
19253
+ * - Provides user prompt strings
19254
+ * - Falls back to empty prompts if configuration is missing
19255
+ *
19256
+ * Used for AI-powered analysis when profit milestones are reached (10%, 20%, 30%, etc).
19257
+ * Triggered by: partialProfitAvailable() events in ActionBase
19258
+ * Use cases: Suggest position adjustments, analyze profit-taking opportunities, optimize milestone actions
19259
+ */
19260
+ declare class PartialProfitPromptService {
19261
+ private readonly loggerService;
19262
+ /**
19263
+ * Retrieves system prompts for AI context.
19264
+ *
19265
+ * System prompts can be:
19266
+ * - Static array of strings (returned directly)
19267
+ * - Async/sync function returning string array (executed and awaited)
19268
+ * - Undefined (returns empty array)
19269
+ *
19270
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19271
+ * @param strategyName - Strategy identifier
19272
+ * @param exchangeName - Exchange identifier
19273
+ * @param frameName - Timeframe identifier
19274
+ * @param backtest - Whether running in backtest mode
19275
+ * @returns Promise resolving to array of system prompt strings
19276
+ */
19277
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19278
+ /**
19279
+ * Retrieves user prompt string for AI input.
19280
+ *
19281
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19282
+ * @param strategyName - Strategy identifier
19283
+ * @param exchangeName - Exchange identifier
19284
+ * @param frameName - Timeframe identifier
19285
+ * @param backtest - Whether running in backtest mode
19286
+ * @returns Promise resolving to user prompt string
19287
+ */
19288
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19289
+ }
19290
+
19291
+ /**
19292
+ * Service for managing partial loss prompts for AI/LLM integrations.
19293
+ *
19294
+ * Provides access to system and user prompts configured in partial-loss.prompt.cjs.
19295
+ * Supports both static prompt arrays and dynamic prompt functions.
19296
+ *
19297
+ * Key responsibilities:
19298
+ * - Lazy-loads prompt configuration from config/prompt/partial-loss.prompt.cjs
19299
+ * - Resolves system prompts (static arrays or async functions)
19300
+ * - Provides user prompt strings
19301
+ * - Falls back to empty prompts if configuration is missing
19302
+ *
19303
+ * Used for AI-powered analysis when loss milestones are reached (-10%, -20%, -30%, etc).
19304
+ * Triggered by: partialLossAvailable() events in ActionBase
19305
+ * Use cases: Suggest risk management actions, analyze loss mitigation strategies, optimize exit decisions
19306
+ */
19307
+ declare class PartialLossPromptService {
19308
+ private readonly loggerService;
19309
+ /**
19310
+ * Retrieves system prompts for AI context.
19311
+ *
19312
+ * System prompts can be:
19313
+ * - Static array of strings (returned directly)
19314
+ * - Async/sync function returning string array (executed and awaited)
19315
+ * - Undefined (returns empty array)
19316
+ *
19317
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19318
+ * @param strategyName - Strategy identifier
19319
+ * @param exchangeName - Exchange identifier
19320
+ * @param frameName - Timeframe identifier
19321
+ * @param backtest - Whether running in backtest mode
19322
+ * @returns Promise resolving to array of system prompt strings
19323
+ */
19324
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19325
+ /**
19326
+ * Retrieves user prompt string for AI input.
19327
+ *
19328
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19329
+ * @param strategyName - Strategy identifier
19330
+ * @param exchangeName - Exchange identifier
19331
+ * @param frameName - Timeframe identifier
19332
+ * @param backtest - Whether running in backtest mode
19333
+ * @returns Promise resolving to user prompt string
19334
+ */
19335
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19336
+ }
19337
+
19338
+ /**
19339
+ * Service for managing breakeven prompts for AI/LLM integrations.
19340
+ *
19341
+ * Provides access to system and user prompts configured in breakeven.prompt.cjs.
19342
+ * Supports both static prompt arrays and dynamic prompt functions.
19343
+ *
19344
+ * Key responsibilities:
19345
+ * - Lazy-loads prompt configuration from config/prompt/breakeven.prompt.cjs
19346
+ * - Resolves system prompts (static arrays or async functions)
19347
+ * - Provides user prompt strings
19348
+ * - Falls back to empty prompts if configuration is missing
19349
+ *
19350
+ * Used for AI-powered analysis when stop-loss is moved to entry price (risk-free position).
19351
+ * Triggered by: breakevenAvailable() events in ActionBase
19352
+ * Use cases: Suggest position management after breakeven, analyze profit potential, optimize trailing strategies
19353
+ */
19354
+ declare class BreakevenPromptService {
19355
+ private readonly loggerService;
19356
+ /**
19357
+ * Retrieves system prompts for AI context.
19358
+ *
19359
+ * System prompts can be:
19360
+ * - Static array of strings (returned directly)
19361
+ * - Async/sync function returning string array (executed and awaited)
19362
+ * - Undefined (returns empty array)
19363
+ *
19364
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19365
+ * @param strategyName - Strategy identifier
19366
+ * @param exchangeName - Exchange identifier
19367
+ * @param frameName - Timeframe identifier
19368
+ * @param backtest - Whether running in backtest mode
19369
+ * @returns Promise resolving to array of system prompt strings
19370
+ */
19371
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19372
+ /**
19373
+ * Retrieves user prompt string for AI input.
19374
+ *
19375
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19376
+ * @param strategyName - Strategy identifier
19377
+ * @param exchangeName - Exchange identifier
19378
+ * @param frameName - Timeframe identifier
19379
+ * @param backtest - Whether running in backtest mode
19380
+ * @returns Promise resolving to user prompt string
19381
+ */
19382
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19383
+ }
19384
+
19385
+ /**
19386
+ * Service for managing schedule cancellation prompts for AI/LLM integrations.
19387
+ *
19388
+ * Provides access to system and user prompts configured in schedule-cancel.prompt.cjs.
19389
+ * Supports both static prompt arrays and dynamic prompt functions.
19390
+ *
19391
+ * Key responsibilities:
19392
+ * - Lazy-loads prompt configuration from config/prompt/schedule-cancel.prompt.cjs
19393
+ * - Resolves system prompts (static arrays or async functions)
19394
+ * - Provides user prompt strings
19395
+ * - Falls back to empty prompts if configuration is missing
19396
+ *
19397
+ * Used for AI-powered analysis when scheduled signals are cancelled before activation.
19398
+ * Triggered by: signal() events with action='cancelled' in ActionBase
19399
+ * Use cases: Analyze cancellation reasons, track signal invalidation patterns, optimize scheduling logic
19400
+ */
19401
+ declare class ScheduleCancelPromptService {
19402
+ private readonly loggerService;
19403
+ /**
19404
+ * Retrieves system prompts for AI context.
19405
+ *
19406
+ * System prompts can be:
19407
+ * - Static array of strings (returned directly)
19408
+ * - Async/sync function returning string array (executed and awaited)
19409
+ * - Undefined (returns empty array)
19410
+ *
19411
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19412
+ * @param strategyName - Strategy identifier
19413
+ * @param exchangeName - Exchange identifier
19414
+ * @param frameName - Timeframe identifier
19415
+ * @param backtest - Whether running in backtest mode
19416
+ * @returns Promise resolving to array of system prompt strings
19417
+ */
19418
+ getSystemPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string[]>;
19419
+ /**
19420
+ * Retrieves user prompt string for AI input.
19421
+ *
19422
+ * @param symbol - Trading symbol (e.g., "BTCUSDT")
19423
+ * @param strategyName - Strategy identifier
19424
+ * @param exchangeName - Exchange identifier
19425
+ * @param frameName - Timeframe identifier
19426
+ * @param backtest - Whether running in backtest mode
19427
+ * @returns Promise resolving to user prompt string
19428
+ */
19429
+ getUserPrompt: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<string>;
19430
+ }
19431
+
18852
19432
  declare const backtest: {
19433
+ signalPromptService: SignalPromptService;
19434
+ riskPromptService: RiskPromptService;
19435
+ trailingTakePromptService: TrailingTakePromptService;
19436
+ trailingStopPromptService: TrailingStopPromptService;
19437
+ partialProfitPromptService: PartialProfitPromptService;
19438
+ partialLossPromptService: PartialLossPromptService;
19439
+ breakevenPromptService: BreakevenPromptService;
19440
+ scheduleCancelPromptService: ScheduleCancelPromptService;
18853
19441
  optimizerTemplateService: OptimizerTemplateService;
18854
19442
  exchangeValidationService: ExchangeValidationService;
18855
19443
  strategyValidationService: StrategyValidationService;
@@ -18924,4 +19512,4 @@ declare const backtest: {
18924
19512
  loggerService: LoggerService;
18925
19513
  };
18926
19514
 
18927
- export { ActionBase, type ActivePingContract, Backtest, type BacktestDoneNotification, type BacktestStatisticsModel, type BootstrapNotification, Breakeven, type BreakevenContract, type BreakevenData, Cache, type CandleInterval, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, type IBidData, type ICandleData, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type IMarkdownDumpOptions, type IOptimizerCallbacks, type IOptimizerData, type IOptimizerFetchArgs, type IOptimizerFilterArgs, type IOptimizerRange, type IOptimizerSchema, type IOptimizerSource, type IOptimizerStrategy, type IOptimizerTemplate, type IOrderBookData, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, 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 IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveDoneNotification, type LiveStatisticsModel, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MessageModel, type MessageRole, MethodContextService, type MetricStats, Notification, type NotificationModel, Optimizer, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossContract, type PartialLossNotification, type PartialProfitContract, type PartialProfitNotification, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PositionSize, type ProgressBacktestContract, type ProgressBacktestNotification, type ProgressOptimizerContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenedNotification, type SignalScheduledNotification, type TMarkdownBase, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TickEvent, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addOptimizerSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, commitBreakeven, commitCancel, commitPartialLoss, commitPartialProfit, commitTrailingStop, commitTrailingTake, dumpSignalData, emitters, formatPrice, formatQuantity, get, getActionSchema, getAveragePrice, getBacktestTimeframe, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getExchangeSchema, getFrameSchema, getMode, getOptimizerSchema, getOrderBook, getRiskSchema, getSizingSchema, getStrategySchema, getSymbol, getWalkerSchema, hasTradeContext, backtest as lib, listExchangeSchema, listFrameSchema, listOptimizerSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenOptimizerProgress, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideOptimizerSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, roundTicks, set, setColumns, setConfig, setLogger, stop, validate };
19515
+ export { ActionBase, type ActivePingContract, Backtest, type BacktestDoneNotification, type BacktestStatisticsModel, type BootstrapNotification, Breakeven, type BreakevenContract, type BreakevenData, Cache, type CandleInterval, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, type IBidData, type ICandleData, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type IMarkdownDumpOptions, type IOptimizerCallbacks, type IOptimizerData, type IOptimizerFetchArgs, type IOptimizerFilterArgs, type IOptimizerRange, type IOptimizerSchema, type IOptimizerSource, type IOptimizerStrategy, type IOptimizerTemplate, type IOrderBookData, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, 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 IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveDoneNotification, type LiveStatisticsModel, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MessageModel, type MessageRole, MethodContextService, type MetricStats, Notification, type NotificationModel, Optimizer, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossContract, type PartialLossNotification, type PartialProfitContract, type PartialProfitNotification, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PositionSize, type ProgressBacktestContract, type ProgressBacktestNotification, type ProgressOptimizerContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenedNotification, type SignalScheduledNotification, type TMarkdownBase, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TickEvent, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addOptimizerSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, commitBreakeven, commitBreakevenPromptHistory, commitCancel, commitPartialLoss, commitPartialLossPromptHistory, commitPartialProfit, commitPartialProfitPromptHistory, commitRiskPromptHistory, commitScheduleCancelPromptHistory, commitSignalPromptHistory, commitTrailingStop, commitTrailingStopPromptHistory, commitTrailingTake, commitTrailingTakePromptHistory, dumpSignalData, emitters, formatPrice, formatQuantity, get, getActionSchema, getAveragePrice, getBacktestTimeframe, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getExchangeSchema, getFrameSchema, getMode, getOptimizerSchema, getOrderBook, getRiskSchema, getSizingSchema, getStrategySchema, getSymbol, getWalkerSchema, hasTradeContext, backtest as lib, listExchangeSchema, listFrameSchema, listOptimizerSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenOptimizerProgress, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideOptimizerSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, roundTicks, set, setColumns, setConfig, setLogger, stop, validate };