ccxt 4.3.6 → 4.3.8

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 (196) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/ace.js +5 -0
  4. package/dist/cjs/src/alpaca.js +6 -0
  5. package/dist/cjs/src/base/Exchange.js +47 -3
  6. package/dist/cjs/src/binance.js +3 -1
  7. package/dist/cjs/src/bingx.js +3 -1
  8. package/dist/cjs/src/bitbank.js +3 -0
  9. package/dist/cjs/src/bitget.js +75 -2
  10. package/dist/cjs/src/bithumb.js +4 -0
  11. package/dist/cjs/src/bitmex.js +2 -0
  12. package/dist/cjs/src/bitopro.js +5 -0
  13. package/dist/cjs/src/bitso.js +3 -0
  14. package/dist/cjs/src/bitstamp.js +3 -0
  15. package/dist/cjs/src/bitteam.js +4 -0
  16. package/dist/cjs/src/bitvavo.js +3 -0
  17. package/dist/cjs/src/bl3p.js +3 -0
  18. package/dist/cjs/src/btcalpha.js +3 -0
  19. package/dist/cjs/src/btcbox.js +3 -0
  20. package/dist/cjs/src/btcmarkets.js +3 -0
  21. package/dist/cjs/src/btcturk.js +3 -0
  22. package/dist/cjs/src/bybit.js +123 -12
  23. package/dist/cjs/src/cex.js +6 -0
  24. package/dist/cjs/src/coinbase.js +95 -17
  25. package/dist/cjs/src/coinbaseinternational.js +2 -0
  26. package/dist/cjs/src/coinbasepro.js +6 -0
  27. package/dist/cjs/src/coincheck.js +3 -0
  28. package/dist/cjs/src/coinex.js +257 -190
  29. package/dist/cjs/src/coinlist.js +4 -0
  30. package/dist/cjs/src/coinmate.js +3 -0
  31. package/dist/cjs/src/coinone.js +3 -0
  32. package/dist/cjs/src/coinsph.js +4 -0
  33. package/dist/cjs/src/coinspot.js +3 -0
  34. package/dist/cjs/src/cryptocom.js +2 -0
  35. package/dist/cjs/src/exmo.js +5 -0
  36. package/dist/cjs/src/gate.js +124 -22
  37. package/dist/cjs/src/hitbtc.js +4 -3
  38. package/dist/cjs/src/htx.js +2 -0
  39. package/dist/cjs/src/idex.js +3 -0
  40. package/dist/cjs/src/independentreserve.js +3 -0
  41. package/dist/cjs/src/indodax.js +3 -0
  42. package/dist/cjs/src/kucoin.js +2 -0
  43. package/dist/cjs/src/kucoinfutures.js +2 -0
  44. package/dist/cjs/src/latoken.js +6 -0
  45. package/dist/cjs/src/luno.js +3 -0
  46. package/dist/cjs/src/lykke.js +5 -0
  47. package/dist/cjs/src/mercado.js +3 -0
  48. package/dist/cjs/src/mexc.js +111 -0
  49. package/dist/cjs/src/ndax.js +4 -0
  50. package/dist/cjs/src/novadax.js +4 -0
  51. package/dist/cjs/src/okx.js +84 -1
  52. package/dist/cjs/src/onetrading.js +3 -0
  53. package/dist/cjs/src/p2b.js +3 -0
  54. package/dist/cjs/src/pro/bybit.js +1 -1
  55. package/dist/cjs/src/pro/coinbase.js +30 -29
  56. package/dist/cjs/src/probit.js +3 -0
  57. package/dist/cjs/src/timex.js +3 -0
  58. package/dist/cjs/src/tradeogre.js +3 -0
  59. package/dist/cjs/src/wavesexchange.js +3 -0
  60. package/dist/cjs/src/wazirx.js +3 -0
  61. package/dist/cjs/src/woo.js +3 -1
  62. package/dist/cjs/src/yobit.js +3 -0
  63. package/js/ccxt.d.ts +1 -1
  64. package/js/ccxt.js +1 -1
  65. package/js/src/abstract/coinbase.d.ts +5 -0
  66. package/js/src/ace.js +5 -0
  67. package/js/src/alpaca.js +6 -0
  68. package/js/src/ascendex.d.ts +2 -2
  69. package/js/src/base/Exchange.d.ts +23 -19
  70. package/js/src/base/Exchange.js +47 -3
  71. package/js/src/base/functions/generic.d.ts +20 -19
  72. package/js/src/bigone.d.ts +1 -1
  73. package/js/src/binance.d.ts +3 -3
  74. package/js/src/binance.js +3 -1
  75. package/js/src/bingx.d.ts +3 -3
  76. package/js/src/bingx.js +3 -1
  77. package/js/src/bitbank.d.ts +1 -1
  78. package/js/src/bitbank.js +3 -0
  79. package/js/src/bitfinex.d.ts +1 -1
  80. package/js/src/bitfinex2.d.ts +1 -1
  81. package/js/src/bitflyer.d.ts +1 -1
  82. package/js/src/bitget.d.ts +4 -3
  83. package/js/src/bitget.js +75 -2
  84. package/js/src/bithumb.d.ts +1 -1
  85. package/js/src/bithumb.js +4 -0
  86. package/js/src/bitmart.d.ts +1 -1
  87. package/js/src/bitmex.d.ts +1 -1
  88. package/js/src/bitmex.js +2 -0
  89. package/js/src/bitopro.d.ts +1 -1
  90. package/js/src/bitopro.js +5 -0
  91. package/js/src/bitrue.d.ts +1 -1
  92. package/js/src/bitso.d.ts +1 -1
  93. package/js/src/bitso.js +3 -0
  94. package/js/src/bitstamp.d.ts +1 -1
  95. package/js/src/bitstamp.js +3 -0
  96. package/js/src/bitteam.js +4 -0
  97. package/js/src/bitvavo.d.ts +1 -1
  98. package/js/src/bitvavo.js +3 -0
  99. package/js/src/bl3p.js +3 -0
  100. package/js/src/blockchaincom.d.ts +1 -1
  101. package/js/src/btcalpha.js +3 -0
  102. package/js/src/btcbox.js +3 -0
  103. package/js/src/btcmarkets.d.ts +1 -1
  104. package/js/src/btcmarkets.js +3 -0
  105. package/js/src/btcturk.js +3 -0
  106. package/js/src/bybit.d.ts +8 -7
  107. package/js/src/bybit.js +123 -12
  108. package/js/src/cex.js +6 -0
  109. package/js/src/coinbase.d.ts +2 -2
  110. package/js/src/coinbase.js +95 -17
  111. package/js/src/coinbaseinternational.d.ts +2 -2
  112. package/js/src/coinbaseinternational.js +2 -0
  113. package/js/src/coinbasepro.d.ts +1 -1
  114. package/js/src/coinbasepro.js +6 -0
  115. package/js/src/coincheck.js +3 -0
  116. package/js/src/coinex.d.ts +8 -7
  117. package/js/src/coinex.js +257 -190
  118. package/js/src/coinlist.d.ts +1 -1
  119. package/js/src/coinlist.js +4 -0
  120. package/js/src/coinmate.d.ts +1 -1
  121. package/js/src/coinmate.js +3 -0
  122. package/js/src/coinone.js +3 -0
  123. package/js/src/coinsph.d.ts +1 -1
  124. package/js/src/coinsph.js +4 -0
  125. package/js/src/coinspot.js +3 -0
  126. package/js/src/cryptocom.d.ts +1 -1
  127. package/js/src/cryptocom.js +2 -0
  128. package/js/src/delta.d.ts +2 -2
  129. package/js/src/deribit.d.ts +1 -1
  130. package/js/src/digifinex.d.ts +3 -3
  131. package/js/src/exmo.d.ts +3 -3
  132. package/js/src/exmo.js +5 -0
  133. package/js/src/gate.d.ts +8 -7
  134. package/js/src/gate.js +124 -22
  135. package/js/src/gemini.d.ts +2 -2
  136. package/js/src/hitbtc.d.ts +3 -3
  137. package/js/src/hitbtc.js +4 -3
  138. package/js/src/hollaex.d.ts +2 -2
  139. package/js/src/htx.d.ts +3 -3
  140. package/js/src/htx.js +2 -0
  141. package/js/src/huobijp.d.ts +1 -1
  142. package/js/src/hyperliquid.d.ts +2 -2
  143. package/js/src/idex.d.ts +2 -2
  144. package/js/src/idex.js +3 -0
  145. package/js/src/independentreserve.js +3 -0
  146. package/js/src/indodax.d.ts +1 -1
  147. package/js/src/indodax.js +3 -0
  148. package/js/src/kraken.d.ts +1 -1
  149. package/js/src/kucoin.d.ts +2 -2
  150. package/js/src/kucoin.js +2 -0
  151. package/js/src/kucoinfutures.d.ts +1 -1
  152. package/js/src/kucoinfutures.js +2 -0
  153. package/js/src/kuna.d.ts +1 -1
  154. package/js/src/latoken.js +6 -0
  155. package/js/src/lbank.d.ts +1 -1
  156. package/js/src/luno.js +3 -0
  157. package/js/src/lykke.d.ts +1 -1
  158. package/js/src/lykke.js +5 -0
  159. package/js/src/mercado.d.ts +1 -1
  160. package/js/src/mercado.js +3 -0
  161. package/js/src/mexc.d.ts +5 -4
  162. package/js/src/mexc.js +111 -0
  163. package/js/src/ndax.d.ts +1 -1
  164. package/js/src/ndax.js +4 -0
  165. package/js/src/novadax.d.ts +1 -1
  166. package/js/src/novadax.js +4 -0
  167. package/js/src/okcoin.d.ts +2 -2
  168. package/js/src/okx.d.ts +10 -9
  169. package/js/src/okx.js +84 -1
  170. package/js/src/onetrading.d.ts +1 -1
  171. package/js/src/onetrading.js +3 -0
  172. package/js/src/p2b.js +3 -0
  173. package/js/src/paymium.d.ts +1 -1
  174. package/js/src/phemex.d.ts +1 -1
  175. package/js/src/poloniex.d.ts +1 -1
  176. package/js/src/pro/bybit.js +1 -1
  177. package/js/src/pro/coinbase.d.ts +2 -2
  178. package/js/src/pro/coinbase.js +30 -29
  179. package/js/src/pro/luno.d.ts +2 -2
  180. package/js/src/probit.d.ts +2 -2
  181. package/js/src/probit.js +3 -0
  182. package/js/src/timex.js +3 -0
  183. package/js/src/tokocrypto.d.ts +1 -1
  184. package/js/src/tradeogre.js +3 -0
  185. package/js/src/upbit.d.ts +2 -2
  186. package/js/src/wavesexchange.d.ts +1 -1
  187. package/js/src/wavesexchange.js +3 -0
  188. package/js/src/wazirx.js +3 -0
  189. package/js/src/whitebit.d.ts +2 -2
  190. package/js/src/woo.d.ts +1 -1
  191. package/js/src/woo.js +3 -1
  192. package/js/src/yobit.d.ts +1 -1
  193. package/js/src/yobit.js +3 -0
  194. package/js/src/zaif.d.ts +1 -1
  195. package/js/src/zonda.d.ts +2 -2
  196. package/package.json +1 -1
