ccxt 4.4.31 → 4.4.33

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 (111) hide show
  1. package/README.md +9 -3
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +89 -0
  5. package/dist/cjs/src/binance.js +154 -0
  6. package/dist/cjs/src/bitvavo.js +0 -4
  7. package/dist/cjs/src/bybit.js +138 -6
  8. package/dist/cjs/src/cex.js +4 -3
  9. package/dist/cjs/src/coinbase.js +2 -22
  10. package/dist/cjs/src/coinbaseexchange.js +2 -1
  11. package/dist/cjs/src/coincatch.js +3 -3
  12. package/dist/cjs/src/coinex.js +2 -1
  13. package/dist/cjs/src/deribit.js +2 -2
  14. package/dist/cjs/src/gate.js +19 -3
  15. package/dist/cjs/src/hitbtc.js +3 -3
  16. package/dist/cjs/src/htx.js +1 -1
  17. package/dist/cjs/src/hyperliquid.js +14 -2
  18. package/dist/cjs/src/indodax.js +1 -1
  19. package/dist/cjs/src/kraken.js +5 -2
  20. package/dist/cjs/src/krakenfutures.js +2 -0
  21. package/dist/cjs/src/kucoin.js +5 -3
  22. package/dist/cjs/src/kucoinfutures.js +99 -28
  23. package/dist/cjs/src/lbank.js +1 -0
  24. package/dist/cjs/src/okx.js +94 -3
  25. package/dist/cjs/src/phemex.js +31 -30
  26. package/dist/cjs/src/pro/binance.js +8 -8
  27. package/dist/cjs/src/pro/bitget.js +4 -4
  28. package/dist/cjs/src/pro/bitmart.js +2 -2
  29. package/dist/cjs/src/pro/bitmex.js +2 -2
  30. package/dist/cjs/src/pro/bitvavo.js +46 -48
  31. package/dist/cjs/src/pro/blofin.js +2 -2
  32. package/dist/cjs/src/pro/bybit.js +2 -2
  33. package/dist/cjs/src/pro/coincatch.js +1 -1
  34. package/dist/cjs/src/pro/cryptocom.js +4 -4
  35. package/dist/cjs/src/pro/gate.js +4 -4
  36. package/dist/cjs/src/pro/hashkey.js +3 -3
  37. package/dist/cjs/src/pro/mexc.js +1 -2
  38. package/dist/cjs/src/pro/okx.js +11 -1
  39. package/dist/cjs/src/wavesexchange.js +1 -0
  40. package/dist/cjs/src/woofipro.js +2 -2
  41. package/js/ccxt.d.ts +1 -1
  42. package/js/ccxt.js +1 -1
  43. package/js/src/abstract/coinbaseexchange.d.ts +1 -0
  44. package/js/src/abstract/kraken.d.ts +1 -0
  45. package/js/src/base/Exchange.d.ts +3 -0
  46. package/js/src/base/Exchange.js +89 -0
  47. package/js/src/binance.d.ts +1 -0
  48. package/js/src/binance.js +154 -0
  49. package/js/src/bitvavo.js +0 -4
  50. package/js/src/bybit.js +139 -7
  51. package/js/src/cex.d.ts +1 -1
  52. package/js/src/cex.js +5 -4
  53. package/js/src/coinbase.js +2 -22
  54. package/js/src/coinbaseexchange.js +2 -1
  55. package/js/src/coincatch.d.ts +1 -1
  56. package/js/src/coincatch.js +3 -3
  57. package/js/src/coinex.d.ts +1 -1
  58. package/js/src/coinex.js +2 -1
  59. package/js/src/deribit.d.ts +2 -2
  60. package/js/src/deribit.js +2 -2
  61. package/js/src/gate.d.ts +3 -1
  62. package/js/src/gate.js +19 -3
  63. package/js/src/hitbtc.d.ts +3 -3
  64. package/js/src/hitbtc.js +3 -3
  65. package/js/src/htx.d.ts +1 -1
  66. package/js/src/htx.js +1 -1
  67. package/js/src/hyperliquid.d.ts +2 -1
  68. package/js/src/hyperliquid.js +14 -2
  69. package/js/src/indodax.js +1 -1
  70. package/js/src/kraken.d.ts +4 -2
  71. package/js/src/kraken.js +5 -2
  72. package/js/src/krakenfutures.d.ts +2 -0
  73. package/js/src/krakenfutures.js +2 -0
  74. package/js/src/kucoin.d.ts +3 -3
  75. package/js/src/kucoin.js +5 -3
  76. package/js/src/kucoinfutures.d.ts +9 -5
  77. package/js/src/kucoinfutures.js +99 -28
  78. package/js/src/lbank.js +1 -0
  79. package/js/src/okx.d.ts +2 -2
  80. package/js/src/okx.js +94 -3
  81. package/js/src/phemex.d.ts +4 -0
  82. package/js/src/phemex.js +31 -30
  83. package/js/src/pro/binance.d.ts +8 -8
  84. package/js/src/pro/binance.js +8 -8
  85. package/js/src/pro/bitget.d.ts +3 -3
  86. package/js/src/pro/bitget.js +4 -4
  87. package/js/src/pro/bitmart.d.ts +2 -2
  88. package/js/src/pro/bitmart.js +2 -2
  89. package/js/src/pro/bitmex.d.ts +2 -2
  90. package/js/src/pro/bitmex.js +2 -2
  91. package/js/src/pro/bitvavo.d.ts +1 -1
  92. package/js/src/pro/bitvavo.js +46 -48
  93. package/js/src/pro/blofin.d.ts +2 -2
  94. package/js/src/pro/blofin.js +2 -2
  95. package/js/src/pro/bybit.d.ts +2 -2
  96. package/js/src/pro/bybit.js +2 -2
  97. package/js/src/pro/coincatch.d.ts +1 -1
  98. package/js/src/pro/coincatch.js +1 -1
  99. package/js/src/pro/cryptocom.d.ts +4 -4
  100. package/js/src/pro/cryptocom.js +4 -4
  101. package/js/src/pro/gate.d.ts +4 -4
  102. package/js/src/pro/gate.js +4 -4
  103. package/js/src/pro/hashkey.d.ts +3 -3
  104. package/js/src/pro/hashkey.js +3 -3
  105. package/js/src/pro/mexc.js +1 -2
  106. package/js/src/pro/okx.js +11 -1
  107. package/js/src/wavesexchange.d.ts +1 -0
  108. package/js/src/wavesexchange.js +1 -0
  109. package/js/src/woofipro.d.ts +2 -2
  110. package/js/src/woofipro.js +2 -2
  111. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -197,7 +197,7 @@ var xt$1 = require('./src/pro/xt.js');
