coinrayjs 2.0.18 → 2.0.19

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.
@@ -9748,7 +9748,7 @@ var $p = void 0, em = class {
9748
9748
  $p = e, console.log("Coinray I18n initialized");
9749
9749
  };
9750
9750
  static t = (e, t) => $p ? $p.t(`coinray:${e}`, t) : `i18n uninitialized. Set the Coinray.I18n.instance. Key: ${e}`;
9751
- }, tm = "2.0.17", nm = class extends Error {
9751
+ }, tm = "2.0.19", nm = class extends Error {
9752
9752
  errorCode;
9753
9753
  errorMessage;
9754
9754
  exchange;
@@ -10935,7 +10935,174 @@ var $p = void 0, em = class {
10935
10935
  }
10936
10936
  this.pendingAdditions.clear(), this.pendingRemovals.clear();
10937
10937
  }
10938
- }, cm = 12e4, lm = 6e5, um = 6e5, dm = 6e5, fm = 250, pm = 10, mm = (e) => mo.default.uniq((Array.isArray(e) ? e : [e]).map((e) => `${e}`.split("_")[0])), hm = class extends im {
10938
+ }, cm = 10, lm = /\s*(?:(\d+(?:\.\d+)?(?![A-Za-z0-9_.]))|([A-Za-z0-9_.:]+(?:-[A-Za-z0-9_.:]+)*)|([-+*/()×÷]))\s*/y, um = {
10939
+ "+": "+",
10940
+ "-": "−",
10941
+ "*": "×",
10942
+ "/": "÷"
10943
+ }, dm = (e) => /[\s+*/()×÷]/.test(`${e}`);
10944
+ function fm(e) {
10945
+ let t = [];
10946
+ for (lm.lastIndex = 0; lm.lastIndex < e.length;) {
10947
+ let n = lm.lastIndex, r = lm.exec(e);
10948
+ if (!r) throw Error(`Invalid formula at "${e.slice(n)}"`);
10949
+ if (r[1] !== void 0) t.push({
10950
+ kind: "num",
10951
+ value: r[1]
10952
+ });
10953
+ else if (r[2] !== void 0) {
10954
+ if (r[2].split("_").length < 3) throw Error(`Invalid market "${r[2]}" in formula`);
10955
+ t.push({
10956
+ kind: "leg",
10957
+ value: r[2]
10958
+ });
10959
+ } else t.push({
10960
+ kind: "op",
10961
+ value: r[3] === "×" ? "*" : r[3] === "÷" ? "/" : r[3]
10962
+ });
10963
+ }
10964
+ return t;
10965
+ }
10966
+ function pm(e) {
10967
+ let t = fm(e), n = 0, r = () => t[n]?.kind === "op" ? t[n].value : void 0, i = () => {
10968
+ let e = a();
10969
+ for (; r() === "+" || r() === "-";) e = {
10970
+ type: "op",
10971
+ op: t[n++].value,
10972
+ left: e,
10973
+ right: a()
10974
+ };
10975
+ return e;
10976
+ }, a = () => {
10977
+ let e = o();
10978
+ for (; r() === "*" || r() === "/";) e = {
10979
+ type: "op",
10980
+ op: t[n++].value,
10981
+ left: e,
10982
+ right: o()
10983
+ };
10984
+ return e;
10985
+ }, o = () => r() === "-" ? (n++, {
10986
+ type: "neg",
10987
+ arg: o()
10988
+ }) : s(), s = () => {
10989
+ let e = t[n++];
10990
+ if (!e) throw Error("Invalid formula: unexpected end");
10991
+ if (e.kind === "num") return {
10992
+ type: "num",
10993
+ value: Number(e.value)
10994
+ };
10995
+ if (e.kind === "leg") return {
10996
+ type: "leg",
10997
+ symbol: e.value
10998
+ };
10999
+ if (e.value === "(") {
11000
+ let e = i();
11001
+ if (t[n++]?.value !== ")") throw Error("Invalid formula: missing )");
11002
+ return e;
11003
+ }
11004
+ throw Error(`Invalid formula: unexpected "${e.value}"`);
11005
+ }, c = i();
11006
+ if (n < t.length) throw Error(`Invalid formula: unexpected "${t[n].value}"`);
11007
+ let l = mm(c);
11008
+ if (l.length === 0) throw Error("Invalid formula: no markets");
11009
+ if (l.length > cm) throw Error(`Invalid formula: max ${cm} markets`);
11010
+ return c;
11011
+ }
11012
+ function mm(e, t = []) {
11013
+ return e.type === "leg" && !t.includes(e.symbol) && t.push(e.symbol), e.type === "neg" && mm(e.arg, t), e.type === "op" && (mm(e.left, t), mm(e.right, t)), t;
11014
+ }
11015
+ function hm(e, t) {
11016
+ switch (e.type) {
11017
+ case "num": return e.value;
11018
+ case "leg": return t(e.symbol);
11019
+ case "neg": return -hm(e.arg, t);
11020
+ case "op": {
11021
+ let n = hm(e.left, t), r = hm(e.right, t);
11022
+ return e.op === "+" ? n + r : e.op === "-" ? n - r : e.op === "*" ? n * r : r === 0 ? NaN : n / r;
11023
+ }
11024
+ }
11025
+ }
11026
+ var gm = (e, t) => ({
11027
+ time: t,
11028
+ open: e.close,
11029
+ high: e.close,
11030
+ low: e.close,
11031
+ close: e.close,
11032
+ baseVolume: 0,
11033
+ quoteVolume: 0,
11034
+ numTrades: 0
11035
+ });
11036
+ function _m(e, t, n) {
11037
+ let r = (n) => hm(e, (e) => Number(t[e][n])), i = r("open"), a = r("close"), o = r("high"), s = r("low");
11038
+ return [
11039
+ i,
11040
+ a,
11041
+ o,
11042
+ s
11043
+ ].every(Number.isFinite) ? {
11044
+ time: n,
11045
+ open: i,
11046
+ close: a,
11047
+ high: Math.max(i, a, o, s),
11048
+ low: Math.min(i, a, o, s),
11049
+ baseVolume: 0,
11050
+ quoteVolume: 0,
11051
+ numTrades: 0
11052
+ } : null;
11053
+ }
11054
+ function vm(e, t) {
11055
+ if (e.some((e) => !t[e]?.length)) return [];
11056
+ let n = Math.max(...e.map((e) => t[e][0].time.getTime())), r = [...new Set(e.flatMap((e) => t[e].map((e) => e.time.getTime())))].filter((e) => e >= n).sort((e, t) => e - t), i = {}, a = {};
11057
+ return r.map((n) => {
11058
+ let r = {};
11059
+ for (let o of e) {
11060
+ let e = t[o];
11061
+ for (i[o] ??= 0; i[o] < e.length && e[i[o]].time.getTime() <= n;) a[o] = e[i[o]++];
11062
+ r[o] = a[o].time.getTime() === n ? a[o] : gm(a[o], new Date(n));
11063
+ }
11064
+ return {
11065
+ time: new Date(n),
11066
+ legs: r
11067
+ };
11068
+ });
11069
+ }
11070
+ function ym(e, t) {
11071
+ return vm(mm(e), t).map(({ time: t, legs: n }) => _m(e, n, t)).filter((e) => e !== null);
11072
+ }
11073
+ function bm(e, t) {
11074
+ let n = mm(e);
11075
+ if (n.some((e) => t[e]?.close === void 0)) return null;
11076
+ let r = Math.max(...n.map((e) => t[e].time.getTime())), i = {};
11077
+ for (let e of n) i[e] = t[e].time.getTime() === r ? t[e] : gm(t[e], new Date(r));
11078
+ return _m(e, i, new Date(r));
11079
+ }
11080
+ function xm(e) {
11081
+ return !Number.isFinite(e) || e === 0 ? 8 : Math.min(12, Math.max(2, 4 - Math.floor(Math.log10(Math.abs(e)))));
11082
+ }
11083
+ function Sm(e, t) {
11084
+ let n = pm(e), r = mm(n), i = {};
11085
+ for (let e of r) {
11086
+ let n = t(e);
11087
+ if (!n) throw Error(`Unknown market ${e}`);
11088
+ i[e] = n;
11089
+ }
11090
+ let a = new Set(r.map((e) => i[e].exchangeCode)).size > 1;
11091
+ return {
11092
+ name: fm(e).map(({ kind: e, value: t }) => {
11093
+ if (e === "leg") {
11094
+ let e = i[t];
11095
+ return `${a ? `${e.exchangeCode}:` : ""}${e.baseCurrency}/${e.quoteCurrency}`;
11096
+ }
11097
+ return um[t] ? ` ${um[t]} ` : t;
11098
+ }).join("").replace(/\( /g, "(").replace(/^ − /, "−"),
11099
+ legs: r,
11100
+ pricePrecision: xm(hm(n, (e) => i[e].lastPrice?.toNumber() ?? NaN))
11101
+ };
11102
+ }
11103
+ //#endregion
11104
+ //#region lib/coinray-cache.ts
11105
+ var Cm = 12e4, wm = 6e5, Tm = 6e5, Em = 6e5, Dm = 250, Om = 10, km = (e) => mo.default.uniq((Array.isArray(e) ? e : [e]).map((e) => `${e}`.split("_")[0])), Am = class extends im {
10939
11106
  rootApi;
10940
11107
  apis;
10941
11108
  exchanges;
@@ -10952,6 +11119,7 @@ var $p = void 0, em = class {
10952
11119
  markets: {}
10953
11120
  };
10954
11121
  destroyed = !1;
11122
+ formulaSubs = /* @__PURE__ */ new Map();
10955
11123
  loopsStarted = !1;
10956
11124
  tickersTimer;
10957
11125
  staticTimer;
@@ -11022,7 +11190,7 @@ var $p = void 0, em = class {
11022
11190
  this.recomputeActive(), this.loopsStarted = !0;
11023
11191
  let e = Date.now();
11024
11192
  for (let t of Object.keys(this.exchanges)) this.staticCheckedAt.set(t, e);
11025
- this.loop("tickersTimer", this.tickersTick, this.refreshRate), this.loop("staticTimer", this.staticTick, lm), this.loop("exchangesTimer", this.refreshExchangeList, um);
11193
+ this.loop("tickersTimer", this.tickersTick, this.refreshRate), this.loop("staticTimer", this.staticTick, wm), this.loop("exchangesTimer", this.refreshExchangeList, Tm);
11026
11194
  }
11027
11195
  loop(e, t, n) {
11028
11196
  this.destroyed || (this[e] = setTimeout(async () => {
@@ -11065,10 +11233,10 @@ var $p = void 0, em = class {
11065
11233
  this.onStoreCache && this.onStoreCache(this.rawCache);
11066
11234
  }
11067
11235
  setActiveExchanges(e) {
11068
- this.pinned = new Set(mm(e)), this.recomputeActive();
11236
+ this.pinned = new Set(km(e)), this.recomputeActive();
11069
11237
  }
11070
11238
  touchExchange(e) {
11071
- let t = mm(e);
11239
+ let t = km(e);
11072
11240
  for (let e of t) this.leases.set(e, (this.leases.get(e) || 0) + 1);
11073
11241
  this.recomputeActive();
11074
11242
  let n = !1;
@@ -11084,7 +11252,7 @@ var $p = void 0, em = class {
11084
11252
  };
11085
11253
  }
11086
11254
  async ensureFresh(e) {
11087
- let t = mm(e).filter((e) => this.exchanges[e]);
11255
+ let t = km(e).filter((e) => this.exchanges[e]);
11088
11256
  if (t.length === 0) return;
11089
11257
  let n = this.touchExchange(t);
11090
11258
  try {
@@ -11116,7 +11284,7 @@ var $p = void 0, em = class {
11116
11284
  ...this.tickerSubscriptions.exchangeCodes()
11117
11285
  ]);
11118
11286
  for (let e of t) this.graceUntil.delete(e);
11119
- for (let n of this.active) !t.has(n) && !this.graceUntil.has(n) && this.graceUntil.set(n, e + cm);
11287
+ for (let n of this.active) !t.has(n) && !this.graceUntil.has(n) && this.graceUntil.set(n, e + Cm);
11120
11288
  for (let [n, r] of this.graceUntil) r <= e ? this.graceUntil.delete(n) : t.add(n);
11121
11289
  let n = new Set([...t].filter((e) => this.exchanges[e]));
11122
11290
  if (this.loopsStarted) {
@@ -11134,13 +11302,13 @@ var $p = void 0, em = class {
11134
11302
  this.pendingActivation.clear(), this.activationPromise = null;
11135
11303
  try {
11136
11304
  await this.fetchTickers(t);
11137
- let e = Date.now(), n = t.filter((t) => e - (this.staticCheckedAt.get(t) || 0) >= lm);
11305
+ let e = Date.now(), n = t.filter((t) => e - (this.staticCheckedAt.get(t) || 0) >= wm);
11138
11306
  Promise.all(n.map(this.revalidateStatic)).then((e) => e.some(Boolean) && this.storeCache()), this.destroyed || this.dispatchEvent("marketsUpdated", { exchangeCodes: t });
11139
11307
  } catch (e) {
11140
11308
  console.error(e);
11141
11309
  }
11142
11310
  e();
11143
- }, fm);
11311
+ }, Dm);
11144
11312
  }), this.activationPromise;
11145
11313
  }
11146
11314
  tickersTick = async () => {
@@ -11151,7 +11319,7 @@ var $p = void 0, em = class {
11151
11319
  (await Promise.all([...this.recomputeActive()].map(this.revalidateStatic))).some(Boolean) && this.storeCache();
11152
11320
  };
11153
11321
  fetchTickers = async (e) => {
11154
- this.destroyed || await Promise.all(mo.default.chunk([...e].sort(), pm).map(async (e) => {
11322
+ this.destroyed || await Promise.all(mo.default.chunk([...e].sort(), Om).map(async (e) => {
11155
11323
  if (Date.now() < this.endpointDownUntil.tickers) return Promise.all(e.map(this.refreshMarkets));
11156
11324
  try {
11157
11325
  let t = await this.rootApi.fetchTickers(e);
@@ -11183,7 +11351,7 @@ var $p = void 0, em = class {
11183
11351
  }
11184
11352
  };
11185
11353
  markEndpointDown(e, t) {
11186
- return t?.status === 404 || t?.isAxiosError && !t.response ? (this.endpointDownUntil[e] || console.warn(`CoinrayCache: ${e} endpoint unavailable (${t?.message}), falling back to /markets`), this.endpointDownUntil[e] = Date.now() + dm, !0) : !1;
11354
+ return t?.status === 404 || t?.isAxiosError && !t.response ? (this.endpointDownUntil[e] || console.warn(`CoinrayCache: ${e} endpoint unavailable (${t?.message}), falling back to /markets`), this.endpointDownUntil[e] = Date.now() + Em, !0) : !1;
11187
11355
  }
11188
11356
  refreshExchangeList = async () => {
11189
11357
  let e = await this.rootApi.fetchExchanges((e) => e, void 0);
@@ -11257,6 +11425,16 @@ var $p = void 0, em = class {
11257
11425
  if (n) return n.getMarket(e);
11258
11426
  };
11259
11427
  async fetchCandles({ coinraySymbol: e, resolution: t, start: n, end: r, useWebSocket: i }) {
11428
+ if (dm(e)) {
11429
+ let { node: a, legs: o } = this.parseFormulaSymbol(e), s = await Promise.all(o.map((e) => this.fetchCandles({
11430
+ coinraySymbol: e,
11431
+ resolution: t,
11432
+ start: n,
11433
+ end: r,
11434
+ useWebSocket: i
11435
+ })));
11436
+ return ym(a, mo.default.zipObject(o, s));
11437
+ }
11260
11438
  return this.apiForSymbol(e).fetchCandles({
11261
11439
  coinraySymbol: e,
11262
11440
  resolution: t,
@@ -11266,6 +11444,13 @@ var $p = void 0, em = class {
11266
11444
  });
11267
11445
  }
11268
11446
  async fetchFirstCandleTime({ coinraySymbol: e, resolution: t }) {
11447
+ if (dm(e)) {
11448
+ let { legs: n } = this.parseFormulaSymbol(e), r = await Promise.all(n.map((e) => this.fetchFirstCandleTime({
11449
+ coinraySymbol: e,
11450
+ resolution: t
11451
+ })));
11452
+ return mo.default.maxBy(r, (e) => new Date(e).getTime());
11453
+ }
11269
11454
  return this.apiForSymbol(e).fetchFirstCandleTime({
11270
11455
  coinraySymbol: e,
11271
11456
  resolution: t
@@ -11312,6 +11497,22 @@ var $p = void 0, em = class {
11312
11497
  }
11313
11498
  };
11314
11499
  async subscribeCandles({ coinraySymbol: e, resolution: t, lastCandle: n }, r) {
11500
+ if (dm(e)) {
11501
+ let { node: n, legs: i } = this.parseFormulaSymbol(e), a = {}, o = i.map((i) => [i, ({ candle: o }) => {
11502
+ a[i] = o;
11503
+ let s = bm(n, a);
11504
+ s && r({
11505
+ coinraySymbol: e,
11506
+ resolution: t,
11507
+ candle: s,
11508
+ previousCandles: []
11509
+ });
11510
+ }]), s = `${e}-${t}`;
11511
+ return this.formulaSubs.has(s) || this.formulaSubs.set(s, /* @__PURE__ */ new Map()), this.formulaSubs.get(s).set(r, o), await Promise.all(o.map(([e, n]) => this.subscribeCandles({
11512
+ coinraySymbol: e,
11513
+ resolution: t
11514
+ }, n))), r;
11515
+ }
11315
11516
  return this.apiForSymbol(e).subscribeCandles({
11316
11517
  coinraySymbol: e,
11317
11518
  resolution: t,
@@ -11319,34 +11520,59 @@ var $p = void 0, em = class {
11319
11520
  }, r);
11320
11521
  }
11321
11522
  async unsubscribeCandles({ coinraySymbol: e, resolution: t }, n) {
11523
+ if (dm(e)) {
11524
+ let r = this.formulaSubs.get(`${e}-${t}`);
11525
+ if (!r) return;
11526
+ for (let e of n ? [n] : [...r.keys()]) {
11527
+ for (let [n, i] of r.get(e) ?? []) await this.unsubscribeCandles({
11528
+ coinraySymbol: n,
11529
+ resolution: t
11530
+ }, i);
11531
+ r.delete(e);
11532
+ }
11533
+ return;
11534
+ }
11322
11535
  await this.apiForSymbol(e).unsubscribeCandles({
11323
11536
  coinraySymbol: e,
11324
11537
  resolution: t
11325
11538
  }, n);
11326
11539
  }
11327
11540
  async subscribeOrderBook({ coinraySymbol: e }, t) {
11541
+ if (dm(e)) throw Error("Not supported for formula symbols");
11328
11542
  await this.apiForSymbol(e).subscribeOrderBook({ coinraySymbol: e }, t);
11329
11543
  }
11330
11544
  async unsubscribeOrderBook({ coinraySymbol: e }, t) {
11331
11545
  await this.apiForSymbol(e).unsubscribeOrderBook({ coinraySymbol: e }, t);
11332
11546
  }
11333
11547
  async subscribeTrades({ coinraySymbol: e }, t) {
11548
+ if (dm(e)) throw Error("Not supported for formula symbols");
11334
11549
  await this.apiForSymbol(e).subscribeTrades({ coinraySymbol: e }, t);
11335
11550
  }
11336
11551
  async unsubscribeTrades({ coinraySymbol: e }, t) {
11337
11552
  await this.apiForSymbol(e).unsubscribeTrades({ coinraySymbol: e }, t);
11338
11553
  }
11554
+ formulaSymbolInfo(e) {
11555
+ return Sm(e, this.getMarket);
11556
+ }
11557
+ parseFormulaSymbol(e) {
11558
+ let t = pm(e), n = mm(t), r = n.find((e) => !this.apiForSymbol(e));
11559
+ if (r) throw Error(`Unknown exchange for ${r}`);
11560
+ return {
11561
+ node: t,
11562
+ legs: n
11563
+ };
11564
+ }
11339
11565
  apiForSymbol(e) {
11340
11566
  let t = `${e}`.split("_");
11341
11567
  if (t.length < 3) return;
11342
11568
  let n = t[0];
11343
11569
  return this.apis.get(n);
11344
11570
  }
11345
- }, gm = class extends Error {
11571
+ }, jm = class extends Error {
11346
11572
  constructor(e) {
11347
11573
  super(e), this.name = "MarketNotFoundError";
11348
11574
  }
11349
- }, _m = class extends im {
11575
+ }, Mm = class extends im {
11350
11576
  coinrayCache;
11351
11577
  getPriceOverrides;
11352
11578
  coinraySymbol;
@@ -11380,7 +11606,7 @@ var $p = void 0, em = class {
11380
11606
  let e = this.coinrayCache.getMarket(this.coinraySymbol);
11381
11607
  return e.overridePrices(this.getPriceOverrides), e;
11382
11608
  }
11383
- throw new gm(`Market not found: ${this.coinraySymbol}`);
11609
+ throw new jm(`Market not found: ${this.coinraySymbol}`);
11384
11610
  }
11385
11611
  subscribeCoinraySymbolWillChange(e) {
11386
11612
  return this.on("coinraySymbolWillChange", e);
@@ -11527,7 +11753,7 @@ var $p = void 0, em = class {
11527
11753
  unsubscribeTradesDelayed = (e) => {
11528
11754
  this.off("tradesDelayed", e);
11529
11755
  };
11530
- }, vm = {
11756
+ }, Nm = {
11531
11757
  "en-US": { validation: {
11532
11758
  notGreaterThanOrEqualTo: "Can't be less than {{min}}",
11533
11759
  insufficientFunds: "Insufficient funds"
@@ -11540,7 +11766,7 @@ var $p = void 0, em = class {
11540
11766
  notGreaterThanOrEqualTo: "Не может быть меньше {{min}}",
11541
11767
  insufficientFunds: "Недостаточно средств"
11542
11768
  } }
11543
- }, ym = /* @__PURE__ */ l((/* @__PURE__ */ o(((e, t) => {
11769
+ }, Pm = /* @__PURE__ */ l((/* @__PURE__ */ o(((e, t) => {
11544
11770
  (function(e, t, n) {
11545
11771
  var r = function(e, t, n) {
11546
11772
  n = i.extend({}, i.options, n);
@@ -11978,63 +12204,63 @@ var $p = void 0, em = class {
11978
12204
  }, r.exposeModule(r, this, e, t, n);
11979
12205
  }).call(e, e === void 0 ? null : /* istanbul ignore next */ e, t === void 0 ? null : /* istanbul ignore next */ t, typeof define < "u" ? /* istanbul ignore next */ define : null);
11980
12206
  })))(), 1);
11981
- ym.default.validators.bigNumericality = (e, t, n, r) => ym.default.validators.numericality(e && e.toNumber(), t, r);
11982
- var bm = ym.default, xm = /* @__PURE__ */ s({
11983
- BalanceLimit: () => km,
11984
- ExchangeFeatures: () => Cm,
11985
- IpWhiteList: () => wm,
11986
- MarginType: () => Tm,
11987
- OrderSide: () => Dm,
11988
- OrderStatus: () => Em,
11989
- OrderType: () => Sm,
11990
- TimeInForce: () => Om
11991
- }), Sm = /* @__PURE__ */ function(e) {
12207
+ Pm.default.validators.bigNumericality = (e, t, n, r) => Pm.default.validators.numericality(e && e.toNumber(), t, r);
12208
+ var Fm = Pm.default, Im = /* @__PURE__ */ s({
12209
+ BalanceLimit: () => Wm,
12210
+ ExchangeFeatures: () => Rm,
12211
+ IpWhiteList: () => zm,
12212
+ MarginType: () => Bm,
12213
+ OrderSide: () => Hm,
12214
+ OrderStatus: () => Vm,
12215
+ OrderType: () => Lm,
12216
+ TimeInForce: () => Um
12217
+ }), Lm = /* @__PURE__ */ function(e) {
11992
12218
  return e.MARKET = "MARKET", e.LIMIT = "LIMIT", e.LIMIT_LADDER = "LIMIT_LADDER", e.STOP_LOSS = "STOP_LOSS", e.OCO = "OCO", e.STOP_LOSS_LIMIT = "STOP_LOSS_LIMIT", e.STOP_LOSS_MARKET = "STOP_LOSS_MARKET", e.TAKE_PROFIT = "TAKE_PROFIT", e.TAKE_PROFIT_LIMIT = "TAKE_PROFIT_LIMIT", e.TAKE_PROFIT_MARKET = "TAKE_PROFIT_MARKET", e;
11993
- }({}), Cm = /* @__PURE__ */ function(e) {
12219
+ }({}), Rm = /* @__PURE__ */ function(e) {
11994
12220
  return e.HEDGE_MODE = "hedgeMode", e.HEDGE_MODE_ONLY = "hedgeModeOnly", e.ORDER_QUOTE_AMOUNT = "orderQuoteAmount", e.MARKET_BUY_QUOTE_ONLY = "marketBuyQuoteOnly", e.UPDATE_LEVERAGE_ONLY_ON_OPEN_POSITIONS = "updateLeverageOnlyOnOpenPositions", e.IGNORE_LEVERAGE_ON_QUICK_SYNC = "ignoreLeverageOnQuickSync", e.MULTIPLE_MARGIN_TYPE_POSITIONS = "multipleMarginTypePositions", e.SET_LEVERAGE_NOT_AVAILABLE = "setLeverageNotAvailable", e.SET_MARGIN_TYPE_NOT_AVAILABLE = "setMarginTypeNotAvailable", e.FIXED_CROSSED_LEVERAGE = "fixedCrossedLeverage", e.FAST_CONNECT = "fastConnect", e.UNIFIED_BALANCE = "unifiedBalance", e.NO_API_KEY_LINK = "noApiKeyLink", e;
11995
- }({}), wm = /* @__PURE__ */ function(e) {
12221
+ }({}), zm = /* @__PURE__ */ function(e) {
11996
12222
  return e.NONE = "NONE", e.LIST = "LIST", e.COMMA = "COMMA", e.COMMA_SPACE = "COMMA_SPACE", e.SPACE = "SPACE", e;
11997
- }({}), Tm = /* @__PURE__ */ function(e) {
12223
+ }({}), Bm = /* @__PURE__ */ function(e) {
11998
12224
  return e.CROSSED = "CROSSED", e.ISOLATED = "ISOLATED", e;
11999
- }({}), Em = /* @__PURE__ */ function(e) {
12225
+ }({}), Vm = /* @__PURE__ */ function(e) {
12000
12226
  return e.OPEN = "open", e.CLOSED = "closed", e.CANCELED = "canceled", e;
12001
- }({}), Dm = /* @__PURE__ */ function(e) {
12227
+ }({}), Hm = /* @__PURE__ */ function(e) {
12002
12228
  return e.BUY = "buy", e.SELL = "sell", e;
12003
- }({}), Om = /* @__PURE__ */ function(e) {
12229
+ }({}), Um = /* @__PURE__ */ function(e) {
12004
12230
  return e.GTC = "gtc", e.FOK = "fok", e.IOC = "ioc", e;
12005
- }({}), km = /* @__PURE__ */ function(e) {
12231
+ }({}), Wm = /* @__PURE__ */ function(e) {
12006
12232
  return e.QUOTE = "quote", e.BASE = "base", e.NONE = "none", e;
12007
- }({}), Am = [];
12008
- for (let e = 0; e < 256; ++e) Am.push((e + 256).toString(16).slice(1));
12009
- function jm(e, t = 0) {
12010
- return (Am[e[t + 0]] + Am[e[t + 1]] + Am[e[t + 2]] + Am[e[t + 3]] + "-" + Am[e[t + 4]] + Am[e[t + 5]] + "-" + Am[e[t + 6]] + Am[e[t + 7]] + "-" + Am[e[t + 8]] + Am[e[t + 9]] + "-" + Am[e[t + 10]] + Am[e[t + 11]] + Am[e[t + 12]] + Am[e[t + 13]] + Am[e[t + 14]] + Am[e[t + 15]]).toLowerCase();
12233
+ }({}), Gm = [];
12234
+ for (let e = 0; e < 256; ++e) Gm.push((e + 256).toString(16).slice(1));
12235
+ function Km(e, t = 0) {
12236
+ return (Gm[e[t + 0]] + Gm[e[t + 1]] + Gm[e[t + 2]] + Gm[e[t + 3]] + "-" + Gm[e[t + 4]] + Gm[e[t + 5]] + "-" + Gm[e[t + 6]] + Gm[e[t + 7]] + "-" + Gm[e[t + 8]] + Gm[e[t + 9]] + "-" + Gm[e[t + 10]] + Gm[e[t + 11]] + Gm[e[t + 12]] + Gm[e[t + 13]] + Gm[e[t + 14]] + Gm[e[t + 15]]).toLowerCase();
12011
12237
  }
12012
12238
  //#endregion
12013
12239
  //#region node_modules/uuid/dist/rng.js
12014
- var Mm = /* @__PURE__ */ new Uint8Array(16);
12015
- function Nm() {
12016
- return crypto.getRandomValues(Mm);
12240
+ var qm = /* @__PURE__ */ new Uint8Array(16);
12241
+ function Jm() {
12242
+ return crypto.getRandomValues(qm);
12017
12243
  }
12018
12244
  //#endregion
12019
12245
  //#region node_modules/uuid/dist/v4.js
12020
- function Pm(e, t, n) {
12021
- return !t && !e && crypto.randomUUID ? crypto.randomUUID() : Fm(e, t, n);
12246
+ function Ym(e, t, n) {
12247
+ return !t && !e && crypto.randomUUID ? crypto.randomUUID() : Xm(e, t, n);
12022
12248
  }
12023
- function Fm(e, t, n) {
12249
+ function Xm(e, t, n) {
12024
12250
  e ||= {};
12025
- let r = e.random ?? e.rng?.() ?? Nm();
12251
+ let r = e.random ?? e.rng?.() ?? Jm();
12026
12252
  if (r.length < 16) throw Error("Random bytes length must be >= 16");
12027
12253
  if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
12028
12254
  if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
12029
12255
  for (let e = 0; e < 16; ++e) t[n + e] = r[e];
12030
12256
  return t;
12031
12257
  }
12032
- return jm(r);
12258
+ return Km(r);
12033
12259
  }
12034
12260
  //#endregion
12035
12261
  //#region lib/orders/base.ts
12036
- var Im = class {
12037
- id = Pm();
12262
+ var Zm = class {
12263
+ id = Ym();
12038
12264
  coinraySymbol;
12039
12265
  precisionBase;
12040
12266
  precisionQuote;
@@ -12053,7 +12279,7 @@ var Im = class {
12053
12279
  postOnly;
12054
12280
  timeInForce;
12055
12281
  constructor(e) {
12056
- this.coinraySymbol = e.coinraySymbol, this.precisionBase = Hp(e.precisionBase), this.precisionQuote = Hp(e.precisionQuote), this.precisionPrice = Hp(e.precisionPrice), this.minBase = $(e.minBase), this.minQuote = $(e.minQuote), this.makerFee = $(e.makerFee), this.takerFee = $(e.takerFee), this.balances = e.balances, this.balanceLimit = e.balanceLimit || km.NONE, this.side = e.side, this.orderExternalId = e.externalId, this.errors = {}, this.isValid = !0, this.reduceOnly = e.reduceOnly, this.postOnly = e.postOnly, this.timeInForce = e.timeInForce;
12282
+ this.coinraySymbol = e.coinraySymbol, this.precisionBase = Hp(e.precisionBase), this.precisionQuote = Hp(e.precisionQuote), this.precisionPrice = Hp(e.precisionPrice), this.minBase = $(e.minBase), this.minQuote = $(e.minQuote), this.makerFee = $(e.makerFee), this.takerFee = $(e.takerFee), this.balances = e.balances, this.balanceLimit = e.balanceLimit || Wm.NONE, this.side = e.side, this.orderExternalId = e.externalId, this.errors = {}, this.isValid = !0, this.reduceOnly = e.reduceOnly, this.postOnly = e.postOnly, this.timeInForce = e.timeInForce;
12057
12283
  }
12058
12284
  startEdit(e) {
12059
12285
  this.orderExternalId = e;
@@ -12063,18 +12289,18 @@ var Im = class {
12063
12289
  this.errors = {}, this.isValid = !0;
12064
12290
  }
12065
12291
  validate() {
12066
- let e = bm(this, this.constraints());
12292
+ let e = Fm(this, this.constraints());
12067
12293
  return e ? (this.errors = e, this.isValid = !1) : this.resetError(), !e;
12068
12294
  }
12069
- }, Lm = class extends Im {
12295
+ }, Qm = class extends Zm {
12070
12296
  baseAmount;
12071
12297
  quoteAmount;
12072
12298
  price;
12073
12299
  lockedOn;
12074
- orderType = Sm.LIMIT;
12300
+ orderType = Lm.LIMIT;
12075
12301
  constraints() {
12076
12302
  let e, t;
12077
- return this.balanceLimit === km.QUOTE ? t = this.balances.quote || 0 : this.balanceLimit === km.BASE && (e = this.balances.base || 0), {
12303
+ return this.balanceLimit === Wm.QUOTE ? t = this.balances.quote || 0 : this.balanceLimit === Wm.BASE && (e = this.balances.base || 0), {
12078
12304
  baseAmount: { bigNumericality: {
12079
12305
  greaterThanOrEqualTo: this.minBase.toNumber(),
12080
12306
  notGreaterThanOrEqualTo: `^${rm.I18n.t("validation.notGreaterThanOrEqualTo", { min: Bp(this.precisionBase, this.minBase) })}`,
@@ -12111,14 +12337,14 @@ var Im = class {
12111
12337
  getOrders() {
12112
12338
  return [this];
12113
12339
  }
12114
- }, Rm = class extends Im {
12340
+ }, $m = class extends Zm {
12115
12341
  baseAmount;
12116
12342
  quoteAmount;
12117
12343
  price;
12118
- orderType = Sm.MARKET;
12344
+ orderType = Lm.MARKET;
12119
12345
  constraints = () => {
12120
12346
  let e, t;
12121
- return this.balanceLimit === km.QUOTE ? t = this.balances.quote || 0 : this.balanceLimit === km.BASE && (e = this.balances.base || 0), {
12347
+ return this.balanceLimit === Wm.QUOTE ? t = this.balances.quote || 0 : this.balanceLimit === Wm.BASE && (e = this.balances.base || 0), {
12122
12348
  baseAmount: { bigNumericality: {
12123
12349
  greaterThanOrEqualTo: e ? this.minBase.toNumber() : void 0,
12124
12350
  notGreaterThanOrEqualTo: `^${rm.I18n.t("validation.notGreaterThanOrEqualTo", { min: Bp(this.precisionBase, this.minBase) })}`,
@@ -12148,17 +12374,17 @@ var Im = class {
12148
12374
  getOrders() {
12149
12375
  return [this];
12150
12376
  }
12151
- }, zm = /* @__PURE__ */ function(e) {
12377
+ }, eh = /* @__PURE__ */ function(e) {
12152
12378
  return e.LINEAR = "LINEAR", e.EXPONENTIAL = "EXPONENTIAL", e.FIBONACCI = "FIBONACCI", e.CUSTOM = "CUSTOM", e;
12153
- }({}), Bm = /* @__PURE__ */ function(e) {
12379
+ }({}), th = /* @__PURE__ */ function(e) {
12154
12380
  return e.EQUAL = "EQUAL", e.LINEAR = "LINEAR", e.LINEAR_REVERSE = "LINEAR_REVERSE", e.EXPONENTIAL = "EXPONENTIAL", e.EXPONENTIAL_REVERSE = "EXPONENTIAL_REVERSE", e.CUSTOM = "CUSTOM", e;
12155
- }({}), Vm = {
12156
- [zm.LINEAR]: (e) => mo.default.times(e, (t) => 1 / (e - 1) * t),
12157
- [zm.EXPONENTIAL]: (e) => {
12381
+ }({}), nh = {
12382
+ [eh.LINEAR]: (e) => mo.default.times(e, (t) => 1 / (e - 1) * t),
12383
+ [eh.EXPONENTIAL]: (e) => {
12158
12384
  let t = 2 ** (e - 1);
12159
12385
  return mo.default.times(e, (e) => e == 0 ? 0 : 2 ** e / t);
12160
12386
  },
12161
- [zm.FIBONACCI]: (e) => [
12387
+ [eh.FIBONACCI]: (e) => [
12162
12388
  0,
12163
12389
  .09,
12164
12390
  .146,
@@ -12169,21 +12395,21 @@ var Im = class {
12169
12395
  .788,
12170
12396
  .886
12171
12397
  ].slice(0, e - 1).concat([1]),
12172
- [zm.CUSTOM]: (e) => []
12173
- }, Hm = (e) => {
12398
+ [eh.CUSTOM]: (e) => []
12399
+ }, rh = (e) => {
12174
12400
  let t = mo.default.sum(e);
12175
12401
  return e.map((e) => e / t);
12176
- }, Um = {
12177
- [Bm.EQUAL]: (e) => Hm(mo.default.times(e, () => 1)),
12178
- [Bm.LINEAR]: (e) => Hm(mo.default.times(e, (t) => 1 / e * (t + 1))),
12179
- [Bm.EXPONENTIAL]: (e) => {
12402
+ }, ih = {
12403
+ [th.EQUAL]: (e) => rh(mo.default.times(e, () => 1)),
12404
+ [th.LINEAR]: (e) => rh(mo.default.times(e, (t) => 1 / e * (t + 1))),
12405
+ [th.EXPONENTIAL]: (e) => {
12180
12406
  let t = 2 ** e - 1;
12181
- return Hm(mo.default.times(e, (e) => 2 ** e / t));
12407
+ return rh(mo.default.times(e, (e) => 2 ** e / t));
12182
12408
  },
12183
- [Bm.LINEAR_REVERSE]: (e) => Um[Bm.LINEAR](e).reverse(),
12184
- [Bm.EXPONENTIAL_REVERSE]: (e) => Um[Bm.EXPONENTIAL](e).reverse(),
12185
- [Bm.CUSTOM]: (e) => []
12186
- }, Wm = class extends Im {
12409
+ [th.LINEAR_REVERSE]: (e) => ih[th.LINEAR](e).reverse(),
12410
+ [th.EXPONENTIAL_REVERSE]: (e) => ih[th.EXPONENTIAL](e).reverse(),
12411
+ [th.CUSTOM]: (e) => []
12412
+ }, ah = class extends Zm {
12187
12413
  baseAmount;
12188
12414
  quoteAmount;
12189
12415
  price;
@@ -12194,10 +12420,10 @@ var Im = class {
12194
12420
  sizeScale;
12195
12421
  priceScales;
12196
12422
  sizeScales;
12197
- orderType = Sm.LIMIT_LADDER;
12423
+ orderType = Lm.LIMIT_LADDER;
12198
12424
  constraints() {
12199
12425
  let e, t;
12200
- return this.balanceLimit === km.QUOTE ? t = this.balances.quote : this.balanceLimit === km.BASE && (e = this.balances.base), {
12426
+ return this.balanceLimit === Wm.QUOTE ? t = this.balances.quote : this.balanceLimit === Wm.BASE && (e = this.balances.base), {
12201
12427
  baseAmount: { bigNumericality: {
12202
12428
  greaterThanOrEqualTo: this.minBase.toNumber(),
12203
12429
  notGreaterThanOrEqualTo: `^${rm.I18n.t("validation.notGreaterThanOrEqualTo", { min: Bp(this.precisionBase, this.minBase) })}`,
@@ -12216,36 +12442,36 @@ var Im = class {
12216
12442
  };
12217
12443
  }
12218
12444
  constructor(e) {
12219
- super(e), this.otherPrice = $(e.otherPrice), this.numOrders = Hp(e.numOrders), this.priceScale = e.priceScale || zm.CUSTOM, this.sizeScale = e.sizeScale || Bm.CUSTOM, this.price = $(e.price || "0"), this.lockedOn = e.lockedOn, this.baseAmount = $(e.baseAmount || "0"), this.quoteAmount = $(e.quoteAmount || "0"), this.priceScales = e.priceScales || Vm[this.priceScale](this.numOrders), this.sizeScales = e.sizeScales || Um[this.sizeScale](this.numOrders), this.quoteAmount.gt(0) && this.lockedOn === "quoteAmount" ? this.updateQuoteAmount(this.quoteAmount) : this.updateBaseAmount(this.baseAmount);
12445
+ super(e), this.otherPrice = $(e.otherPrice), this.numOrders = Hp(e.numOrders), this.priceScale = e.priceScale || eh.CUSTOM, this.sizeScale = e.sizeScale || th.CUSTOM, this.price = $(e.price || "0"), this.lockedOn = e.lockedOn, this.baseAmount = $(e.baseAmount || "0"), this.quoteAmount = $(e.quoteAmount || "0"), this.priceScales = e.priceScales || nh[this.priceScale](this.numOrders), this.sizeScales = e.sizeScales || ih[this.sizeScale](this.numOrders), this.quoteAmount.gt(0) && this.lockedOn === "quoteAmount" ? this.updateQuoteAmount(this.quoteAmount) : this.updateBaseAmount(this.baseAmount);
12220
12446
  }
12221
12447
  updateNumOrders(e) {
12222
12448
  this.numOrders = e;
12223
12449
  }
12224
12450
  updatePrice(e, t = .05) {
12225
12451
  if (this.price = e.decimalPlaces(this.precisionPrice), e && this.otherPrice.eq(0)) {
12226
- let n = this.side === Dm.BUY ? 1 + t : 1 - t;
12452
+ let n = this.side === Hm.BUY ? 1 + t : 1 - t;
12227
12453
  this.otherPrice = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12228
12454
  }
12229
12455
  this.recalculate();
12230
12456
  }
12231
12457
  updateOtherPrice(e, t = .05) {
12232
12458
  if (this.otherPrice = e.decimalPlaces(this.precisionPrice), e && this.price.eq(0)) {
12233
- let n = this.side === Dm.BUY ? 1 - t : 1 + t;
12459
+ let n = this.side === Hm.BUY ? 1 - t : 1 + t;
12234
12460
  this.price = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12235
12461
  }
12236
12462
  this.recalculate();
12237
12463
  }
12238
12464
  updatePriceScales(e) {
12239
- this.priceScales = e, this.priceScale = zm.CUSTOM, this.recalculate();
12465
+ this.priceScales = e, this.priceScale = eh.CUSTOM, this.recalculate();
12240
12466
  }
12241
12467
  updatePriceScale(e) {
12242
- this.priceScales = Vm[e](this.numOrders), this.priceScale = e, this.recalculate();
12468
+ this.priceScales = nh[e](this.numOrders), this.priceScale = e, this.recalculate();
12243
12469
  }
12244
12470
  updateSizeScales(e) {
12245
- this.sizeScales = e, this.sizeScale = Bm.CUSTOM, this.recalculate();
12471
+ this.sizeScales = e, this.sizeScale = th.CUSTOM, this.recalculate();
12246
12472
  }
12247
12473
  updateSizeScale(e) {
12248
- this.sizeScales = Um[e](this.numOrders), this.sizeScale = e, this.recalculate();
12474
+ this.sizeScales = ih[e](this.numOrders), this.sizeScale = e, this.recalculate();
12249
12475
  }
12250
12476
  updateLockedOn(e) {
12251
12477
  this.lockedOn = e;
@@ -12269,7 +12495,7 @@ var Im = class {
12269
12495
  let r = this.priceScales.slice(0, this.numOrders), i = this.sizeScales.slice(0, this.numOrders), a = this.otherPrice.minus(this.price), o = t;
12270
12496
  return mo.default.times(this.numOrders, (s) => {
12271
12497
  let c = t.multipliedBy(i[s]).decimalPlaces(n > 0 ? n : 0, d.ROUND_DOWN);
12272
- return o = o.minus(c), s === this.numOrders - 1 && (c = c.plus(o)), new Lm({
12498
+ return o = o.minus(c), s === this.numOrders - 1 && (c = c.plus(o)), new Qm({
12273
12499
  ...this,
12274
12500
  [e]: c,
12275
12501
  lockedOn: e,
@@ -12277,9 +12503,9 @@ var Im = class {
12277
12503
  });
12278
12504
  });
12279
12505
  }
12280
- }, Gm = class extends Lm {
12506
+ }, oh = class extends Qm {
12281
12507
  stopPrice;
12282
- orderType = Sm.STOP_LOSS_LIMIT;
12508
+ orderType = Lm.STOP_LOSS_LIMIT;
12283
12509
  constraints() {
12284
12510
  return {
12285
12511
  ...super.constraints(),
@@ -12291,21 +12517,21 @@ var Im = class {
12291
12517
  }
12292
12518
  updatePrice(e, t = .05) {
12293
12519
  if (super.updatePrice(e), e && this.stopPrice.eq(0)) {
12294
- let n = this.side === Dm.BUY ? 1 - t : 1 + t;
12520
+ let n = this.side === Hm.BUY ? 1 - t : 1 + t;
12295
12521
  this.stopPrice = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12296
12522
  }
12297
12523
  }
12298
12524
  updateStopPrice(e, t = .05) {
12299
12525
  if (this.stopPrice = e.decimalPlaces(this.precisionPrice), e && this.price.eq(0)) {
12300
- let n = this.side === Dm.BUY ? 1 + t : 1 - t;
12526
+ let n = this.side === Hm.BUY ? 1 + t : 1 - t;
12301
12527
  this.price = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12302
12528
  }
12303
12529
  }
12304
- }, Km = class extends Lm {
12530
+ }, sh = class extends Qm {
12305
12531
  linkedOrderId;
12306
12532
  otherPrice;
12307
12533
  stopPrice;
12308
- orderType = Sm.OCO;
12534
+ orderType = Lm.OCO;
12309
12535
  constraints() {
12310
12536
  return {
12311
12537
  ...super.constraints(),
@@ -12318,29 +12544,29 @@ var Im = class {
12318
12544
  }
12319
12545
  updateQuoteAmount(e) {
12320
12546
  this.quoteAmount = e;
12321
- let t = this.side === Dm.BUY ? this.otherPrice : this.price;
12547
+ let t = this.side === Hm.BUY ? this.otherPrice : this.price;
12322
12548
  this.baseAmount = e.dividedBy(t).decimalPlaces(this.precisionBase > 0 ? this.precisionBase : 0, d.ROUND_DOWN), this.validate();
12323
12549
  }
12324
12550
  updateBaseAmount(e) {
12325
12551
  this.baseAmount = e;
12326
- let t = this.side === Dm.BUY ? this.otherPrice : this.price;
12552
+ let t = this.side === Hm.BUY ? this.otherPrice : this.price;
12327
12553
  this.quoteAmount = t.multipliedBy(this.baseAmount).decimalPlaces(this.precisionQuote > 0 ? this.precisionQuote : 0, d.ROUND_DOWN), this.validate();
12328
12554
  }
12329
12555
  updatePrice(e, t = .05) {
12330
12556
  if (super.updatePrice(e), e && this.otherPrice.eq(0)) {
12331
- let n = this.side === Dm.BUY ? 1 + t * 2 : 1 - t * 2, r = this.side === Dm.BUY ? 1 + t : 1 - t;
12557
+ let n = this.side === Hm.BUY ? 1 + t * 2 : 1 - t * 2, r = this.side === Hm.BUY ? 1 + t : 1 - t;
12332
12558
  this.otherPrice = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0), this.stopPrice = e.multipliedBy(r).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12333
12559
  }
12334
12560
  }
12335
12561
  updateOtherPrice(e, t = .05) {
12336
12562
  if (this.otherPrice = e.decimalPlaces(this.precisionPrice), e && this.price.eq(0)) {
12337
- let n = this.side === Dm.BUY ? 1 - t * 2 : 1 + t * 2, r = this.side === Dm.BUY ? 1 - t : 1 + t;
12563
+ let n = this.side === Hm.BUY ? 1 - t * 2 : 1 + t * 2, r = this.side === Hm.BUY ? 1 - t : 1 + t;
12338
12564
  this.price = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0), this.stopPrice = e.multipliedBy(r).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12339
12565
  }
12340
12566
  }
12341
12567
  updateStopPrice(e, t = .05) {
12342
12568
  if (this.stopPrice = e.decimalPlaces(this.precisionPrice), e && this.price.eq(0)) {
12343
- let n = this.side === Dm.BUY ? 1 - t : 1 + t, r = this.side === Dm.BUY ? 1 + t : 1 - t;
12569
+ let n = this.side === Hm.BUY ? 1 - t : 1 + t, r = this.side === Hm.BUY ? 1 + t : 1 - t;
12344
12570
  this.price = e.multipliedBy(n).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0), this.otherPrice = e.multipliedBy(r).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
12345
12571
  }
12346
12572
  }
@@ -12348,8 +12574,8 @@ var Im = class {
12348
12574
  //#endregion
12349
12575
  //#region lib/index.ts
12350
12576
  d.set({ STRICT: !1 });
12351
- var qm = rm;
12577
+ var ch = rm;
12352
12578
  //#endregion
12353
- export { km as BalanceLimit, hm as CoinrayCache, _m as CurrentMarket, _p as DAYS, Cm as ExchangeFeatures, gp as HOURS, wm as IpWhiteList, Wm as LimitLadderOrder, Lm as LimitOrder, hp as MINUTES, Tm as MarginType, Rm as MarketOrder, Km as OcoOrder, Dm as OrderSide, Em as OrderStatus, Sm as OrderType, zm as PriceScales, Bm as SizeScales, Gm as StopLimitOrder, Om as TimeInForce, vp as WEEK, Sp as base64UrlDecode, xp as base64UrlEncode, kp as camelize, Zp as candleTime, Pp as checkArray, Ip as checkBigNumber, Lp as checkBoolean, Rp as checkNull, Fp as checkNumber, Q as checkString, Bp as correctNumberPrecision, Tp as createJWT, qm as default, Op as encryptPayload, zp as errorHelper, Qp as filterMarkets, Xp as getBucketStartDates, Yp as getTimeParams, Dp as jwkToPublicKey, Ap as jwtExpired, vm as locales, Ep as parseJWT, Jp as resolutionToBucketType, Wp as resolutionToDuration, $ as safeBigNumber, Vp as safeFloat, Hp as safeInteger, Up as safeTime, Cp as sha256hexdigest, wp as signHMAC, bp as strToArray, Np as throwIsArray, Mp as throwNotObject, jp as throwNull2NonNull, Kp as toBucketEnd, qp as toBucketStart, Gp as toSafeDate, xm as types, yp as unix };
12579
+ export { Wm as BalanceLimit, Am as CoinrayCache, Mm as CurrentMarket, _p as DAYS, Rm as ExchangeFeatures, gp as HOURS, zm as IpWhiteList, ah as LimitLadderOrder, Qm as LimitOrder, hp as MINUTES, Bm as MarginType, $m as MarketOrder, sh as OcoOrder, Hm as OrderSide, Vm as OrderStatus, Lm as OrderType, eh as PriceScales, th as SizeScales, oh as StopLimitOrder, Um as TimeInForce, vp as WEEK, vm as alignCandles, Sp as base64UrlDecode, xp as base64UrlEncode, kp as camelize, Zp as candleTime, Pp as checkArray, Ip as checkBigNumber, Lp as checkBoolean, Rp as checkNull, Fp as checkNumber, Q as checkString, _m as combineCandles, Bp as correctNumberPrecision, Tp as createJWT, ch as default, Op as encryptPayload, zp as errorHelper, hm as evalFormula, Qp as filterMarkets, ym as formulaCandles, mm as formulaLegs, xm as formulaPrecision, Sm as formulaSymbolInfo, Xp as getBucketStartDates, Yp as getTimeParams, dm as isFormula, Dp as jwkToPublicKey, Ap as jwtExpired, bm as latestFormulaCandle, Nm as locales, pm as parseFormula, Ep as parseJWT, Jp as resolutionToBucketType, Wp as resolutionToDuration, $ as safeBigNumber, Vp as safeFloat, Hp as safeInteger, Up as safeTime, Cp as sha256hexdigest, wp as signHMAC, bp as strToArray, Np as throwIsArray, Mp as throwNotObject, jp as throwNull2NonNull, Kp as toBucketEnd, qp as toBucketStart, Gp as toSafeDate, Im as types, yp as unix };
12354
12580
 
12355
12581
  //# sourceMappingURL=coinrayjs.es.js.map