@tradejs/node 3.1.28-beta.254 → 3.1.28-beta.256

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/dist/backtest.js CHANGED
@@ -4515,6 +4515,19 @@ var applyProtectiveOrders = async ({
4515
4515
  takeProfits,
4516
4516
  stopLossPrice
4517
4517
  }) => {
4518
+ if (connector.setPositionProtection) {
4519
+ const protectionOk = await connector.setPositionProtection({
4520
+ symbol,
4521
+ direction,
4522
+ qty,
4523
+ takeProfits,
4524
+ stopLossPrice
4525
+ });
4526
+ if (!protectionOk) {
4527
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
4528
+ }
4529
+ return;
4530
+ }
4518
4531
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
4519
4532
  const tpOk = await connector.setTakeProfits({
4520
4533
  symbol,
@@ -7469,12 +7482,6 @@ var createTestConnector = (connector, context) => {
7469
7482
  entryPrice: roundPrice(tradeResult.entryPrice),
7470
7483
  requestedExitPrice: roundNullablePrice(tradeResult.requestedExitPrice),
7471
7484
  exitPrice: roundNullablePrice(tradeResult.exitPrice),
7472
- grossProfit: (0, import_math.round)(tradeResult.grossProfit),
7473
- netProfit: (0, import_math.round)(tradeResult.netProfit),
7474
- openFee: (0, import_math.round)(tradeResult.openFee),
7475
- closeFee: (0, import_math.round)(tradeResult.closeFee),
7476
- fundingFee: roundNullable2(tradeResult.fundingFee),
7477
- totalFee: (0, import_math.round)(tradeResult.totalFee),
7478
7485
  entrySlippagePrice: (0, import_math.round)(tradeResult.entrySlippagePrice),
7479
7486
  entrySlippageBps: (0, import_math.round)(tradeResult.entrySlippageBps),
7480
7487
  entryBaseSlippageBps: (0, import_math.round)(tradeResult.entryBaseSlippageBps),
@@ -7482,18 +7489,13 @@ var createTestConnector = (connector, context) => {
7482
7489
  entrySpreadSlippageBps: (0, import_math.round)(tradeResult.entrySpreadSlippageBps),
7483
7490
  entryMarketImpactBps: (0, import_math.round)(tradeResult.entryMarketImpactBps),
7484
7491
  entryDelayRiskBps: roundNullable2(tradeResult.entryDelayRiskBps),
7485
- entrySlippageCost: (0, import_math.round)(tradeResult.entrySlippageCost),
7486
7492
  exitSlippagePrice: roundNullable2(tradeResult.exitSlippagePrice),
7487
7493
  exitSlippageBps: roundNullable2(tradeResult.exitSlippageBps),
7488
7494
  exitBaseSlippageBps: roundNullable2(tradeResult.exitBaseSlippageBps),
7489
7495
  exitSpreadBps: roundNullable2(tradeResult.exitSpreadBps),
7490
7496
  exitSpreadSlippageBps: roundNullable2(tradeResult.exitSpreadSlippageBps),
7491
7497
  exitMarketImpactBps: roundNullable2(tradeResult.exitMarketImpactBps),
7492
- exitDelayRiskBps: roundNullable2(tradeResult.exitDelayRiskBps),
7493
- exitSlippageCost: (0, import_math.round)(tradeResult.exitSlippageCost),
7494
- totalSlippageCost: (0, import_math.round)(tradeResult.totalSlippageCost),
7495
- qty: (0, import_math.round)(tradeResult.qty),
7496
- closedQty: (0, import_math.round)(tradeResult.closedQty)
7498
+ exitDelayRiskBps: roundNullable2(tradeResult.exitDelayRiskBps)
7497
7499
  };
7498
7500
  };
7499
7501
  const appendExitToTradeResult = ({
@@ -7655,7 +7657,7 @@ var createTestConnector = (connector, context) => {
7655
7657
  for (const tradeResult of finalizedCycleResults) {
7656
7658
  closedSignalResults.push({
7657
7659
  signalId: tradeResult.signalId,
7658
- profit: (0, import_math.round)(tradeResult.netProfit),
7660
+ profit: tradeResult.netProfit,
7659
7661
  tradeResult
7660
7662
  });
7661
7663
  }
@@ -7664,7 +7666,7 @@ var createTestConnector = (connector, context) => {
7664
7666
  if (tradeResult) finalizedCycleResults = [tradeResult];
7665
7667
  closedSignalResults.push({
7666
7668
  signalId: currentSignalId,
7667
- profit: (0, import_math.round)(currentPositionProfit),
7669
+ profit: tradeResult?.netProfit ?? currentPositionProfit,
7668
7670
  ...tradeResult ? { tradeResult } : {}
7669
7671
  });
7670
7672
  }
@@ -7679,12 +7681,10 @@ var createTestConnector = (connector, context) => {
7679
7681
  timestamp,
7680
7682
  amount: (0, import_math.round)(amount)
7681
7683
  },
7682
- netProfit: finalizedCycleResults.length ? (0, import_math.round)(
7683
- finalizedCycleResults.reduce(
7684
- (total, tradeResult) => total + tradeResult.netProfit,
7685
- 0
7686
- )
7687
- ) : (0, import_math.round)(currentPositionProfit)
7684
+ netProfit: finalizedCycleResults.length ? finalizedCycleResults.reduce(
7685
+ (total, tradeResult) => total + tradeResult.netProfit,
7686
+ 0
7687
+ ) : currentPositionProfit
7688
7688
  });
7689
7689
  currentPosition = null;
7690
7690
  currentSignalId = null;
package/dist/backtest.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  buildMlPayload,
7
7
  enrichSignalWithMarketContextStages
8
- } from "./chunk-VQSGH7YA.mjs";
8
+ } from "./chunk-JDFPF2RG.mjs";
9
9
  import {
10
10
  buildAiPayload,
11
11
  getStrategyCreator
@@ -411,12 +411,6 @@ var createTestConnector = (connector, context) => {
411
411
  entryPrice: roundPrice(tradeResult.entryPrice),
412
412
  requestedExitPrice: roundNullablePrice(tradeResult.requestedExitPrice),
413
413
  exitPrice: roundNullablePrice(tradeResult.exitPrice),
414
- grossProfit: round(tradeResult.grossProfit),
415
- netProfit: round(tradeResult.netProfit),
416
- openFee: round(tradeResult.openFee),
417
- closeFee: round(tradeResult.closeFee),
418
- fundingFee: roundNullable(tradeResult.fundingFee),
419
- totalFee: round(tradeResult.totalFee),
420
414
  entrySlippagePrice: round(tradeResult.entrySlippagePrice),
421
415
  entrySlippageBps: round(tradeResult.entrySlippageBps),
422
416
  entryBaseSlippageBps: round(tradeResult.entryBaseSlippageBps),
@@ -424,18 +418,13 @@ var createTestConnector = (connector, context) => {
424
418
  entrySpreadSlippageBps: round(tradeResult.entrySpreadSlippageBps),
425
419
  entryMarketImpactBps: round(tradeResult.entryMarketImpactBps),
426
420
  entryDelayRiskBps: roundNullable(tradeResult.entryDelayRiskBps),
427
- entrySlippageCost: round(tradeResult.entrySlippageCost),
428
421
  exitSlippagePrice: roundNullable(tradeResult.exitSlippagePrice),
429
422
  exitSlippageBps: roundNullable(tradeResult.exitSlippageBps),
430
423
  exitBaseSlippageBps: roundNullable(tradeResult.exitBaseSlippageBps),
431
424
  exitSpreadBps: roundNullable(tradeResult.exitSpreadBps),
432
425
  exitSpreadSlippageBps: roundNullable(tradeResult.exitSpreadSlippageBps),
433
426
  exitMarketImpactBps: roundNullable(tradeResult.exitMarketImpactBps),
434
- exitDelayRiskBps: roundNullable(tradeResult.exitDelayRiskBps),
435
- exitSlippageCost: round(tradeResult.exitSlippageCost),
436
- totalSlippageCost: round(tradeResult.totalSlippageCost),
437
- qty: round(tradeResult.qty),
438
- closedQty: round(tradeResult.closedQty)
427
+ exitDelayRiskBps: roundNullable(tradeResult.exitDelayRiskBps)
439
428
  };
440
429
  };
441
430
  const appendExitToTradeResult = ({
@@ -597,7 +586,7 @@ var createTestConnector = (connector, context) => {
597
586
  for (const tradeResult of finalizedCycleResults) {
598
587
  closedSignalResults.push({
599
588
  signalId: tradeResult.signalId,
600
- profit: round(tradeResult.netProfit),
589
+ profit: tradeResult.netProfit,
601
590
  tradeResult
602
591
  });
603
592
  }
@@ -606,7 +595,7 @@ var createTestConnector = (connector, context) => {
606
595
  if (tradeResult) finalizedCycleResults = [tradeResult];
607
596
  closedSignalResults.push({
608
597
  signalId: currentSignalId,
609
- profit: round(currentPositionProfit),
598
+ profit: tradeResult?.netProfit ?? currentPositionProfit,
610
599
  ...tradeResult ? { tradeResult } : {}
611
600
  });
612
601
  }
@@ -621,12 +610,10 @@ var createTestConnector = (connector, context) => {
621
610
  timestamp,
622
611
  amount: round(amount)
623
612
  },
624
- netProfit: finalizedCycleResults.length ? round(
625
- finalizedCycleResults.reduce(
626
- (total, tradeResult) => total + tradeResult.netProfit,
627
- 0
628
- )
629
- ) : round(currentPositionProfit)
613
+ netProfit: finalizedCycleResults.length ? finalizedCycleResults.reduce(
614
+ (total, tradeResult) => total + tradeResult.netProfit,
615
+ 0
616
+ ) : currentPositionProfit
630
617
  });
631
618
  currentPosition = null;
632
619
  currentSignalId = null;
@@ -2925,6 +2925,19 @@ var applyProtectiveOrders = async ({
2925
2925
  takeProfits,
2926
2926
  stopLossPrice
2927
2927
  }) => {
2928
+ if (connector.setPositionProtection) {
2929
+ const protectionOk = await connector.setPositionProtection({
2930
+ symbol,
2931
+ direction,
2932
+ qty,
2933
+ takeProfits,
2934
+ stopLossPrice
2935
+ });
2936
+ if (!protectionOk) {
2937
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
2938
+ }
2939
+ return;
2940
+ }
2928
2941
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
2929
2942
  const tpOk = await connector.setTakeProfits({
2930
2943
  symbol,
package/dist/registry.js CHANGED
@@ -4553,6 +4553,19 @@ var applyProtectiveOrders = async ({
4553
4553
  takeProfits,
4554
4554
  stopLossPrice
4555
4555
  }) => {
4556
+ if (connector.setPositionProtection) {
4557
+ const protectionOk = await connector.setPositionProtection({
4558
+ symbol,
4559
+ direction,
4560
+ qty,
4561
+ takeProfits,
4562
+ stopLossPrice
4563
+ });
4564
+ if (!protectionOk) {
4565
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
4566
+ }
4567
+ return;
4568
+ }
4556
4569
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
4557
4570
  const tpOk = await connector.setTakeProfits({
4558
4571
  symbol,
package/dist/registry.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-VQSGH7YA.mjs";
1
+ import "./chunk-JDFPF2RG.mjs";
2
2
  import {
3
3
  ensureIndicatorPluginsLoaded,
4
4
  ensureStrategyPluginsLoaded,
@@ -5534,6 +5534,19 @@ var applyProtectiveOrders = async ({
5534
5534
  takeProfits,
5535
5535
  stopLossPrice
5536
5536
  }) => {
5537
+ if (connector.setPositionProtection) {
5538
+ const protectionOk = await connector.setPositionProtection({
5539
+ symbol,
5540
+ direction,
5541
+ qty,
5542
+ takeProfits,
5543
+ stopLossPrice
5544
+ });
5545
+ if (!protectionOk) {
5546
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
5547
+ }
5548
+ return;
5549
+ }
5537
5550
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
5538
5551
  const tpOk = await connector.setTakeProfits({
5539
5552
  symbol,
@@ -8147,6 +8160,16 @@ var MIN_HOURS = 6;
8147
8160
  var MAX_HOURS = 24 * 90;
8148
8161
  var BYBIT_MAX_TIME_RANGE_MS = 7 * 24 * 60 * 60 * 1e3 - 1e3;
8149
8162
  var EXCHANGE_REQUEST_TIMEOUT_MS = 15e3;
8163
+ var ENABLED_BOOLEAN_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
8164
+ var getSignalsDaemonExecution = (deploymentId) => {
8165
+ const deploymentIds = String(process.env.SIGNALS_DAEMON_DEPLOYMENT_ID ?? "").split(",").map((value) => value.trim()).filter(Boolean);
8166
+ const managedByDaemon = deploymentIds.includes(deploymentId);
8167
+ const configuredMakeOrders = process.env.SIGNALS_DAEMON_MAKE_ORDERS ?? "true";
8168
+ return {
8169
+ runtimeMode: managedByDaemon ? "CRON" : null,
8170
+ makeOrders: managedByDaemon && ENABLED_BOOLEAN_ENV_VALUES.has(configuredMakeOrders.toLowerCase())
8171
+ };
8172
+ };
8150
8173
  var groupRuntimeTradesByIdentity = (trades, identities) => {
8151
8174
  const grouped = /* @__PURE__ */ new Map();
8152
8175
  for (const trade of trades) {
@@ -8272,7 +8295,7 @@ var buildStrategyRevisionChanges = ({
8272
8295
  endTime
8273
8296
  }) => {
8274
8297
  const changes = [];
8275
- let previousRevision;
8298
+ let previousStrategy;
8276
8299
  let wasPresent = false;
8277
8300
  for (const event of [...events].sort(
8278
8301
  (left, right) => left.observedAt - right.observedAt || left.eventId.localeCompare(right.eventId)
@@ -8281,17 +8304,20 @@ var buildStrategyRevisionChanges = ({
8281
8304
  (item) => item.strategyName === strategyName
8282
8305
  );
8283
8306
  if (!strategy) {
8284
- previousRevision = void 0;
8285
8307
  wasPresent = false;
8286
8308
  continue;
8287
8309
  }
8288
- if ((!wasPresent || strategy.strategyRevision !== previousRevision) && event.observedAt >= startTime && event.observedAt <= endTime) {
8310
+ if ((!wasPresent || strategy.strategyRevision !== previousStrategy?.strategyRevision) && event.observedAt >= startTime && event.observedAt <= endTime) {
8311
+ const strategyPackageChanged = Boolean(
8312
+ previousStrategy?.strategyPackage && previousStrategy.strategyPackageVersion && strategy.strategyPackage && strategy.strategyPackageVersion && (strategy.strategyPackage !== previousStrategy.strategyPackage || strategy.strategyPackageVersion !== previousStrategy.strategyPackageVersion)
8313
+ );
8289
8314
  changes.push({
8290
8315
  timestamp: event.observedAt,
8291
- strategyRevision: strategy.strategyRevision
8316
+ strategyRevision: strategy.strategyRevision,
8317
+ kind: strategyPackageChanged ? "strategy_package" : "other"
8292
8318
  });
8293
8319
  }
8294
- previousRevision = strategy.strategyRevision;
8320
+ previousStrategy = strategy;
8295
8321
  wasPresent = true;
8296
8322
  }
8297
8323
  return changes;
@@ -8604,7 +8630,7 @@ var loadRuntimeDashboard = async ({
8604
8630
  ...resolvedStrategy.generation ? { generation: resolvedStrategy.generation } : {},
8605
8631
  policyProfileId: strategyPolicyProfileId,
8606
8632
  enabled: resolvedStrategy.controlState !== "entries_paused",
8607
- config: resolvedStrategy.strategyConfig,
8633
+ config: resolvedStrategy.sourceStrategyConfig,
8608
8634
  connected: deployment.enabled,
8609
8635
  ...resolvedStrategy.selection ? { selection: resolvedStrategy.selection } : {}
8610
8636
  });
@@ -8630,7 +8656,8 @@ var loadRuntimeDashboard = async ({
8630
8656
  startTime,
8631
8657
  endTime
8632
8658
  });
8633
- const effectiveStrategyConfig = identity.config;
8659
+ const committedStrategyConfig = identity.config;
8660
+ const daemonExecution = getSignalsDaemonExecution(identity.deploymentId);
8634
8661
  return {
8635
8662
  runtimeKey,
8636
8663
  strategyName,
@@ -8649,9 +8676,10 @@ var loadRuntimeDashboard = async ({
8649
8676
  deploymentLabel: identity.deploymentLabel,
8650
8677
  ...identity.selection ? { selection: identity.selection } : {},
8651
8678
  policyProfileId: identity.policyProfileId,
8679
+ ...daemonExecution,
8652
8680
  connected: identity.connected,
8653
8681
  enabled: identity.enabled,
8654
- config: effectiveStrategyConfig,
8682
+ config: committedStrategyConfig,
8655
8683
  symbols: [...new Set(strategyTrades.map((trade) => trade.symbol))],
8656
8684
  stat: analytics.stat,
8657
8685
  summary: analytics.summary,
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  getConnectorCreatorByProvider
11
11
  } from "./chunk-QVKUROR2.mjs";
12
- import "./chunk-VQSGH7YA.mjs";
12
+ import "./chunk-JDFPF2RG.mjs";
13
13
  import "./chunk-UITD6LG6.mjs";
14
14
  import "./chunk-LZDXRXIU.mjs";
15
15
  import "./chunk-Y6FXYEAI.mjs";
@@ -250,6 +250,16 @@ var MIN_HOURS = 6;
250
250
  var MAX_HOURS = 24 * 90;
251
251
  var BYBIT_MAX_TIME_RANGE_MS = 7 * 24 * 60 * 60 * 1e3 - 1e3;
252
252
  var EXCHANGE_REQUEST_TIMEOUT_MS = 15e3;
253
+ var ENABLED_BOOLEAN_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
254
+ var getSignalsDaemonExecution = (deploymentId) => {
255
+ const deploymentIds = String(process.env.SIGNALS_DAEMON_DEPLOYMENT_ID ?? "").split(",").map((value) => value.trim()).filter(Boolean);
256
+ const managedByDaemon = deploymentIds.includes(deploymentId);
257
+ const configuredMakeOrders = process.env.SIGNALS_DAEMON_MAKE_ORDERS ?? "true";
258
+ return {
259
+ runtimeMode: managedByDaemon ? "CRON" : null,
260
+ makeOrders: managedByDaemon && ENABLED_BOOLEAN_ENV_VALUES.has(configuredMakeOrders.toLowerCase())
261
+ };
262
+ };
253
263
  var groupRuntimeTradesByIdentity = (trades, identities) => {
254
264
  const grouped = /* @__PURE__ */ new Map();
255
265
  for (const trade of trades) {
@@ -375,7 +385,7 @@ var buildStrategyRevisionChanges = ({
375
385
  endTime
376
386
  }) => {
377
387
  const changes = [];
378
- let previousRevision;
388
+ let previousStrategy;
379
389
  let wasPresent = false;
380
390
  for (const event of [...events].sort(
381
391
  (left, right) => left.observedAt - right.observedAt || left.eventId.localeCompare(right.eventId)
@@ -384,17 +394,20 @@ var buildStrategyRevisionChanges = ({
384
394
  (item) => item.strategyName === strategyName
385
395
  );
386
396
  if (!strategy) {
387
- previousRevision = void 0;
388
397
  wasPresent = false;
389
398
  continue;
390
399
  }
391
- if ((!wasPresent || strategy.strategyRevision !== previousRevision) && event.observedAt >= startTime && event.observedAt <= endTime) {
400
+ if ((!wasPresent || strategy.strategyRevision !== previousStrategy?.strategyRevision) && event.observedAt >= startTime && event.observedAt <= endTime) {
401
+ const strategyPackageChanged = Boolean(
402
+ previousStrategy?.strategyPackage && previousStrategy.strategyPackageVersion && strategy.strategyPackage && strategy.strategyPackageVersion && (strategy.strategyPackage !== previousStrategy.strategyPackage || strategy.strategyPackageVersion !== previousStrategy.strategyPackageVersion)
403
+ );
392
404
  changes.push({
393
405
  timestamp: event.observedAt,
394
- strategyRevision: strategy.strategyRevision
406
+ strategyRevision: strategy.strategyRevision,
407
+ kind: strategyPackageChanged ? "strategy_package" : "other"
395
408
  });
396
409
  }
397
- previousRevision = strategy.strategyRevision;
410
+ previousStrategy = strategy;
398
411
  wasPresent = true;
399
412
  }
400
413
  return changes;
@@ -707,7 +720,7 @@ var loadRuntimeDashboard = async ({
707
720
  ...resolvedStrategy.generation ? { generation: resolvedStrategy.generation } : {},
708
721
  policyProfileId: strategyPolicyProfileId,
709
722
  enabled: resolvedStrategy.controlState !== "entries_paused",
710
- config: resolvedStrategy.strategyConfig,
723
+ config: resolvedStrategy.sourceStrategyConfig,
711
724
  connected: deployment.enabled,
712
725
  ...resolvedStrategy.selection ? { selection: resolvedStrategy.selection } : {}
713
726
  });
@@ -733,7 +746,8 @@ var loadRuntimeDashboard = async ({
733
746
  startTime,
734
747
  endTime
735
748
  });
736
- const effectiveStrategyConfig = identity.config;
749
+ const committedStrategyConfig = identity.config;
750
+ const daemonExecution = getSignalsDaemonExecution(identity.deploymentId);
737
751
  return {
738
752
  runtimeKey,
739
753
  strategyName,
@@ -752,9 +766,10 @@ var loadRuntimeDashboard = async ({
752
766
  deploymentLabel: identity.deploymentLabel,
753
767
  ...identity.selection ? { selection: identity.selection } : {},
754
768
  policyProfileId: identity.policyProfileId,
769
+ ...daemonExecution,
755
770
  connected: identity.connected,
756
771
  enabled: identity.enabled,
757
- config: effectiveStrategyConfig,
772
+ config: committedStrategyConfig,
758
773
  symbols: [...new Set(strategyTrades.map((trade) => trade.symbol))],
759
774
  stat: analytics.stat,
760
775
  summary: analytics.summary,
@@ -4531,6 +4531,19 @@ var applyProtectiveOrders = async ({
4531
4531
  takeProfits,
4532
4532
  stopLossPrice
4533
4533
  }) => {
4534
+ if (connector.setPositionProtection) {
4535
+ const protectionOk = await connector.setPositionProtection({
4536
+ symbol,
4537
+ direction,
4538
+ qty,
4539
+ takeProfits,
4540
+ stopLossPrice
4541
+ });
4542
+ if (!protectionOk) {
4543
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
4544
+ }
4545
+ return;
4546
+ }
4534
4547
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
4535
4548
  const tpOk = await connector.setTakeProfits({
4536
4549
  symbol,
@@ -9,7 +9,7 @@ import {
9
9
  resolveRuntimeComposition,
10
10
  verifyRuntimeDeclaration
11
11
  } from "./chunk-K2YQ3MQC.mjs";
12
- import "./chunk-VQSGH7YA.mjs";
12
+ import "./chunk-JDFPF2RG.mjs";
13
13
  import "./chunk-UITD6LG6.mjs";
14
14
  import "./chunk-LZDXRXIU.mjs";
15
15
  import "./chunk-Y6FXYEAI.mjs";
@@ -4794,6 +4794,19 @@ var applyProtectiveOrders = async ({
4794
4794
  takeProfits,
4795
4795
  stopLossPrice
4796
4796
  }) => {
4797
+ if (connector.setPositionProtection) {
4798
+ const protectionOk = await connector.setPositionProtection({
4799
+ symbol,
4800
+ direction,
4801
+ qty,
4802
+ takeProfits,
4803
+ stopLossPrice
4804
+ });
4805
+ if (!protectionOk) {
4806
+ throw new Error("SET_POSITION_PROTECTION_FAILED");
4807
+ }
4808
+ return;
4809
+ }
4797
4810
  if (Array.isArray(takeProfits) && takeProfits.length > 0) {
4798
4811
  const tpOk = await connector.setTakeProfits({
4799
4812
  symbol,
@@ -23,7 +23,7 @@ import {
23
23
  resolveHyperliquidPerpFromSignalSymbol,
24
24
  resolveStrategyConfig,
25
25
  validateEntryProtectionAtArrival
26
- } from "./chunk-VQSGH7YA.mjs";
26
+ } from "./chunk-JDFPF2RG.mjs";
27
27
  import {
28
28
  DEFAULT_AI_MODEL,
29
29
  MAX_AI_SERIES_POINTS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/node",
3
- "version": "3.1.28-beta.254",
3
+ "version": "3.1.28-beta.256",
4
4
  "description": "Node-only runtime for the TradeJS TypeScript framework: strategies, backtests, Pine strategy loading, and plugin registries.",
5
5
  "keywords": [
6
6
  "tradejs",
@@ -89,9 +89,9 @@
89
89
  "dependencies": {
90
90
  "@langchain/core": "^1.2.3",
91
91
  "@langchain/openai": "^1.5.5",
92
- "@tradejs/core": "^3.1.28-beta.254",
93
- "@tradejs/infra": "^3.1.28-beta.254",
94
- "@tradejs/types": "^3.1.28-beta.254",
92
+ "@tradejs/core": "^3.1.28-beta.256",
93
+ "@tradejs/infra": "^3.1.28-beta.256",
94
+ "@tradejs/types": "^3.1.28-beta.256",
95
95
  "@types/node": "^24",
96
96
  "chalk": "4.1.2",
97
97
  "ioredis": "5.11.1",
@@ -104,7 +104,7 @@
104
104
  "typescript": "^5.9"
105
105
  },
106
106
  "devDependencies": {
107
- "@tradejs/indicators": "^3.1.28-beta.254",
107
+ "@tradejs/indicators": "^3.1.28-beta.256",
108
108
  "@tradejs/strategy-adaptive-momentum-ribbon": "3.0.2",
109
109
  "@tradejs/strategy-hyperliquid-consensus": "3.0.2",
110
110
  "@tradejs/strategy-kit": "3.0.5",