@xapy/orderbook 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1054,10 +1054,10 @@ function toBingxSymbol(symbol) {
1054
1054
  if (!base || !quote) {
1055
1055
  throw new Error(`invalid symbol "${symbol}" \u2014 expected "BASE/QUOTE"`);
1056
1056
  }
1057
- return `${base}-${quote}`.toUpperCase();
1057
+ return `${base}_${quote}`.toUpperCase();
1058
1058
  }
1059
1059
  function fromBingxSymbol(s) {
1060
- return s.toUpperCase().replace("-", "/");
1060
+ return s.toUpperCase().replace("_", "/");
1061
1061
  }
1062
1062
 
1063
1063
  // src/exchanges/bingx/rest.ts
@@ -1120,9 +1120,10 @@ var WS_SPOT3 = "wss://open-api-ws.bingx.com/market";
1120
1120
  var WS_SWAP = "wss://open-api-swap.bingx.com/swap-market";
1121
1121
  function streamBingxOrderbook(opts) {
1122
1122
  const isSpot = opts.market === "spot";
1123
- const bingxSymbol = toBingxSymbol(opts.symbol);
1124
- const depth = opts.depth ?? 20;
1125
- const dataType = `${bingxSymbol}@depth${depth}`;
1123
+ const wsSymbol = opts.symbol.toUpperCase().replace("/", "-");
1124
+ const level = opts.depth ?? 20;
1125
+ const interval = opts.interval ?? "500ms";
1126
+ const dataType = `${wsSymbol}@depth${level}@${interval}`;
1126
1127
  const merger = new BookMerger();
1127
1128
  let ws = null;
1128
1129
  const stream = new OrderbookStream(() => ws?.close());
@@ -1157,7 +1158,7 @@ function streamBingxOrderbook(opts) {
1157
1158
  if (!r.ok) return;
1158
1159
  const book = {
1159
1160
  exchange: "bingx",
1160
- symbol: fromBingxSymbol(bingxSymbol),
1161
+ symbol: opts.symbol,
1161
1162
  market: opts.market,
1162
1163
  bids: r.bids,
1163
1164
  asks: r.asks,