ccxt 4.3.22 → 4.3.24

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 (44) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/ccxt.js +9 -6
  3. package/dist/cjs/src/base/Exchange.js +4 -3
  4. package/dist/cjs/src/binance.js +1 -1
  5. package/dist/cjs/src/bitrue.js +6 -1
  6. package/dist/cjs/src/coinbase.js +5 -0
  7. package/dist/cjs/src/coinbaseadvanced.js +17 -0
  8. package/dist/cjs/src/{coinbasepro.js → coinbaseexchange.js} +40 -40
  9. package/dist/cjs/src/coinex.js +198 -257
  10. package/dist/cjs/src/kucoin.js +1 -0
  11. package/dist/cjs/src/phemex.js +26 -9
  12. package/dist/cjs/src/pro/bitget.js +12 -3
  13. package/dist/cjs/src/pro/{coinbasepro.js → coinbaseexchange.js} +13 -13
  14. package/dist/cjs/src/pro/poloniexfutures.js +22 -17
  15. package/dist/cjs/src/probit.js +1 -20
  16. package/dist/cjs/src/whitebit.js +9 -0
  17. package/js/ccxt.d.ts +11 -8
  18. package/js/ccxt.js +8 -6
  19. package/js/src/abstract/coinbaseadvanced.d.ts +97 -0
  20. package/js/src/abstract/coinbaseadvanced.js +11 -0
  21. package/js/src/abstract/whitebit.d.ts +9 -0
  22. package/js/src/base/Exchange.js +4 -3
  23. package/js/src/binance.js +1 -1
  24. package/js/src/bitrue.js +6 -1
  25. package/js/src/coinbase.js +5 -0
  26. package/js/src/coinbaseadvanced.d.ts +4 -0
  27. package/js/src/coinbaseadvanced.js +18 -0
  28. package/js/src/{coinbasepro.d.ts → coinbaseexchange.d.ts} +3 -3
  29. package/js/src/{coinbasepro.js → coinbaseexchange.js} +39 -39
  30. package/js/src/coinex.d.ts +13 -13
  31. package/js/src/coinex.js +199 -258
  32. package/js/src/kucoin.js +1 -0
  33. package/js/src/phemex.d.ts +1 -0
  34. package/js/src/phemex.js +26 -9
  35. package/js/src/pro/bitget.js +12 -3
  36. package/js/src/pro/{coinbasepro.d.ts → coinbaseexchange.d.ts} +2 -2
  37. package/js/src/pro/{coinbasepro.js → coinbaseexchange.js} +12 -12
  38. package/js/src/pro/poloniexfutures.js +22 -17
  39. package/js/src/probit.js +1 -20
  40. package/js/src/whitebit.js +9 -0
  41. package/package.json +1 -1
  42. /package/dist/cjs/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
  43. /package/js/src/abstract/{coinbasepro.d.ts → coinbaseexchange.d.ts} +0 -0
  44. /package/js/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
package/js/src/kucoin.js CHANGED
@@ -4786,6 +4786,7 @@ export default class kucoin extends Exchange {
4786
4786
  const partnerSignature = this.hmac(this.encode(partnerPayload), this.encode(partnerSecret), sha256, 'base64');
4787
4787
  headers['KC-API-PARTNER-SIGN'] = partnerSignature;
4788
4788
  headers['KC-API-PARTNER'] = partnerId;
4789
+ headers['KC-API-PARTNER-VERIFY'] = 'true';
4789
4790
  }
