ccxt 4.4.27 → 4.4.28

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/js/src/binance.js CHANGED
@@ -953,6 +953,9 @@ export default class binance extends Exchange {
953
953
  'mmp': 1,
954
954
  'countdownCancelAll': 1,
955
955
  'order': 1,
956
+ 'block/order/orders': 5,
957
+ 'block/order/execute': 5,
958
+ 'block/user-trades': 5,
956
959
  },
957
960
  'post': {
958
961
  'order': 1,
@@ -962,9 +965,12 @@ export default class binance extends Exchange {
962
965
  'mmpReset': 1,
963
966
  'countdownCancelAll': 1,
964
967
  'countdownCancelAllHeartBeat': 10,
968
+ 'block/order/create': 5,
969
+ 'block/order/execute': 5,
965
970
  },
966
971
  'put': {
967
972
  'listenKey': 1,
973
+ 'block/order/create': 5,
968
974
  },
969
975
  'delete': {
970
976
  'order': 1,
@@ -972,6 +978,7 @@ export default class binance extends Exchange {
972
978
  'allOpenOrders': 1,
973
979
  'allOpenOrdersByUnderlying': 1,
974
980
  'listenKey': 1,
981
+ 'block/order/create': 5,
975
982
  },
976
983
  },
977
984
  'public': {
package/js/src/kraken.js CHANGED
@@ -1492,7 +1492,7 @@ export default class kraken extends Exchange {
1492
1492
  // {
1493
1493
  // "error": [],
1494
1494
  // "result": {
1495
- // "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' },
1495
+ // "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' }, // see more examples in "parseOrder"
1496
1496
  // "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
1497
1497
  // }
1498
1498
  // }
@@ -1558,9 +1558,10 @@ export default class kraken extends Exchange {
1558
1558
  }
1559
1559
  parseOrderType(status) {
1560
1560
  const statuses = {
1561
+ // we dont add "space" delimited orders here (eg. stop loss) because they need separate parsing
1561
1562
  'take-profit': 'market',
1562
- 'stop-loss-limit': 'limit',
1563
1563
  'stop-loss': 'market',
1564
+ 'stop-loss-limit': 'limit',
1564
1565
  'take-profit-limit': 'limit',
1565
1566
  'trailing-stop-limit': 'limit',
1566
1567
  };
@@ -1568,30 +1569,19 @@ export default class kraken extends Exchange {
1568
1569
  }
1569
1570
  parseOrder(order, market = undefined) {
1570
1571
  //
1571
- // createOrder for regular orders
1572
+ // createOrder
1572
1573
  //
1573
1574
  // {
1574
- // "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' },
1575
+ // "descr": {
1576
+ // "order": "buy 0.02100000 ETHUSDT @ limit 330.00" // limit orders
1577
+ // "buy 0.12345678 ETHUSDT @ market" // market order
1578
+ // "sell 0.28002676 ETHUSDT @ stop loss 0.0123 -> limit 0.0.1222" // stop order
1579
+ // "sell 0.00100000 ETHUSDT @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"
1580
+ // "buy 0.10000000 LTCUSDT @ take profit 75.00000 -> limit 74.00000"
1581
+ // "sell 10.00000000 XRPEUR @ trailing stop +50.0000%" // trailing stop
1582
+ // },
1575
1583
  // "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
1576
1584
  // }
1577
- // {
1578
- // "txid": [ "TX_ID_HERE" ],
1579
- // "descr": { "order":"buy 0.12345678 ETHEUR @ market" },
1580
- // }
1581
- //
1582
- //
1583
- // createOrder for stop orders
1584
- //
1585
- // {
1586
- // "txid":["OSILNC-VQI5Q-775ZDQ"],
1587
- // "descr":{"order":"sell 167.28002676 ADAXBT @ stop loss 0.00003280 -> limit 0.00003212"}
1588
- // }
1589
- //
1590
- //
1591
- // {
1592
- // "txid":["OVHMJV-BZW2V-6NZFWF"],
1593
- // "descr":{"order":"sell 0.00100000 ETHUSD @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"}
1594
- // }
1595
1585
  //
1596
1586
  // editOrder
1597
1587
  //
@@ -1671,27 +1661,34 @@ export default class kraken extends Exchange {
1671
1661
  orderDescription = this.safeString(order, 'descr');
1672
1662
  }
1673
1663
  let side = undefined;
1674
- let type = undefined;
1664
+ let rawType = undefined;
1675
1665
  let marketId = undefined;
1676
1666
  let price = undefined;
1677
1667
  let amount = undefined;
1678
- let stopPrice = undefined;
1668
+ let triggerPrice = undefined;
1679
1669
  if (orderDescription !== undefined) {
1680
1670
  const parts = orderDescription.split(' ');
1681
1671
  side = this.safeString(parts, 0);
1682
1672
  amount = this.safeString(parts, 1);
1683
1673
  marketId = this.safeString(parts, 2);
1684
- type = this.safeString(parts, 4);
1685
- if (type === 'stop') {
1686
- stopPrice = this.safeString(parts, 6);
1674
+ const part4 = this.safeString(parts, 4);
1675
+ const part5 = this.safeString(parts, 5);
1676
+ if (part4 === 'limit' || part4 === 'market') {
1677
+ rawType = part4; // eg, limit, market
1678
+ }
1679
+ else {
1680
+ rawType = part4 + ' ' + part5; // eg. stop loss, take profit, trailing stop
1681
+ }
1682
+ if (rawType === 'stop loss' || rawType === 'take profit') {
1683
+ triggerPrice = this.safeString(parts, 6);
1687
1684
  price = this.safeString(parts, 9);
1688
1685
  }
1689
- else if (type === 'limit') {
1686
+ else if (rawType === 'limit') {
1690
1687
  price = this.safeString(parts, 5);
1691
1688
  }
1692
1689
  }
1693
1690
  side = this.safeString(description, 'type', side);
1694
- type = this.safeString(description, 'ordertype', type);
1691
+ rawType = this.safeString(description, 'ordertype', rawType); // orderType has dash, e.g. trailing-stop
1695
1692
  marketId = this.safeString(description, 'pair', marketId);
1696
1693
  const foundMarket = this.findMarketByAltnameOrId(marketId);
1697
1694
  let symbol = undefined;
@@ -1756,17 +1753,33 @@ export default class kraken extends Exchange {
1756
1753
  trades.push(rawTrade);
1757
1754
  }
1758
1755
  }
1759
- stopPrice = this.omitZero(this.safeString(order, 'stopprice', stopPrice));
1756
+ // as mentioned in #24192 PR, this field is not something consistent/actual
1757
+ // triggerPrice = this.omitZero (this.safeString (order, 'stopprice', triggerPrice));
1760
1758
  let stopLossPrice = undefined;
1761
1759
  let takeProfitPrice = undefined;
1762
- if (type.startsWith('take-profit')) {
1760
+ // the dashed strings are not provided from fields (eg. fetch order)
1761
+ // while spaced strings from "order" sentence (when other fields not available)
1762
+ if (rawType.startsWith('take-profit')) {
1763
1763
  takeProfitPrice = this.safeString(description, 'price');
1764
1764
  price = this.omitZero(this.safeString(description, 'price2'));
1765
1765
  }
1766
- else if (type.startsWith('stop-loss')) {
1766
+ else if (rawType.startsWith('stop-loss')) {
1767
1767
  stopLossPrice = this.safeString(description, 'price');
1768
1768
  price = this.omitZero(this.safeString(description, 'price2'));
1769
1769
  }
1770
+ else if (rawType === 'take profit') {
1771
+ takeProfitPrice = triggerPrice;
1772
+ }
1773
+ else if (rawType === 'stop loss') {
1774
+ stopLossPrice = triggerPrice;
1775
+ }
1776
+ let finalType = this.parseOrderType(rawType);
1777
+ // unlike from endpoints which provide eg: "take-profit-limit"
1778
+ // for "space-delimited" orders we dont have market/limit suffixes, their format is
1779
+ // eg: `stop loss > limit 123`, so we need to parse them manually
1780
+ if (this.inArray(finalType, ['stop loss', 'take profit'])) {
1781
+ finalType = (price === undefined) ? 'market' : 'limit';
1782
+ }
1770
1783
  return this.safeOrder({
1771
1784
  'id': id,
1772
1785
  'clientOrderId': clientOrderId,
@@ -1776,13 +1789,13 @@ export default class kraken extends Exchange {
1776
1789
  'lastTradeTimestamp': undefined,
1777
1790
  'status': status,
1778
1791
  'symbol': symbol,
1779
- 'type': this.parseOrderType(type),
1792
+ 'type': finalType,
1780
1793
  'timeInForce': undefined,
1781
1794
  'postOnly': isPostOnly,
1782
1795
  'side': side,
1783
1796
  'price': price,
1784
- 'stopPrice': stopPrice,
1785
- 'triggerPrice': stopPrice,
1797
+ 'stopPrice': triggerPrice,
1798
+ 'triggerPrice': triggerPrice,
1786
1799
  'takeProfitPrice': takeProfitPrice,
1787
1800
  'stopLossPrice': stopLossPrice,
1788
1801
  'cost': undefined,
@@ -3720,12 +3720,6 @@ export default class binance extends binanceRest {
3720
3720
  market = this.getMarketFromSymbols(symbols);
3721
3721
  messageHash = '::' + symbols.join(',');
3722
3722
  }
3723
- const marketTypeObject = {};
3724
- if (market !== undefined) {
3725
- marketTypeObject['type'] = market['type'];
3726
- marketTypeObject['subType'] = market['subType'];
3727
- }
3728
- await this.authenticate(this.extend(marketTypeObject, params));
3729
3723
  let type = undefined;
3730
3724
  [type, params] = this.handleMarketTypeAndParams('watchPositions', market, params);
3731
3725
  if (type === 'spot' || type === 'margin') {
@@ -3739,6 +3733,10 @@ export default class binance extends binanceRest {
3739
3733
  else if (this.isInverse(type, subType)) {
3740
3734
  type = 'delivery';
3741
3735
  }
3736
+ const marketTypeObject = {};
3737
+ marketTypeObject['type'] = type;
3738
+ marketTypeObject['subType'] = subType;
3739
+ await this.authenticate(this.extend(marketTypeObject, params));
3742
3740
  messageHash = type + ':positions' + messageHash;
3743
3741
  let isPortfolioMargin = undefined;
3744
3742
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'watchPositions', 'papi', 'portfolioMargin', false);
@@ -1525,6 +1525,7 @@ export default class wavesexchange extends Exchange {
1525
1525
  * @method
1526
1526
  * @name wavesexchange#fetchOrder
1527
1527
  * @description fetches information on an order made by the user
1528
+ * @see https://matcher.waves.exchange/api-docs/index.html#/status/getOrderStatusByPKAndIdWithSig
1528
1529
  * @param {string} symbol unified symbol of the market the order was made in
1529
1530
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1530
1531
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.27",
3
+ "version": "4.4.28",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",