ccxt 4.2.51 → 4.2.53

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 (57) hide show
  1. package/CHANGELOG.md +76 -16
  2. package/README.md +5 -6
  3. package/dist/ccxt.browser.js +994 -1412
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -4
  6. package/dist/cjs/src/base/Exchange.js +65 -26
  7. package/dist/cjs/src/binance.js +92 -3
  8. package/dist/cjs/src/bingx.js +32 -1
  9. package/dist/cjs/src/bitget.js +1 -0
  10. package/dist/cjs/src/bitvavo.js +1 -1
  11. package/dist/cjs/src/coinbase.js +186 -12
  12. package/dist/cjs/src/htx.js +10 -4
  13. package/dist/cjs/src/pro/binance.js +156 -1
  14. package/dist/cjs/src/pro/bitfinex2.js +3 -1
  15. package/dist/cjs/src/pro/bitvavo.js +1 -1
  16. package/dist/cjs/src/pro/blockchaincom.js +7 -25
  17. package/dist/cjs/src/pro/deribit.js +2 -2
  18. package/dist/cjs/src/pro/gate.js +2 -1
  19. package/dist/cjs/src/pro/gemini.js +1 -1
  20. package/dist/cjs/src/pro/okx.js +18 -4
  21. package/dist/cjs/src/woo.js +3 -1
  22. package/js/ccxt.d.ts +2 -5
  23. package/js/ccxt.js +2 -4
  24. package/js/src/abstract/coinbase.d.ts +1 -1
  25. package/js/src/base/Exchange.d.ts +65 -26
  26. package/js/src/base/Exchange.js +65 -26
  27. package/js/src/binance.d.ts +6 -0
  28. package/js/src/binance.js +92 -3
  29. package/js/src/bingx.d.ts +4 -0
  30. package/js/src/bingx.js +32 -1
  31. package/js/src/bitget.js +1 -0
  32. package/js/src/bitvavo.js +1 -1
  33. package/js/src/coinbase.d.ts +2 -0
  34. package/js/src/coinbase.js +186 -12
  35. package/js/src/deribit.js +1 -1
  36. package/js/src/htx.js +10 -4
  37. package/js/src/ndax.js +1 -1
  38. package/js/src/pro/binance.d.ts +3 -0
  39. package/js/src/pro/binance.js +156 -1
  40. package/js/src/pro/bingx.js +1 -1
  41. package/js/src/pro/bitfinex2.js +3 -1
  42. package/js/src/pro/bitvavo.js +1 -1
  43. package/js/src/pro/blockchaincom.d.ts +0 -1
  44. package/js/src/pro/blockchaincom.js +7 -25
  45. package/js/src/pro/deribit.js +2 -2
  46. package/js/src/pro/gate.js +2 -1
  47. package/js/src/pro/gemini.js +1 -1
  48. package/js/src/pro/okx.js +18 -4
  49. package/js/src/woo.js +4 -2
  50. package/package.json +2 -1
  51. package/skip-tests.json +29 -13
  52. package/dist/cjs/src/abstract/bitforex.js +0 -9
  53. package/dist/cjs/src/bitforex.js +0 -884
  54. package/js/src/abstract/bitforex.d.ts +0 -27
  55. package/js/src/abstract/bitforex.js +0 -11
  56. package/js/src/bitforex.d.ts +0 -39
  57. package/js/src/bitforex.js +0 -885
