hollaex-node-lib 2.12.0 → 2.13.0

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/kit.js +8 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -75,7 +75,7 @@ client
75
75
  | `getOrders` | <ul><li>**opts**: Object with additional params</li><li>**opts.symbol**: (_optional_) HollaEx trading symbol e.g. `xht-usdt`</li><li>**opts.side**: (_optional_, _enum_=[`buy`, `sell`]) Order side</li><li>**opts.status**: (_optional_) Filter data set `status`</li><li>**opts.limit**: (_optional_, _default_=`50`, _max_=`50`) Number of items to get</li><li>**opts.page**: (_optional_, _default_=`1`) Page number of data</li><li>**opts.orderBy**: (_optional_) Field to order data by</li><li>**opts.order**: (_optional_, _enum_=[`asc`, `desc`])</li><li>**opts.startDate**: (_optional_, _format_=`ISO8601`) Start date of data set</li><li>**opts.endDate**: (_optional_, _format_=`ISO8601`) End date of data set</li></ul> | Get the list of all user orders. It can be filter by passing the symbol |
76
76
  | `createOrder` | <ul><li>**symbol**: HollaEx trading symbol e.g. `xht-usdt`</li><li>**side** (_enum_=[`buy`, `sell`]): Order side</li><li>**size**: Size of order to place</li><li>**type**: (_enum_=[`market`, `limit`] Order type</li><li>**price**: (_required if limit order type_) Order price</li><li>**opts**: Object with additional params</li><li>**opts.stop**: (_optional_) Stop price for order</li><li>**opts.meta**: (_optional_) Object with additional meta configurations</li><li>**opts.meta.post_only**: (_optional_, _default_=`false`) Make post only order </li><li>**opts.meta.note**: (_optional_) Custom note for order</li></ul> | Create a new order |
77
77
  | `cancelOrder` | <ul><li>**orderId**: HollaEx Network order ID</li></ul> | Cancel a specific order with its ID |
78
- | `cancelAllOrders` | <ul><li>**opts**: Object with additional params</li><li>**opts.symbol**: (_optional_) HollaEx trading symbol e.g. `xht-usdt`</li></ul> | Cancel all open order. It can be filter by passing the symbol |
78
+ | `cancelAllOrders` | <ul><li>**symbol**: HollaEx trading symbol e.g. `xht-usdt`</li></ul> | Cancel all the active orders of a user, filtered by currency pair symbol |
79
79
 
80
80
  ### Websocket
81
81
 
package/kit.js CHANGED
@@ -656,19 +656,17 @@ class HollaExKit {
656
656
  }
657
657
 
658
658
  /**
659
- * Cancel all the user's active orders, can filter by currency pair symbol
660
- * @param {object} opts - Optional parameters
661
- * @param {string} opts.symbol - The currency pair symbol to filter by e.g. 'hex-usdt', leave empty to cancel orders of all symbols
659
+ * Cancel all the active orders of a user, filtered by currency pair symbol
660
+ * @param {string} symbol - The currency pair symbol to filter by e.g. 'hex-usdt'
662
661
  * @return {array} A JSON array of objects containing the cancelled orders
663
662
  */
664
- cancelAllOrders(opts = { symbol: null }) {
665
- const verb = 'DELETE';
666
- let path = `${this.baseUrl}/order/all`;
667
-
668
- if (isString(opts.symbol)) {
669
- path += `?symbol=${opts.symbol}`;
663
+ cancelAllOrders(symbol) {
664
+ if (!isString(symbol)) {
665
+ throw new Error('You must provide a symbol to cancel all orders for');
670
666
  }
671
667
 
668
+ const verb = 'DELETE';
669
+ let path = `${this.baseUrl}/order/all?symbol=${symbol}`;
672
670
  const headers = generateHeaders(
673
671
  this.headers,
674
672
  this.apiSecret,
@@ -676,6 +674,7 @@ class HollaExKit {
676
674
  path,
677
675
  this.apiExpiresAfter
678
676
  );
677
+
679
678
  return createRequest(verb, `${this.apiUrl}${path}`, headers);
680
679
  }
681
680
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hollaex-node-lib",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "hollaex api and websocket library for nodejs",
5
5
  "main": "index.js",
6
6
  "dependencies": {