ccxt 4.4.7 → 4.4.9

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 (61) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/bigone.js +35 -86
  5. package/dist/cjs/src/binance.js +51 -12
  6. package/dist/cjs/src/bingx.js +7 -2
  7. package/dist/cjs/src/bitget.js +3 -0
  8. package/dist/cjs/src/bybit.js +368 -1
  9. package/dist/cjs/src/gate.js +35 -1
  10. package/dist/cjs/src/htx.js +24 -0
  11. package/dist/cjs/src/kucoin.js +2 -1
  12. package/dist/cjs/src/kucoinfutures.js +162 -2
  13. package/dist/cjs/src/okx.js +4 -0
  14. package/dist/cjs/src/pro/binance.js +4 -4
  15. package/dist/cjs/src/pro/bitmart.js +81 -0
  16. package/dist/cjs/src/pro/bitvavo.js +92 -1
  17. package/dist/cjs/src/pro/blofin.js +64 -0
  18. package/dist/cjs/src/pro/hitbtc.js +122 -48
  19. package/dist/cjs/src/pro/hollaex.js +5 -0
  20. package/dist/cjs/src/pro/okx.js +19 -3
  21. package/dist/cjs/src/pro/p2b.js +35 -1
  22. package/dist/cjs/src/pro/whitebit.js +31 -0
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/bigone.d.ts +1 -1
  26. package/js/src/abstract/binance.d.ts +1 -0
  27. package/js/src/abstract/binancecoinm.d.ts +1 -0
  28. package/js/src/abstract/binanceus.d.ts +1 -0
  29. package/js/src/abstract/binanceusdm.d.ts +1 -0
  30. package/js/src/abstract/bybit.d.ts +5 -0
  31. package/js/src/abstract/kucoinfutures.d.ts +5 -0
  32. package/js/src/abstract/okx.d.ts +2 -0
  33. package/js/src/bigone.js +35 -86
  34. package/js/src/binance.d.ts +15 -15
  35. package/js/src/binance.js +51 -12
  36. package/js/src/bingx.js +7 -2
  37. package/js/src/bitget.js +3 -0
  38. package/js/src/bybit.d.ts +7 -1
  39. package/js/src/bybit.js +368 -1
  40. package/js/src/gate.js +35 -1
  41. package/js/src/htx.js +24 -0
  42. package/js/src/kucoin.js +2 -1
  43. package/js/src/kucoinfutures.d.ts +7 -1
  44. package/js/src/kucoinfutures.js +162 -2
  45. package/js/src/okx.js +4 -0
  46. package/js/src/pro/binance.js +4 -4
  47. package/js/src/pro/bitmart.d.ts +3 -0
  48. package/js/src/pro/bitmart.js +81 -0
  49. package/js/src/pro/bitvavo.d.ts +7 -2
  50. package/js/src/pro/bitvavo.js +92 -1
  51. package/js/src/pro/blofin.d.ts +3 -0
  52. package/js/src/pro/blofin.js +64 -0
  53. package/js/src/pro/hitbtc.d.ts +4 -1
  54. package/js/src/pro/hitbtc.js +122 -48
  55. package/js/src/pro/hollaex.js +5 -0
  56. package/js/src/pro/okx.js +19 -3
  57. package/js/src/pro/p2b.d.ts +2 -1
  58. package/js/src/pro/p2b.js +35 -1
  59. package/js/src/pro/whitebit.d.ts +2 -1
  60. package/js/src/pro/whitebit.js +31 -0
  61. package/package.json +1 -1
package/js/src/bigone.js CHANGED
@@ -161,7 +161,7 @@ export default class bigone extends Exchange {
161
161
  },
162
162
  'webExchange': {
163
163
  'get': [
164
- 'uc/v2/assets',
164
+ 'v3/assets',
165
165
  ],
166
166
  },
167
167
  },