package/js/src/binance.js CHANGED
@@ -44,8 +44,12 @@ export default class binance extends Exchange {
44
44
  'closeAllPositions': false,
45
45
  'closePosition': false,
46
46
  'createDepositAddress': false,
47
+ 'createLimitBuyOrder': true,
48
+ 'createLimitSellOrder': true,
49
+ 'createMarketBuyOrder': true,
47
50
  'createMarketBuyOrderWithCost': true,
48
51
  'createMarketOrderWithCost': true,
52
+ 'createMarketSellOrder': true,
49
53
  'createMarketSellOrderWithCost': true,
50
54
  'createOrder': true,
51
55
  'createOrders': true,
@@ -66,6 +70,7 @@ export default class binance extends Exchange {
66
70
  'fetchBorrowInterest': true,
67
71
  'fetchBorrowRateHistories': false,
68
72
  'fetchBorrowRateHistory': true,
73
+ 'fetchCanceledAndClosedOrders': 'emulated',
69
74
  'fetchCanceledOrders': 'emulated',
70
75
  'fetchClosedOrder': false,
71
76
  'fetchClosedOrders': 'emulated',
@@ -111,6 +116,7 @@ export default class binance extends Exchange {
111
116
  'fetchOrders': true,
112
117
  'fetchOrderTrades': true,
113
118
  'fetchPosition': true,
119
+ 'fetchPositionMode': true,
114
120
  'fetchPositions': true,
115
121
  'fetchPositionsRisk': true,
116
122
  'fetchPremiumIndexOHLCV': false,
@@ -122,10 +128,11 @@ export default class binance extends Exchange {
122
128
  'fetchTrades': true,
123
129
  'fetchTradingFee': true,
124
130
  'fetchTradingFees': true,
125
- 'fetchTradingLimits': undefined,
131
+ 'fetchTradingLimits': 'emulated',
126
132
  'fetchTransactionFee': 'emulated',
127
133
  'fetchTransactionFees': true,
128
134
  'fetchTransactions': false,
135
+ 'fetchTransfer': false,
129
136
  'fetchTransfers': true,
130
137
  'fetchUnderlyingAssets': false,
131
138
  'fetchVolatilityHistory': false,
@@ -4116,7 +4123,8 @@ export default class binance extends Exchange {
4116
4123
  // "closeTime": 1677097200000
4117
4124
  // }
4118
4125
  //
4119
- const volumeIndex = (market['inverse']) ? 7 : 5;
4126
+ const inverse = this.safeBool(market, 'inverse');
4127
+ const volumeIndex = inverse ? 7 : 5;
4120
4128
  return [
4121
4129
  this.safeInteger2(ohlcv, 0, 'closeTime'),
4122
4130
  this.safeNumber2(ohlcv, 1, 'open'),
@@ -6819,6 +6827,38 @@ export default class binance extends Exchange {
6819
6827
  const filteredOrders = this.filterBy(orders, 'status', 'canceled');
6820
6828
  return this.filterBySinceLimit(filteredOrders, since, limit);
6821
6829
  }
6830
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6831
+ /**
6832
+ * @method
6833
+ * @name binance#fetchCanceledAndClosedOrders
6834
+ * @description fetches information on multiple canceled orders made by the user
6835
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
6836
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
6837
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
6838
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
6839
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
6840
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
6841
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
6842
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
6843
+ * @param {string} symbol unified market symbol of the market the orders were made in
6844
+ * @param {int} [since] the earliest time in ms to fetch orders for
6845
+ * @param {int} [limit] the maximum number of order structures to retrieve
6846
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6847
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6848
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
6849
+ * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
6850
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6851
+ */
6852
+ if (symbol === undefined) {
6853
+ throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
6854
+ }
6855
+ const orders = await this.fetchOrders(symbol, since, undefined, params);
6856
+ const canceledOrders = this.filterBy(orders, 'status', 'canceled');
6857
+ const closedOrders = this.filterBy(orders, 'status', 'closed');
6858
+ const filteredOrders = this.arrayConcat(canceledOrders, closedOrders);
6859
+ const sortedOrders = this.sortBy(filteredOrders, 'timestamp');
6860
+ return this.filterBySinceLimit(sortedOrders, since, limit);
6861
+ }
6822
6862
  async cancelOrder(id, symbol = undefined, params = {}) {
6823
6863
  /**
6824
6864
  * @method
@@ -8102,7 +8142,6 @@ export default class binance extends Exchange {
8102
8142
  /**
8103
8143
  * @method
8104
8144
  * @name binance#fetchTransfers
8105
- * @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
8106
8145
  * @description fetch a history of internal transfers made on an account
8107
8146
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
8108
8147
  * @param {string} code unified currency code of the currency transferred
@@ -11991,4 +12030,54 @@ export default class binance extends Exchange {
11991
12030
  'info': greeks,
11992
12031
  };
11993
12032
  }
12033
+ async fetchTradingLimits(symbols = undefined, params = {}) {
12034
+ // this method should not be called directly, use loadTradingLimits () instead
12035
+ const markets = await this.fetchMarkets();
12036
+ const tradingLimits = {};
12037
+ for (let i = 0; i < markets.length; i++) {
12038
+ const market = markets[i];
12039
+ const symbol = market['symbol'];
12040
+ if ((symbols === undefined) || (this.inArray(symbol, symbols))) {
12041
+ tradingLimits[symbol] = market['limits']['amount'];
12042
+ }
12043
+ }
12044
+ return tradingLimits;
12045
+ }
12046
+ async fetchPositionMode(symbol = undefined, params = {}) {
12047
+ /**
12048
+ * @method
12049
+ * @name binance#fetchPositionMode
12050
+ * @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
12051
+ * @param {string} symbol unified symbol of the market to fetch the order book for
12052
+ * @param {object} params extra parameters specific to the exchange API endpoint
12053
+ * @param {string} params.subType "linear" or "inverse"
12054
+ * @returns {object} an object detailing whether the market is in hedged or one-way mode
12055
+ */
12056
+ let market = undefined;
12057
+ if (symbol !== undefined) {
12058
+ market = this.market(symbol);
12059
+ }
12060
+ let subType = undefined;
12061
+ [subType, params] = this.handleSubTypeAndParams('fetchPositionMode', market, params);
12062
+ let response = undefined;
12063
+ if (subType === 'linear') {
12064
+ response = await this.fapiPrivateGetPositionSideDual(params);
12065
+ }
12066
+ else if (subType === 'inverse') {
12067
+ response = await this.dapiPrivateGetPositionSideDual(params);
12068
+ }
12069
+ else {
12070
+ throw new BadRequest(this.id + ' fetchPositionMode requires either a symbol argument or params["subType"]');
12071
+ }
12072
+ //
12073
+ // {
12074
+ // dualSidePosition: false
12075
+ // }
12076
+ //
12077
+ const dualSidePosition = this.safeBool(response, 'dualSidePosition');
12078
+ return {
12079
+ 'info': response,
12080
+ 'hedged': dualSidePosition,
12081
+ };
12082
+ }
11994
12083
  }
package/js/src/bingx.d.ts CHANGED
@@ -132,6 +132,10 @@ export default class bingx extends Exchange {
132
132
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
133
133
  closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
134
134
  closeAllPositions(params?: {}): Promise<Position[]>;
135
+ fetchPositionMode(symbol?: Str, params?: {}): Promise<{
136
+ info: any;
137
+ hedged: boolean;
138
+ }>;
135
139
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
136
140
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
137
141
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
package/js/src/bingx.js CHANGED
@@ -70,6 +70,7 @@ export default class bingx extends Exchange {
70
70
  'fetchOpenOrders': true,
71
71
  'fetchOrder': true,
72
72
  'fetchOrderBook': true,
73
+ 'fetchPositionMode': true,
73
74
  'fetchPositions': true,
74
75
  'fetchTicker': true,
75
76
  'fetchTickers': true,
@@ -80,6 +81,7 @@ export default class bingx extends Exchange {
80
81
  'setLeverage': true,
81
82
  'setMargin': true,
82
83
  'setMarginMode': true,
84
+ 'setPositionMode': true,
83
85
  'transfer': true,
84
86
  },
85
87
  'hostname': 'bingx.com',
@@ -3506,13 +3508,14 @@ export default class bingx extends Exchange {
3506
3508
  * @param {float} leverage the rate of leverage
3507
3509
  * @param {string} symbol unified market symbol
3508
3510
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3511
+ * @param {string} [params.side] hedged: ['long' or 'short']. one way: ['both']
3509
3512
  * @returns {object} response from the exchange
3510
3513
  */
3511
3514
  if (symbol === undefined) {
3512
3515
  throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
3513
3516
  }
3514
3517
  const side = this.safeStringUpper(params, 'side');
3515
- this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT']);
3518
+ this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH']);
3516
3519
  await this.loadMarkets();
3517
3520
  const market = this.market(symbol);
3518
3521
  const request = {
@@ -3956,6 +3959,34 @@ export default class bingx extends Exchange {
3956
3959
  }
3957
3960
  return positions;
3958
3961
  }
3962
+ async fetchPositionMode(symbol = undefined, params = {}) {
3963
+ /**
3964
+ * @method
3965
+ * @name bingx#fetchPositionMode
3966
+ * @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
3967
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
3968
+ * @param {string} symbol unified symbol of the market to fetch the order book for
3969
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3970
+ * @returns {object} an object detailing whether the market is in hedged or one-way mode
3971
+ */
3972
+ const response = await this.swapV1PrivateGetPositionSideDual(params);
3973
+ //
3974
+ // {
3975
+ // "code": "0",
3976
+ // "msg": "",
3977
+ // "timeStamp": "1709002057516",
3978
+ // "data": {
3979
+ // "dualSidePosition": "false"
3980
+ // }
3981
+ // }
3982
+ //
3983
+ const data = this.safeDict(response, 'data', {});
3984
+ const dualSidePosition = this.safeString(data, 'dualSidePosition');
3985
+ return {
3986
+ 'info': response,
3987
+ 'hedged': (dualSidePosition === 'true'),
3988
+ };
3989
+ }
3959
3990
  async setPositionMode(hedged, symbol = undefined, params = {}) {
3960
3991
  /**
3961
3992
  * @method
package/js/src/bitget.js CHANGED
@@ -3595,6 +3595,7 @@ export default class bitget extends Exchange {
3595
3595
  'not_trigger': 'open',
3596
3596
  'partial_fill': 'open',
3597
3597
  'partially_fill': 'open',
3598
+ 'partially_filled': 'open',
3598
3599
  'triggered': 'closed',
3599
3600
  'full_fill': 'closed',
3600
3601
  'filled': 'closed',
package/js/src/bitvavo.js CHANGED
@@ -571,7 +571,7 @@ export default class bitvavo extends Exchange {
571
571
  // "market":"ETH-BTC",
572
572
  // "open":"0.022578",
573
573
  // "high":"0.023019",
574
- // "low":"0.022573",
574
+ // "low":"0.022572",
575
575
  // "last":"0.023019",
576
576
  // "volume":"25.16366324",
577
577
  // "volumeQuote":"0.57333305",
@@ -99,6 +99,8 @@ export default class coinbase extends Exchange {
99
99
  tag: string;
100
100
  network: string;
101
101
  };
102
+ deposit(code: string, amount: number, id: string, params?: {}): Promise<Transaction>;
103
+ fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
102
104
  sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
103
105
  url: string;
104
106
  method: string;
@@ -54,6 +54,7 @@ export default class coinbase extends Exchange {
54
54
  'createStopLimitOrder': true,
55
55
  'createStopMarketOrder': false,
56
56
  'createStopOrder': true,
57
+ 'deposit': true,
57
58
  'editOrder': true,
58
59
  'fetchAccounts': true,
59
60
  'fetchBalance': true,
@@ -65,6 +66,7 @@ export default class coinbase extends Exchange {
65
66
  'fetchCrossBorrowRate': false,
66
67
  'fetchCrossBorrowRates': false,
67
68
  'fetchCurrencies': true,
69
+ 'fetchDeposit': true,
68
70
  'fetchDepositAddress': 'emulated',
69
71
  'fetchDepositAddresses': false,
70
72
  'fetchDepositAddressesByNetwork': true,
@@ -193,6 +195,11 @@ export default class coinbase extends Exchange {
193
195
  },
194
196
  },
195
197
  'v3': {
198
+ 'public': {
199
+ 'get': [
200
+ 'brokerage/time',
201
+ ],
202
+ },
196
203
  'private': {
197
204
  'get': [
198
205
  'brokerage/accounts',
@@ -210,7 +217,6 @@ export default class coinbase extends Exchange {
210
217
  'brokerage/product_book',
211
218
  'brokerage/best_bid_ask',
212
219
  'brokerage/convert/trade/{trade_id}',
213
- 'brokerage/time',
214
220
  'brokerage/cfm/balance_summary',
215
221
  'brokerage/cfm/positions',
216
222
  'brokerage/cfm/positions/{product_id}',
@@ -341,6 +347,7 @@ export default class coinbase extends Exchange {
341
347
  'fetchTickers': 'fetchTickersV3',
342
348
  'fetchAccounts': 'fetchAccountsV3',
343
349
  'fetchBalance': 'v2PrivateGetAccounts',
350
+ 'fetchTime': 'v2PublicGetTime',
344
351
  'user_native_currency': 'USD', // needed to get fees for v3
345
352
  },
346
353
  });
@@ -352,19 +359,36 @@ export default class coinbase extends Exchange {
352
359
  * @description fetches the current integer timestamp in milliseconds from the exchange server
353
360
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
354
361
  * @param {object} [params] extra parameters specific to the exchange API endpoint
362
+ * @param {string} [params.method] 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
355
363
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
356
364
  */
357
- const response = await this.v2PublicGetTime(params);
358
- //
359
- // {
360
- // "data": {
361
- // "epoch": 1589295679,
362
- // "iso": "2020-05-12T15:01:19Z"
363
- // }
364
- // }
365
- //
366
- const data = this.safeValue(response, 'data', {});
367
- return this.safeTimestamp(data, 'epoch');
365
+ const defaultMethod = this.safeString(this.options, 'fetchTime', 'v2PublicGetTime');
366
+ const method = this.safeString(params, 'method', defaultMethod);
367
+ params = this.omit(params, 'method');
368
+ let response = undefined;
369
+ if (method === 'v2PublicGetTime') {
370
+ response = await this.v2PublicGetTime(params);
371
+ //
372
+ // {
373
+ // "data": {
374
+ // "epoch": 1589295679,
375
+ // "iso": "2020-05-12T15:01:19Z"
376
+ // }
377
+ // }
378
+ //
379
+ response = this.safeValue(response, 'data', {});
380
+ }
381
+ else {
382
+ response = await this.v3PublicGetBrokerageTime(params);
383
+ //
384
+ // {
385
+ // "iso": "2024-02-27T03:37:14Z",
386
+ // "epochSeconds": "1709005034",
387
+ // "epochMillis": "1709005034333"
388
+ // }
389
+ //
390
+ }
391
+ return this.safeTimestamp2(response, 'epoch', 'epochSeconds');
368
392
  }
369
393
  async fetchAccounts(params = {}) {
370
394
  /**
@@ -1760,6 +1784,7 @@ export default class coinbase extends Exchange {
1760
1784
  response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
1761
1785
  }
1762
1786
  else {
1787
+ request['limit'] = 100;
1763
1788
  response = await this.v2PrivateGetAccounts(this.extend(request, params));
1764
1789
  }
1765
1790
  //
@@ -3539,6 +3564,145 @@ export default class coinbase extends Exchange {
3539
3564
  'network': this.networkIdToCode(networkId, code),
3540
3565
  };
3541
3566
  }
3567
+ async deposit(code, amount, id, params = {}) {
3568
+ /**
3569
+ * @method
3570
+ * @name coinbase#deposit
3571
+ * @description make a deposit
3572
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds
3573
+ * @param {string} code unified currency code
3574
+ * @param {float} amount the amount to deposit
3575
+ * @param {string} id the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
3576
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3577
+ * @param {string} [params.accountId] the id of the account to deposit into
3578
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3579
+ */
3580
+ await this.loadMarkets();
3581
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
3582
+ params = this.omit(params, ['account_id', 'accountId']);
3583
+ if (accountId === undefined) {
3584
+ if (code === undefined) {
3585
+ throw new ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
3586
+ }
3587
+ accountId = await this.findAccountId(code);
3588
+ if (accountId === undefined) {
3589
+ throw new ExchangeError(this.id + ' deposit() could not find account id for ' + code);
3590
+ }
3591
+ }
3592
+ const request = {
3593
+ 'account_id': accountId,
3594
+ 'amount': this.numberToString(amount),
3595
+ 'currency': code.toUpperCase(),
3596
+ 'payment_method': id,
3597
+ };
3598
+ const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
3599
+ //
3600
+ // {
3601
+ // "data": {
3602
+ // "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
3603
+ // "status": "created",
3604
+ // "payment_method": {
3605
+ // "id": "83562370-3e5c-51db-87da-752af5ab9559",
3606
+ // "resource": "payment_method",
3607
+ // "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
3608
+ // },
3609
+ // "transaction": {
3610
+ // "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
3611
+ // "resource": "transaction",
3612
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
3613
+ // },
3614
+ // "amount": {
3615
+ // "amount": "10.00",
3616
+ // "currency": "USD"
3617
+ // },
3618
+ // "subtotal": {
3619
+ // "amount": "10.00",
3620
+ // "currency": "USD"
3621
+ // },
3622
+ // "created_at": "2015-01-31T20:49:02Z",
3623
+ // "updated_at": "2015-02-11T16:54:02-08:00",
3624
+ // "resource": "deposit",
3625
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
3626
+ // "committed": true,
3627
+ // "fee": {
3628
+ // "amount": "0.00",
3629
+ // "currency": "USD"
3630
+ // },
3631
+ // "payout_at": "2015-02-18T16:54:00-08:00"
3632
+ // }
3633
+ // }
3634
+ //
3635
+ const data = this.safeDict(response, 'data', {});
3636
+ return this.parseTransaction(data);
3637
+ }
3638
+ async fetchDeposit(id, code = undefined, params = {}) {
3639
+ /**
3640
+ * @method
3641
+ * @name coinbase#fetchDeposit
3642
+ * @description fetch information on a deposit, fiat only, for crypto transactions use fetchLedger
3643
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit
3644
+ * @param {string} id deposit id
3645
+ * @param {string} [code] unified currency code
3646
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3647
+ * @param {string} [params.accountId] the id of the account that the funds were deposited into
3648
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3649
+ */
3650
+ await this.loadMarkets();
3651
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
3652
+ params = this.omit(params, ['account_id', 'accountId']);
3653
+ if (accountId === undefined) {
3654
+ if (code === undefined) {
3655
+ throw new ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
3656
+ }
3657
+ accountId = await this.findAccountId(code);
3658
+ if (accountId === undefined) {
3659
+ throw new ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
3660
+ }
3661
+ }
3662
+ const request = {
3663
+ 'account_id': accountId,
3664
+ 'deposit_id': id,
3665
+ };
3666
+ const response = await this.v2PrivateGetAccountsAccountIdDepositsDepositId(this.extend(request, params));
3667
+ //
3668
+ // {
3669
+ // "data": {
3670
+ // "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
3671
+ // "status": "completed",
3672
+ // "payment_method": {
3673
+ // "id": "83562370-3e5c-51db-87da-752af5ab9559",
3674
+ // "resource": "payment_method",
3675
+ // "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
3676
+ // },
3677
+ // "transaction": {
3678
+ // "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
3679
+ // "resource": "transaction",
3680
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
3681
+ // },
3682
+ // "amount": {
3683
+ // "amount": "10.00",
3684
+ // "currency": "USD"
3685
+ // },
3686
+ // "subtotal": {
3687
+ // "amount": "10.00",
3688
+ // "currency": "USD"
3689
+ // },
3690
+ // "created_at": "2015-01-31T20:49:02Z",
3691
+ // "updated_at": "2015-02-11T16:54:02-08:00",
3692
+ // "resource": "deposit",
3693
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
3694
+ // "committed": true,
3695
+ // "fee": {
3696
+ // "amount": "0.00",
3697
+ // "currency": "USD"
3698
+ // },
3699
+ // "payout_at": "2015-02-18T16:54:00-08:00"
3700
+ // }
3701
+ // }
3702
+ //
3703
+ const data = this.safeValue(response, 'data', {});
3704
+ return this.parseTransaction(data);
3705
+ }
3542
3706
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
3543
3707
  const version = api[0];
3544
3708
  const signed = api[1] === 'private';
@@ -3559,6 +3723,11 @@ export default class coinbase extends Exchange {
3559
3723
  'Authorization': authorization,
3560
3724
  'Content-Type': 'application/json',
3561
3725
  };
3726
+ if (method !== 'GET') {
3727
+ if (Object.keys(query).length) {
3728
+ body = this.json(query);
3729
+ }
3730
+ }
3562
3731
  }
3563
3732
  else if (this.token && !this.checkRequiredCredentials(false)) {
3564
3733
  headers = {
@@ -3581,6 +3750,11 @@ export default class coinbase extends Exchange {
3581
3750
  payload = body;
3582
3751
  }
3583
3752
  }
3753
+ else {
3754
+ if (Object.keys(query).length) {
3755
+ payload += '?' + this.urlencode(query);
3756
+ }
3757
+ }
3584
3758
  const auth = nonce + method + savedPath + payload;
3585
3759
  const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
3586
3760
  headers = {
package/js/src/deribit.js CHANGED
@@ -10,7 +10,7 @@ import { TICK_SIZE } from './base/functions/number.js';
10
10
  import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, DDoSProtection, NotSupported, ExchangeNotAvailable, InsufficientFunds, BadRequest, InvalidAddress, OnMaintenance } from './base/errors.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
- import totp from './base/functions/totp.js';
13
+ import { totp } from './base/functions/totp.js';
14
14
  // ---------------------------------------------------------------------------
15
15
  /**
16
16
  * @class deribit
package/js/src/htx.js CHANGED
@@ -1234,9 +1234,10 @@ export default class htx extends Exchange {
1234
1234
  async fetchStatus(params = {}) {
1235
1235
  await this.loadMarkets();
1236
1236
  let marketType = undefined;
1237
- [marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', undefined, params);
1237
+ [marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
1238
+ const enabledForContracts = this.handleOption('fetchStatus', 'enableForContracts', false); // temp fix for: https://status-linear-swap.huobigroup.com/api/v2/summary.json
1238
1239
  let response = undefined;
1239
- if (marketType !== 'spot') {
1240
+ if (marketType !== 'spot' && enabledForContracts) {
1240
1241
  const subType = this.safeString(params, 'subType', this.options['defaultSubType']);
1241
1242
  if (marketType === 'swap') {
1242
1243
  if (subType === 'linear') {
@@ -1258,7 +1259,7 @@ export default class htx extends Exchange {
1258
1259
  response = await this.contractPublicGetHeartbeat();
1259
1260
  }
1260
1261
  }
1261
- else {
1262
+ else if (marketType === 'spot') {
1262
1263
  response = await this.statusPublicSpotGetApiV2SummaryJson();
1263
1264
  }
1264
1265
  //
@@ -1427,7 +1428,12 @@ export default class htx extends Exchange {
1427
1428
  let url = undefined;
1428
1429
  if (marketType === 'contract') {
1429
1430
  const statusRaw = this.safeString(response, 'status');
1430
- status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
1431
+ if (statusRaw === undefined) {
1432
+ status = undefined;
1433
+ }
1434
+ else {
1435
+ status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
1436
+ }
1431
1437
  updated = this.safeString(response, 'ts');
1432
1438
  }
1433
1439
  else {
package/js/src/ndax.js CHANGED
@@ -10,7 +10,7 @@ import { ExchangeError, AuthenticationError, InsufficientFunds, BadSymbol, Order
10
10
  import { TICK_SIZE } from './base/functions/number.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
- import totp from './base/functions/totp.js';
13
+ import { totp } from './base/functions/totp.js';
14
14
  // ---------------------------------------------------------------------------
15
15
  /**
16
16
  * @class ndax
@@ -20,6 +20,8 @@ export default class binance extends binanceRest {
20
20
  handleTrade(client: Client, message: any): void;
21
21
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
22
22
  handleOHLCV(client: Client, message: any): void;
23
+ fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
24
+ handleFetchOHLCV(client: Client, message: any): void;
23
25
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
24
26
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
25
27
  parseWsTicker(message: any, marketType: any): Ticker;
@@ -55,6 +57,7 @@ export default class binance extends binanceRest {
55
57
  handlePositions(client: any, message: any): void;
56
58
  parseWsPosition(position: any, market?: any): Position;
57
59
  fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
60
+ fetchTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
58
61
  handleTradesWs(client: Client, message: any): void;
59
62
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
60
63
  handleMyTrade(client: Client, message: any): void;