@gbozee/ultimate 0.0.2-167 → 0.0.2-169

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.
@@ -580,8 +580,7 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
580
580
  let macCheckPassed;
581
581
  try {
582
582
  macCheckPassed = timing_safe_equal_default(tag, expectedTag);
583
- } catch {
584
- }
583
+ } catch {}
585
584
  if (!macCheckPassed) {
586
585
  throw new JWEDecryptionFailed;
587
586
  }
@@ -589,8 +588,7 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
589
588
  try {
590
589
  const decipher = import_node_crypto6.createDecipheriv(algorithm, encKey, iv);
591
590
  plaintext = concat(decipher.update(ciphertext), decipher.final());
592
- } catch {
593
- }
591
+ } catch {}
594
592
  if (!plaintext) {
595
593
  throw new JWEDecryptionFailed;
596
594
  }
@@ -769,8 +767,7 @@ function isPublicJWK(key) {
769
767
  function isSecretJWK(key) {
770
768
  return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
771
769
  }
772
- var init_is_jwk = () => {
773
- };
770
+ var init_is_jwk = () => {};
774
771
 
775
772
  // node_modules/jose/dist/node/esm/runtime/get_named_curve.js
776
773
  var import_node_crypto8, weakMap, namedCurveToJOSE = (namedCurve) => {
@@ -952,8 +949,7 @@ var import_node_crypto11, check_key_length_default = (key, alg) => {
952
949
  } else {
953
950
  modulusLength = Buffer.from(key.n, "base64url").byteLength << 3;
954
951
  }
955
- } catch {
956
- }
952
+ } catch {}
957
953
  if (typeof modulusLength !== "number" || modulusLength < 2048) {
958
954
  throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
959
955
  }
@@ -1714,8 +1710,7 @@ async function generalDecrypt(jwe, key, options) {
1714
1710
  tag: jwe.tag,
1715
1711
  unprotected: jwe.unprotected
1716
1712
  }, key, options);
1717
- } catch {
1718
- }
1713
+ } catch {}
1719
1714
  }
1720
1715
  throw new JWEDecryptionFailed;
1721
1716
  }
@@ -2601,8 +2596,7 @@ async function generalVerify(jws, key, options) {
2601
2596
  protected: signature.protected,
2602
2597
  signature: signature.signature
2603
2598
  }, key, options);
2604
- } catch {
2605
- }
2599
+ } catch {}
2606
2600
  }
2607
2601
  throw new JWSSignatureVerificationFailed;
2608
2602
  }
@@ -2685,8 +2679,7 @@ var normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, ""),
2685
2679
  let payload;
2686
2680
  try {
2687
2681
  payload = JSON.parse(decoder.decode(encodedPayload));
2688
- } catch {
2689
- }
2682
+ } catch {}
2690
2683
  if (!isObject(payload)) {
2691
2684
  throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
2692
2685
  }
@@ -3371,8 +3364,7 @@ class LocalJWKSet {
3371
3364
  for (const jwk2 of candidates) {
3372
3365
  try {
3373
3366
  yield await importWithAlgCache(_cached, jwk2, alg);
3374
- } catch {
3375
- }
3367
+ } catch {}
3376
3368
  }
3377
3369
  };
3378
3370
  throw error;