197
197
 
198
198
  //-----------------------------------------------------------------------------
199
199
  // this is updated by vss.js when building
200
- const version = '4.4.31';
200
+ const version = '4.4.33';
201
201
  Exchange["default"].ccxtVersion = version;
202
202
  const exchanges = {
203
203
  'ace': ace,
@@ -116,6 +116,7 @@ class Exchange {
116
116
  this.last_request_path = undefined;
117
117
  this.id = 'Exchange';
118
118
  this.markets = undefined;
119
+ this.features = undefined;
119
120
  this.status = undefined;
120
121
  this.rateLimit = undefined; // milliseconds
121
122
  this.tokenBucket = undefined;
@@ -2316,6 +2317,94 @@ class Exchange {
2316
2317
  }
2317
2318
  afterConstruct() {
2318
2319
  this.createNetworksByIdObject();
2320
+ this.featuresGenerator();
2321
+ }
2322
+ featuresGenerator() {
2323
+ //
2324
+ // the exchange-specific features can be something like this, where we support 'string' aliases too:
2325
+ //
2326
+ // {
2327
+ // 'myItem' : {
2328
+ // 'createOrder' : {...},
2329
+ // 'fetchOrders' : {...},
2330
+ // },
2331
+ // 'swap': {
2332
+ // 'linear': 'myItem',
2333
+ // 'inverse': 'myItem',
2334
+ // },
2335
+ // 'future': {
2336
+ // 'linear': 'myItem',
2337
+ // 'inverse': 'myItem',
2338
+ // }
2339
+ // }
2340
+ //
2341
+ //
2342
+ //
2343
+ // this method would regenerate the blank features tree, eg:
2344
+ //
2345
+ // {
2346
+ // "spot": {
2347
+ // "createOrder": undefined,
2348
+ // "fetchBalance": undefined,
2349
+ // ...
2350
+ // },
2351
+ // "swap": {
2352
+ // ...
2353
+ // }
2354
+ // }
2355
+ //
2356
+ if (this.features === undefined) {
2357
+ return;
2358
+ }
2359
+ // reconstruct
2360
+ const initialFeatures = this.features;
2361
+ this.features = {};
2362
+ const unifiedMarketTypes = ['spot', 'swap', 'future', 'option'];
2363
+ const subTypes = ['linear', 'inverse'];
2364
+ // atm only support basic methods to avoid to be able to maintain, eg: 'createOrder', 'fetchOrder', 'fetchOrders', 'fetchMyTrades'
2365
+ for (let i = 0; i < unifiedMarketTypes.length; i++) {
2366
+ const marketType = unifiedMarketTypes[i];
2367
+ // if marketType is not filled for this exchange, don't add that in `features`
2368
+ if (!(marketType in initialFeatures)) {
2369
+ this.features[marketType] = undefined;
2370
+ }
2371
+ else {
2372
+ if (marketType === 'spot') {
2373
+ this.features[marketType] = this.featuresMapper(initialFeatures, marketType, undefined);
2374
+ }
2375
+ else {
2376
+ this.features[marketType] = {};
2377
+ for (let j = 0; j < subTypes.length; j++) {
2378
+ const subType = subTypes[j];
2379
+ this.features[marketType][subType] = this.featuresMapper(initialFeatures, marketType, subType);
2380
+ }
2381
+ }
2382
+ }
2383
+ }
2384
+ }
2385
+ featuresMapper(initialFeatures, marketType, subType = undefined) {
2386
+ let featuresObj = (subType !== undefined) ? initialFeatures[marketType][subType] : initialFeatures[marketType];
2387
+ const extendsStr = this.safeString(featuresObj, 'extends');
2388
+ if (extendsStr !== undefined) {
2389
+ featuresObj = this.omit(featuresObj, 'extends');
2390
+ const extendObj = initialFeatures[extendsStr];
2391
+ featuresObj = this.extend(extendObj, featuresObj); // Warning, do not use deepExtend here, because we override only one level
2392
+ }
2393
+ //
2394
+ // corrections
2395
+ //
2396
+ if ('createOrder' in featuresObj) {
2397
+ const value = this.safeDict(featuresObj['createOrder'], 'attachedStopLossTakeProfit');
2398
+ if (value !== undefined) {
2399
+ featuresObj['createOrder']['stopLoss'] = value;
2400
+ featuresObj['createOrder']['takeProfit'] = value;
2401
+ }
2402
+ // omit 'hedged' from spot
2403
+ if (marketType === 'spot') {
2404
+ featuresObj['createOrder']['hedged'] = undefined;
2405
+ }
2406
+ }
2407
+ return featuresObj;
2319
2408
  }
2320
2409
  orderbookChecksumMessage(symbol) {
2321
2410
  return symbol + ' : ' + 'orderbook data checksum validation failed. You can reconnect by calling watchOrderBook again or you can mute the error by setting exchange.options["watchOrderBook"]["checksum"] = false';
@@ -1555,6 +1555,157 @@ class binance extends binance$1 {
1555
1555
  'BUSD': 'USD',
1556
1556
  },
1557
1557
  },
1558
+ 'features': {
1559
+ // https://developers.binance.com/docs/binance-spot-api-docs/rest-api#:~:text=quoteOrderQty
1560
+ 'spot': {
1561
+ 'sandbox': true,
1562
+ 'createOrder': {
1563
+ 'triggerPrice': true,
1564
+ 'triggerPriceType': undefined,
1565
+ 'triggerDirection': false,
1566
+ 'stopLossPrice': true,
1567
+ 'takeProfitPrice': true,
1568
+ 'attachedStopLossTakeProfit': undefined,
1569
+ 'marginMode': true,
1570
+ 'timeInForce': {
1571
+ 'GTC': true,
1572
+ 'IOC': true,
1573
+ 'FOK': true,
1574
+ 'PO': true,
1575
+ 'GTD': false,
1576
+ },
1577
+ 'hedged': true,
1578
+ // exchange-supported features
1579
+ 'selfTradePrevention': true,
1580
+ 'trailing': true,
1581
+ 'twap': false,
1582
+ 'iceberg': true,
1583
+ 'oco': false,
1584
+ },
1585
+ 'createOrders': undefined,
1586
+ 'fetchMyTrades': {
1587
+ 'limit': 1000,
1588
+ 'daysBack': undefined,
1589
+ 'untilDays': 1, // days between start-end
1590
+ },
1591
+ 'fetchOrder': {
1592
+ 'marginMode': true,
1593
+ 'trigger': false,
1594
+ 'trailing': false,
1595
+ },
1596
+ 'fetchOpenOrders': {
1597
+ 'limit': undefined,
1598
+ 'marginMode': true,
1599
+ 'trigger': false,
1600
+ 'trailing': false,
1601
+ },
1602
+ 'fetchOrders': {
1603
+ 'limit': 1000,
1604
+ 'daysBack': undefined,
1605
+ 'untilDays': 10000,
1606
+ 'marginMode': true,
1607
+ 'trigger': false,
1608
+ 'trailing': false,
1609
+ },
1610
+ 'fetchClosedOrders': {
1611
+ 'limit': 1000,
1612
+ 'daysBackClosed': undefined,
1613
+ 'daysBackCanceled': undefined,
1614
+ 'untilDays': 10000,
1615
+ 'marginMode': true,
1616
+ 'trigger': false,
1617
+ 'trailing': false,
1618
+ },
1619
+ 'fetchOHLCV': {
1620
+ 'limit': 1000,
1621
+ },
1622
+ },
1623
+ 'default': {
1624
+ 'sandbox': true,
1625
+ 'createOrder': {
1626
+ 'triggerPrice': true,
1627
+ 'triggerPriceType': {
1628
+ 'mark': true,
1629
+ 'last': true,
1630
+ 'index': false,
1631
+ },
1632
+ 'stopLossPrice': true,
1633
+ 'takeProfitPrice': true,
1634
+ 'attachedStopLossTakeProfit': undefined,
1635
+ 'marginMode': false,
1636
+ 'timeInForce': {
1637
+ 'GTC': true,
1638
+ 'IOC': true,
1639
+ 'FOK': true,
1640
+ 'PO': true,
1641
+ 'GTD': true,
1642
+ // 'GTX': true,
1643
+ },
1644
+ 'hedged': true,
1645
+ // exchange-supported features
1646
+ 'selfTradePrevention': true,
1647
+ 'trailing': true,
1648
+ 'twap': false,
1649
+ 'iceberg': false,
1650
+ 'oco': false,
1651
+ },
1652
+ 'createOrders': {
1653
+ 'max': 5,
1654
+ },
1655
+ 'fetchMyTrades': {
1656
+ 'daysBack': undefined,
1657
+ 'limit': 1000,
1658
+ 'untilDays': 7,
1659
+ },
1660
+ 'fetchOrder': {
1661
+ 'marginMode': false,
1662
+ 'trigger': false,
1663
+ 'trailing': false,
1664
+ },
1665
+ 'fetchOpenOrders': {
1666
+ 'limit': 500,
1667
+ 'marginMode': true,
1668
+ 'trigger': false,
1669
+ 'trailing': false,
1670
+ },
1671
+ 'fetchOrders': {
1672
+ 'limit': 1000,
1673
+ 'daysBack': 90,
1674
+ 'untilDays': 7,
1675
+ 'marginMode': true,
1676
+ 'trigger': false,
1677
+ 'trailing': false,
1678
+ },
1679
+ 'fetchClosedOrders': {
1680
+ 'limit': 1000,
1681
+ 'daysBackClosed': 90,
1682
+ 'daysBackCanceled': 3,
1683
+ 'untilDays': 7,
1684
+ 'marginMode': true,
1685
+ 'trigger': false,
1686
+ 'trailing': false,
1687
+ },
1688
+ 'fetchOHLCV': {
1689
+ 'limit': 1500,
1690
+ },
1691
+ },
1692
+ 'swap': {
1693
+ 'linear': {
1694
+ 'extends': 'default',
1695
+ },
1696
+ 'inverse': {
1697
+ 'extends': 'default',
1698
+ },
1699
+ },
1700
+ 'future': {
1701
+ 'linear': {
1702
+ 'extends': 'default',
1703
+ },
1704
+ 'inverse': {
1705
+ 'extends': 'default',
1706
+ },
1707
+ },
1708
+ },
1558
1709
  'exceptions': {
1559
1710
  'spot': {
1560
1711
  'exact': {
@@ -1950,6 +2101,8 @@ class binance extends binance$1 {
1950
2101
  '-4088': errors.PermissionDenied,
1951
2102
  '-4114': errors.BadRequest,
1952
2103
  '-4115': errors.BadRequest,
2104
+ '-4116': errors.InvalidOrder,
2105
+ '-4117': errors.OperationRejected,
1953
2106
  '-4118': errors.OperationRejected,
1954
2107
  '-4131': errors.OperationRejected,
1955
2108
  '-4140': errors.BadRequest,
@@ -13393,6 +13546,7 @@ class binance extends binance$1 {
13393
13546
  }
13394
13547
  /**
13395
13548
  * @method
13549
+ * @name binance#fetchMarginAdjustmentHistory
13396
13550
  * @description fetches the history of margin added or reduced from contract isolated positions
13397
13551
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Get-Position-Margin-Change-History
13398
13552
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Get-Position-Margin-Change-History
@@ -1114,10 +1114,6 @@ class bitvavo extends bitvavo$1 {
1114
1114
  if (postOnly) {
1115
1115
  request['postOnly'] = true;
1116
1116
  }
1117
- const clientOrderId = this.safeString(params, 'clientOrderId');
1118
- if (clientOrderId === undefined) {
1119
- request['clientOrderId'] = this.uuid22();
1120
- }
1121
1117
  return this.extend(request, params);
1122
1118
  }
1123
1119
  /**
@@ -551,7 +551,7 @@ class bybit extends bybit$1 {
551
551
  '10005': errors.PermissionDenied,
552
552
  '10006': errors.RateLimitExceeded,
553
553
  '10007': errors.AuthenticationError,
554
- '10008': errors.AuthenticationError,
554
+ '10008': errors.AccountSuspended,
555
555
  '10009': errors.AuthenticationError,
556
556
  '10010': errors.PermissionDenied,
557
557
  '10014': errors.BadRequest,
@@ -995,7 +995,7 @@ class bybit extends bybit$1 {
995
995
  'enableUnifiedMargin': undefined,
996
996
  'enableUnifiedAccount': undefined,
997
997
  'unifiedMarginStatus': undefined,
998
- 'createMarketBuyOrderRequiresPrice': true,
998
+ 'createMarketBuyOrderRequiresPrice': false,
999
999
  'createUnifiedMarginAccount': false,
1000
1000
  'defaultType': 'swap',
1001
1001
  'defaultSubType': 'linear',
@@ -1055,6 +1055,122 @@ class bybit extends bybit$1 {
1055
1055
  '1d': '1d',
1056
1056
  },
1057
1057
  },
1058
+ 'features': {
1059
+ 'default': {
1060
+ 'sandbox': true,
1061
+ 'createOrder': {
1062
+ 'triggerPrice': true,
1063
+ 'triggerPriceType': {
1064
+ 'last': true,
1065
+ 'mark': true,
1066
+ 'index': true,
1067
+ },
1068
+ 'triggerDirection': true,
1069
+ 'stopLossPrice': true,
1070
+ 'takeProfitPrice': true,
1071
+ 'attachedStopLossTakeProfit': {
1072
+ 'triggerPriceType': {
1073
+ 'last': true,
1074
+ 'mark': true,
1075
+ 'index': true,
1076
+ },
1077
+ 'limitPrice': true,
1078
+ },
1079
+ 'marginMode': false,
1080
+ 'timeInForce': {
1081
+ 'GTC': true,
1082
+ 'IOC': true,
1083
+ 'FOK': true,
1084
+ 'PO': true,
1085
+ 'GTD': false,
1086
+ },
1087
+ 'hedged': true,
1088
+ // exchange-supported features
1089
+ 'selfTradePrevention': true,
1090
+ 'trailing': true,
1091
+ 'twap': false,
1092
+ 'iceberg': false,
1093
+ 'oco': false,
1094
+ },
1095
+ 'createOrders': {
1096
+ 'max': 10,
1097
+ },
1098
+ 'fetchMyTrades': {
1099
+ 'limit': 100,
1100
+ 'daysBack': 365 * 2,
1101
+ 'untilDays': 7, // days between start-end
1102
+ },
1103
+ 'fetchOrder': {
1104
+ 'marginMode': false,
1105
+ 'trigger': true,
1106
+ 'trailing': false,
1107
+ },
1108
+ 'fetchOpenOrders': {
1109
+ 'limit': 50,
1110
+ 'marginMode': false,
1111
+ 'trigger': true,
1112
+ 'trailing': false,
1113
+ },
1114
+ 'fetchOrders': undefined,
1115
+ 'fetchClosedOrders': {
1116
+ 'limit': 50,
1117
+ 'daysBackClosed': 365 * 2,
1118
+ 'daysBackCanceled': 1,
1119
+ 'untilDays': 7,
1120
+ 'marginMode': false,
1121
+ 'trigger': true,
1122
+ 'trailing': false,
1123
+ },
1124
+ 'fetchOHLCV': {
1125
+ 'limit': 1000,
1126
+ },
1127
+ },
1128
+ 'spot': {
1129
+ 'extends': 'default',
1130
+ 'createOrder': {
1131
+ 'triggerPrice': true,
1132
+ 'triggerPriceType': undefined,
1133
+ 'triggerDirection': false,
1134
+ 'stopLossPrice': true,
1135
+ 'takeProfitPrice': true,
1136
+ 'attachedStopLossTakeProfit': {
1137
+ 'triggerPriceType': undefined,
1138
+ 'limitPrice': true,
1139
+ },
1140
+ 'marginMode': false,
1141
+ 'timeInForce': {
1142
+ 'GTC': true,
1143
+ 'IOC': true,
1144
+ 'FOK': true,
1145
+ 'PO': true,
1146
+ 'GTD': false,
1147
+ },
1148
+ 'hedged': true,
1149
+ // exchange-supported features
1150
+ 'selfTradePrevention': true,
1151
+ 'trailing': true,
1152
+ 'twap': false,
1153
+ 'iceberg': false,
1154
+ 'oco': false,
1155
+ },
1156
+ },
1157
+ 'swap': {
1158
+ 'linear': {
1159
+ 'extends': 'default',
1160
+ },
1161
+ 'inverse': {
1162
+ 'extends': 'default',
1163
+ },
1164
+ },
1165
+ 'future': {
1166
+ 'linear': {
1167
+ 'extends': 'default',
1168
+ },
1169
+ 'inverse': {
1170
+ 'extends': 'default',
1171
+ },
1172
+ },
1173
+ },
1058
1174
  'fees': {
1059
1175
  'trading': {
1060
1176
  'feeSide': 'get',
@@ -3486,11 +3602,19 @@ class bybit extends bybit$1 {
3486
3602
  market = this.safeMarket(marketId, market, undefined, marketType);
3487
3603
  const symbol = market['symbol'];
3488
3604
  const timestamp = this.safeInteger2(order, 'createdTime', 'createdAt');
3605
+ const marketUnit = this.safeString(order, 'marketUnit', 'baseCoin');
3489
3606
  const id = this.safeString(order, 'orderId');
3490
3607
  const type = this.safeStringLower(order, 'orderType');
3491
3608
  const price = this.safeString(order, 'price');
3492
- const amount = this.safeString(order, 'qty');
3493
- const cost = this.safeString(order, 'cumExecValue');
3609
+ let amount = undefined;
3610
+ let cost = undefined;
3611
+ if (marketUnit === 'baseCoin') {
3612
+ amount = this.safeString(order, 'qty');
3613
+ cost = this.safeString(order, 'cumExecValue');
3614
+ }
3615
+ else {
3616
+ cost = this.safeString(order, 'cumExecValue');
3617
+ }
3494
3618
  const filled = this.safeString(order, 'cumExecQty');
3495
3619
  const remaining = this.safeString(order, 'leavesQty');
3496
3620
  const lastTradeTimestamp = this.safeInteger2(order, 'updatedTime', 'updatedAt');
@@ -3855,7 +3979,7 @@ class bybit extends bybit$1 {
3855
3979
  // classic accounts
3856
3980
  // for market buy it requires the amount of quote currency to spend
3857
3981
  let createMarketBuyOrderRequiresPrice = true;
3858
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
3982
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice');
3859
3983
  if (createMarketBuyOrderRequiresPrice) {
3860
3984
  if ((price === undefined) && (cost === undefined)) {
3861
3985
  throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
@@ -3867,7 +3991,15 @@ class bybit extends bybit$1 {
3867
3991
  }
3868
3992
  }
3869
3993
  else {
3870
- request['qty'] = this.getCost(symbol, this.numberToString(amount));
3994
+ if (cost !== undefined) {
3995
+ request['qty'] = this.getCost(symbol, this.numberToString(cost));
3996
+ }
3997
+ else if (price !== undefined) {
3998
+ request['qty'] = this.getCost(symbol, Precise["default"].stringMul(amountString, priceString));
3999
+ }
4000
+ else {
4001
+ request['qty'] = this.getCost(symbol, this.numberToString(amount));
4002
+ }
3871
4003
  }
3872
4004
  }
3873
4005
  else {
@@ -118,7 +118,8 @@ class cex extends cex$1 {
118
118
  'check failed': errors.BadRequest,
119
119
  'Insufficient funds': errors.InsufficientFunds,
120
120
  'Get deposit address for main account is not allowed': errors.PermissionDenied,
121
- 'Market Trigger orders are not allowed': errors.BadRequest, // for some reason, triggerPrice does not work for market orders
121
+ 'Market Trigger orders are not allowed': errors.BadRequest,
122
+ 'key not passed or incorrect': errors.AuthenticationError,
122
123
  },
123
124
  },
124
125
  'timeframes': {
@@ -849,7 +850,7 @@ class cex extends cex$1 {
849
850
  const code = this.safeCurrencyCode(key);
850
851
  const account = {
851
852
  'used': this.safeString(balance, 'balanceOnHold'),
852
- 'free': this.safeString(balance, 'balance'),
853
+ 'total': this.safeString(balance, 'balance'),
853
854
  };
854
855
  result[code] = account;
855
856
  }
@@ -860,7 +861,7 @@ class cex extends cex$1 {
860
861
  * @name cex#fetchOrders
861
862
  * @description fetches information on multiple orders made by the user
862
863
  * @see https://trade.cex.io/docs/#rest-private-api-calls-orders
863
- * @param status
864
+ * @param {string} status order status to fetch for
864
865
  * @param {string} symbol unified market symbol of the market orders were made in
865
866
  * @param {int} [since] the earliest time in ms to fetch orders for
866
867
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -2376,28 +2376,8 @@ class coinbase extends coinbase$1 {
2376
2376
  const pagination = this.safeDict(response, 'pagination', {});
2377
2377
  const cursor = this.safeString(pagination, 'next_starting_after');
2378
2378
  if ((cursor !== undefined) && (cursor !== '')) {
2379
- const lastFee = this.safeDict(last, 'fee');
2380
- last['next_starting_after'] = cursor;
2381
- ledger[lastIndex] = {
2382
- 'info': this.safeDict(last, 'info'),
2383
- 'id': this.safeString(last, 'id'),
2384
- 'timestamp': this.safeInteger(last, 'timestamp'),
2385
- 'datetime': this.safeString(last, 'datetime'),
2386
- 'direction': this.safeString(last, 'direction'),
2387
- 'account': this.safeString(last, 'account'),
2388
- 'referenceId': undefined,
2389
- 'referenceAccount': undefined,
2390
- 'type': this.safeString(last, 'type'),
2391
- 'currency': this.safeString(last, 'currency'),
2392
- 'amount': this.safeNumber(last, 'amount'),
2393
- 'before': undefined,
2394
- 'after': undefined,
2395
- 'status': this.safeString(last, 'status'),
2396
- 'fee': {
2397
- 'cost': this.safeNumber(lastFee, 'cost'),
2398
- 'currency': this.safeString(lastFee, 'currency'),
2399
- },
2400
- };
2379
+ last['info']['next_starting_after'] = cursor;
2380
+ ledger[lastIndex] = last;
2401
2381
  }
2402
2382
  return ledger;
2403
2383
  }
@@ -116,7 +116,8 @@ class coinbaseexchange extends coinbaseexchange$1 {
116
116
  'products/{id}/ticker',
117
117
  'products/{id}/trades',
118
118
  'time',
119
- 'products/spark-lines', // experimental
119
+ 'products/spark-lines',
120
+ 'products/volume-summary',
120
121
  ],
121
122
  },
122
123
  'private': {
@@ -2272,7 +2272,7 @@ class coincatch extends coincatch$1 {
2272
2272
  /**
2273
2273
  * @method
2274
2274
  * @ignore
2275
- * @name hashkey#createSpotOrderRequest
2275
+ * @name coincatch#createSpotOrderRequest
2276
2276
  * @description helper function to build request
2277
2277
  * @param {string} symbol unified symbol of the market to create an order in
2278
2278
  * @param {string} type 'market' or 'limit'
@@ -2452,7 +2452,7 @@ class coincatch extends coincatch$1 {
2452
2452
  /**
2453
2453
  * @method
2454
2454
  * @ignore
2455
- * @name hashkey#createSwapOrderRequest
2455
+ * @name coincatch#createSwapOrderRequest
2456
2456
  * @description helper function to build request
2457
2457
  * @param {string} symbol unified symbol of the market to create an order in
2458
2458
  * @param {string} type 'market' or 'limit'
@@ -4619,7 +4619,7 @@ class coincatch extends coincatch$1 {
4619
4619
  }
4620
4620
  /**
4621
4621
  * @method
4622
- * @name hashkey#setLeverage
4622
+ * @name coincatch#setLeverage
4623
4623
  * @description set the level of leverage for a market
4624
4624
  * @see https://hashkeyglobal-apidoc.readme.io/reference/change-futures-leverage-trade
4625
4625
  * @param {float} leverage the rate of leverage
@@ -3390,7 +3390,7 @@ class coinex extends coinex$1 {
3390
3390
  * @see https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order
3391
3391
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
3392
3392
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
3393
- * @param status
3393
+ * @param {string} status order status to fetch for
3394
3394
  * @param {string} symbol unified market symbol of the market orders were made in
3395
3395
  * @param {int} [since] the earliest time in ms to fetch orders for
3396
3396
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4770,6 +4770,7 @@ class coinex extends coinex$1 {
4770
4770
  'not_pass': 'failed',
4771
4771
  'cancel': 'canceled',
4772
4772
  'finish': 'ok',
4773
+ 'finished': 'ok',
4773
4774
  'fail': 'failed',
4774
4775
  };
4775
4776
  return this.safeString(statuses, status, status);
@@ -3058,8 +3058,8 @@ class deribit extends deribit$1 {
3058
3058
  * @description fetch the current funding rate
3059
3059
  * @see https://docs.deribit.com/#public-get_funding_rate_history
3060
3060
  * @param {string} symbol unified market symbol
3061
- * @param since
3062
- * @param limit
3061
+ * @param {int} [since] the earliest time in ms to fetch funding rate history for
3062
+ * @param {int} [limit] the maximum number of entries to retrieve
3063
3063
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3064
3064
  * @param {int} [params.end_timestamp] fetch funding rate ending at this timestamp
3065
3065
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)