backtest-kit 1.6.1 → 1.6.2

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 CHANGED
@@ -2167,7 +2167,7 @@ const GET_SIGNAL_FN = functoolsKit.trycatch(async (self) => {
2167
2167
  }, {
2168
2168
  defaultValue: null,
2169
2169
  fallback: (error) => {
2170
- const message = "ClientStrategy exception thrown";
2170
+ const message = "ClientStrategy GET_SIGNAL_FN thrown";
2171
2171
  const payload = {
2172
2172
  error: functoolsKit.errorData(error),
2173
2173
  message: functoolsKit.getErrorMessage(error),
@@ -2384,14 +2384,25 @@ const ACTIVATE_SCHEDULED_SIGNAL_FN = async (self, scheduled, activationTimestamp
2384
2384
  }
2385
2385
  return result;
2386
2386
  };
2387
- const CALL_PING_CALLBACKS_FN = async (self, scheduled, timestamp) => {
2387
+ const CALL_PING_CALLBACKS_FN = functoolsKit.trycatch(async (self, scheduled, timestamp) => {
2388
2388
  // Call system onPing callback first (emits to pingSubject)
2389
2389
  await self.params.onPing(self.params.execution.context.symbol, self.params.method.context.strategyName, self.params.method.context.exchangeName, scheduled, self.params.execution.context.backtest, timestamp);
2390
2390
  // Call user onPing callback only if signal is still active (not cancelled, not activated)
2391
2391
  if (self.params.callbacks?.onPing) {
2392
2392
  await self.params.callbacks.onPing(self.params.execution.context.symbol, scheduled, new Date(timestamp), self.params.execution.context.backtest);
2393
2393
  }
2394
- };
2394
+ }, {
2395
+ fallback: (error) => {
2396
+ const message = "ClientStrategy CALL_PING_CALLBACKS_FN thrown";
2397
+ const payload = {
2398
+ error: functoolsKit.errorData(error),
2399
+ message: functoolsKit.getErrorMessage(error),
2400
+ };
2401
+ backtest$1.loggerService.warn(message, payload);
2402
+ console.warn(message, payload);
2403
+ errorEmitter.next(error);
2404
+ }
2405
+ });
2395
2406
  const RETURN_SCHEDULED_SIGNAL_ACTIVE_FN = async (self, scheduled, currentPrice) => {
2396
2407
  await CALL_PING_CALLBACKS_FN(self, scheduled, self.params.execution.context.when.getTime());
2397
2408
  const result = {
package/build/index.mjs CHANGED
@@ -2165,7 +2165,7 @@ const GET_SIGNAL_FN = trycatch(async (self) => {
2165
2165
  }, {
2166
2166
  defaultValue: null,
2167
2167
  fallback: (error) => {
2168
- const message = "ClientStrategy exception thrown";
2168
+ const message = "ClientStrategy GET_SIGNAL_FN thrown";
2169
2169
  const payload = {
2170
2170
  error: errorData(error),
2171
2171
  message: getErrorMessage(error),
@@ -2382,14 +2382,25 @@ const ACTIVATE_SCHEDULED_SIGNAL_FN = async (self, scheduled, activationTimestamp
2382
2382
  }
2383
2383
  return result;
2384
2384
  };
2385
- const CALL_PING_CALLBACKS_FN = async (self, scheduled, timestamp) => {
2385
+ const CALL_PING_CALLBACKS_FN = trycatch(async (self, scheduled, timestamp) => {
2386
2386
  // Call system onPing callback first (emits to pingSubject)
2387
2387
  await self.params.onPing(self.params.execution.context.symbol, self.params.method.context.strategyName, self.params.method.context.exchangeName, scheduled, self.params.execution.context.backtest, timestamp);
2388
2388
  // Call user onPing callback only if signal is still active (not cancelled, not activated)
2389
2389
  if (self.params.callbacks?.onPing) {
2390
2390
  await self.params.callbacks.onPing(self.params.execution.context.symbol, scheduled, new Date(timestamp), self.params.execution.context.backtest);
2391
2391
  }
2392
- };
2392
+ }, {
2393
+ fallback: (error) => {
2394
+ const message = "ClientStrategy CALL_PING_CALLBACKS_FN thrown";
2395
+ const payload = {
2396
+ error: errorData(error),
2397
+ message: getErrorMessage(error),
2398
+ };
2399
+ backtest$1.loggerService.warn(message, payload);
2400
+ console.warn(message, payload);
2401
+ errorEmitter.next(error);
2402
+ }
2403
+ });
2393
2404
  const RETURN_SCHEDULED_SIGNAL_ACTIVE_FN = async (self, scheduled, currentPrice) => {
2394
2405
  await CALL_PING_CALLBACKS_FN(self, scheduled, self.params.execution.context.when.getTime());
2395
2406
  const result = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",