@@ -3919,8 +3911,7 @@ var require_util = __commonJS((exports2) => {
3919
3911
  var util5;
3920
3912
  (function(util6) {
3921
3913
  util6.assertEqual = (val) => val;
3922
- function assertIs(_arg) {
3923
- }
3914
+ function assertIs(_arg) {}
3924
3915
  util6.assertIs = assertIs;
3925
3916
  function assertNever(_x) {
3926
3917
  throw new Error;
@@ -6336,8 +6327,7 @@ var require_types = __commonJS((exports2) => {
6336
6327
  });
6337
6328
  status.dirty();
6338
6329
  }
6339
- } else if (unknownKeys === "strip") {
6340
- } else {
6330
+ } else if (unknownKeys === "strip") {} else {
6341
6331
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
6342
6332
  }
6343
6333
  } else {
@@ -8489,8 +8479,7 @@ var require_logLevelLogger = __commonJS((exports2) => {
8489
8479
  if (typeof theFunc === "function" && maxLevel >= theLevel) {
8490
8480
  return theFunc.bind(logger);
8491
8481
  }
8492
- return function() {
8493
- };
8482
+ return function() {};
8494
8483
  }
8495
8484
  return {
8496
8485
  error: _filterFunc("error", types_1.DiagLogLevel.ERROR),
@@ -8715,8 +8704,7 @@ var require_NoopMeter = __commonJS((exports2) => {
8715
8704
  exports2.createNoopMeter = exports2.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports2.NOOP_OBSERVABLE_GAUGE_METRIC = exports2.NOOP_OBSERVABLE_COUNTER_METRIC = exports2.NOOP_UP_DOWN_COUNTER_METRIC = exports2.NOOP_HISTOGRAM_METRIC = exports2.NOOP_GAUGE_METRIC = exports2.NOOP_COUNTER_METRIC = exports2.NOOP_METER = exports2.NoopObservableUpDownCounterMetric = exports2.NoopObservableGaugeMetric = exports2.NoopObservableCounterMetric = exports2.NoopObservableMetric = exports2.NoopHistogramMetric = exports2.NoopGaugeMetric = exports2.NoopUpDownCounterMetric = exports2.NoopCounterMetric = exports2.NoopMetric = exports2.NoopMeter = undefined;
8716
8705
 
8717
8706
  class NoopMeter {
8718
- constructor() {
8719
- }
8707
+ constructor() {}
8720
8708
  createGauge(_name, _options) {
8721
8709
  return exports2.NOOP_GAUGE_METRIC;
8722
8710
  }
@@ -8738,10 +8726,8 @@ var require_NoopMeter = __commonJS((exports2) => {
8738
8726
  createObservableUpDownCounter(_name, _options) {
8739
8727
  return exports2.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
8740
8728
  }
8741
- addBatchObservableCallback(_callback, _observables) {
8742
- }
8743
- removeBatchObservableCallback(_callback) {
8744
- }
8729
+ addBatchObservableCallback(_callback, _observables) {}
8730
+ removeBatchObservableCallback(_callback) {}
8745
8731
  }
8746
8732
  exports2.NoopMeter = NoopMeter;
8747
8733
 
@@ -8750,34 +8736,28 @@ var require_NoopMeter = __commonJS((exports2) => {
8750
8736
  exports2.NoopMetric = NoopMetric;
8751
8737
 
8752
8738
  class NoopCounterMetric extends NoopMetric {
8753
- add(_value, _attributes) {
8754
- }
8739
+ add(_value, _attributes) {}
8755
8740
  }
8756
8741
  exports2.NoopCounterMetric = NoopCounterMetric;
8757
8742
 
8758
8743
  class NoopUpDownCounterMetric extends NoopMetric {
8759
- add(_value, _attributes) {
8760
- }
8744
+ add(_value, _attributes) {}
8761
8745
  }
8762
8746
  exports2.NoopUpDownCounterMetric = NoopUpDownCounterMetric;
8763
8747
 
8764
8748
  class NoopGaugeMetric extends NoopMetric {
8765
- record(_value, _attributes) {
8766
- }
8749
+ record(_value, _attributes) {}
8767
8750
  }
8768
8751
  exports2.NoopGaugeMetric = NoopGaugeMetric;
8769
8752
 
8770
8753
  class NoopHistogramMetric extends NoopMetric {
8771
- record(_value, _attributes) {
8772
- }
8754
+ record(_value, _attributes) {}
8773
8755
  }
8774
8756
  exports2.NoopHistogramMetric = NoopHistogramMetric;
8775
8757
 
8776
8758
  class NoopObservableMetric {
8777
- addCallback(_callback) {
8778
- }
8779
- removeCallback(_callback) {
8780
- }
8759
+ addCallback(_callback) {}
8760
+ removeCallback(_callback) {}
8781
8761
  }
8782
8762
  exports2.NoopObservableMetric = NoopObservableMetric;
8783
8763
 
@@ -8882,8 +8862,7 @@ var require_context2 = __commonJS((exports2) => {
8882
8862
  var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager;
8883
8863
 
8884
8864
  class ContextAPI {
8885
- constructor() {
8886
- }
8865
+ constructor() {}
8887
8866
  static getInstance() {
8888
8867
  if (!this._instance) {
8889
8868
  this._instance = new ContextAPI;
@@ -8972,13 +8951,11 @@ var require_NonRecordingSpan = __commonJS((exports2) => {
8972
8951
  updateName(_name) {
8973
8952
  return this;
8974
8953
  }
8975
- end(_endTime) {
8976
- }
8954
+ end(_endTime) {}
8977
8955
  isRecording() {
8978
8956
  return false;
8979
8957
  }
8980
- recordException(_exception, _time) {
8981
- }
8958
+ recordException(_exception, _time) {}
8982
8959
  }
8983
8960
  exports2.NonRecordingSpan = NonRecordingSpan;
8984
8961
  });
@@ -9280,8 +9257,7 @@ var require_tracestate_impl = __commonJS((exports2) => {
9280
9257
  const value = listMember.slice(i + 1, part.length);
9281
9258
  if ((0, tracestate_validators_1.validateKey)(key) && (0, tracestate_validators_1.validateValue)(value)) {
9282
9259
  agg.set(key, value);
9283
- } else {
9284
- }
9260
+ } else {}
9285
9261
  }
9286
9262
  return agg;
9287
9263
  }, new Map);
@@ -9353,8 +9329,7 @@ var require_metrics = __commonJS((exports2) => {
9353
9329
  var API_NAME2 = "metrics";
9354
9330
 
9355
9331
  class MetricsAPI {
9356
- constructor() {
9357
- }
9332
+ constructor() {}
9358
9333
  static getInstance() {
9359
9334
  if (!this._instance) {
9360
9335
  this._instance = new MetricsAPI;
@@ -9391,8 +9366,7 @@ var require_NoopTextMapPropagator = __commonJS((exports2) => {
9391
9366
  exports2.NoopTextMapPropagator = undefined;
9392
9367
 
9393
9368
  class NoopTextMapPropagator {
9394
- inject(_context, _carrier) {
9395
- }
9369
+ inject(_context, _carrier) {}
9396
9370
  extract(context, _carrier) {
9397
9371
  return context;
9398
9372
  }
@@ -9705,8 +9679,7 @@ class Registry {
9705
9679
  return this.kv.getByKey(identifier);
9706
9680
  }
9707
9681
  }
9708
- var init_registry = () => {
9709
- };
9682
+ var init_registry = () => {};
9710
9683
 
9711
9684
  // node_modules/superjson/dist/class-registry.js
9712
9685
  var ClassRegistry;
@@ -9791,8 +9764,7 @@ class CustomTransformerRegistry {
9791
9764
  return this.transfomers[name2];
9792
9765
  }
9793
9766
  }
9794
- var init_custom_transformer_registry = () => {
9795
- };
9767
+ var init_custom_transformer_registry = () => {};
9796
9768
 
9797
9769
  // node_modules/superjson/dist/is.js
9798
9770
  var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1), isUndefined = (payload) => typeof payload === "undefined", isNull = (payload) => payload === null, isPlainObject = (payload) => {
@@ -10137,8 +10109,7 @@ var getNthKey = (value, n) => {
10137
10109
  }
10138
10110
  return object2;
10139
10111
  };
10140
- var init_accessDeep = () => {
10141
- };
10112
+ var init_accessDeep = () => {};
10142
10113
 
10143
10114
  // node_modules/superjson/dist/plainer.js
10144
10115
  function traverse(tree, walker, origin = []) {
@@ -10727,8 +10698,7 @@ var require_NoopLogger = __commonJS((exports2) => {
10727
10698
  exports2.NOOP_LOGGER = exports2.NoopLogger = undefined;
10728
10699
 
10729
10700
  class NoopLogger {
10730
- emit(_logRecord) {
10731
- }
10701
+ emit(_logRecord) {}
10732
10702
  }
10733
10703
  exports2.NoopLogger = NoopLogger;
10734
10704
  exports2.NOOP_LOGGER = new NoopLogger;
@@ -10822,8 +10792,7 @@ var require_logs = __commonJS((exports2) => {
10822
10792
  var NoopLoggerProvider_1 = require_NoopLoggerProvider();
10823
10793
 
10824
10794
  class LogsAPI {
10825
- constructor() {
10826
- }
10795
+ constructor() {}
10827
10796
  static getInstance() {
10828
10797
  if (!this._instance) {
10829
10798
  this._instance = new LogsAPI;
@@ -11291,8 +11260,7 @@ var require_browser = __commonJS((exports2, module2) => {
11291
11260
  });
11292
11261
  args.splice(lastC, 0, c);
11293
11262
  }
11294
- exports2.log = console.debug || console.log || (() => {
11295
- });
11263
+ exports2.log = console.debug || console.log || (() => {});
11296
11264
  function save(namespaces) {
11297
11265
  try {
11298
11266
  if (namespaces) {
@@ -11300,15 +11268,13 @@ var require_browser = __commonJS((exports2, module2) => {
11300
11268
  } else {
11301
11269
  exports2.storage.removeItem("debug");
11302
11270
  }
11303
- } catch (error) {
11304
- }
11271
+ } catch (error) {}
11305
11272
  }
11306
11273
  function load() {
11307
11274
  let r;
11308
11275
  try {
11309
11276
  r = exports2.storage.getItem("debug");
11310
- } catch (error) {
11311
- }
11277
+ } catch (error) {}
11312
11278
  if (!r && typeof process !== "undefined" && "env" in process) {
11313
11279
  r = process.env.DEBUG;
11314
11280
  }
@@ -11317,8 +11283,7 @@ var require_browser = __commonJS((exports2, module2) => {
11317
11283
  function localstorage() {
11318
11284
  try {
11319
11285
  return localStorage;
11320
- } catch (error) {
11321
- }
11286
+ } catch (error) {}
11322
11287
  }
11323
11288
  module2.exports = require_common()(exports2);
11324
11289
  var { formatters } = module2.exports;
@@ -11450,8 +11415,7 @@ var require_node3 = __commonJS((exports2, module2) => {
11450
11415
  exports2.save = save;
11451
11416
  exports2.load = load;
11452
11417
  exports2.useColors = useColors;
11453
- exports2.destroy = util5.deprecate(() => {
11454
- }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
11418
+ exports2.destroy = util5.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
11455
11419
  exports2.colors = [6, 2, 3, 4, 5, 1];
11456
11420
  try {
11457
11421
  const supportsColor = require_supports_color();
@@ -11535,8 +11499,7 @@ var require_node3 = __commonJS((exports2, module2) => {
11535
11499
  221
11536
11500
  ];
11537
11501
  }
11538
- } catch (error) {
11539
- }
11502
+ } catch (error) {}
11540
11503
  exports2.inspectOpts = Object.keys(process.env).filter((key) => {
11541
11504
  return /^debug_/i.test(key);
11542
11505
  }).reduce((obj, key) => {
@@ -13785,8 +13748,7 @@ var require_jsbn = __commonJS((exports2, module2) => {
13785
13748
  ++this[w];
13786
13749
  }
13787
13750
  }
13788
- function NullExp() {
13789
- }
13751
+ function NullExp() {}
13790
13752
  function nNop(x) {
13791
13753
  return x;
13792
13754
  }
@@ -14211,8 +14173,7 @@ var require_jsbn = __commonJS((exports2, module2) => {
14211
14173
  for (i2 = 0;i2 < ba.length; ++i2)
14212
14174
  ba[i2] = rng_get_byte();
14213
14175
  }
14214
- function SecureRandom() {
14215
- }
14176
+ function SecureRandom() {}
14216
14177
  SecureRandom.prototype.nextBytes = rng_get_bytes;
14217
14178
  function Arcfour() {
14218
14179
  this.i = 0;
@@ -16435,8 +16396,7 @@ var require_delayed_stream = __commonJS((exports2, module2) => {
16435
16396
  delayedStream._handleEmit(arguments);
16436
16397
  return realEmit.apply(source, arguments);
16437
16398
  };
16438
- source.on("error", function() {
16439
- });
16399
+ source.on("error", function() {});
16440
16400
  if (delayedStream.pauseStream) {
16441
16401
  source.pause();
16442
16402
  }
@@ -25740,8 +25700,7 @@ var require_implementation = __commonJS((exports2, module2) => {
25740
25700
  }
25741
25701
  bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
25742
25702
  if (target.prototype) {
25743
- var Empty = function Empty() {
25744
- };
25703
+ var Empty = function Empty() {};
25745
25704
  Empty.prototype = target.prototype;
25746
25705
  bound.prototype = new Empty;
25747
25706
  Empty.prototype = null;
@@ -25861,8 +25820,7 @@ var require_get_intrinsic = __commonJS((exports2, module2) => {
25861
25820
  var getEvalledConstructor = function(expressionSyntax) {
25862
25821
  try {
25863
25822
  return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
25864
- } catch (e2) {
25865
- }
25823
+ } catch (e2) {}
25866
25824
  };
25867
25825
  var $gOPD = require_gopd();
25868
25826
  var $defineProperty = require_es_define_property();
@@ -26601,11 +26559,9 @@ var require_debug = __commonJS((exports2, module2) => {
26601
26559
  if (!debug) {
26602
26560
  try {
26603
26561
  debug = require_src4()("follow-redirects");
26604
- } catch (error) {
26605
- }
26562
+ } catch (error) {}
26606
26563
  if (typeof debug !== "function") {
26607
- debug = function() {
26608
- };
26564
+ debug = function() {};
26609
26565
  }
26610
26566
  }
26611
26567
  debug.apply(null, arguments);
@@ -26980,8 +26936,7 @@ var require_follow_redirects = __commonJS((exports2, module2) => {
26980
26936
  });
26981
26937
  return exports3;
26982
26938
  }
26983
- function noop2() {
26984
- }
26939
+ function noop2() {}
26985
26940
  function parseUrl(input) {
26986
26941
  var parsed;
26987
26942
  if (useNativeURL) {
@@ -27364,8 +27319,7 @@ var require_axios = __commonJS((exports2, module2) => {
27364
27319
  isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
27365
27320
  return obj;
27366
27321
  };
27367
- var noop2 = () => {
27368
- };
27322
+ var noop2 = () => {};
27369
27323
  var toFiniteNumber = (value, defaultValue) => {
27370
27324
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
27371
27325
  };
@@ -28818,8 +28772,7 @@ var require_axios = __commonJS((exports2, module2) => {
28818
28772
  try {
28819
28773
  const knownLength = await util__default["default"].promisify(data.getLength).call(data);
28820
28774
  Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
28821
- } catch (e2) {
28822
- }
28775
+ } catch (e2) {}
28823
28776
  }
28824
28777
  } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
28825
28778
  data.size && headers.setContentType(data.type || "application/octet-stream");
@@ -29093,13 +29046,11 @@ var require_axios = __commonJS((exports2, module2) => {
29093
29046
  this.write(name2, "", Date.now() - 86400000);
29094
29047
  }
29095
29048
  } : {
29096
- write() {
29097
- },
29049
+ write() {},
29098
29050
  read() {
29099
29051
  return null;
29100
29052
  },
29101
- remove() {
29102
- }
29053
+ remove() {}
29103
29054
  };
29104
29055
  var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
29105
29056
  function mergeConfig(config1, config2) {
@@ -29593,8 +29544,7 @@ var require_axios = __commonJS((exports2, module2) => {
29593
29544
  if (fn) {
29594
29545
  try {
29595
29546
  Object.defineProperty(fn, "name", { value });
29596
- } catch (e2) {
29597
- }
29547
+ } catch (e2) {}
29598
29548
  Object.defineProperty(fn, "adapterName", { value });
29599
29549
  }
29600
29550
  });
@@ -29744,8 +29694,7 @@ var require_axios = __commonJS((exports2, module2) => {
29744
29694
  err.stack += `
29745
29695
  ` + stack;
29746
29696
  }
29747
- } catch (e2) {
29748
- }
29697
+ } catch (e2) {}
29749
29698
  }
29750
29699
  throw err;
29751
29700
  }
@@ -31818,8 +31767,7 @@ var require_logger = __commonJS((exports2) => {
31818
31767
  Object.defineProperty(exports2, "__esModule", { value: true });
31819
31768
  exports2.DefaultLogger = undefined;
31820
31769
  exports2.DefaultLogger = {
31821
- silly: (...params) => {
31822
- },
31770
+ silly: (...params) => {},
31823
31771
  debug: (...params) => {
31824
31772
  console.log(new Date, params);
31825
31773
  },
@@ -34562,8 +34510,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
34562
34510
  kListener: Symbol("kListener"),
34563
34511
  kStatusCode: Symbol("status-code"),
34564
34512
  kWebSocket: Symbol("websocket"),
34565
- NOOP: () => {
34566
- }
34513
+ NOOP: () => {}
34567
34514
  };
34568
34515
  });
34569
34516
 
@@ -34641,8 +34588,7 @@ var require_buffer_util = __commonJS((exports2, module2) => {
34641
34588
  else
34642
34589
  bufferUtil.unmask(buffer, mask);
34643
34590
  };
34644
- } catch (e2) {
34645
- }
34591
+ } catch (e2) {}
34646
34592
  }
34647
34593
  });
34648
34594
 
@@ -35121,8 +35067,7 @@ var require_validation = __commonJS((exports2, module2) => {
35121
35067
  module2.exports.isValidUTF8 = function(buf) {
35122
35068
  return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
35123
35069
  };
35124
- } catch (e2) {
35125
- }
35070
+ } catch (e2) {}
35126
35071
  }
35127
35072
  });
35128
35073
 
@@ -37552,8 +37497,7 @@ var require_websocket_client = __commonJS((exports2) => {
37552
37497
  this.options = Object.assign({ pongTimeout: 7500, pingInterval: 1e4, reconnectTimeout: 500 }, options);
37553
37498
  this.listenKeyStateStore = {};
37554
37499
  this.wsUrlKeyMap = {};
37555
- this.on("error", () => {
37556
- });
37500
+ this.on("error", () => {});
37557
37501
  }
37558
37502
  getRestClientOptions() {
37559
37503
  return Object.assign(Object.assign(Object.assign({}, this.options), this.options.restOptions), { api_key: this.options.api_key, api_secret: this.options.api_secret });
@@ -38771,8 +38715,7 @@ var require_axios2 = __commonJS((exports2, module2) => {
38771
38715
  isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
38772
38716
  return obj;
38773
38717
  };
38774
- var noop2 = () => {
38775
- };
38718
+ var noop2 = () => {};
38776
38719
  var toFiniteNumber = (value2, defaultValue) => {
38777
38720
  return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
38778
38721
  };
@@ -40225,8 +40168,7 @@ var require_axios2 = __commonJS((exports2, module2) => {
40225
40168
  try {
40226
40169
  const knownLength = await util__default["default"].promisify(data.getLength).call(data);
40227
40170
  Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
40228
- } catch (e2) {
40229
- }
40171
+ } catch (e2) {}
40230
40172
  }
40231
40173
  } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
40232
40174
  data.size && headers.setContentType(data.type || "application/octet-stream");
@@ -40500,13 +40442,11 @@ var require_axios2 = __commonJS((exports2, module2) => {
40500
40442
  this.write(name2, "", Date.now() - 86400000);
40501
40443
  }
40502
40444
  } : {
40503
- write() {
40504
- },
40445
+ write() {},
40505
40446
  read() {
40506
40447
  return null;
40507
40448
  },
40508
- remove() {
40509
- }
40449
+ remove() {}
40510
40450
  };
40511
40451
  var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
40512
40452
  function mergeConfig(config1, config2) {
@@ -41000,8 +40940,7 @@ var require_axios2 = __commonJS((exports2, module2) => {
41000
40940
  if (fn) {
41001
40941
  try {
41002
40942
  Object.defineProperty(fn, "name", { value: value2 });
41003
- } catch (e2) {
41004
- }
40943
+ } catch (e2) {}
41005
40944
  Object.defineProperty(fn, "adapterName", { value: value2 });
41006
40945
  }
41007
40946
  });
@@ -41151,8 +41090,7 @@ var require_axios2 = __commonJS((exports2, module2) => {
41151
41090
  err.stack += `
41152
41091
  ` + stack;
41153
41092
  }
41154
- } catch (e2) {
41155
- }
41093
+ } catch (e2) {}
41156
41094
  }
41157
41095
  throw err;
41158
41096
  }
@@ -42021,8 +41959,7 @@ var require_logger2 = __commonJS((exports2) => {
42021
41959
  Object.defineProperty(exports2, "__esModule", { value: true });
42022
41960
  exports2.DefaultLogger = undefined;
42023
41961
  exports2.DefaultLogger = {
42024
- trace: (..._params) => {
42025
- },
41962
+ trace: (..._params) => {},
42026
41963
  info: (...params) => {
42027
41964
  console.info(params);
42028
41965
  },
@@ -44068,8 +44005,7 @@ var require_BaseWSClient = __commonJS((exports2) => {
44068
44005
  if (wsState === null || wsState === undefined ? undefined : wsState.activePongTimer) {
44069
44006
  clearTimeout(wsState.activePongTimer);
44070
44007
  wsState.activePongTimer = undefined;
44071
- } else {
44072
- }
44008
+ } else {}
44073
44009
  }
44074
44010
  clearReconnectTimer(wsKey) {
44075
44011
  const wsState = this.wsStore.get(wsKey);
@@ -44947,8 +44883,7 @@ module.exports = __toCommonJS(exports_mcp_server);
44947
44883
  var util;
44948
44884
  (function(util2) {
44949
44885
  util2.assertEqual = (val) => val;
44950
- function assertIs(_arg) {
44951
- }
44886
+ function assertIs(_arg) {}
44952
44887
  util2.assertIs = assertIs;
44953
44888
  function assertNever(_x) {
44954
44889
  throw new Error;
@@ -50303,8 +50238,7 @@ function parseStringDef(def, refs) {
50303
50238
  case "trim":
50304
50239
  break;
50305
50240
  default:
50306
- ((_) => {
50307
- })(check);
50241
+ ((_) => {})(check);
50308
50242
  }
50309
50243
  }
50310
50244
  }
@@ -51694,8 +51628,7 @@ class StdioServerTransport {
51694
51628
  var util2;
51695
51629
  (function(util3) {
51696
51630
  util3.assertEqual = (val) => val;
51697
- function assertIs(_arg) {
51698
- }
51631
+ function assertIs(_arg) {}
51699
51632
  util3.assertIs = assertIs;
51700
51633
  function assertNever(_x) {
51701
51634
  throw new Error;
@@ -56556,8 +56489,7 @@ var API_NAME = "task-context";
56556
56489
 
56557
56490
  class TaskContextAPI {
56558
56491
  static _instance;
56559
- constructor() {
56560
- }
56492
+ constructor() {}
56561
56493
  static getInstance() {
56562
56494
  if (!this._instance) {
56563
56495
  this._instance = new TaskContextAPI;
@@ -56977,8 +56909,7 @@ class ParseError extends Error {
56977
56909
  super(message2), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
56978
56910
  }
56979
56911
  }
56980
- function noop(_arg) {
56981
- }
56912
+ function noop(_arg) {}
56982
56913
  function createParser(callbacks) {
56983
56914
  if (typeof callbacks == "function")
56984
56915
  throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
@@ -57181,8 +57112,7 @@ async function _doZodFetchWithRetries(schema, url, requestInit, options, attempt
57181
57112
  if (error instanceof ApiError) {
57182
57113
  throw error;
57183
57114
  }
57184
- if (error instanceof import_zod_validation_error.ValidationError) {
57185
- }
57115
+ if (error instanceof import_zod_validation_error.ValidationError) {}
57186
57116
  if (options?.retry) {
57187
57117
  const retry = { ...defaultRetryOptions2, ...options.retry };
57188
57118
  const delay = calculateNextRetryDelay(retry, attempt);
@@ -57656,8 +57586,7 @@ class ApiClientMissingError extends Error {
57656
57586
 
57657
57587
  class APIClientManagerAPI {
57658
57588
  static _instance;
57659
- constructor() {
57660
- }
57589
+ constructor() {}
57661
57590
  static getInstance() {
57662
57591
  if (!this._instance) {
57663
57592
  this._instance = new APIClientManagerAPI;
@@ -58212,8 +58141,7 @@ var PrefetchQueue = class {
58212
58141
  if (__privateGet(this, _queueTailUrl) && !__privateGet(this, _prefetchQueue).has(__privateGet(this, _queueTailUrl))) {
58213
58142
  __privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, __privateGet(this, _queueTailUrl), args[1]);
58214
58143
  }
58215
- }).catch(() => {
58216
- });
58144
+ }).catch(() => {});
58217
58145
  return request;
58218
58146
  }
58219
58147
  };
@@ -58244,10 +58172,8 @@ prefetch_fn = function(...args) {
58244
58172
  }
58245
58173
  __privateSet(this, _queueTailUrl, nextUrl);
58246
58174
  return __privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, nextUrl, args[1]);
58247
- }).catch(() => {
58248
- });
58249
- } catch (_) {
58250
- }
58175
+ }).catch(() => {});
58176
+ } catch (_) {}
58251
58177
  };
58252
58178
  function getNextChunkUrl(url, res) {
58253
58179
  const shapeHandle = res.headers.get(SHAPE_HANDLE_HEADER);
@@ -58350,8 +58276,7 @@ var ShapeStream = class {
58350
58276
  get lastOffset() {
58351
58277
  return __privateGet(this, _lastOffset);
58352
58278
  }
58353
- subscribe(callback, onError = () => {
58354
- }) {
58279
+ subscribe(callback, onError = () => {}) {
58355
58280
  const subscriptionId = Math.random();
58356
58281
  __privateGet(this, _subscribers).set(subscriptionId, [callback, onError]);
58357
58282
  return () => {
@@ -59545,8 +59470,7 @@ class SimpleClock {
59545
59470
  const nowStruct = now.toStruct();
59546
59471
  return [nowStruct.seconds, nowStruct.nanos];
59547
59472
  }
59548
- reset() {
59549
- }
59473
+ reset() {}
59550
59474
  }
59551
59475
 
59552
59476
  // node_modules/@trigger.dev/core/dist/esm/v3/clock/index.js
@@ -59555,8 +59479,7 @@ var SIMPLE_CLOCK = new SimpleClock;
59555
59479
 
59556
59480
  class ClockAPI {
59557
59481
  static _instance;
59558
- constructor() {
59559
- }
59482
+ constructor() {}
59560
59483
  static getInstance() {
59561
59484
  if (!this._instance) {
59562
59485
  this._instance = new ClockAPI;
@@ -59582,8 +59505,7 @@ var clock = ClockAPI.getInstance();
59582
59505
 
59583
59506
  // node_modules/@trigger.dev/core/dist/esm/v3/usage/noopUsageManager.js
59584
59507
  class NoopUsageManager {
59585
- disable() {
59586
- }
59508
+ disable() {}
59587
59509
  start() {
59588
59510
  return {
59589
59511
  sample: () => ({ cpuTime: 0, wallTime: 0 })
@@ -59606,8 +59528,7 @@ var NOOP_USAGE_MANAGER = new NoopUsageManager;
59606
59528
 
59607
59529
  class UsageAPI {
59608
59530
  static _instance;
59609
- constructor() {
59610
- }
59531
+ constructor() {}
59611
59532
  static getInstance() {
59612
59533
  if (!this._instance) {
59613
59534
  this._instance = new UsageAPI;
@@ -59667,8 +59588,7 @@ class NoopRunMetadataManager {
59667
59588
  refresh(requestOptions) {
59668
59589
  throw new Error("Method not implemented.");
59669
59590
  }
59670
- enterWithMetadata(metadata) {
59671
- }
59591
+ enterWithMetadata(metadata) {}
59672
59592
  current() {
59673
59593
  throw new Error("Method not implemented.");
59674
59594
  }
@@ -59724,8 +59644,7 @@ var NOOP_MANAGER = new NoopRunMetadataManager;
59724
59644
 
59725
59645
  class RunMetadataAPI {
59726
59646
  static _instance;
59727
- constructor() {
59728
- }
59647
+ constructor() {}
59729
59648
  static getInstance() {
59730
59649
  if (!this._instance) {
59731
59650
  this._instance = new RunMetadataAPI;
@@ -59810,8 +59729,7 @@ var NOOP_TIMEOUT_MANAGER = new NoopTimeoutManager;
59810
59729
 
59811
59730
  class TimeoutAPI {
59812
59731
  static _instance;
59813
- constructor() {
59814
- }
59732
+ constructor() {}
59815
59733
  static getInstance() {
59816
59734
  if (!this._instance) {
59817
59735
  this._instance = new TimeoutAPI;
@@ -60210,8 +60128,7 @@ function getTokenPayload(e2) {
60210
60128
  return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
60211
60129
  }).join(""));
60212
60130
  return JSON.parse(t2) || {};
60213
- } catch (e3) {
60214
- }
60131
+ } catch (e3) {}
60215
60132
  return {};
60216
60133
  }
60217
60134
  function isTokenExpired(e2, t2 = 0) {
@@ -60265,8 +60182,7 @@ class BaseAuthStore {
60265
60182
  let n = {};
60266
60183
  try {
60267
60184
  n = JSON.parse(s2), (typeof n === null || typeof n != "object" || Array.isArray(n)) && (n = {});
60268
- } catch (e3) {
60269
- }
60185
+ } catch (e3) {}
60270
60186
  this.save(n.token || "", n.record || n.model || null);
60271
60187
  }
60272
60188
  exportToCookie(e2, t2 = i) {
@@ -60413,8 +60329,7 @@ class RealtimeService extends BaseService {
60413
60329
  let i3;
60414
60330
  try {
60415
60331
  i3 = JSON.parse(s3?.data);
60416
- } catch {
60417
- }
60332
+ } catch {}
60418
60333
  t2(i3 || {});
60419
60334
  };
60420
60335
  return this.subscriptions[i2] || (this.subscriptions[i2] = []), this.subscriptions[i2].push(listener), this.isConnected ? this.subscriptions[i2].length === 1 ? await this.submitSubscriptions() : this.eventSource?.addEventListener(i2, listener) : await this.connect(), async () => this.unsubscribeByTopicAndListener(e2, listener);
@@ -61127,8 +61042,7 @@ class Client {
61127
61042
  let s3 = {};
61128
61043
  try {
61129
61044
  s3 = await e3.json();
61130
- } catch (e4) {
61131
- }
61045
+ } catch (e4) {}
61132
61046
  if (this.afterSend && (s3 = await this.afterSend(e3, s3, t2)), e3.status >= 400)
61133
61047
  throw new ClientResponseError({ url: e3.url, status: e3.status, data: s3 });
61134
61048
  return s3;
@@ -62655,8 +62569,7 @@ class Signal {
62655
62569
  support: kind === "long" ? _stop_loss : this.support
62656
62570
  };
62657
62571
  const instance = new Signal(derivedConfig);
62658
- if (kind === "short") {
62659
- }
62572
+ if (kind === "short") {}
62660
62573
  let result = instance.get_bulk_trade_zones({ current_price, kind });
62661
62574
  return result;
62662
62575
  return result?.filter((x) => {
@@ -62874,8 +62787,7 @@ class Signal {
62874
62787
  kind = "long",
62875
62788
  raw
62876
62789
  }) {
62877
- if (raw) {
62878
- }
62790
+ if (raw) {}
62879
62791
  const margin_range = this.get_margin_range(current_price, kind);
62880
62792
  let margin_zones = this.get_margin_zones({ current_price });
62881
62793
  let remaining_zones = margin_zones.filter((x) => JSON.stringify(x) != JSON.stringify(margin_range));
@@ -63102,8 +63014,7 @@ class Signal {
63102
63014
  return true;
63103
63015
  });
63104
63016
  let total_orders = limit_trades.concat(market_trades);
63105
- if (kind === "short") {
63106
- }
63017
+ if (kind === "short") {}
63107
63018
  if (this.minimum_size && total_orders.length > 0) {
63108
63019
  let payload = total_orders;
63109
63020
  let greater_than_min_size = total_orders.filter((o) => o ? o.quantity >= this.minimum_size : true);
@@ -63189,8 +63100,7 @@ class Signal {
63189
63100
  });
63190
63101
  const multiplier = start - index;
63191
63102
  const incurred_fees = fees.reduce((a, b) => a + b, 0) + previous_risks.reduce((a, b) => a + b, 0);
63192
- if (index === 0) {
63193
- }
63103
+ if (index === 0) {}
63194
63104
  let quantity = determine_position_size({
63195
63105
  entry,
63196
63106
  stop,
@@ -63576,8 +63486,7 @@ function buildConfig(app_config, {
63576
63486
  return [];
63577
63487
  }
63578
63488
  const condition = (kind === "long" ? entry > app_config.support : entry >= app_config.support) && stop >= app_config.support * 0.999;
63579
- if (kind === "short") {
63580
- }
63489
+ if (kind === "short") {}
63581
63490
  console.log({ entry, stop, condition, working_risk, config: config2 });
63582
63491
  const result = entry === stop ? [] : condition ? instance.build_entry({
63583
63492
  current_price: entry,
@@ -64595,6 +64504,31 @@ function constructAppConfig(payload) {
64595
64504
  const appConfig = buildAppConfig(global_config, options);
64596
64505
  return appConfig;
64597
64506
  }
64507
+ function generateDangerousConfig(payload) {
64508
+ const { account, global_config, config: config2 } = payload;
64509
+ const app_config = constructAppConfig({
64510
+ account,
64511
+ global_config,
64512
+ kelly_config: {}
64513
+ });
64514
+ const { optimal_risk, optimal_stop } = getOptimumStopAndRisk(app_config, {
64515
+ max_size: config2.quantity,
64516
+ target_stop: config2.stop
64517
+ });
64518
+ const optimumRiskReward = computeRiskReward({
64519
+ app_config,
64520
+ entry: config2.entry,
64521
+ stop: optimal_stop,
64522
+ risk_per_trade: optimal_risk,
64523
+ target_loss: optimal_risk
64524
+ });
64525
+ return {
64526
+ entry: config2.entry,
64527
+ risk: optimal_risk,
64528
+ stop: optimal_stop,
64529
+ risk_reward: optimumRiskReward
64530
+ };
64531
+ }
64598
64532
  // src/helpers/strategy.ts
64599
64533
  class Strategy {
64600
64534
  position;
@@ -65666,8 +65600,7 @@ async function createLimitPurchaseOrdersParallel(client, symbol, priceFormat, qu
65666
65600
  const splitOrders = (inputOrders) => {
65667
65601
  const result = [];
65668
65602
  for (const o of inputOrders) {
65669
- if (o.take_profit) {
65670
- }
65603
+ if (o.take_profit) {}
65671
65604
  if (o.stop && !o.side) {
65672
65605
  result.push({
65673
65606
  price: o.price,
@@ -66562,8 +66495,7 @@ async function createLimitPurchaseOrders(client, symbol, priceFormat, quantityFo
66562
66495
  const splitOrders = (inputOrders) => {
66563
66496
  const result = [];
66564
66497
  for (const o of inputOrders) {
66565
- if (o.take_profit) {
66566
- }
66498
+ if (o.take_profit) {}
66567
66499
  if (o.stop && !o.side) {
66568
66500
  result.push({
66569
66501
  price: o.price,
@@ -67115,10 +67047,8 @@ class BybitExchange extends BaseExchange {
67115
67047
  sellLeverage: payload.leverage.toString()
67116
67048
  });
67117
67049
  }
67118
- async generateConfig(payload) {
67119
- }
67120
- async checkDelistedMovers(payload) {
67121
- }
67050
+ async generateConfig(payload) {}
67051
+ async checkDelistedMovers(payload) {}
67122
67052
  async getAllOpenOrders() {
67123
67053
  const result = await getAllOpenOrders2({ client: this.client });
67124
67054
  return result;
@@ -67129,13 +67059,11 @@ class BybitExchange extends BaseExchange {
67129
67059
  async getDelistedSpotSymbols() {
67130
67060
  return [];
67131
67061
  }
67132
- async crossAccountTransfer(payload) {
67133
- }
67062
+ async crossAccountTransfer(payload) {}
67134
67063
  getOpenOrders(payload) {
67135
67064
  return getOpenOrders2(this.client, payload.symbol);
67136
67065
  }
67137
- async placeBadStopEntry(payload) {
67138
- }
67066
+ async placeBadStopEntry(payload) {}
67139
67067
  }
67140
67068
 
67141
67069
  // src/helpers/accounts.ts
@@ -67242,14 +67170,24 @@ function build_reduce_config(payload) {
67242
67170
  } = payload;
67243
67171
  const long_position = _positions.find((x) => x.kind === "long");
67244
67172
  const short_position = _positions.find((x) => x.kind === "short");
67173
+ let long_target_pnl = long_position?.target_pnl || 0;
67174
+ let short_target_pnl = short_position?.target_pnl || 0;
67175
+ if (long_config.profit_percent && long_position?.entry) {
67176
+ const sell_price = (1 + long_config.profit_percent / 100) * long_position.entry;
67177
+ long_target_pnl = Math.abs(sell_price - long_position.entry) * long_position.quantity;
67178
+ }
67179
+ if (short_config.profit_percent && short_position?.entry) {
67180
+ const buy_price = (1 - short_config.profit_percent / 100) * short_position.entry;
67181
+ short_target_pnl = Math.abs(short_position.entry - buy_price) * short_position.quantity;
67182
+ }
67245
67183
  return {
67246
67184
  trigger_short: true,
67247
67185
  trigger_long: true,
67248
67186
  symbol,
67249
67187
  short_minimum_pnl,
67250
67188
  long_minimum_pnl,
67251
- short_profit: short_position?.target_pnl || 0,
67252
- long_profit: long_position?.target_pnl || 0,
67189
+ short_profit: short_target_pnl,
67190
+ long_profit: long_target_pnl,
67253
67191
  owner: account.owner,
67254
67192
  exchange: account.exchange,
67255
67193
  not_reduce,
@@ -67566,6 +67504,10 @@ class ExchangePosition {
67566
67504
  if (this.instance.expand.proxy) {
67567
67505
  const result = this.instance.expand.proxy;
67568
67506
  const { type, ip_address } = result;
67507
+ console.log("exchange", {
67508
+ owner: this.account.owner,
67509
+ exchange: this.account.exchange
67510
+ });
67569
67511
  console.log("position", type, ip_address);
67570
67512
  if (type === "http") {
67571
67513
  return new import_https_proxy_agent2.HttpsProxyAgent(`http://${ip_address}`);
@@ -67604,7 +67546,7 @@ class ExchangePosition {
67604
67546
  if (payload?.params) {
67605
67547
  const db_position = this.instance;
67606
67548
  if (db_position) {
67607
- const config2 = db_position.expand?.config;
67549
+ const config2 = db_position.expand?.b_config;
67608
67550
  const params = {
67609
67551
  entry: payload.params.entry !== undefined ? payload.params.entry : config2?.entry,
67610
67552
  stop: payload.params.stop !== undefined ? payload.params.stop : config2?.stop,
@@ -67985,7 +67927,6 @@ class ExchangePosition {
67985
67927
  place
67986
67928
  });
67987
67929
  }
67988
- const rr = await this.refresh(true);
67989
67930
  await this.updateConfigPnl();
67990
67931
  if (tp) {
67991
67932
  await this.exchange_account.placeProfitAndStop({
@@ -67995,7 +67936,6 @@ class ExchangePosition {
67995
67936
  });
67996
67937
  }
67997
67938
  return [];
67998
- return rr.existingOrders;
67999
67939
  }
68000
67940
  async placeStopLimit(payload) {
68001
67941
  const { place, stop, quantity: _quantity } = payload;
@@ -68469,14 +68409,29 @@ class ExchangePosition {
68469
68409
  });
68470
68410
  }
68471
68411
  const last_order = focus_position.instance.last_order;
68472
- const take_profit = this.instance.take_profit;
68473
- if (this.kind === "short" && last_order && take_profit) {
68474
- const reduce_ratio = take_profit < last_order ? 1 : 0;
68475
- await this.getConfig({
68476
- params: {
68477
- reduce_ratio
68412
+ let take_profit;
68413
+ if (this.instance.tp?.price) {
68414
+ take_profit = to_f(this.instance.tp?.price, this.symbol_config.price_places);
68415
+ if (this.kind === "short" && last_order && take_profit) {
68416
+ const reduce_ratio = take_profit < last_order ? 1 : 0;
68417
+ await this.getConfig({
68418
+ params: {
68419
+ reduce_ratio
68420
+ }
68421
+ });
68422
+ }
68423
+ if (this.instance.quantity > 0) {
68424
+ if (focus_position.kind === "long" && focus_position.instance.stop_loss && take_profit > focus_position.appConfig.stop && focus_position.instance.stop_loss?.price) {
68425
+ await focus_position.cancelExchangeOrder({
68426
+ type: "stop"
68427
+ });
68478
68428
  }
68479
- });
68429
+ if (focus_position.kind === "short" && focus_position.instance.stop_loss && take_profit < focus_position.appConfig.stop && focus_position.instance.stop_loss?.price) {
68430
+ await focus_position.cancelExchangeOrder({
68431
+ type: "stop"
68432
+ });
68433
+ }
68434
+ }
68480
68435
  }
68481
68436
  return { profit_percent, take_profit, last_order };
68482
68437
  }
@@ -68504,6 +68459,21 @@ class ExchangePosition {
68504
68459
  }
68505
68460
  return result;
68506
68461
  }
68462
+ placeDangerousTrade(payload) {
68463
+ const { ...rest } = payload;
68464
+ const expected_quantity = rest.quantity;
68465
+ const entry = rest.entry;
68466
+ const stop = rest.stop;
68467
+ return generateDangerousConfig({
68468
+ account: this.instance,
68469
+ global_config: this.symbol_config,
68470
+ config: {
68471
+ entry,
68472
+ stop,
68473
+ quantity: expected_quantity
68474
+ }
68475
+ });
68476
+ }
68507
68477
  }
68508
68478
  function convert_to_exchange_order(order) {
68509
68479
  return {
@@ -68569,8 +68539,7 @@ class ExchangeAccount {
68569
68539
  async initializePositions(payload) {
68570
68540
  const raw_positions = await this.syncAccount({
68571
68541
  update: payload.update,
68572
- symbol: payload.symbol,
68573
- live_refresh: payload.update
68542
+ symbol: payload.symbol
68574
68543
  });
68575
68544
  const positions = await this.syncAccount({
68576
68545
  symbol: payload.symbol,
@@ -68582,6 +68551,7 @@ class ExchangeAccount {
68582
68551
  const active_account = await this.getActiveAccount({
68583
68552
  symbol: payload.symbol
68584
68553
  });
68554
+ console.log("active_account", payload);
68585
68555
  const long_position = positions.find((x) => x.kind === "long");
68586
68556
  const short_position = positions.find((x) => x.kind === "short");
68587
68557
  this.long_position = new ExchangePosition({
@@ -68657,6 +68627,9 @@ class ExchangeAccount {
68657
68627
  });
68658
68628
  if (options.kind) {
68659
68629
  let position2 = db_positions2.find((x) => x.kind === options.kind);
68630
+ if (position2.symbol !== symbol) {
68631
+ throw new Error("Symbol mismatch");
68632
+ }
68660
68633
  return position2;
68661
68634
  }
68662
68635
  return db_positions2;
@@ -68667,7 +68640,11 @@ class ExchangeAccount {
68667
68640
  leverage: options.leverage
68668
68641
  });
68669
68642
  if (options.kind) {
68670
- return db_positions.find((x) => x.kind === options.kind);
68643
+ const result = db_positions.find((x) => x.kind === options.kind);
68644
+ if (result.symbol !== symbol) {
68645
+ throw new Error("Symbol mismatch");
68646
+ }
68647
+ return result;
68671
68648
  }
68672
68649
  return db_positions;
68673
68650
  }
@@ -68722,14 +68699,18 @@ class ExchangeAccount {
68722
68699
  }
68723
68700
  async getFocusPosition(payload) {
68724
68701
  const { symbol, kind, update = false } = payload;
68702
+ console.log("payload", payload);
68725
68703
  let focus_position = kind === "long" ? this.long_position : this.short_position;
68726
- if (!focus_position) {
68704
+ if (!focus_position || focus_position.symbol !== symbol) {
68727
68705
  focus_position = await this.initializePositions({
68728
68706
  symbol,
68729
68707
  kind,
68730
68708
  update
68731
68709
  });
68732
68710
  }
68711
+ if (focus_position.symbol !== symbol) {
68712
+ throw new Error("Symbol mismatch");
68713
+ }
68733
68714
  return focus_position;
68734
68715
  }
68735
68716
  async cancelOrders(payload) {
@@ -68848,7 +68829,10 @@ class ExchangeAccount {
68848
68829
  return await focus_position.getOrCreatePositionConfig(payload);
68849
68830
  }
68850
68831
  async getPositionConfig(payload) {
68851
- const focus_position = await this.getFocusPosition(payload);
68832
+ const focus_position = await this.getFocusPosition({
68833
+ ...payload,
68834
+ update: !Boolean(payload.params)
68835
+ });
68852
68836
  return await focus_position.getConfig({
68853
68837
  params: payload.params
68854
68838
  });
@@ -68883,6 +68867,7 @@ class ExchangeAccount {
68883
68867
  long_config,
68884
68868
  short_config
68885
68869
  });
68870
+ console.log("config", config2);
68886
68871
  if (!long_config || !short_config) {
68887
68872
  return null;
68888
68873
  }
@@ -69925,10 +69910,19 @@ class ExchangeAccount {
69925
69910
  const focus_position = await this.getFocusPosition(payload);
69926
69911
  return await focus_position.placeStopLimit(payload);
69927
69912
  }
69913
+ async placeDangerousTrade(payload) {
69914
+ const { symbol, config: config2, kind } = payload;
69915
+ const focus_position = await this.getFocusPosition({
69916
+ symbol,
69917
+ kind
69918
+ });
69919
+ return focus_position.placeDangerousTrade(config2);
69920
+ }
69928
69921
  async placeTrade(payload) {
69929
69922
  const focus_position = await this.getFocusPosition({
69930
69923
  symbol: payload.symbol,
69931
- kind: payload.kind
69924
+ kind: payload.kind,
69925
+ update: true
69932
69926
  });
69933
69927
  return await focus_position.placeTrade(payload);
69934
69928
  }
@@ -69987,8 +69981,13 @@ class ExchangeAccount {
69987
69981
  const opposite_config = focus_position.getOppositeConfig({
69988
69982
  ratio: reward_factor
69989
69983
  });
69984
+ console.log("opposite_config", opposite_config);
69990
69985
  const reverse_config = await reversePosition.getConfig();
69991
- if ((reverse_config.entry !== opposite_config.entry || reverse_config.stop !== opposite_config.stop || reverse_config.risk !== opposite_config.risk || reverse_config.risk_reward !== opposite_config.risk_reward) && focus_position.getInstance().quantity > 0) {
69986
+ let condition = (reverse_config.entry !== opposite_config.entry || reverse_config.stop !== opposite_config.stop || reverse_config.risk !== opposite_config.risk || reverse_config.risk_reward !== opposite_config.risk_reward) && focus_position.getInstance().quantity > 0;
69987
+ if (reversePosition.getInstance().quantity === 0 && focus_position.getInstance().quantity > 0) {
69988
+ condition = true;
69989
+ }
69990
+ if (condition) {
69992
69991
  console.log("Updating reverse config for ", symbol, kind, "with opposite config", opposite_config);
69993
69992
  await reversePosition.getConfig({
69994
69993
  params: {
@@ -70156,8 +70155,7 @@ class ExchangeAccount {
70156
70155
  full_ratio
70157
70156
  });
70158
70157
  }
70159
- async placeCompoundShortTrade(payload) {
70160
- }
70158
+ async placeCompoundShortTrade(payload) {}
70161
70159
  async placeCompoundLongTrade(payload) {
70162
70160
  const { symbol, params, place = false } = payload;
70163
70161
  if (place) {
@@ -70845,8 +70843,7 @@ async function fetchExchangeDetails(payload) {
70845
70843
  }
70846
70844
 
70847
70845
  // src/mcp-server.ts
70848
- console.log = (...args) => {
70849
- };
70846
+ console.log = (...args) => {};
70850
70847
  var server = new McpServer({
70851
70848
  name: "ultimate-trader",
70852
70849
  version: "0.0.1",