ccxt 4.2.30 → 4.2.31

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/cjs/ccxt.js CHANGED
@@ -176,7 +176,7 @@ var woo$1 = require('./src/pro/woo.js');
176
176
 
177
177
  //-----------------------------------------------------------------------------
178
178
  // this is updated by vss.js when building
179
- const version = '4.2.30';
179
+ const version = '4.2.31';
180
180
  Exchange["default"].ccxtVersion = version;
181
181
  const exchanges = {
182
182
  'ace': ace,
@@ -1681,7 +1681,7 @@ class Exchange {
1681
1681
  }
1682
1682
  return result;
1683
1683
  }
1684
- filterByLimit(array, limit = undefined, key = 'timestamp') {
1684
+ filterByLimit(array, limit = undefined, key = 'timestamp', fromStart = false) {
1685
1685
  if (this.valueIsDefined(limit)) {
1686
1686
  const arrayLength = array.length;
1687
1687
  if (arrayLength > 0) {
@@ -1693,7 +1693,12 @@ class Exchange {
1693
1693
  ascending = first <= last; // true if array is sorted in ascending order based on 'timestamp'
1694
1694
  }
1695
1695
  }
1696
- array = ascending ? this.arraySlice(array, -limit) : this.arraySlice(array, 0, limit);
1696
+ if (fromStart) {
1697
+ array = ascending ? this.arraySlice(array, 0, limit) : this.arraySlice(array, -limit);
1698
+ }
1699
+ else {
1700
+ array = ascending ? this.arraySlice(array, -limit) : this.arraySlice(array, 0, limit);
1701
+ }
1697
1702
  }
1698
1703
  }
1699
1704
  return array;
@@ -1715,7 +1720,10 @@ class Exchange {
1715
1720
  if (tail && limit !== undefined) {
1716
1721
  return this.arraySlice(result, -limit);
1717
1722
  }
1718
- return this.filterByLimit(result, limit, key);
1723
+ // if the user provided a 'since' argument
1724
+ // we want to limit the result starting from the 'since'
1725
+ const shouldFilterFromStart = !tail && sinceIsDefined;
1726
+ return this.filterByLimit(result, limit, key, shouldFilterFromStart);
1719
1727
  }
1720
1728
  filterByValueSinceLimit(array, field, value = undefined, since = undefined, limit = undefined, key = 'timestamp', tail = false) {
1721
1729
  const valueIsDefined = this.valueIsDefined(value);
@@ -1740,7 +1748,7 @@ class Exchange {
1740
1748
  if (tail && limit !== undefined) {
1741
1749
  return this.arraySlice(result, -limit);
1742
1750
  }
1743
- return this.filterByLimit(result, limit, key);
1751
+ return this.filterByLimit(result, limit, key, sinceIsDefined);
1744
1752
  }
1745
1753
  setSandboxMode(enabled) {
1746
1754
  if (enabled) {
@@ -5853,7 +5853,7 @@ class binance extends binance$1 {
5853
5853
  params = this.omit(params, 'type');
5854
5854
  const orders = await this.fetchOrders(symbol, since, undefined, params);
5855
5855
  const filteredOrders = this.filterBy(orders, 'status', 'canceled');
5856
- return this.filterByLimit(filteredOrders, limit);
5856
+ return this.filterBySinceLimit(filteredOrders, since, limit);
5857
5857
  }
5858
5858
  async cancelOrder(id, symbol = undefined, params = {}) {
5859
5859
  /**