@@ -341,7 +341,7 @@ export default class bigone extends Exchange {
341
341
  * @returns {dict} an associative dictionary of currencies
342
342
  */
343
343
  // we use undocumented link (possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
344
- const data = await this.fetchWebEndpoint('fetchCurrencies', 'webExchangeGetUcV2Assets', true);
344
+ const data = await this.fetchWebEndpoint('fetchCurrencies', 'webExchangeGetV3Assets', true);
345
345
  if (data === undefined) {
346
346
  return undefined;
347
347
  }
@@ -351,91 +351,40 @@ export default class bigone extends Exchange {
351
351
  // "message": "",
352
352
  // "data": [
353
353
  // {
354
- // "name": "TetherUS",
355
- // "symbol": "USDT",
356
- // "contract_address": "31",
357
- // "is_deposit_enabled": true,
358
- // "is_withdrawal_enabled": true,
359
- // "is_stub": false,
360
- // "withdrawal_fee": "5.0",
361
- // "is_fiat": false,
362
- // "is_memo_required": false,
363
- // "logo": {
364
- // "default": "https://assets.peatio.com/assets/v1/color/normal/usdt.png",
365
- // "white": "https://assets.peatio.com/assets/v1/white/normal/usdt.png",
354
+ // "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
355
+ // "symbol": "USDT",
356
+ // "name": "TetherUS",
357
+ // "scale": 12,
358
+ // "is_fiat": false,
359
+ // "is_transfer_enabled": true,
360
+ // "transfer_scale": 12,
361
+ // "binding_gateways": [
362
+ // {
363
+ // "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
364
+ // "is_deposit_enabled": true,
365
+ // "gateway_name": "Ethereum",
366
+ // "min_withdrawal_amount": "0.000001",
367
+ // "withdrawal_fee": "5.71",
368
+ // "is_withdrawal_enabled": true,
369
+ // "min_deposit_amount": "0.000001",
370
+ // "is_memo_required": false,
371
+ // "withdrawal_scale": 6,
372
+ // "scale": 12
373
+ // },
374
+ // {
375
+ // "guid": "4e387a9a-a480-40a3-b4ae-ed1773c2db5a",
376
+ // "is_deposit_enabled": true,
377
+ // "gateway_name": "BinanceSmartChain",
378
+ // "min_withdrawal_amount": "10",
379
+ // "withdrawal_fee": "5",
380
+ // "is_withdrawal_enabled": false,
381
+ // "min_deposit_amount": "1",
382
+ // "is_memo_required": false,
383
+ // "withdrawal_scale": 8,
384
+ // "scale": 12
385
+ // }
386
+ // ]
366
387
  // },
367
- // "info_link": null,
368
- // "scale": "12",
369
- // "default_gateway": ..., // one object from "gateways"
370
- // "gateways": [
371
- // {
372
- // "uuid": "f0fa5a85-7f65-428a-b7b7-13aad55c2837",
373
- // "name": "Mixin",
374
- // "kind": "CHAIN",
375
- // "required_confirmations": "0",
376
- // },
377
- // {
378
- // "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
379
- // "name": "Ethereum",
380
- // "kind": "CHAIN",
381
- // "required_confirmations": "18",
382
- // },
383
- // {
384
- // "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
385
- // "name": "Tron",
386
- // "kind": "CHAIN",
387
- // "required_confirmations": "1",
388
- // },
389
- // ...
390
- // ],
391
- // "payments": [],
392
- // "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
393
- // "binding_gateways": [
394
- // {
395
- // "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
396
- // "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
397
- // "is_deposit_enabled": true,
398
- // "display_name": "Ethereum(ERC20)",
399
- // "gateway_name": "Ethereum",
400
- // "min_withdrawal_amount": "0.000001",
401
- // "min_internal_withdrawal_amount": "0.00000001",
402
- // "withdrawal_fee": "14",
403
- // "is_withdrawal_enabled": true,
404
- // "min_deposit_amount": "0.000001",
405
- // "is_memo_required": false,
406
- // "withdrawal_scale": "2",
407
- // "gateway": {
408
- // "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
409
- // "name": "Ethereum",
410
- // "kind": "CHAIN",
411
- // "required_confirmations": "18",
412
- // },
413
- // "scale": "12",
414
- // },
415
- // {
416
- // "guid": "b80a4d13-cac7-4319-842d-b33c3bfab8ec",
417
- // "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
418
- // "is_deposit_enabled": true,
419
- // "display_name": "Tron(TRC20)",
420
- // "gateway_name": "Tron",
421
- // "min_withdrawal_amount": "0.000001",
422
- // "min_internal_withdrawal_amount": "0.00000001",
423
- // "withdrawal_fee": "1",
424
- // "is_withdrawal_enabled": true,
425
- // "min_deposit_amount": "0.000001",
426
- // "is_memo_required": false,
427
- // "withdrawal_scale": "6",
428
- // "gateway": {
429
- // "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
430
- // "name": "Tron",
431
- // "kind": "CHAIN",
432
- // "required_confirmations": "1",
433
- // },
434
- // "scale": "12",
435
- // },
436
- // ...
437
- // ],
438
- // },
439
388
  // ...
440
389
  // ],
441
390
  // }
@@ -303,46 +303,46 @@ export default class binance extends Exchange {
303
303
  repayCrossMargin(code: string, amount: any, params?: {}): Promise<{
304
304
  id: number;
305
305
  currency: string;
306
- amount: any;
306
+ amount: number;
307
307
  symbol: any;
308
- timestamp: any;
309
- datetime: any;
308
+ timestamp: number;
309
+ datetime: string;
310
310
  info: any;
311
311
  }>;
312
312
  repayIsolatedMargin(symbol: string, code: string, amount: any, params?: {}): Promise<{
313
313
  id: number;
314
314
  currency: string;
315
- amount: any;
315
+ amount: number;
316
316
  symbol: any;
317
- timestamp: any;
318
- datetime: any;
317
+ timestamp: number;
318
+ datetime: string;
319
319
  info: any;
320
320
  }>;
321
321
  borrowCrossMargin(code: string, amount: number, params?: {}): Promise<{
322
322
  id: number;
323
323
  currency: string;
324
- amount: any;
324
+ amount: number;
325
325
  symbol: any;
326
- timestamp: any;
327
- datetime: any;
326
+ timestamp: number;
327
+ datetime: string;
328
328
  info: any;
329
329
  }>;
330
330
  borrowIsolatedMargin(symbol: string, code: string, amount: number, params?: {}): Promise<{
331
331
  id: number;
332
332
  currency: string;
333
- amount: any;
333
+ amount: number;
334
334
  symbol: any;
335
- timestamp: any;
336
- datetime: any;
335
+ timestamp: number;
336
+ datetime: string;
337
337
  info: any;
338
338
  }>;
339
339
  parseMarginLoan(info: any, currency?: Currency): {
340
340
  id: number;
341
341
  currency: string;
342
- amount: any;
342
+ amount: number;
343
343
  symbol: any;
344
- timestamp: any;
345
- datetime: any;
344
+ timestamp: number;
345
+ datetime: string;
346
346
  info: any;
347
347
  };
348
348
  fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
package/js/src/binance.js CHANGED
@@ -1094,6 +1094,7 @@ export default class binance extends Exchange {
1094
1094
  'repay-futures-negative-balance': 150,
1095
1095
  'listenKey': 1,
1096
1096
  'asset-collection': 3,
1097
+ 'margin/repay-debt': 0.4, // Weight(Order): 0.4 => (1000 / (50 * 0.4)) * 60 = 3000
1097
1098
  },
1098
1099
  'put': {
1099
1100
  'listenKey': 1, // 1
@@ -1211,6 +1212,7 @@ export default class binance extends Exchange {
1211
1212
  ],
1212
1213
  'fetchCurrencies': true,
1213
1214
  // 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades, eapiPublicGetTrades
1215
+ // 'repayCrossMarginMethod': 'papiPostRepayLoan', // papiPostMarginRepayDebt
1214
1216
  'defaultTimeInForce': 'GTC',
1215
1217
  'defaultType': 'spot',
1216
1218
  'defaultSubType': undefined,
@@ -2907,7 +2909,7 @@ export default class binance extends Exchange {
2907
2909
  const res = this.safeValue(results, i);
2908
2910
  if (fetchMargins && Array.isArray(res)) {
2909
2911
  const keysList = Object.keys(this.indexBy(res, 'symbol'));
2910
- const length = (Object.keys(this.options['crossMarginPairsData'])).length;
2912
+ const length = this.options['crossMarginPairsData'].length;
2911
2913
  // first one is the cross-margin promise
2912
2914
  if (length === 0) {
2913
2915
  this.options['crossMarginPairsData'] = keysList;
@@ -12220,10 +12222,13 @@ export default class binance extends Exchange {
12220
12222
  * @description repay borrowed margin and interest
12221
12223
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay
12222
12224
  * @see https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay
12225
+ * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt
12223
12226
  * @param {string} code unified currency code of the currency to repay
12224
12227
  * @param {float} amount the amount to repay
12225
12228
  * @param {object} [params] extra parameters specific to the exchange API endpoint
12226
12229
  * @param {boolean} [params.portfolioMargin] set to true if you would like to repay margin in a portfolio margin account
12230
+ * @param {string} [params.repayCrossMarginMethod] *portfolio margin only* 'papiPostRepayLoan' (default), 'papiPostMarginRepayDebt' (alternative)
12231
+ * @param {string} [params.specifyRepayAssets] *portfolio margin papiPostMarginRepayDebt only* specific asset list to repay debt
12227
12232
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
12228
12233
  */
12229
12234
  await this.loadMarkets();
@@ -12236,19 +12241,41 @@ export default class binance extends Exchange {
12236
12241
  let isPortfolioMargin = undefined;
12237
12242
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'repayCrossMargin', 'papi', 'portfolioMargin', false);
12238
12243
  if (isPortfolioMargin) {
12239
- response = await this.papiPostRepayLoan(this.extend(request, params));
12244
+ let method = undefined;
12245
+ [method, params] = this.handleOptionAndParams2(params, 'repayCrossMargin', 'repayCrossMarginMethod', 'method');
12246
+ if (method === 'papiPostMarginRepayDebt') {
12247
+ response = await this.papiPostMarginRepayDebt(this.extend(request, params));
12248
+ //
12249
+ // {
12250
+ // "asset": "USDC",
12251
+ // "amount": 10,
12252
+ // "specifyRepayAssets": null,
12253
+ // "updateTime": 1727170761267,
12254
+ // "success": true
12255
+ // }
12256
+ //
12257
+ }
12258
+ else {
12259
+ response = await this.papiPostRepayLoan(this.extend(request, params));
12260
+ //
12261
+ // {
12262
+ // "tranId": 108988250265,
12263
+ // "clientTag":""
12264
+ // }
12265
+ //
12266
+ }
12240
12267
  }
12241
12268
  else {
12242
12269
  request['isIsolated'] = 'FALSE';
12243
12270
  request['type'] = 'REPAY';
12244
12271
  response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
12272
+ //
12273
+ // {
12274
+ // "tranId": 108988250265,
12275
+ // "clientTag":""
12276
+ // }
12277
+ //
12245
12278
  }
12246
- //
12247
- // {
12248
- // "tranId": 108988250265,
12249
- // "clientTag":""
12250
- // }
12251
- //
12252
12279
  return this.parseMarginLoan(response, currency);
12253
12280
  }
12254
12281
  async repayIsolatedMargin(symbol, code, amount, params = {}) {
@@ -12358,13 +12385,25 @@ export default class binance extends Exchange {
12358
12385
  // "clientTag":""
12359
12386
  // }
12360
12387
  //
12388
+ // repayCrossMargin alternative endpoint
12389
+ //
12390
+ // {
12391
+ // "asset": "USDC",
12392
+ // "amount": 10,
12393
+ // "specifyRepayAssets": null,
12394
+ // "updateTime": 1727170761267,
12395
+ // "success": true
12396
+ // }
12397
+ //
12398
+ const currencyId = this.safeString(info, 'asset');
12399
+ const timestamp = this.safeInteger(info, 'updateTime');
12361
12400
  return {
12362
12401
  'id': this.safeInteger(info, 'tranId'),
12363
- 'currency': this.safeCurrencyCode(undefined, currency),
12364
- 'amount': undefined,
12402
+ 'currency': this.safeCurrencyCode(currencyId, currency),
12403
+ 'amount': this.safeNumber(info, 'amount'),
12365
12404
  'symbol': undefined,
12366
- 'timestamp': undefined,
12367
- 'datetime': undefined,
12405
+ 'timestamp': timestamp,
12406
+ 'datetime': this.iso8601(timestamp),
12368
12407
  'info': info,
12369
12408
  };
12370
12409
  }
package/js/src/bingx.js CHANGED
@@ -651,7 +651,12 @@ export default class bingx extends Exchange {
651
651
  // "maxNotional": 20000,
652
652
  // "status": 1,
653
653
  // "tickSize": 0.000001,
654
- // "stepSize": 1
654
+ // "stepSize": 1,
655
+ // "apiStateSell": true,
656
+ // "apiStateBuy": true,
657
+ // "timeOnline": 0,
658
+ // "offTime": 0,
659
+ // "maintainTime": 0
655
660
  // },
656
661
  // ...
657
662
  // ]
@@ -760,7 +765,7 @@ export default class bingx extends Exchange {
760
765
  if ((this.safeString(market, 'apiStateOpen') === 'true') && (this.safeString(market, 'apiStateClose') === 'true')) {
761
766
  isActive = true; // swap active
762
767
  }
763
- else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy')) {
768
+ else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.safeNumber(market, 'status') === 1)) {
764
769
  isActive = true; // spot active
765
770
  }
766
771
  const isInverse = (spot) ? undefined : checkIsInverse;
package/js/src/bitget.js CHANGED
@@ -1423,6 +1423,9 @@ export default class bitget extends Exchange {
1423
1423
  'STARKNET': 'Starknet',
1424
1424
  'OPTIMISM': 'Optimism',
1425
1425
  'ARBITRUM': 'Arbitrum',
1426
+ 'APT': 'APTOS',
1427
+ 'MATIC': 'POLYGON',
1428
+ 'VIC': 'VICTION',
1426
1429
  },
1427
1430
  'networksById': {},
1428
1431
  'fetchPositions': {
package/js/src/bybit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bybit.js';
2
- import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, Conversion } from './base/types.js';
3
3
  /**
4
4
  * @class bybit
5
5
  * @augments Exchange
@@ -204,6 +204,12 @@ export default class bybit extends Exchange {
204
204
  fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
205
205
  parseOption(chain: Dict, currency?: Currency, market?: Market): Option;
206
206
  fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
207
+ fetchConvertCurrencies(params?: {}): Promise<Currencies>;
208
+ fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
209
+ createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
210
+ fetchConvertTrade(id: string, code?: Str, params?: {}): Promise<Conversion>;
211
+ fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
212
+ parseConversion(conversion: Dict, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
207
213
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
208
214
  url: string;
209
215
  method: string;