@orderly.network/hooks 1.1.4-alpha.4 → 1.1.4-alpha.6

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.d.mts CHANGED
@@ -25,7 +25,7 @@ declare global {
25
25
  };
26
26
  }
27
27
  }
28
- declare const _default: "1.1.4-alpha.4";
28
+ declare const _default: "1.1.4-alpha.6";
29
29
 
30
30
  type useQueryOptions<T> = SWRConfiguration & {
31
31
  formatter?: (data: any) => T;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ declare global {
25
25
  };
26
26
  }
27
27
  }
28
- declare const _default: "1.1.4-alpha.4";
28
+ declare const _default: "1.1.4-alpha.6";
29
29
 
30
30
  type useQueryOptions<T> = SWRConfiguration & {
31
31
  formatter?: (data: any) => T;
package/dist/index.js CHANGED
@@ -28,9 +28,9 @@ var useSWRSubscription__default = /*#__PURE__*/_interopDefault(useSWRSubscriptio
28
28
  // src/version.ts
29
29
  if (typeof window !== "undefined") {
30
30
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
31
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-alpha.4";
31
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-alpha.6";
32
32
  }
33
- var version_default = "1.1.4-alpha.4";
33
+ var version_default = "1.1.4-alpha.6";
34
34
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
35
35
  var OrderlyContext = React.createContext({
36
36
  // configStore: new MemoryConfigStore(),
@@ -972,20 +972,24 @@ var reduceOrderbook = (depth, level, data) => {
972
972
  let bids = reduceItems(depth, level, data.bids);
973
973
  if (asks.length !== 0 && bids.length !== 0 && asks[0][0] <= bids[0][0]) {
974
974
  if (asks.length === 1) {
975
- const [price, qty, newQuantity] = asks[0];
975
+ const [price, qty, newQuantity, newAmount] = asks[0];
976
976
  asks.shift();
977
- asks.push([price + (depth === void 0 ? 0 : depth), qty, newQuantity]);
977
+ asks.push([price + (depth === void 0 ? 0 : depth), qty, newQuantity, newAmount]);
978
978
  } else {
979
979
  const [bidPrice] = bids[0];
980
980
  while (asks.length > 0) {
981
- const [askPrice, askQty, newQuantity] = asks[0];
981
+ const [askPrice, askQty, newQuantity, newAmount] = asks[0];
982
982
  if (askPrice <= bidPrice) {
983
983
  asks.shift();
984
984
  for (let index = 0; index < asks.length; index++) {
985
985
  if (index === 0) {
986
- asks[index][1] += askQty;
986
+ const quantity = asks[index][1] + askQty;
987
+ asks[index][1] = quantity;
988
+ asks[index][2] = quantity;
989
+ asks[index][3] += newAmount;
990
+ } else {
991
+ asks[index][3] += newAmount;
987
992
  }
988
- asks[index][2] += newQuantity;
989
993
  }
990
994
  } else {
991
995
  break;