@@ -102,7 +102,9 @@ class bybit extends bybit$1 {
102
102
  'fetchOrders': false,
103
103
  'fetchOrderTrades': true,
104
104
  'fetchPosition': true,
105
+ 'fetchPositionHistory': 'emulated',
105
106
  'fetchPositions': true,
107
+ 'fetchPositionsHistory': true,
106
108
  'fetchPremiumIndexOHLCV': true,
107
109
  'fetchSettlementHistory': true,
108
110
  'fetchTicker': true,
@@ -6457,37 +6459,64 @@ class bybit extends bybit$1 {
6457
6459
  // "tradeMode": 0
6458
6460
  // }
6459
6461
  //
6462
+ // fetchPositionsHistory
6463
+ //
6464
+ // {
6465
+ // symbol: 'XRPUSDT',
6466
+ // orderType: 'Market',
6467
+ // leverage: '10',
6468
+ // updatedTime: '1712717265572',
6469
+ // side: 'Sell',
6470
+ // orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
6471
+ // closedPnl: '-0.00049568',
6472
+ // avgEntryPrice: '0.6045',
6473
+ // qty: '3',
6474
+ // cumEntryValue: '1.8135',
6475
+ // createdTime: '1712717265566',
6476
+ // orderPrice: '0.5744',
6477
+ // closedSize: '3',
6478
+ // avgExitPrice: '0.605',
6479
+ // execType: 'Trade',
6480
+ // fillCount: '1',
6481
+ // cumExitValue: '1.815'
6482
+ // }
6483
+ //
6484
+ const closedSize = this.safeString(position, 'closedSize');
6485
+ const isHistory = (closedSize !== undefined);
6460
6486
  const contract = this.safeString(position, 'symbol');
6461
6487
  market = this.safeMarket(contract, market, undefined, 'contract');
6462
- const size = Precise["default"].stringAbs(this.safeString(position, 'size'));
6488
+ const size = Precise["default"].stringAbs(this.safeString2(position, 'size', 'qty'));
6463
6489
  let side = this.safeString(position, 'side');
6464
6490
  if (side !== undefined) {
6465
6491
  if (side === 'Buy') {
6466
- side = 'long';
6492
+ side = isHistory ? 'short' : 'long';
6467
6493
  }
6468
6494
  else if (side === 'Sell') {
6469
- side = 'short';
6495
+ side = isHistory ? 'long' : 'short';
6470
6496
  }
6471
6497
  else {
6472
6498
  side = undefined;
6473
6499
  }
6474
6500
  }
6475
- const notional = this.safeString(position, 'positionValue');
6501
+ const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
6476
6502
  const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
6477
- let initialMarginString = this.safeString(position, 'positionIM');
6503
+ let initialMarginString = this.safeStringN(position, ['positionIM', 'cumEntryValue']);
6478
6504
  let maintenanceMarginString = this.safeString(position, 'positionMM');
6479
- let timestamp = this.parse8601(this.safeString(position, 'updated_at'));
6480
- if (timestamp === undefined) {
6481
- timestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt']);
6505
+ const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
6506
+ let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
6507
+ if (lastUpdateTimestamp === undefined) {
6508
+ lastUpdateTimestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt', 'updatedTime']);
6482
6509
  }
6483
6510
  const tradeMode = this.safeInteger(position, 'tradeMode', 0);
6484
6511
  let marginMode = undefined;
6485
6512
  if ((!this.options['enableUnifiedAccount']) || (this.options['enableUnifiedAccount'] && market['inverse'])) {
6486
6513
  // tradeMode would work for classic and UTA(inverse)
6487
- marginMode = (tradeMode === 1) ? 'isolated' : 'cross';
6514
+ if (!isHistory) { // cannot tell marginMode for fetchPositionsHistory, and closedSize will only be defined for fetchPositionsHistory response
6515
+ marginMode = (tradeMode === 1) ? 'isolated' : 'cross';
6516
+ }
6488
6517
  }
6489
6518
  let collateralString = this.safeString(position, 'positionBalance');
6490
- const entryPrice = this.omitZero(this.safeString2(position, 'entryPrice', 'avgPrice'));
6519
+ const entryPrice = this.omitZero(this.safeStringN(position, ['entryPrice', 'avgPrice', 'avgEntryPrice']));
6491
6520
  const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
6492
6521
  const leverage = this.safeString(position, 'leverage');
6493
6522
  if (liquidationPrice !== undefined) {
@@ -6533,7 +6562,7 @@ class bybit extends bybit$1 {
6533
6562
  'symbol': market['symbol'],
6534
6563
  'timestamp': timestamp,
6535
6564
  'datetime': this.iso8601(timestamp),
6536
- 'lastUpdateTimestamp': undefined,
6565
+ 'lastUpdateTimestamp': lastUpdateTimestamp,
6537
6566
  'initialMargin': this.parseNumber(initialMarginString),
6538
6567
  'initialMarginPercentage': this.parseNumber(Precise["default"].stringDiv(initialMarginString, notional)),
6539
6568
  'maintenanceMargin': this.parseNumber(maintenanceMarginString),
@@ -6542,12 +6571,13 @@ class bybit extends bybit$1 {
6542
6571
  'notional': this.parseNumber(notional),
6543
6572
  'leverage': this.parseNumber(leverage),
6544
6573
  'unrealizedPnl': this.parseNumber(unrealisedPnl),
6574
+ 'realizedPnl': this.safeNumber(position, 'closedPnl'),
6545
6575
  'contracts': this.parseNumber(size),
6546
6576
  'contractSize': this.safeNumber(market, 'contractSize'),
6547
6577
  'marginRatio': this.parseNumber(marginRatio),
6548
6578
  'liquidationPrice': this.parseNumber(liquidationPrice),
6549
6579
  'markPrice': this.safeNumber(position, 'markPrice'),
6550
- 'lastPrice': undefined,
6580
+ 'lastPrice': this.safeNumber(position, 'avgExitPrice'),
6551
6581
  'collateral': this.parseNumber(collateralString),
6552
6582
  'marginMode': marginMode,
6553
6583
  'side': side,
@@ -8470,6 +8500,87 @@ class bybit extends bybit$1 {
8470
8500
  'quoteVolume': undefined,
8471
8501
  };
8472
8502
  }
8503
+ async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
8504
+ /**
8505
+ * @method
8506
+ * @name bybit#fetchPositionsHistory
8507
+ * @description fetches historical positions
8508
+ * @see https://bybit-exchange.github.io/docs/v5/position/close-pnl
8509
+ * @param {string} [symbol] unified market symbols, symbols must have the same subType (must all be linear or all be inverse)
8510
+ * @param {int} [since] timestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days
8511
+ * @param {int} [limit] the maximum amount of records to fetch, default=50, max=100
8512
+ * @param {object} params extra parameters specific to the exchange api endpoint
8513
+ * @param {int} [params.until] timestamp in ms of the latest position to fetch, params["until"] - since <= 7 days
8514
+ * @param {string} [params.subType] 'linear' or 'inverse'
8515
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8516
+ */
8517
+ await this.loadMarkets();
8518
+ let market = undefined;
8519
+ let subType = undefined;
8520
+ let symbolsLength = 0;
8521
+ if (symbols !== undefined) {
8522
+ symbolsLength = symbols.length;
8523
+ if (symbolsLength > 0) {
8524
+ market = this.market(symbols[0]);
8525
+ }
8526
+ }
8527
+ const until = this.safeInteger(params, 'until');
8528
+ [subType, params] = this.handleSubTypeAndParams('fetchPositionsHistory', market, params, 'linear');
8529
+ params = this.omit(params, 'until');
8530
+ const request = {
8531
+ 'category': subType,
8532
+ };
8533
+ if ((symbols !== undefined) && (symbolsLength === 1)) {
8534
+ request['symbol'] = market['id'];
8535
+ }
8536
+ if (since !== undefined) {
8537
+ request['startTime'] = since;
8538
+ }
8539
+ if (limit !== undefined) {
8540
+ request['limit'] = limit;
8541
+ }
8542
+ if (until !== undefined) {
8543
+ request['endTime'] = until;
8544
+ }
8545
+ const response = await this.privateGetV5PositionClosedPnl(this.extend(request, params));
8546
+ //
8547
+ // {
8548
+ // retCode: '0',
8549
+ // retMsg: 'OK',
8550
+ // result: {
8551
+ // nextPageCursor: '071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788%2C071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788',
8552
+ // category: 'linear',
8553
+ // list: [
8554
+ // {
8555
+ // symbol: 'XRPUSDT',
8556
+ // orderType: 'Market',
8557
+ // leverage: '10',
8558
+ // updatedTime: '1712717265572',
8559
+ // side: 'Sell',
8560
+ // orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
8561
+ // closedPnl: '-0.00049568',
8562
+ // avgEntryPrice: '0.6045',
8563
+ // qty: '3',
8564
+ // cumEntryValue: '1.8135',
8565
+ // createdTime: '1712717265566',
8566
+ // orderPrice: '0.5744',
8567
+ // closedSize: '3',
8568
+ // avgExitPrice: '0.605',
8569
+ // execType: 'Trade',
8570
+ // fillCount: '1',
8571
+ // cumExitValue: '1.815'
8572
+ // }
8573
+ // ]
8574
+ // },
8575
+ // retExtInfo: {},
8576
+ // time: '1712717286073'
8577
+ // }
8578
+ //
8579
+ const result = this.safeDict(response, 'result');
8580
+ const rawPositions = this.safeList(result, 'list');
8581
+ const positions = this.parsePositions(rawPositions, symbols, params);
8582
+ return this.filterBySinceLimit(positions, since, limit);
8583
+ }
8473
8584
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8474
8585
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8475
8586
  if (api === 'public') {
@@ -62,7 +62,13 @@ class cex extends cex$1 {
62
62
  'fetchOrder': true,
63
63
  'fetchOrderBook': true,
64
64
  'fetchOrders': true,
65
+ 'fetchPosition': false,
66
+ 'fetchPositionHistory': false,
65
67
  'fetchPositionMode': false,
68
+ 'fetchPositions': false,
69
+ 'fetchPositionsForSymbol': false,
70
+ 'fetchPositionsHistory': false,
71
+ 'fetchPositionsRisk': false,
66
72
  'fetchPremiumIndexOHLCV': false,
67
73
  'fetchTicker': true,
68
74
  'fetchTickers': true,
@@ -202,6 +202,11 @@ class coinbase extends coinbase$1 {
202
202
  'public': {
203
203
  'get': {
204
204
  'brokerage/time': 3,
205
+ 'brokerage/market/product_book': 3,
206
+ 'brokerage/market/products': 3,
207
+ 'brokerage/market/products/{product_id}': 3,
208
+ 'brokerage/market/products/{product_id}/candles': 3,
209
+ 'brokerage/market/products/{product_id}/ticker': 3,
205
210
  },
206
211
  },
207
212
  'private': {
@@ -1091,7 +1096,7 @@ class coinbase extends coinbase$1 {
1091
1096
  /**
1092
1097
  * @method
1093
1098
  * @name coinbase#fetchMarkets
1094
- * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
1099
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproducts
1095
1100
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
1096
1101
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1097
1102
  * @description retrieves data on all markets for coinbase
@@ -1178,20 +1183,92 @@ class coinbase extends coinbase$1 {
1178
1183
  }
1179
1184
  async fetchMarketsV3(params = {}) {
1180
1185
  const spotUnresolvedPromises = [
1181
- this.v3PrivateGetBrokerageProducts(params),
1182
- this.v3PrivateGetBrokerageTransactionSummary(params),
1186
+ this.v3PublicGetBrokerageMarketProducts(params),
1187
+ //
1188
+ // {
1189
+ // products: [
1190
+ // {
1191
+ // product_id: 'BTC-USD',
1192
+ // price: '67060',
1193
+ // price_percentage_change_24h: '3.30054960636883',
1194
+ // volume_24h: '10967.87426597',
1195
+ // volume_percentage_change_24h: '141.73048325503036',
1196
+ // base_increment: '0.00000001',
1197
+ // quote_increment: '0.01',
1198
+ // quote_min_size: '1',
1199
+ // quote_max_size: '150000000',
1200
+ // base_min_size: '0.00000001',
1201
+ // base_max_size: '3400',
1202
+ // base_name: 'Bitcoin',
1203
+ // quote_name: 'US Dollar',
1204
+ // watched: false,
1205
+ // is_disabled: false,
1206
+ // new: false,
1207
+ // status: 'online',
1208
+ // cancel_only: false,
1209
+ // limit_only: false,
1210
+ // post_only: false,
1211
+ // trading_disabled: false,
1212
+ // auction_mode: false,
1213
+ // product_type: 'SPOT',
1214
+ // quote_currency_id: 'USD',
1215
+ // base_currency_id: 'BTC',
1216
+ // fcm_trading_session_details: null,
1217
+ // mid_market_price: '',
1218
+ // alias: '',
1219
+ // alias_to: [ 'BTC-USDC' ],
1220
+ // base_display_symbol: 'BTC',
1221
+ // quote_display_symbol: 'USD',
1222
+ // view_only: false,
1223
+ // price_increment: '0.01',
1224
+ // display_name: 'BTC-USD',
1225
+ // product_venue: 'CBE'
1226
+ // },
1227
+ // ...
1228
+ // ],
1229
+ // num_products: '646'
1230
+ // }
1231
+ //
1183
1232
  ];
1233
+ if (this.checkRequiredCredentials(false)) {
1234
+ spotUnresolvedPromises.push(this.v3PrivateGetBrokerageTransactionSummary(params));
1235
+ }
1236
+ //
1237
+ // {
1238
+ // total_volume: '9.995989116664404',
1239
+ // total_fees: '0.07996791093331522',
1240
+ // fee_tier: {
1241
+ // pricing_tier: 'Advanced 1',
1242
+ // usd_from: '0',
1243
+ // usd_to: '1000',
1244
+ // taker_fee_rate: '0.008',
1245
+ // maker_fee_rate: '0.006',
1246
+ // aop_from: '',
1247
+ // aop_to: ''
1248
+ // },
1249
+ // margin_rate: null,
1250
+ // goods_and_services_tax: null,
1251
+ // advanced_trade_only_volume: '9.995989116664404',
1252
+ // advanced_trade_only_fees: '0.07996791093331522',
1253
+ // coinbase_pro_volume: '0',
1254
+ // coinbase_pro_fees: '0',
1255
+ // total_balance: '',
1256
+ // has_promo_fee: false
1257
+ // }
1258
+ //
1184
1259
  let unresolvedContractPromises = [];
1185
1260
  try {
1186
1261
  unresolvedContractPromises = [
1187
- this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE' })),
1188
- this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
1189
- this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE' })),
1190
- this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
1262
+ this.v3PublicGetBrokerageMarketProducts(this.extend(params, { 'product_type': 'FUTURE' })),
1263
+ this.v3PublicGetBrokerageMarketProducts(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
1191
1264
  ];
1265
+ if (this.checkRequiredCredentials(false)) {
1266
+ unresolvedContractPromises.push(this.extend(params, { 'product_type': 'FUTURE' }));
1267
+ unresolvedContractPromises.push(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' }));
1268
+ }
1192
1269
  }
1193
1270
  catch (e) {
1194
- unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here
1271
+ unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here. Some users can't access perpetual products
1195
1272
  }
1196
1273
  const promises = await Promise.all(spotUnresolvedPromises);
1197
1274
  let contractPromises = undefined;
@@ -1460,6 +1537,7 @@ class coinbase extends coinbase$1 {
1460
1537
  const contractSize = this.safeNumber(futureProductDetails, 'contract_size');
1461
1538
  const contractExpire = this.safeString(futureProductDetails, 'contract_expiry');
1462
1539
  const expireTimestamp = this.parse8601(contractExpire);
1540
+ const expireDateTime = this.iso8601(expireTimestamp);
1463
1541
  const isSwap = (contractExpiryType === 'PERPETUAL');
1464
1542
  const baseId = this.safeString(futureProductDetails, 'contract_root_unit');
1465
1543
  const quoteId = this.safeString(market, 'quote_currency_id');
@@ -1503,7 +1581,7 @@ class coinbase extends coinbase$1 {
1503
1581
  'maker': maker,
1504
1582
  'contractSize': contractSize,
1505
1583
  'expiry': expireTimestamp,
1506
- 'expiryDatetime': contractExpire,
1584
+ 'expiryDatetime': expireDateTime,
1507
1585
  'strike': undefined,
1508
1586
  'optionType': undefined,
1509
1587
  'precision': {
@@ -1728,7 +1806,7 @@ class coinbase extends coinbase$1 {
1728
1806
  if (symbols !== undefined) {
1729
1807
  request['product_ids'] = this.marketIds(symbols);
1730
1808
  }
1731
- const response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
1809
+ const response = await this.v3PublicGetBrokerageMarketProducts(this.extend(request, params));
1732
1810
  //
1733
1811
  // {
1734
1812
  // "products": [
@@ -1831,7 +1909,7 @@ class coinbase extends coinbase$1 {
1831
1909
  'product_id': market['id'],
1832
1910
  'limit': 1,
1833
1911
  };
1834
- const response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
1912
+ const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
1835
1913
  //
1836
1914
  // {
1837
1915
  // "trades": [
@@ -3392,7 +3470,7 @@ class coinbase extends coinbase$1 {
3392
3470
  * @method
3393
3471
  * @name coinbase#fetchOHLCV
3394
3472
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
3395
- * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getcandles
3473
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpubliccandles
3396
3474
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
3397
3475
  * @param {string} timeframe the length of time each candle represents
3398
3476
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -3435,7 +3513,7 @@ class coinbase extends coinbase$1 {
3435
3513
  // 300 candles max
3436
3514
  request['end'] = Precise["default"].stringAdd(sinceString, requestedDuration.toString());
3437
3515
  }
3438
- const response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
3516
+ const response = await this.v3PublicGetBrokerageMarketProductsProductIdCandles(this.extend(request, params));
3439
3517
  //
3440
3518
  // {
3441
3519
  // "candles": [
@@ -3480,7 +3558,7 @@ class coinbase extends coinbase$1 {
3480
3558
  * @method
3481
3559
  * @name coinbase#fetchTrades
3482
3560
  * @description get the list of most recent trades for a particular symbol
3483
- * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getmarkettrades
3561
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicmarkettrades
3484
3562
  * @param {string} symbol unified market symbol of the trades
3485
3563
  * @param {int} [since] not used by coinbase fetchTrades
3486
3564
  * @param {int} [limit] the maximum number of trade structures to fetch
@@ -3506,7 +3584,7 @@ class coinbase extends coinbase$1 {
3506
3584
  else if (since !== undefined) {
3507
3585
  throw new errors.ArgumentsRequired(this.id + ' fetchTrades() requires a `until` parameter when you use `since` argument');
3508
3586
  }
3509
- const response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
3587
+ const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
3510
3588
  //
3511
3589
  // {
3512
3590
  // "trades": [
@@ -3603,7 +3681,7 @@ class coinbase extends coinbase$1 {
3603
3681
  * @method
3604
3682
  * @name coinbase#fetchOrderBook
3605
3683
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
3606
- * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproductbook
3684
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproductbook
3607
3685
  * @param {string} symbol unified symbol of the market to fetch the order book for
3608
3686
  * @param {int} [limit] the maximum amount of order book entries to return
3609
3687
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3617,7 +3695,7 @@ class coinbase extends coinbase$1 {
3617
3695
  if (limit !== undefined) {
3618
3696
  request['limit'] = limit;
3619
3697
  }
3620
- const response = await this.v3PrivateGetBrokerageProductBook(this.extend(request, params));
3698
+ const response = await this.v3PublicGetBrokerageMarketProductBook(this.extend(request, params));
3621
3699
  //
3622
3700
  // {
3623
3701
  // "pricebook": {
@@ -90,8 +90,10 @@ class coinbaseinternational extends coinbaseinternational$1 {
90
90
  'fetchOrderBook': false,
91
91
  'fetchOrders': false,
92
92
  'fetchPosition': true,
93
+ 'fetchPositionHistory': false,
93
94
  'fetchPositionMode': false,
94
95
  'fetchPositions': true,
96
+ 'fetchPositionsHistory': false,
95
97
  'fetchPositionsRisk': false,
96
98
  'fetchPremiumIndexOHLCV': false,
97
99
  'fetchTicker': true,
@@ -53,7 +53,13 @@ class coinbasepro extends coinbasepro$1 {
53
53
  'fetchOrderBook': true,
54
54
  'fetchOrders': true,
55
55
  'fetchOrderTrades': true,
56
+ 'fetchPosition': false,
57
+ 'fetchPositionHistory': false,
56
58
  'fetchPositionMode': false,
59
+ 'fetchPositions': false,
60
+ 'fetchPositionsForSymbol': false,
61
+ 'fetchPositionsHistory': false,
62
+ 'fetchPositionsRisk': false,
57
63
  'fetchTicker': true,
58
64
  'fetchTickers': true,
59
65
  'fetchTime': true,
@@ -52,8 +52,11 @@ class coincheck extends coincheck$1 {
52
52
  'fetchOpenOrders': true,
53
53
  'fetchOrderBook': true,
54
54
  'fetchPosition': false,
55
+ 'fetchPositionHistory': false,
55
56
  'fetchPositionMode': false,
56
57
  'fetchPositions': false,
58
+ 'fetchPositionsForSymbol': false,
59
+ 'fetchPositionsHistory': false,
57
60
  'fetchPositionsRisk': false,
58
61
  'fetchPremiumIndexOHLCV': false,
59
62
  'fetchTicker': true,