ccxt 4.2.53 → 4.2.55

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.
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.53';
41
+ const version = '4.2.55';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -71,8 +71,6 @@ interface Exchange {
71
71
  sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
72
72
  sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
73
73
  sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
74
- sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
75
- sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
76
74
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
77
75
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
78
76
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -336,7 +334,6 @@ interface Exchange {
336
334
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
337
335
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
338
336
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
339
- sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
340
337
  sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
341
338
  sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
342
339
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
@@ -379,8 +376,17 @@ interface Exchange {
379
376
  sapiV2GetSubAccountFuturesAccount(params?: {}): Promise<implicitReturnType>;
380
377
  sapiV2GetSubAccountFuturesAccountSummary(params?: {}): Promise<implicitReturnType>;
381
378
  sapiV2GetSubAccountFuturesPositionRisk(params?: {}): Promise<implicitReturnType>;
379
+ sapiV2GetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
380
+ sapiV2GetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
381
+ sapiV2GetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
382
+ sapiV2GetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
383
+ sapiV2GetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
384
+ sapiV2GetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
382
385
  sapiV2PostEthStakingEthStake(params?: {}): Promise<implicitReturnType>;
383
386
  sapiV2PostSubAccountSubAccountApiIpRestriction(params?: {}): Promise<implicitReturnType>;
387
+ sapiV2PostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
388
+ sapiV2PostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
389
+ sapiV2PostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
384
390
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
385
391
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
386
392
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
@@ -71,8 +71,6 @@ interface binance {
71
71
  sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
72
72
  sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
73
73
  sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
74
- sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
75
- sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
76
74
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
77
75
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
78
76
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -336,7 +334,6 @@ interface binance {
336
334
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
337
335
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
338
336
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
339
- sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
340
337
  sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
341
338
  sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
342
339
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
@@ -379,8 +376,17 @@ interface binance {
379
376
  sapiV2GetSubAccountFuturesAccount(params?: {}): Promise<implicitReturnType>;
380
377
  sapiV2GetSubAccountFuturesAccountSummary(params?: {}): Promise<implicitReturnType>;
381
378
  sapiV2GetSubAccountFuturesPositionRisk(params?: {}): Promise<implicitReturnType>;
379
+ sapiV2GetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
380
+ sapiV2GetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
381
+ sapiV2GetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
382
+ sapiV2GetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
383
+ sapiV2GetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
384
+ sapiV2GetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
382
385
  sapiV2PostEthStakingEthStake(params?: {}): Promise<implicitReturnType>;
383
386
  sapiV2PostSubAccountSubAccountApiIpRestriction(params?: {}): Promise<implicitReturnType>;
387
+ sapiV2PostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
388
+ sapiV2PostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
389
+ sapiV2PostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
384
390
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
385
391
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
386
392
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
@@ -71,8 +71,6 @@ interface binance {
71
71
  sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
72
72
  sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
73
73
  sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
74
- sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
75
- sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
76
74
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
77
75
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
78
76
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -367,7 +365,6 @@ interface binance {
367
365
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
368
366
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
369
367
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
370
- sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
371
368
  sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
372
369
  sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
373
370
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
@@ -424,10 +421,19 @@ interface binance {
424
421
  sapiV2GetSubAccountFuturesAccount(params?: {}): Promise<implicitReturnType>;
425
422
  sapiV2GetSubAccountFuturesAccountSummary(params?: {}): Promise<implicitReturnType>;
426
423
  sapiV2GetSubAccountFuturesPositionRisk(params?: {}): Promise<implicitReturnType>;
424
+ sapiV2GetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
425
+ sapiV2GetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
426
+ sapiV2GetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
427
+ sapiV2GetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
428
+ sapiV2GetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
429
+ sapiV2GetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
427
430
  sapiV2GetClAccount(params?: {}): Promise<implicitReturnType>;
428
431
  sapiV2GetClAlertHistory(params?: {}): Promise<implicitReturnType>;
429
432
  sapiV2PostEthStakingEthStake(params?: {}): Promise<implicitReturnType>;
430
433
  sapiV2PostSubAccountSubAccountApiIpRestriction(params?: {}): Promise<implicitReturnType>;
434
+ sapiV2PostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
435
+ sapiV2PostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
436
+ sapiV2PostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
431
437
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
432
438
  sapiV3GetAccountStatus(params?: {}): Promise<implicitReturnType>;
433
439
  sapiV3GetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
@@ -71,8 +71,6 @@ interface binance {
71
71
  sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
72
72
  sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
73
73
  sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
74
- sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
75
- sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
76
74
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
77
75
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
78
76
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -336,7 +334,6 @@ interface binance {
336
334
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
337
335
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
338
336
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
339
- sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
340
337
  sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
341
338
  sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
342
339
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
@@ -379,8 +376,17 @@ interface binance {
379
376
  sapiV2GetSubAccountFuturesAccount(params?: {}): Promise<implicitReturnType>;
380
377
  sapiV2GetSubAccountFuturesAccountSummary(params?: {}): Promise<implicitReturnType>;
381
378
  sapiV2GetSubAccountFuturesPositionRisk(params?: {}): Promise<implicitReturnType>;
379
+ sapiV2GetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
380
+ sapiV2GetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
381
+ sapiV2GetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
382
+ sapiV2GetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
383
+ sapiV2GetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
384
+ sapiV2GetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
382
385
  sapiV2PostEthStakingEthStake(params?: {}): Promise<implicitReturnType>;
383
386
  sapiV2PostSubAccountSubAccountApiIpRestriction(params?: {}): Promise<implicitReturnType>;
387
+ sapiV2PostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
388
+ sapiV2PostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
389
+ sapiV2PostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
384
390
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
385
391
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
386
392
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
@@ -66,9 +66,12 @@ interface Exchange {
66
66
  privateWalletGetSavedAddress(params?: {}): Promise<implicitReturnType>;
67
67
  privateWalletGetFee(params?: {}): Promise<implicitReturnType>;
68
68
  privateWalletGetTotalBalance(params?: {}): Promise<implicitReturnType>;
69
+ privateWalletGetSmallBalance(params?: {}): Promise<implicitReturnType>;
70
+ privateWalletGetSmallBalanceHistory(params?: {}): Promise<implicitReturnType>;
69
71
  privateWalletPostTransfers(params?: {}): Promise<implicitReturnType>;
70
72
  privateWalletPostSubAccountTransfers(params?: {}): Promise<implicitReturnType>;
71
73
  privateWalletPostSubAccountToSubAccount(params?: {}): Promise<implicitReturnType>;
74
+ privateWalletPostSmallBalance(params?: {}): Promise<implicitReturnType>;
72
75
  privateSubAccountsGetSubAccounts(params?: {}): Promise<implicitReturnType>;
73
76
  privateSubAccountsGetSubAccountsUserId(params?: {}): Promise<implicitReturnType>;
74
77
  privateSubAccountsGetSubAccountsUserIdKeys(params?: {}): Promise<implicitReturnType>;
@@ -79,15 +82,16 @@ interface Exchange {
79
82
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
83
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
84
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
- privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
83
- privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
84
- privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
85
- privatePortfolioGetTransferable(params?: {}): Promise<implicitReturnType>;
86
- privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
87
- privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
88
- privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
89
- privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
90
- privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
85
+ privateUnifiedGetAccounts(params?: {}): Promise<implicitReturnType>;
86
+ privateUnifiedGetAccountMode(params?: {}): Promise<implicitReturnType>;
87
+ privateUnifiedGetBorrowable(params?: {}): Promise<implicitReturnType>;
88
+ privateUnifiedGetTransferable(params?: {}): Promise<implicitReturnType>;
89
+ privateUnifiedGetLoans(params?: {}): Promise<implicitReturnType>;
90
+ privateUnifiedGetLoanRecords(params?: {}): Promise<implicitReturnType>;
91
+ privateUnifiedGetInterestRecords(params?: {}): Promise<implicitReturnType>;
92
+ privateUnifiedGetEstimateRate(params?: {}): Promise<implicitReturnType>;
93
+ privateUnifiedPostAccountMode(params?: {}): Promise<implicitReturnType>;
94
+ privateUnifiedPostLoans(params?: {}): Promise<implicitReturnType>;
91
95
  privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
92
96
  privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
93
97
  privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
@@ -66,9 +66,12 @@ interface gate {
66
66
  privateWalletGetSavedAddress(params?: {}): Promise<implicitReturnType>;
67
67
  privateWalletGetFee(params?: {}): Promise<implicitReturnType>;
68
68
  privateWalletGetTotalBalance(params?: {}): Promise<implicitReturnType>;
69
+ privateWalletGetSmallBalance(params?: {}): Promise<implicitReturnType>;
70
+ privateWalletGetSmallBalanceHistory(params?: {}): Promise<implicitReturnType>;
69
71
  privateWalletPostTransfers(params?: {}): Promise<implicitReturnType>;
70
72
  privateWalletPostSubAccountTransfers(params?: {}): Promise<implicitReturnType>;
71
73
  privateWalletPostSubAccountToSubAccount(params?: {}): Promise<implicitReturnType>;
74
+ privateWalletPostSmallBalance(params?: {}): Promise<implicitReturnType>;
72
75
  privateSubAccountsGetSubAccounts(params?: {}): Promise<implicitReturnType>;
73
76
  privateSubAccountsGetSubAccountsUserId(params?: {}): Promise<implicitReturnType>;
74
77
  privateSubAccountsGetSubAccountsUserIdKeys(params?: {}): Promise<implicitReturnType>;
@@ -79,15 +82,16 @@ interface gate {
79
82
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
83
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
84
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
- privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
83
- privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
84
- privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
85
- privatePortfolioGetTransferable(params?: {}): Promise<implicitReturnType>;
86
- privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
87
- privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
88
- privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
89
- privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
90
- privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
85
+ privateUnifiedGetAccounts(params?: {}): Promise<implicitReturnType>;
86
+ privateUnifiedGetAccountMode(params?: {}): Promise<implicitReturnType>;
87
+ privateUnifiedGetBorrowable(params?: {}): Promise<implicitReturnType>;
88
+ privateUnifiedGetTransferable(params?: {}): Promise<implicitReturnType>;
89
+ privateUnifiedGetLoans(params?: {}): Promise<implicitReturnType>;
90
+ privateUnifiedGetLoanRecords(params?: {}): Promise<implicitReturnType>;
91
+ privateUnifiedGetInterestRecords(params?: {}): Promise<implicitReturnType>;
92
+ privateUnifiedGetEstimateRate(params?: {}): Promise<implicitReturnType>;
93
+ privateUnifiedPostAccountMode(params?: {}): Promise<implicitReturnType>;
94
+ privateUnifiedPostLoans(params?: {}): Promise<implicitReturnType>;
91
95
  privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
92
96
  privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
93
97
  privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
@@ -264,6 +264,7 @@ export default class binance extends Exchange {
264
264
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
265
265
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
266
266
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
267
+ fetchLeverage(symbol: string, params?: {}): Promise<any>;
267
268
  fetchSettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
268
269
  fetchMySettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
269
270
  parseSettlement(settlement: any, market: any): {
@@ -274,6 +275,7 @@ export default class binance extends Exchange {
274
275
  datetime: string;
275
276
  };
276
277
  parseSettlements(settlements: any, market: any): any[];
278
+ fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<any>;
277
279
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
278
280
  parseLedgerEntry(item: any, currency?: Currency): {
279
281
  id: string;
package/js/src/binance.js CHANGED
@@ -96,7 +96,8 @@ export default class binance extends Exchange {
96
96
  'fetchL3OrderBook': false,
97
97
  'fetchLastPrices': true,
98
98
  'fetchLedger': true,
99
- 'fetchLeverage': false,
99
+ 'fetchLedgerEntry': true,
100
+ 'fetchLeverage': true,
100
101
  'fetchLeverageTiers': true,
101
102
  'fetchLiquidations': false,
102
103
  'fetchMarketLeverageTiers': 'emulated',
@@ -296,8 +297,6 @@ export default class binance extends Exchange {
296
297
  'loan/flexible/borrow/history': 40,
297
298
  'loan/flexible/repay/history': 40,
298
299
  'loan/flexible/ltv/adjustment/history': 40,
299
- 'loan/flexible/loanable/data': 40,
300
- 'loan/flexible/collateral/data': 40,
301
300
  'loan/vip/ongoing/orders': 40,
302
301
  'loan/vip/repay/history': 40,
303
302
  'loan/vip/collateral/account': 600,
@@ -589,7 +588,6 @@ export default class binance extends Exchange {
589
588
  'loan/repay': 40.002,
590
589
  'loan/adjust/ltv': 40.002,
591
590
  'loan/customize/margin_call': 40.002,
592
- 'loan/flexible/borrow': 40.002,
593
591
  'loan/flexible/repay': 40.002,
594
592
  'loan/flexible/adjust/ltv': 40.002,
595
593
  'loan/vip/repay': 40.002,
@@ -644,10 +642,19 @@ export default class binance extends Exchange {
644
642
  'sub-account/futures/account': 0.1,
645
643
  'sub-account/futures/accountSummary': 1,
646
644
  'sub-account/futures/positionRisk': 0.1,
645
+ 'loan/flexible/ongoing/orders': 30,
646
+ 'loan/flexible/borrow/history': 40,
647
+ 'loan/flexible/repay/history': 40,
648
+ 'loan/flexible/ltv/adjustment/history': 40,
649
+ 'loan/flexible/loanable/data': 40,
650
+ 'loan/flexible/collateral/data': 40, // Weight(IP): 400 => cost = 0.1 * 400 = 40
647
651
  },
648
652
  'post': {
649
653
  'eth-staking/eth/stake': 15,
650
- 'sub-account/subAccountApi/ipRestriction': 20.001, // Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
654
+ 'sub-account/subAccountApi/ipRestriction': 20.001,
655
+ 'loan/flexible/borrow': 40.002,
656
+ 'loan/flexible/repay': 40.002,
657
+ 'loan/flexible/adjust/ltv': 40.002, // Weight(UID): 6000 => cost = 0.006667 * 6000 = 40.002
651
658
  },
652
659
  },
653
660
  'sapiV3': {
@@ -10382,6 +10389,67 @@ export default class binance extends Exchange {
10382
10389
  //
10383
10390
  return response;
10384
10391
  }
10392
+ async fetchLeverage(symbol, params = {}) {
10393
+ /**
10394
+ * @method
10395
+ * @name binance#fetchLeverage
10396
+ * @description fetch the set leverage for a market
10397
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
10398
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
10399
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
10400
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
10401
+ * @param {string} symbol unified market symbol
10402
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10403
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
10404
+ */
10405
+ await this.loadMarkets();
10406
+ await this.loadLeverageBrackets(false, params);
10407
+ const market = this.market(symbol);
10408
+ if (!market['contract']) {
10409
+ throw new NotSupported(this.id + ' fetchLeverage() supports linear and inverse contracts only');
10410
+ }
10411
+ let type = undefined;
10412
+ [type, params] = this.handleMarketTypeAndParams('fetchLeverage', market, params);
10413
+ let subType = undefined;
10414
+ [subType, params] = this.handleSubTypeAndParams('fetchLeverage', market, params, 'linear');
10415
+ let isPortfolioMargin = undefined;
10416
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchLeverage', 'papi', 'portfolioMargin', false);
10417
+ let response = undefined;
10418
+ if (this.isLinear(type, subType)) {
10419
+ if (isPortfolioMargin) {
10420
+ response = await this.papiGetUmAccount(params);
10421
+ }
10422
+ else {
10423
+ response = await this.fapiPrivateV2GetAccount(params);
10424
+ }
10425
+ }
10426
+ else if (this.isInverse(type, subType)) {
10427
+ if (isPortfolioMargin) {
10428
+ response = await this.papiGetCmAccount(params);
10429
+ }
10430
+ else {
10431
+ response = await this.dapiPrivateGetAccount(params);
10432
+ }
10433
+ }
10434
+ else {
10435
+ throw new NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
10436
+ }
10437
+ const positions = this.safeList(response, 'positions', []);
10438
+ for (let i = 0; i < positions.length; i++) {
10439
+ const position = positions[i];
10440
+ const innerSymbol = this.safeString(position, 'symbol');
10441
+ if (innerSymbol === market['id']) {
10442
+ const isolated = this.safeBool(position, 'isolated');
10443
+ const marginMode = isolated ? 'isolated' : 'cross';
10444
+ return {
10445
+ 'info': position,
10446
+ 'marginMode': marginMode,
10447
+ 'leverage': this.safeInteger(position, 'leverage'),
10448
+ };
10449
+ }
10450
+ }
10451
+ return response;
10452
+ }
10385
10453
  async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
10386
10454
  /**
10387
10455
  * @method
@@ -10564,6 +10632,19 @@ export default class binance extends Exchange {
10564
10632
  }
10565
10633
  return result;
10566
10634
  }
10635
+ async fetchLedgerEntry(id, code = undefined, params = {}) {
10636
+ await this.loadMarkets();
10637
+ let type = undefined;
10638
+ [type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
10639
+ const query = {
10640
+ 'recordId': id,
10641
+ 'type': type,
10642
+ };
10643
+ if (type !== 'option') {
10644
+ throw new BadRequest(this.id + ' fetchLedgerEntry () can only be used for type option');
10645
+ }
10646
+ return await this.fetchLedger(code, undefined, undefined, this.extend(query, params));
10647
+ }
10567
10648
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
10568
10649
  /**
10569
10650
  * @method
package/js/src/bybit.d.ts CHANGED
@@ -126,6 +126,11 @@ export default class bybit extends Exchange {
126
126
  fetchUsdcPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
127
127
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
128
128
  parsePosition(position: any, market?: Market): import("./base/types.js").Position;
129
+ fetchLeverage(symbol: string, params?: {}): Promise<{
130
+ info: import("./base/types.js").Position;
131
+ leverage: number;
132
+ marginMode: number;
133
+ }>;
129
134
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
130
135
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
131
136
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
package/js/src/bybit.js CHANGED
@@ -81,6 +81,7 @@ export default class bybit extends Exchange {
81
81
  'fetchIsolatedBorrowRate': false,
82
82
  'fetchIsolatedBorrowRates': false,
83
83
  'fetchLedger': true,
84
+ 'fetchLeverage': true,
84
85
  'fetchMarketLeverageTiers': true,
85
86
  'fetchMarkets': true,
86
87
  'fetchMarkOHLCV': true,
@@ -6347,6 +6348,24 @@ export default class bybit extends Exchange {
6347
6348
  'takeProfitPrice': this.safeNumber2(position, 'take_profit', 'takeProfit'),
6348
6349
  });
6349
6350
  }
6351
+ async fetchLeverage(symbol, params = {}) {
6352
+ /**
6353
+ * @method
6354
+ * @name bybit#fetchLeverage
6355
+ * @description fetch the set leverage for a market
6356
+ * @see https://bybit-exchange.github.io/docs/v5/position
6357
+ * @param {string} symbol unified market symbol
6358
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6359
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
6360
+ */
6361
+ await this.loadMarkets();
6362
+ const position = await this.fetchPosition(symbol, params);
6363
+ return {
6364
+ 'info': position,
6365
+ 'leverage': this.safeInteger(position, 'leverage'),
6366
+ 'marginMode': this.safeNumber(position, 'marginMode'),
6367
+ };
6368
+ }
6350
6369
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
6351
6370
  /**
6352
6371
  * @method
package/js/src/gate.js CHANGED
@@ -48,7 +48,7 @@ export default class gate extends Exchange {
48
48
  'spot': 'https://api.gateio.ws/api/v4',
49
49
  'options': 'https://api.gateio.ws/api/v4',
50
50
  'subAccounts': 'https://api.gateio.ws/api/v4',
51
- 'portfolio': 'https://api.gateio.ws/api/v4',
51
+ 'unified': 'https://api.gateio.ws/api/v4',
52
52
  'rebate': 'https://api.gateio.ws/api/v4',
53
53
  'earn': 'https://api.gateio.ws/api/v4',
54
54
  'account': 'https://api.gateio.ws/api/v4',
@@ -271,11 +271,14 @@ export default class gate extends Exchange {
271
271
  'saved_address': 1,
272
272
  'fee': 1,
273
273
  'total_balance': 2.5,
274
+ 'small_balance': 1,
275
+ 'small_balance_history': 1,
274
276
  },
275
277
  'post': {
276
278
  'transfers': 2.5,
277
279
  'sub_account_transfers': 2.5,
278
280
  'sub_account_to_sub_account': 2.5,
281
+ 'small_balance': 1,
279
282
  },
280
283
  },
281
284
  'subAccounts': {
@@ -298,7 +301,7 @@ export default class gate extends Exchange {
298
301
  'sub_accounts/{user_id}/keys/{key}': 2.5,
299
302
  },
300
303
  },
301
- 'portfolio': {
304
+ 'unified': {
302
305
  'get': {
303
306
  'accounts': 20 / 15,
304
307
  'account_mode': 20 / 15,
@@ -307,6 +310,7 @@ export default class gate extends Exchange {
307
310
  'loans': 20 / 15,
308
311
  'loan_records': 20 / 15,
309
312
  'interest_records': 20 / 15,
313
+ 'estimate_rate': 20 / 15,
310
314
  },
311
315
  'post': {
312
316
  'account_mode': 20 / 15,
package/js/src/okx.js CHANGED
@@ -576,6 +576,7 @@ export default class okx extends Exchange {
576
576
  '50027': PermissionDenied,
577
577
  '50028': ExchangeError,
578
578
  '50044': BadRequest,
579
+ '50062': ExchangeError,
579
580
  // API Class
580
581
  '50100': ExchangeError,
581
582
  '50101': AuthenticationError,
@@ -630,6 +631,15 @@ export default class okx extends Exchange {
630
631
  '51072': InvalidOrder,
631
632
  '51073': InvalidOrder,
632
633
  '51074': InvalidOrder,
634
+ '51090': InvalidOrder,
635
+ '51091': InvalidOrder,
636
+ '51092': InvalidOrder,
637
+ '51093': InvalidOrder,
638
+ '51094': InvalidOrder,
639
+ '51095': InvalidOrder,
640
+ '51096': InvalidOrder,
641
+ '51098': InvalidOrder,
642
+ '51099': InvalidOrder,
633
643
  '51100': InvalidOrder,
634
644
  '51101': InvalidOrder,
635
645
  '51102': InvalidOrder,
@@ -2757,7 +2767,7 @@ export default class okx extends Exchange {
2757
2767
  }
2758
2768
  request['tpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
2759
2769
  const takeProfitLimitPrice = this.safeValueN(takeProfit, ['price', 'takeProfitPrice', 'tpOrdPx']);
2760
- const takeProfitOrderType = this.safeString(takeProfit, 'type');
2770
+ const takeProfitOrderType = this.safeString2(takeProfit, 'type', 'tpOrdKind');
2761
2771
  if (takeProfitOrderType !== undefined) {
2762
2772
  const takeProfitLimitOrderType = (takeProfitOrderType === 'limit');
2763
2773
  const takeProfitMarketOrderType = (takeProfitOrderType === 'market');
@@ -2769,6 +2779,7 @@ export default class okx extends Exchange {
2769
2779
  throw new InvalidOrder(this.id + ' createOrder() requires a limit price in params["takeProfit"]["price"] or params["takeProfit"]["tpOrdPx"] for a take profit limit order');
2770
2780
  }
2771
2781
  else {
2782
+ request['tpOrdKind'] = takeProfitOrderType;
2772
2783
  request['tpOrdPx'] = this.priceToPrecision(symbol, takeProfitLimitPrice);
2773
2784
  }
2774
2785
  }
@@ -2777,6 +2788,7 @@ export default class okx extends Exchange {
2777
2788
  }
2778
2789
  }
2779
2790
  else if (takeProfitLimitPrice !== undefined) {
2791
+ request['tpOrdKind'] = 'limit';
2780
2792
  request['tpOrdPx'] = this.priceToPrecision(symbol, takeProfitLimitPrice); // limit tp order
2781
2793
  }
2782
2794
  else {
@@ -2801,6 +2813,7 @@ export default class okx extends Exchange {
2801
2813
  const twoWayCondition = ((takeProfitPrice !== undefined) && (stopLossPrice !== undefined));
2802
2814
  // if TP and SL are sent together
2803
2815
  // as ordType 'conditional' only stop-loss order will be applied
2816
+ // tpOrdKind is 'condition' which is the default
2804
2817
  if (twoWayCondition) {
2805
2818
  request['ordType'] = 'oco';
2806
2819
  }
@@ -2854,6 +2867,7 @@ export default class okx extends Exchange {
2854
2867
  * @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
2855
2868
  * @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
2856
2869
  * @param {string} [params.trailingPercent] the percent to trail away from the current market price
2870
+ * @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
2857
2871
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2858
2872
  */
2859
2873
  await this.loadMarkets();
@@ -3019,6 +3033,7 @@ export default class okx extends Exchange {
3019
3033
  takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
3020
3034
  takeProfitPrice = this.safeValue(takeProfit, 'price');
3021
3035
  const takeProfitType = this.safeString(takeProfit, 'type');
3036
+ request['newTpOrdKind'] = (takeProfitType === 'limit') ? takeProfitType : 'condition';
3022
3037
  request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
3023
3038
  request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
3024
3039
  request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
@@ -3064,6 +3079,7 @@ export default class okx extends Exchange {
3064
3079
  * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
3065
3080
  * @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
3066
3081
  * @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
3082
+ * @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
3067
3083
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3068
3084
  */
3069
3085
  await this.loadMarkets();
@@ -30,8 +30,8 @@ export default class binance extends binanceRest {
30
30
  signParams(params?: {}): any;
31
31
  authenticate(params?: {}): Promise<void>;
32
32
  keepAliveListenKey(params?: {}): Promise<void>;
33
- setBalanceCache(client: Client, type: any): void;
34
- loadBalanceSnapshot(client: any, messageHash: any, type: any): Promise<void>;
33
+ setBalanceCache(client: Client, type: any, isPortfolioMargin?: boolean): void;
34
+ loadBalanceSnapshot(client: any, messageHash: any, type: any, isPortfolioMargin: any): Promise<void>;
35
35
  fetchBalanceWs(params?: {}): Promise<Balances>;
36
36
  handleBalanceWs(client: Client, message: any): void;
37
37
  watchBalance(params?: {}): Promise<Balances>;
@@ -52,8 +52,8 @@ export default class binance extends binanceRest {
52
52
  parseWsOrder(order: any, market?: any): Order;
53
53
  handleOrderUpdate(client: Client, message: any): void;
54
54
  watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
55
- setPositionsCache(client: Client, type: any, symbols?: Strings): void;
56
- loadPositionsSnapshot(client: any, messageHash: any, type: any): Promise<void>;
55
+ setPositionsCache(client: Client, type: any, symbols?: Strings, isPortfolioMargin?: boolean): void;
56
+ loadPositionsSnapshot(client: any, messageHash: any, type: any, isPortfolioMargin: any): Promise<void>;
57
57
  handlePositions(client: any, message: any): void;
58
58
  parseWsPosition(position: any, market?: any): Position;
59
59
  fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;