4790
4791
  if (isBroker) {
4791
4792
  const brokerName = this.safeString(partner, 'name');
@@ -61,6 +61,7 @@ export default class phemex extends Exchange {
61
61
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
62
62
  parsePosition(position: any, market?: Market): import("./base/types.js").Position;
63
63
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
64
+ parseFundingFeeToPrecision(value: any, market?: Market, currencyCode?: Str): any;
64
65
  fetchFundingRate(symbol: string, params?: {}): Promise<{
65
66
  info: any;
66
67
  symbol: string;
package/js/src/phemex.js CHANGED
@@ -3910,7 +3910,8 @@ export default class phemex extends Exchange {
3910
3910
  request['limit'] = limit;
3911
3911
  }
3912
3912
  let response = undefined;
3913
- if (market['settle'] === 'USDT') {
3913
+ const isUsdt = market['settle'] === 'USDT';
3914
+ if (isUsdt) {
3914
3915
  response = await this.privateGetApiDataGFuturesFundingFees(this.extend(request, params));
3915
3916
  }
3916
3917
  else {
@@ -3925,13 +3926,13 @@ export default class phemex extends Exchange {
3925
3926
  // {
3926
3927
  // "symbol": "BTCUSD",
3927
3928
  // "currency": "BTC",
3928
- // "execQty": 18,
3929
+ // "execQty": 18, // "execQty" regular, but "execQtyRq" in hedge
3929
3930
  // "side": "Buy",
3930
- // "execPriceEp": 360086455,
3931
- // "execValueEv": 49987,
3932
- // "fundingRateEr": 10000,
3933
- // "feeRateEr": 10000,
3934
- // "execFeeEv": 5,
3931
+ // "execPriceEp": 360086455, // "execPriceEp" regular, but "execPriceRp" in hedge
3932
+ // "execValueEv": 49987, // "execValueEv" regular, but "execValueRv" in hedge
3933
+ // "fundingRateEr": 10000, // "fundingRateEr" regular, but "fundingRateRr" in hedge
3934
+ // "feeRateEr": 10000, // "feeRateEr" regular, but "feeRateRr" in hedge
3935
+ // "execFeeEv": 5, // "execFeeEv" regular, but "execFeeRv" in hedge
3935
3936
  // "createTime": 1651881600000
3936
3937
  // }
3937
3938
  // ]
@@ -3944,18 +3945,34 @@ export default class phemex extends Exchange {
3944
3945
  for (let i = 0; i < rows.length; i++) {
3945
3946
  const entry = rows[i];
3946
3947
  const timestamp = this.safeInteger(entry, 'createTime');
3948
+ const execFee = this.safeString2(entry, 'execFeeEv', 'execFeeRv');
3949
+ const currencyCode = this.safeCurrencyCode(this.safeString(entry, 'currency'));
3947
3950
  result.push({
3948
3951
  'info': entry,
3949
3952
  'symbol': this.safeString(entry, 'symbol'),
3950
- 'code': this.safeCurrencyCode(this.safeString(entry, 'currency')),
3953
+ 'code': currencyCode,
3951
3954
  'timestamp': timestamp,
3952
3955
  'datetime': this.iso8601(timestamp),
3953
3956
  'id': undefined,
3954
- 'amount': this.fromEv(this.safeString(entry, 'execFeeEv'), market),
3957
+ 'amount': this.parseFundingFeeToPrecision(execFee, market, currencyCode),
3955
3958
  });
3956
3959
  }
3957
3960
  return result;
3958
3961
  }
3962
+ parseFundingFeeToPrecision(value, market = undefined, currencyCode = undefined) {
3963
+ if (value === undefined || currencyCode === undefined) {
3964
+ return value;
3965
+ }
3966
+ // it was confirmed by phemex support, that USDT contracts use direct amounts in funding fees, while USD & INVERSE needs 'valueScale'
3967
+ const isUsdt = market['settle'] === 'USDT';
3968
+ if (!isUsdt) {
3969
+ const currency = this.safeCurrency(currencyCode);
3970
+ const scale = this.safeString(currency['info'], 'valueScale');
3971
+ const tickPrecision = this.parsePrecision(scale);
3972
+ value = Precise.stringMul(value, tickPrecision);
3973
+ }
3974
+ return value;
3975
+ }
3959
3976
  async fetchFundingRate(symbol, params = {}) {
3960
3977
  /**
3961
3978
  * @method
@@ -1126,7 +1126,7 @@ export default class bitget extends bitgetRest {
1126
1126
  // "executePrice": "35123", // this is limit price
1127
1127
  // "triggerType": "fill_price",
1128
1128
  // "planType": "amount",
1129
- // #### in case order had fill: ####
1129
+ // #### in case order had a partial fill: ####
1130
1130
  // fillPrice: '35123',
1131
1131
  // tradeId: '1171775539946528779',
1132
1132
  // baseVolume: '7', // field present in market order
@@ -1246,6 +1246,8 @@ export default class bitget extends bitgetRest {
1246
1246
  let totalAmount = undefined;
1247
1247
  let filledAmount = undefined;
1248
1248
  let cost = undefined;
1249
+ let remaining = undefined;
1250
+ const totalFilled = this.safeString(order, 'accBaseVolume');
1249
1251
  if (isSpot) {
1250
1252
  if (isMargin) {
1251
1253
  filledAmount = this.omitZero(this.safeString(order, 'fillTotalAmount'));
@@ -1253,7 +1255,13 @@ export default class bitget extends bitgetRest {
1253
1255
  cost = this.safeString(order, 'quoteSize');
1254
1256
  }
1255
1257
  else {
1256
- filledAmount = this.omitZero(this.safeString2(order, 'accBaseVolume', 'baseVolume'));
1258
+ const partialFillAmount = this.safeString(order, 'baseVolume');
1259
+ if (partialFillAmount !== undefined) {
1260
+ filledAmount = partialFillAmount;
1261
+ }
1262
+ else {
1263
+ filledAmount = totalFilled;
1264
+ }
1257
1265
  if (isMarketOrder) {
1258
1266
  if (isBuy) {
1259
1267
  totalAmount = accBaseVolume;
@@ -1276,6 +1284,7 @@ export default class bitget extends bitgetRest {
1276
1284
  totalAmount = this.safeString(order, 'size');
1277
1285
  cost = this.safeString(order, 'fillNotionalUsd');
1278
1286
  }
1287
+ remaining = this.omitZero(Precise.stringSub(totalAmount, totalFilled));
1279
1288
  return this.safeOrder({
1280
1289
  'info': order,
1281
1290
  'symbol': symbol,
@@ -1294,7 +1303,7 @@ export default class bitget extends bitgetRest {
1294
1303
  'cost': cost,
1295
1304
  'average': avgPrice,
1296
1305
  'filled': filledAmount,
1297
- 'remaining': undefined,
1306
+ 'remaining': remaining,
1298
1307
  'status': this.parseWsOrderStatus(rawStatus),
1299
1308
  'fee': feeObject,
1300
1309
  'trades': undefined,
@@ -1,7 +1,7 @@
1
- import coinbaseproRest from '../coinbasepro.js';
1
+ import coinbaseexchangeRest from '../coinbaseexchange.js';
2
2
  import type { Tickers, Int, Ticker, Str, Strings, OrderBook, Trade, Order } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
- export default class coinbasepro extends coinbaseproRest {
4
+ export default class coinbaseexchange extends coinbaseexchangeRest {
5
5
  describe(): any;
6
6
  authenticate(): {
7
7
  timestamp: number;
@@ -5,12 +5,12 @@
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
- import coinbaseproRest from '../coinbasepro.js';
8
+ import coinbaseexchangeRest from '../coinbaseexchange.js';
9
9
  import { AuthenticationError, ExchangeError, BadSymbol, BadRequest, ArgumentsRequired } from '../base/errors.js';
10
10
  import { ArrayCache, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
11
11
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
12
12
  // ---------------------------------------------------------------------------
13
- export default class coinbasepro extends coinbaseproRest {
13
+ export default class coinbaseexchange extends coinbaseexchangeRest {
14
14
  describe() {
15
15
  return this.deepExtend(super.describe(), {
16
16
  'has': {
@@ -31,7 +31,7 @@ export default class coinbasepro extends coinbaseproRest {
31
31
  },
32
32
  'urls': {
33
33
  'api': {
34
- 'ws': 'wss://ws-feed.pro.coinbase.com',
34
+ 'ws': 'wss://ws-feed.exchange.coinbase.com',
35
35
  },
36
36
  'test': {
37
37
  'ws': 'wss://ws-feed-public.sandbox.exchange.coinbase.com',
@@ -112,7 +112,7 @@ export default class coinbasepro extends coinbaseproRest {
112
112
  async watchTicker(symbol, params = {}) {
113
113
  /**
114
114
  * @method
115
- * @name coinbasepro#watchTicker
115
+ * @name coinbaseexchange#watchTicker
116
116
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
117
117
  * @param {string} symbol unified symbol of the market to fetch the ticker for
118
118
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -124,7 +124,7 @@ export default class coinbasepro extends coinbaseproRest {
124
124
  async watchTickers(symbols = undefined, params = {}) {
125
125
  /**
126
126
  * @method
127
- * @name coinbasepro#watchTickers
127
+ * @name coinbaseexchange#watchTickers
128
128
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
129
129
  * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
130
130
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -149,7 +149,7 @@ export default class coinbasepro extends coinbaseproRest {
149
149
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
150
150
  /**
151
151
  * @method
152
- * @name coinbasepro#watchTrades
152
+ * @name coinbaseexchange#watchTrades
153
153
  * @description get the list of most recent trades for a particular symbol
154
154
  * @param {string} symbol unified symbol of the market to fetch trades for
155
155
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -195,7 +195,7 @@ export default class coinbasepro extends coinbaseproRest {
195
195
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
196
196
  /**
197
197
  * @method
198
- * @name coinbasepro#watchMyTrades
198
+ * @name coinbaseexchange#watchMyTrades
199
199
  * @description watches information on multiple trades made by the user
200
200
  * @param {string} symbol unified market symbol of the market trades were made in
201
201
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -220,7 +220,7 @@ export default class coinbasepro extends coinbaseproRest {
220
220
  async watchMyTradesForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
221
221
  /**
222
222
  * @method
223
- * @name coinbasepro#watchMyTradesForSymbols
223
+ * @name coinbaseexchange#watchMyTradesForSymbols
224
224
  * @description watches information on multiple trades made by the user
225
225
  * @param {string[]} symbols unified symbol of the market to fetch trades for
226
226
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -244,7 +244,7 @@ export default class coinbasepro extends coinbaseproRest {
244
244
  async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
245
245
  /**
246
246
  * @method
247
- * @name coinbasepro#watchOrdersForSymbols
247
+ * @name coinbaseexchange#watchOrdersForSymbols
248
248
  * @description watches information on multiple orders made by the user
249
249
  * @param {string[]} symbols unified symbol of the market to fetch orders for
250
250
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -268,7 +268,7 @@ export default class coinbasepro extends coinbaseproRest {
268
268
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
269
269
  /**
270
270
  * @method
271
- * @name coinbasepro#watchOrders
271
+ * @name coinbaseexchange#watchOrders
272
272
  * @description watches information on multiple orders made by the user
273
273
  * @param {string} symbol unified market symbol of the market orders were made in
274
274
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -293,7 +293,7 @@ export default class coinbasepro extends coinbaseproRest {
293
293
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
294
294
  /**
295
295
  * @method
296
- * @name coinbasepro#watchOrderBookForSymbols
296
+ * @name coinbaseexchange#watchOrderBookForSymbols
297
297
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
298
298
  * @param {string[]} symbols unified array of symbols
299
299
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -335,7 +335,7 @@ export default class coinbasepro extends coinbaseproRest {
335
335
  async watchOrderBook(symbol, limit = undefined, params = {}) {
336
336
  /**
337
337
  * @method
338
- * @name coinbasepro#watchOrderBook
338
+ * @name coinbaseexchange#watchOrderBook
339
339
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
340
340
  * @param {string} symbol unified symbol of the market to fetch the order book for
341
341
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -846,31 +846,36 @@ export default class poloniexfutures extends poloniexfuturesRest {
846
846
  handleDelta(orderbook, delta) {
847
847
  //
848
848
  // {
849
- // "sequence": 18, // Sequence number which is used to judge the continuity of pushed messages
850
- // "change": "5000.0,sell,83" // Price, side, quantity
851
- // "timestamp": 1551770400000
852
- // }
849
+ // sequence: 123677914,
850
+ // lastSequence: 123677913,
851
+ // change: '80.36,buy,4924',
852
+ // changes: [ '80.19,buy,0',"80.15,buy,10794" ],
853
+ // timestamp: 1715643483528
854
+ // },
853
855
  //
854
856
  const sequence = this.safeInteger(delta, 'sequence');
857
+ const lastSequence = this.safeInteger(delta, 'lastSequence');
855
858
  const nonce = this.safeInteger(orderbook, 'nonce');
856
- if (nonce !== sequence - 1) {
857
- const checksum = this.safeBool(this.options, 'checksum', true);
858
- if (checksum) {
859
- // todo: client.reject from handleOrderBookMessage properly
860
- throw new InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
861
- }
859
+ if (nonce > sequence) {
860
+ return;
861
+ }
862
+ if (nonce !== lastSequence) {
863
+ throw new InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
864
+ }
865
+ const changes = this.safeList(delta, 'changes');
866
+ for (let i = 0; i < changes.length; i++) {
867
+ const change = changes[i];
868
+ const splitChange = change.split(',');
869
+ const price = this.safeNumber(splitChange, 0);
870
+ const side = this.safeString(splitChange, 1);
871
+ const size = this.safeNumber(splitChange, 2);
872
+ const orderBookSide = (side === 'buy') ? orderbook['bids'] : orderbook['asks'];
873
+ orderBookSide.store(price, size);
862
874
  }
863
- const change = this.safeString(delta, 'change');
864
- const splitChange = change.split(',');
865
- const price = this.safeNumber(splitChange, 0);
866
- const side = this.safeString(splitChange, 1);
867
- const size = this.safeNumber(splitChange, 2);
868
875
  const timestamp = this.safeInteger(delta, 'timestamp');
869
876
  orderbook['timestamp'] = timestamp;
870
877
  orderbook['datetime'] = this.iso8601(timestamp);
871
878
  orderbook['nonce'] = sequence;
872
- const orderBookSide = (side === 'buy') ? orderbook['bids'] : orderbook['asks'];
873
- orderBookSide.store(price, size);
874
879
  }
875
880
  handleBalance(client, message) {
876
881
  //
package/js/src/probit.js CHANGED
@@ -208,41 +208,22 @@ export default class probit extends Exchange {
208
208
  },
209
209
  },
210
210
  'commonCurrencies': {
211
- 'AUTO': 'Cube',
212
- 'AZU': 'Azultec',
213
- 'BCC': 'BCC',
214
- 'BDP': 'BidiPass',
215
- 'BIRD': 'Birdchain',
216
- 'BTCBEAR': 'BEAR',
217
- 'BTCBULL': 'BULL',
211
+ 'BB': 'Baby Bali',
218
212
  'CBC': 'CryptoBharatCoin',
219
- 'CHE': 'Chellit',
220
- 'CLR': 'Color Platform',
221
213
  'CTK': 'Cryptyk',
222
214
  'CTT': 'Castweet',
223
- 'DIP': 'Dipper',
224
215
  'DKT': 'DAKOTA',
225
216
  'EGC': 'EcoG9coin',
226
217
  'EPS': 'Epanus',
227
218
  'FX': 'Fanzy',
228
- 'GDT': 'Gorilla Diamond',
229
219
  'GM': 'GM Holding',
230
220
  'GOGOL': 'GOL',
231
221
  'GOL': 'Goldofir',
232
- 'GRB': 'Global Reward Bank',
233
- 'HBC': 'Hybrid Bank Cash',
234
222
  'HUSL': 'The Hustle App',
235
223
  'LAND': 'Landbox',
236
- 'LBK': 'Legal Block',
237
- 'ORC': 'Oracle System',
238
- 'PXP': 'PIXSHOP COIN',
239
- 'PYE': 'CreamPYE',
240
- 'ROOK': 'Reckoon',
241
- 'SOC': 'Soda Coin',
242
224
  'SST': 'SocialSwap',
243
225
  'TCT': 'Top Coin Token',
244
226
  'TOR': 'Torex',
245
- 'TPAY': 'Tetra Pay',
246
227
  'UNI': 'UNICORN Token',
247
228
  'UNISWAP': 'UNI',
248
229
  },
@@ -235,6 +235,15 @@ export default class whitebit extends Exchange {
235
235
  'convert/estimate',
236
236
  'convert/confirm',
237
237
  'convert/history',
238
+ 'sub-account/create',
239
+ 'sub-account/delete',
240
+ 'sub-account/edit',
241
+ 'sub-account/list',
242
+ 'sub-account/transfer',
243
+ 'sub-account/block',
244
+ 'sub-account/unblock',
245
+ 'sub-account/balances',
246
+ 'sub-account/transfer/history',
238
247
  ],
239
248
  },
240
249
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.22",
3
+ "version": "4.3.24",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",