ccxt 4.2.88 → 4.2.90
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/README.md +3 -3
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +1062 -241
- package/dist/ccxt.browser.min.js +6 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +3 -0
- package/dist/cjs/src/base/Exchange.js +53 -7
- package/dist/cjs/src/base/functions/crypto.js +37 -0
- package/dist/cjs/src/base/functions/rsa.js +19 -4
- package/dist/cjs/src/binance.js +92 -9
- package/dist/cjs/src/bingx.js +101 -1
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bitflyer.js +2 -0
- package/dist/cjs/src/bitget.js +9 -1
- package/dist/cjs/src/bitmart.js +2 -0
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitstamp.js +83 -99
- package/dist/cjs/src/blofin.js +2 -0
- package/dist/cjs/src/bybit.js +63 -0
- package/dist/cjs/src/coinbase.js +48 -24
- package/dist/cjs/src/coinbaseinternational.js +1 -0
- package/dist/cjs/src/coinex.js +102 -8
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/digifinex.js +3 -0
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +4 -0
- package/dist/cjs/src/gemini.js +10 -9
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/htx.js +3 -0
- package/dist/cjs/src/hyperliquid.js +1 -0
- package/dist/cjs/src/kucoin.js +40 -15
- package/dist/cjs/src/kucoinfutures.js +34 -3
- package/dist/cjs/src/latoken.js +4 -0
- package/dist/cjs/src/lbank.js +3 -1
- package/dist/cjs/src/luno.js +2 -0
- package/dist/cjs/src/mexc.js +55 -6
- package/dist/cjs/src/okx.js +159 -8
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/pro/bitget.js +2 -0
- package/dist/cjs/src/static_dependencies/noble-curves/p256.js +48 -0
- package/dist/cjs/src/timex.js +2 -0
- package/dist/cjs/src/woo.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/ascendex.js +3 -0
- package/js/src/base/Exchange.d.ts +13 -8
- package/js/src/base/Exchange.js +53 -7
- package/js/src/base/functions/crypto.js +37 -0
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/base/functions/rsa.js +21 -5
- package/js/src/base/types.d.ts +35 -1
- package/js/src/bigone.d.ts +2 -2
- package/js/src/binance.d.ts +6 -15
- package/js/src/binance.js +92 -9
- package/js/src/bingx.d.ts +3 -2
- package/js/src/bingx.js +101 -1
- package/js/src/bit2c.d.ts +2 -2
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitfinex.d.ts +2 -2
- package/js/src/bitfinex2.d.ts +3 -3
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bitflyer.d.ts +2 -7
- package/js/src/bitflyer.js +2 -0
- package/js/src/bitget.d.ts +6 -9
- package/js/src/bitget.js +9 -1
- package/js/src/bitmart.d.ts +4 -14
- package/js/src/bitmart.js +2 -0
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +1 -0
- package/js/src/bitopro.d.ts +3 -3
- package/js/src/bitrue.d.ts +2 -2
- package/js/src/bitrue.js +1 -0
- package/js/src/bitso.d.ts +2 -2
- package/js/src/bitstamp.d.ts +7 -19
- package/js/src/bitstamp.js +83 -99
- package/js/src/bitteam.d.ts +2 -2
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/bl3p.d.ts +2 -2
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +2 -7
- package/js/src/blofin.js +2 -0
- package/js/src/bybit.d.ts +7 -15
- package/js/src/bybit.js +63 -0
- package/js/src/cex.d.ts +3 -3
- package/js/src/coinbase.d.ts +2 -2
- package/js/src/coinbase.js +48 -24
- package/js/src/coinbaseinternational.d.ts +2 -2
- package/js/src/coinbaseinternational.js +1 -0
- package/js/src/coinbasepro.d.ts +3 -3
- package/js/src/coincheck.d.ts +2 -2
- package/js/src/coinex.d.ts +7 -19
- package/js/src/coinex.js +102 -8
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +2 -9
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +4 -14
- package/js/src/coinsph.js +2 -0
- package/js/src/cryptocom.js +1 -0
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/delta.d.ts +2 -2
- package/js/src/delta.js +1 -0
- package/js/src/deribit.d.ts +3 -3
- package/js/src/digifinex.d.ts +4 -14
- package/js/src/digifinex.js +3 -0
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +1 -0
- package/js/src/gate.d.ts +6 -9
- package/js/src/gate.js +4 -0
- package/js/src/gemini.d.ts +3 -3
- package/js/src/gemini.js +10 -9
- package/js/src/hitbtc.d.ts +5 -15
- package/js/src/hitbtc.js +3 -0
- package/js/src/hollaex.d.ts +3 -3
- package/js/src/htx.d.ts +4 -14
- package/js/src/htx.js +3 -0
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.d.ts +2 -2
- package/js/src/hyperliquid.js +1 -0
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/kraken.d.ts +3 -10
- package/js/src/kucoin.d.ts +3 -10
- package/js/src/kucoin.js +40 -15
- package/js/src/kucoinfutures.d.ts +2 -9
- package/js/src/kucoinfutures.js +34 -3
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +7 -8
- package/js/src/latoken.js +4 -0
- package/js/src/lbank.d.ts +4 -9
- package/js/src/lbank.js +3 -1
- package/js/src/luno.d.ts +2 -7
- package/js/src/luno.js +2 -0
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mexc.d.ts +3 -3
- package/js/src/mexc.js +55 -6
- package/js/src/ndax.d.ts +2 -2
- package/js/src/oceanex.d.ts +2 -2
- package/js/src/okcoin.d.ts +2 -2
- package/js/src/okx.d.ts +5 -14
- package/js/src/okx.js +159 -8
- package/js/src/onetrading.d.ts +3 -3
- package/js/src/phemex.d.ts +2 -2
- package/js/src/phemex.js +1 -0
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/pro/bitget.js +2 -0
- package/js/src/pro/bitvavo.d.ts +2 -2
- package/js/src/probit.d.ts +2 -2
- package/js/src/timex.d.ts +4 -14
- package/js/src/timex.js +2 -0
- package/js/src/upbit.d.ts +2 -9
- package/js/src/wazirx.d.ts +2 -2
- package/js/src/whitebit.d.ts +3 -3
- package/js/src/woo.d.ts +3 -3
- package/js/src/woo.js +1 -0
- package/js/src/yobit.d.ts +2 -2
- package/package.json +1 -1
- package/skip-tests.json +6 -1
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -428,6 +428,30 @@ class bitstamp extends bitstamp$1 {
|
|
|
428
428
|
'commonCurrencies': {
|
|
429
429
|
'UST': 'USTC',
|
|
430
430
|
},
|
|
431
|
+
// exchange-specific options
|
|
432
|
+
'options': {
|
|
433
|
+
'networksById': {
|
|
434
|
+
'bitcoin-cash': 'BCH',
|
|
435
|
+
'bitcoin': 'BTC',
|
|
436
|
+
'ethereum': 'ERC20',
|
|
437
|
+
'litecoin': 'LTC',
|
|
438
|
+
'stellar': 'XLM',
|
|
439
|
+
'xrpl': 'XRP',
|
|
440
|
+
'tron': 'TRC20',
|
|
441
|
+
'algorand': 'ALGO',
|
|
442
|
+
'flare': 'FLR',
|
|
443
|
+
'hedera': 'HBAR',
|
|
444
|
+
'cardana': 'ADA',
|
|
445
|
+
'songbird': 'FLR',
|
|
446
|
+
'avalanche-c-chain': 'AVAX',
|
|
447
|
+
'solana': 'SOL',
|
|
448
|
+
'polkadot': 'DOT',
|
|
449
|
+
'near': 'NEAR',
|
|
450
|
+
'doge': 'DOGE',
|
|
451
|
+
'sui': 'SUI',
|
|
452
|
+
'casper': 'CSRP',
|
|
453
|
+
},
|
|
454
|
+
},
|
|
431
455
|
'exceptions': {
|
|
432
456
|
'exact': {
|
|
433
457
|
'No permission found': errors.PermissionDenied,
|
|
@@ -1200,6 +1224,8 @@ class bitstamp extends bitstamp$1 {
|
|
|
1200
1224
|
'symbol': this.safeSymbol(marketId, market),
|
|
1201
1225
|
'maker': this.safeNumber(fees, 'maker'),
|
|
1202
1226
|
'taker': this.safeNumber(fees, 'taker'),
|
|
1227
|
+
'percentage': undefined,
|
|
1228
|
+
'tierBased': undefined,
|
|
1203
1229
|
};
|
|
1204
1230
|
}
|
|
1205
1231
|
parseTradingFees(fees) {
|
|
@@ -1245,60 +1271,41 @@ class bitstamp extends bitstamp$1 {
|
|
|
1245
1271
|
* @name bitstamp#fetchTransactionFees
|
|
1246
1272
|
* @deprecated
|
|
1247
1273
|
* @description please use fetchDepositWithdrawFees instead
|
|
1248
|
-
* @see https://www.bitstamp.net/api/#
|
|
1274
|
+
* @see https://www.bitstamp.net/api/#tag/Fees
|
|
1249
1275
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
1250
1276
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1251
1277
|
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1252
1278
|
*/
|
|
1253
1279
|
await this.loadMarkets();
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1280
|
+
const response = await this.privatePostFeesWithdrawal(params);
|
|
1281
|
+
//
|
|
1282
|
+
// [
|
|
1283
|
+
// {
|
|
1284
|
+
// "currency": "btc",
|
|
1285
|
+
// "fee": "0.00015000",
|
|
1286
|
+
// "network": "bitcoin"
|
|
1287
|
+
// }
|
|
1288
|
+
// ...
|
|
1289
|
+
// ]
|
|
1290
|
+
//
|
|
1291
|
+
return this.parseTransactionFees(response);
|
|
1256
1292
|
}
|
|
1257
1293
|
parseTransactionFees(response, codes = undefined) {
|
|
1258
|
-
//
|
|
1259
|
-
// {
|
|
1260
|
-
// "yfi_available": "0.00000000",
|
|
1261
|
-
// "yfi_balance": "0.00000000",
|
|
1262
|
-
// "yfi_reserved": "0.00000000",
|
|
1263
|
-
// "yfi_withdrawal_fee": "0.00070000",
|
|
1264
|
-
// "yfieur_fee": "0.000",
|
|
1265
|
-
// "yfiusd_fee": "0.000",
|
|
1266
|
-
// "zrx_available": "0.00000000",
|
|
1267
|
-
// "zrx_balance": "0.00000000",
|
|
1268
|
-
// "zrx_reserved": "0.00000000",
|
|
1269
|
-
// "zrx_withdrawal_fee": "12.00000000",
|
|
1270
|
-
// "zrxeur_fee": "0.000",
|
|
1271
|
-
// "zrxusd_fee": "0.000",
|
|
1272
|
-
// ...
|
|
1273
|
-
// }
|
|
1274
|
-
//
|
|
1275
|
-
if (codes === undefined) {
|
|
1276
|
-
codes = Object.keys(this.currencies);
|
|
1277
|
-
}
|
|
1278
1294
|
const result = {};
|
|
1279
|
-
|
|
1280
|
-
const ids = Object.keys(
|
|
1295
|
+
const currencies = this.indexBy(response, 'currency');
|
|
1296
|
+
const ids = Object.keys(currencies);
|
|
1281
1297
|
for (let i = 0; i < ids.length; i++) {
|
|
1282
1298
|
const id = ids[i];
|
|
1283
|
-
const
|
|
1284
|
-
const code = this.safeCurrencyCode(
|
|
1285
|
-
if (codes !== undefined && !this.inArray(code, codes)) {
|
|
1299
|
+
const fees = this.safeValue(response, i, {});
|
|
1300
|
+
const code = this.safeCurrencyCode(id);
|
|
1301
|
+
if ((codes !== undefined) && !this.inArray(code, codes)) {
|
|
1286
1302
|
continue;
|
|
1287
1303
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
'info': {},
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
|
-
if (currencyId === mainCurrencyId) {
|
|
1297
|
-
result[code]['info'][id] = this.safeNumber(response, id);
|
|
1298
|
-
}
|
|
1299
|
-
if (id.indexOf('_withdrawal_fee') >= 0) {
|
|
1300
|
-
result[code]['withdraw'] = this.safeNumber(response, id);
|
|
1301
|
-
}
|
|
1304
|
+
result[code] = {
|
|
1305
|
+
'withdraw_fee': this.safeNumber(fees, 'fee'),
|
|
1306
|
+
'deposit': {},
|
|
1307
|
+
'info': this.safeDict(currencies, id),
|
|
1308
|
+
};
|
|
1302
1309
|
}
|
|
1303
1310
|
return result;
|
|
1304
1311
|
}
|
|
@@ -1313,64 +1320,41 @@ class bitstamp extends bitstamp$1 {
|
|
|
1313
1320
|
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1314
1321
|
*/
|
|
1315
1322
|
await this.loadMarkets();
|
|
1316
|
-
const response = await this.
|
|
1317
|
-
//
|
|
1318
|
-
// {
|
|
1319
|
-
// "yfi_available": "0.00000000",
|
|
1320
|
-
// "yfi_balance": "0.00000000",
|
|
1321
|
-
// "yfi_reserved": "0.00000000",
|
|
1322
|
-
// "yfi_withdrawal_fee": "0.00070000",
|
|
1323
|
-
// "yfieur_fee": "0.000",
|
|
1324
|
-
// "yfiusd_fee": "0.000",
|
|
1325
|
-
// "zrx_available": "0.00000000",
|
|
1326
|
-
// "zrx_balance": "0.00000000",
|
|
1327
|
-
// "zrx_reserved": "0.00000000",
|
|
1328
|
-
// "zrx_withdrawal_fee": "12.00000000",
|
|
1329
|
-
// "zrxeur_fee": "0.000",
|
|
1330
|
-
// "zrxusd_fee": "0.000",
|
|
1331
|
-
// ...
|
|
1332
|
-
// }
|
|
1333
|
-
//
|
|
1334
|
-
return this.parseDepositWithdrawFees(response, codes);
|
|
1335
|
-
}
|
|
1336
|
-
parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
|
|
1337
|
-
//
|
|
1338
|
-
// {
|
|
1339
|
-
// "yfi_available": "0.00000000",
|
|
1340
|
-
// "yfi_balance": "0.00000000",
|
|
1341
|
-
// "yfi_reserved": "0.00000000",
|
|
1342
|
-
// "yfi_withdrawal_fee": "0.00070000",
|
|
1343
|
-
// "yfieur_fee": "0.000",
|
|
1344
|
-
// "yfiusd_fee": "0.000",
|
|
1345
|
-
// "zrx_available": "0.00000000",
|
|
1346
|
-
// "zrx_balance": "0.00000000",
|
|
1347
|
-
// "zrx_reserved": "0.00000000",
|
|
1348
|
-
// "zrx_withdrawal_fee": "12.00000000",
|
|
1349
|
-
// "zrxeur_fee": "0.000",
|
|
1350
|
-
// "zrxusd_fee": "0.000",
|
|
1351
|
-
// ...
|
|
1352
|
-
// }
|
|
1323
|
+
const response = await this.privatePostFeesWithdrawal(params);
|
|
1353
1324
|
//
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1325
|
+
// [
|
|
1326
|
+
// {
|
|
1327
|
+
// "currency": "btc",
|
|
1328
|
+
// "fee": "0.00015000",
|
|
1329
|
+
// "network": "bitcoin"
|
|
1330
|
+
// }
|
|
1331
|
+
// ...
|
|
1332
|
+
// ]
|
|
1333
|
+
//
|
|
1334
|
+
const responseByCurrencyId = this.groupBy(response, 'currency');
|
|
1335
|
+
return this.parseDepositWithdrawFees(responseByCurrencyId, codes);
|
|
1336
|
+
}
|
|
1337
|
+
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
1338
|
+
const result = this.depositWithdrawFee(fee);
|
|
1339
|
+
for (let j = 0; j < fee.length; j++) {
|
|
1340
|
+
const networkEntry = fee[j];
|
|
1341
|
+
const networkId = this.safeString(networkEntry, 'network');
|
|
1342
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
1343
|
+
const withdrawFee = this.safeNumber(networkEntry, 'fee');
|
|
1344
|
+
result['withdraw'] = {
|
|
1345
|
+
'fee': withdrawFee,
|
|
1346
|
+
'percentage': undefined,
|
|
1347
|
+
};
|
|
1348
|
+
result['networks'][networkCode] = {
|
|
1349
|
+
'withdraw': {
|
|
1350
|
+
'fee': withdrawFee,
|
|
1351
|
+
'percentage': undefined,
|
|
1352
|
+
},
|
|
1353
|
+
'deposit': {
|
|
1354
|
+
'fee': undefined,
|
|
1355
|
+
'percentage': undefined,
|
|
1356
|
+
},
|
|
1357
|
+
};
|
|
1374
1358
|
}
|
|
1375
1359
|
return result;
|
|
1376
1360
|
}
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -941,6 +941,8 @@ class blofin extends blofin$1 {
|
|
|
941
941
|
// blofin returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
|
|
942
942
|
'maker': this.parseNumber(Precise["default"].stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
|
|
943
943
|
'taker': this.parseNumber(Precise["default"].stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
|
|
944
|
+
'percentage': undefined,
|
|
945
|
+
'tierBased': undefined,
|
|
944
946
|
};
|
|
945
947
|
}
|
|
946
948
|
async fetchBalance(params = {}) {
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -81,6 +81,7 @@ class bybit extends bybit$1 {
|
|
|
81
81
|
'fetchLedger': true,
|
|
82
82
|
'fetchLeverage': true,
|
|
83
83
|
'fetchLeverageTiers': true,
|
|
84
|
+
'fetchMarginAdjustmentHistory': false,
|
|
84
85
|
'fetchMarketLeverageTiers': true,
|
|
85
86
|
'fetchMarkets': true,
|
|
86
87
|
'fetchMarkOHLCV': true,
|
|
@@ -151,6 +152,13 @@ class bybit extends bybit$1 {
|
|
|
151
152
|
'public': 'https://api.{hostname}',
|
|
152
153
|
'private': 'https://api.{hostname}',
|
|
153
154
|
},
|
|
155
|
+
'demotrading': {
|
|
156
|
+
'spot': 'https://api-demo.{hostname}',
|
|
157
|
+
'futures': 'https://api-demo.{hostname}',
|
|
158
|
+
'v2': 'https://api-demo.{hostname}',
|
|
159
|
+
'public': 'https://api-demo.{hostname}',
|
|
160
|
+
'private': 'https://api-demo.{hostname}',
|
|
161
|
+
},
|
|
154
162
|
'www': 'https://www.bybit.com',
|
|
155
163
|
'doc': [
|
|
156
164
|
'https://bybit-exchange.github.io/docs/inverse/',
|
|
@@ -339,6 +347,7 @@ class bybit extends bybit$1 {
|
|
|
339
347
|
'v5/user/get-member-type': 5,
|
|
340
348
|
'v5/user/aff-customer-info': 5,
|
|
341
349
|
'v5/user/del-submember': 5,
|
|
350
|
+
'v5/user/submembers': 5,
|
|
342
351
|
// spot leverage token
|
|
343
352
|
'v5/spot-lever-token/order-record': 1,
|
|
344
353
|
// spot margin trade
|
|
@@ -499,6 +508,8 @@ class bybit extends bybit$1 {
|
|
|
499
508
|
'v5/lending/redeem-cancel': 5,
|
|
500
509
|
'v5/account/set-collateral-switch': 5,
|
|
501
510
|
'v5/account/set-collateral-switch-batch': 5,
|
|
511
|
+
// demo trading
|
|
512
|
+
'v5/account/demo-apply-money': 5,
|
|
502
513
|
},
|
|
503
514
|
},
|
|
504
515
|
},
|
|
@@ -965,6 +976,8 @@ class bybit extends bybit$1 {
|
|
|
965
976
|
},
|
|
966
977
|
'precisionMode': number.TICK_SIZE,
|
|
967
978
|
'options': {
|
|
979
|
+
'sandboxMode': false,
|
|
980
|
+
'enableDemoTrading': false,
|
|
968
981
|
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
|
969
982
|
'createOrder': {
|
|
970
983
|
'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
|
|
@@ -1048,6 +1061,39 @@ class bybit extends bybit$1 {
|
|
|
1048
1061
|
},
|
|
1049
1062
|
});
|
|
1050
1063
|
}
|
|
1064
|
+
setSandboxMode(enable) {
|
|
1065
|
+
/**
|
|
1066
|
+
* @method
|
|
1067
|
+
* @name bybit#setSandboxMode
|
|
1068
|
+
* @description enables or disables sandbox mode
|
|
1069
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
1070
|
+
*/
|
|
1071
|
+
super.setSandboxMode(enable);
|
|
1072
|
+
this.options['sandboxMode'] = enable;
|
|
1073
|
+
}
|
|
1074
|
+
enableDemoTrading(enable) {
|
|
1075
|
+
/**
|
|
1076
|
+
* @method
|
|
1077
|
+
* @name bybit#enableDemoTrading
|
|
1078
|
+
* @description enables or disables demo trading mode
|
|
1079
|
+
* @see https://bybit-exchange.github.io/docs/v5/demo
|
|
1080
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
1081
|
+
*/
|
|
1082
|
+
if (this.options['sandboxMode']) {
|
|
1083
|
+
throw new errors.NotSupported(this.id + ' demo trading does not support in sandbox environment');
|
|
1084
|
+
}
|
|
1085
|
+
// enable demo trading in bybit, see: https://bybit-exchange.github.io/docs/v5/demo
|
|
1086
|
+
if (enable) {
|
|
1087
|
+
this.urls['apiBackupDemoTrading'] = this.urls['api'];
|
|
1088
|
+
this.urls['api'] = this.urls['demotrading'];
|
|
1089
|
+
}
|
|
1090
|
+
else if ('apiBackupDemoTrading' in this.urls) {
|
|
1091
|
+
this.urls['api'] = this.urls['apiBackupDemoTrading'];
|
|
1092
|
+
const newUrls = this.omit(this.urls, 'apiBackupDemoTrading');
|
|
1093
|
+
this.urls = newUrls;
|
|
1094
|
+
}
|
|
1095
|
+
this.options['enableDemoTrading'] = enable;
|
|
1096
|
+
}
|
|
1051
1097
|
nonce() {
|
|
1052
1098
|
return this.milliseconds() - this.options['timeDifference'];
|
|
1053
1099
|
}
|
|
@@ -1064,12 +1110,24 @@ class bybit extends bybit$1 {
|
|
|
1064
1110
|
return data;
|
|
1065
1111
|
}
|
|
1066
1112
|
async isUnifiedEnabled(params = {}) {
|
|
1113
|
+
/**
|
|
1114
|
+
* @method
|
|
1115
|
+
* @name bybit#isUnifiedEnabled
|
|
1116
|
+
* @description returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
|
|
1117
|
+
*/
|
|
1067
1118
|
// The API key of user id must own one of permissions will be allowed to call following API endpoints.
|
|
1068
1119
|
// SUB UID: "Account Transfer"
|
|
1069
1120
|
// MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
|
|
1070
1121
|
const enableUnifiedMargin = this.safeValue(this.options, 'enableUnifiedMargin');
|
|
1071
1122
|
const enableUnifiedAccount = this.safeValue(this.options, 'enableUnifiedAccount');
|
|
1072
1123
|
if (enableUnifiedMargin === undefined || enableUnifiedAccount === undefined) {
|
|
1124
|
+
if (this.options['enableDemoTrading']) {
|
|
1125
|
+
// info endpoint is not available in demo trading
|
|
1126
|
+
// so we're assuming UTA is enabled
|
|
1127
|
+
this.options['enableUnifiedMargin'] = false;
|
|
1128
|
+
this.options['enableUnifiedAccount'] = true;
|
|
1129
|
+
return [this.options['enableUnifiedMargin'], this.options['enableUnifiedAccount']];
|
|
1130
|
+
}
|
|
1073
1131
|
const response = await this.privateGetV5UserQueryApi(params);
|
|
1074
1132
|
//
|
|
1075
1133
|
// {
|
|
@@ -1239,6 +1297,9 @@ class bybit extends bybit$1 {
|
|
|
1239
1297
|
if (!this.checkRequiredCredentials(false)) {
|
|
1240
1298
|
return undefined;
|
|
1241
1299
|
}
|
|
1300
|
+
if (this.options['enableDemoTrading']) {
|
|
1301
|
+
return undefined;
|
|
1302
|
+
}
|
|
1242
1303
|
const response = await this.privateGetV5AssetCoinQueryInfo(params);
|
|
1243
1304
|
//
|
|
1244
1305
|
// {
|
|
@@ -7264,6 +7325,8 @@ class bybit extends bybit$1 {
|
|
|
7264
7325
|
'symbol': symbol,
|
|
7265
7326
|
'maker': this.safeNumber(fee, 'makerFeeRate'),
|
|
7266
7327
|
'taker': this.safeNumber(fee, 'takerFeeRate'),
|
|
7328
|
+
'percentage': undefined,
|
|
7329
|
+
'tierBased': undefined,
|
|
7267
7330
|
};
|
|
7268
7331
|
}
|
|
7269
7332
|
async fetchTradingFee(symbol, params = {}) {
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -5,6 +5,7 @@ var errors = require('./base/errors.js');
|
|
|
5
5
|
var Precise = require('./base/Precise.js');
|
|
6
6
|
var number = require('./base/functions/number.js');
|
|
7
7
|
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
8
|
+
var rsa = require('./base/functions/rsa.js');
|
|
8
9
|
|
|
9
10
|
// ----------------------------------------------------------------------------
|
|
10
11
|
// ----------------------------------------------------------------------------
|
|
@@ -3783,31 +3784,16 @@ class coinbase extends coinbase$1 {
|
|
|
3783
3784
|
const url = this.urls['api']['rest'] + fullPath;
|
|
3784
3785
|
if (signed) {
|
|
3785
3786
|
const authorization = this.safeString(this.headers, 'Authorization');
|
|
3787
|
+
let authorizationString = undefined;
|
|
3786
3788
|
if (authorization !== undefined) {
|
|
3787
|
-
|
|
3788
|
-
'Authorization': authorization,
|
|
3789
|
-
'Content-Type': 'application/json',
|
|
3790
|
-
};
|
|
3791
|
-
if (method !== 'GET') {
|
|
3792
|
-
if (Object.keys(query).length) {
|
|
3793
|
-
body = this.json(query);
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3789
|
+
authorizationString = authorization;
|
|
3796
3790
|
}
|
|
3797
3791
|
else if (this.token && !this.checkRequiredCredentials(false)) {
|
|
3798
|
-
|
|
3799
|
-
'Authorization': 'Bearer ' + this.token,
|
|
3800
|
-
'Content-Type': 'application/json',
|
|
3801
|
-
};
|
|
3802
|
-
if (method !== 'GET') {
|
|
3803
|
-
if (Object.keys(query).length) {
|
|
3804
|
-
body = this.json(query);
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3792
|
+
authorizationString = 'Bearer ' + this.token;
|
|
3807
3793
|
}
|
|
3808
3794
|
else {
|
|
3809
3795
|
this.checkRequiredCredentials();
|
|
3810
|
-
const
|
|
3796
|
+
const seconds = this.seconds();
|
|
3811
3797
|
let payload = '';
|
|
3812
3798
|
if (method !== 'GET') {
|
|
3813
3799
|
if (Object.keys(query).length) {
|
|
@@ -3826,14 +3812,52 @@ class coinbase extends coinbase$1 {
|
|
|
3826
3812
|
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
3827
3813
|
// v2: 'GET' require payload in the signature
|
|
3828
3814
|
// https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
|
3829
|
-
const
|
|
3830
|
-
|
|
3815
|
+
const isCloudAPiKey = (this.apiKey.indexOf('organizations/') >= 0) || (this.secret.startsWith('-----BEGIN'));
|
|
3816
|
+
if (isCloudAPiKey) {
|
|
3817
|
+
if (this.apiKey.startsWith('-----BEGIN')) {
|
|
3818
|
+
throw new errors.ArgumentsRequired(this.id + ' apiKey should contain the name (eg: organizations/3b910e93....) and not the public key');
|
|
3819
|
+
}
|
|
3820
|
+
// it may not work for v2
|
|
3821
|
+
let uri = method + ' ' + url.replace('https://', '');
|
|
3822
|
+
const quesPos = uri.indexOf('?');
|
|
3823
|
+
if (quesPos >= 0) {
|
|
3824
|
+
uri = uri.slice(0, quesPos);
|
|
3825
|
+
}
|
|
3826
|
+
const nonce = this.randomBytes(16);
|
|
3827
|
+
const request = {
|
|
3828
|
+
'aud': ['retail_rest_api_proxy'],
|
|
3829
|
+
'iss': 'coinbase-cloud',
|
|
3830
|
+
'nbf': seconds,
|
|
3831
|
+
'exp': seconds + 120,
|
|
3832
|
+
'sub': this.apiKey,
|
|
3833
|
+
'uri': uri,
|
|
3834
|
+
'iat': seconds,
|
|
3835
|
+
};
|
|
3836
|
+
const token = rsa.jwt(request, this.encode(this.secret), sha256.sha256, false, { 'kid': this.apiKey, 'nonce': nonce, 'alg': 'ES256' });
|
|
3837
|
+
authorizationString = 'Bearer ' + token;
|
|
3838
|
+
}
|
|
3839
|
+
else {
|
|
3840
|
+
const timestampString = this.seconds().toString();
|
|
3841
|
+
const auth = timestampString + method + savedPath + payload;
|
|
3842
|
+
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256);
|
|
3843
|
+
headers = {
|
|
3844
|
+
'CB-ACCESS-KEY': this.apiKey,
|
|
3845
|
+
'CB-ACCESS-SIGN': signature,
|
|
3846
|
+
'CB-ACCESS-TIMESTAMP': timestampString,
|
|
3847
|
+
'Content-Type': 'application/json',
|
|
3848
|
+
};
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
if (authorizationString !== undefined) {
|
|
3831
3852
|
headers = {
|
|
3832
|
-
'
|
|
3833
|
-
'CB-ACCESS-SIGN': signature,
|
|
3834
|
-
'CB-ACCESS-TIMESTAMP': timestampString,
|
|
3853
|
+
'Authorization': authorizationString,
|
|
3835
3854
|
'Content-Type': 'application/json',
|
|
3836
3855
|
};
|
|
3856
|
+
if (method !== 'GET') {
|
|
3857
|
+
if (Object.keys(query).length) {
|
|
3858
|
+
body = this.json(query);
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3837
3861
|
}
|
|
3838
3862
|
}
|
|
3839
3863
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
@@ -76,6 +76,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
76
76
|
'fetchLedger': false,
|
|
77
77
|
'fetchLeverage': false,
|
|
78
78
|
'fetchLeverageTiers': false,
|
|
79
|
+
'fetchMarginAdjustmentHistory': false,
|
|
79
80
|
'fetchMarginMode': false,
|
|
80
81
|
'fetchMarkets': true,
|
|
81
82
|
'fetchMarkOHLCV': false,
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -80,6 +80,7 @@ class coinex extends coinex$1 {
|
|
|
80
80
|
'fetchLeverage': 'emulated',
|
|
81
81
|
'fetchLeverages': true,
|
|
82
82
|
'fetchLeverageTiers': true,
|
|
83
|
+
'fetchMarginAdjustmentHistory': true,
|
|
83
84
|
'fetchMarketLeverageTiers': 'emulated',
|
|
84
85
|
'fetchMarkets': true,
|
|
85
86
|
'fetchMarkOHLCV': false,
|
|
@@ -4239,11 +4240,10 @@ class coinex extends coinex$1 {
|
|
|
4239
4240
|
// "message":"OK"
|
|
4240
4241
|
// }
|
|
4241
4242
|
//
|
|
4243
|
+
const data = this.safeDict(response, 'data');
|
|
4242
4244
|
const status = this.safeString(response, 'message');
|
|
4243
|
-
|
|
4244
|
-
return this.extend(this.parseMarginModification(response, market), {
|
|
4245
|
+
return this.extend(this.parseMarginModification(data, market), {
|
|
4245
4246
|
'amount': this.parseNumber(amount),
|
|
4246
|
-
'type': type,
|
|
4247
4247
|
'status': status,
|
|
4248
4248
|
});
|
|
4249
4249
|
}
|
|
@@ -4303,13 +4303,34 @@ class coinex extends coinex$1 {
|
|
|
4303
4303
|
// "user_id": 3620173
|
|
4304
4304
|
// }
|
|
4305
4305
|
//
|
|
4306
|
-
|
|
4306
|
+
// fetchMarginAdjustmentHistory
|
|
4307
|
+
//
|
|
4308
|
+
// {
|
|
4309
|
+
// bkr_price: '0',
|
|
4310
|
+
// leverage: '3',
|
|
4311
|
+
// liq_price: '0',
|
|
4312
|
+
// margin_amount: '5.33236666666666666666',
|
|
4313
|
+
// margin_change: '3',
|
|
4314
|
+
// market: 'XRPUSDT',
|
|
4315
|
+
// position_amount: '11',
|
|
4316
|
+
// position_id: '297155652',
|
|
4317
|
+
// position_type: '2',
|
|
4318
|
+
// settle_price: '0.6361',
|
|
4319
|
+
// time: '1711050906.382891',
|
|
4320
|
+
// type: '1',
|
|
4321
|
+
// user_id: '3685860'
|
|
4322
|
+
// }
|
|
4323
|
+
//
|
|
4324
|
+
const marketId = this.safeString(data, 'market');
|
|
4325
|
+
const type = this.safeString(data, 'type');
|
|
4326
|
+
const timestamp = this.safeIntegerProduct2(data, 'time', 'update_time', 1000);
|
|
4307
4327
|
return {
|
|
4308
4328
|
'info': data,
|
|
4309
|
-
'symbol': this.safeSymbol(undefined,
|
|
4310
|
-
'type':
|
|
4311
|
-
'
|
|
4312
|
-
'
|
|
4329
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
4330
|
+
'type': (type === '1') ? 'add' : 'reduce',
|
|
4331
|
+
'marginMode': 'isolated',
|
|
4332
|
+
'amount': this.safeNumber(data, 'margin_change'),
|
|
4333
|
+
'total': this.safeNumber(data, 'position_amount'),
|
|
4313
4334
|
'code': market['quote'],
|
|
4314
4335
|
'status': undefined,
|
|
4315
4336
|
'timestamp': timestamp,
|
|
@@ -4960,6 +4981,7 @@ class coinex extends coinex$1 {
|
|
|
4960
4981
|
const currencyId = this.safeString(transfer, 'asset');
|
|
4961
4982
|
const currencyCode = this.safeCurrencyCode(currencyId, currency);
|
|
4962
4983
|
return {
|
|
4984
|
+
'info': transfer,
|
|
4963
4985
|
'id': this.safeInteger(transfer, 'id'),
|
|
4964
4986
|
'timestamp': timestamp,
|
|
4965
4987
|
'datetime': this.iso8601(timestamp),
|
|
@@ -5792,6 +5814,78 @@ class coinex extends coinex$1 {
|
|
|
5792
5814
|
}
|
|
5793
5815
|
return undefined;
|
|
5794
5816
|
}
|
|
5817
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5818
|
+
/**
|
|
5819
|
+
* @method
|
|
5820
|
+
* @name coinex#fetchMarginAdjustmentHistory
|
|
5821
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
5822
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
|
|
5823
|
+
* @param {string} [symbol] unified market symbol
|
|
5824
|
+
* @param {string} [type] not used by coinex fetchMarginAdjustmentHistory
|
|
5825
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
5826
|
+
* @param {int} [limit] the maximum amount of changes to fetch, default=100, max=100
|
|
5827
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
5828
|
+
* @param {int} [params.until] timestamp in ms of the latest change to fetch
|
|
5829
|
+
*
|
|
5830
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
5831
|
+
* @param {int} [params.offset] offset
|
|
5832
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
5833
|
+
*/
|
|
5834
|
+
await this.loadMarkets();
|
|
5835
|
+
const until = this.safeInteger(params, 'until');
|
|
5836
|
+
params = this.omit(params, 'until');
|
|
5837
|
+
if (limit === undefined) {
|
|
5838
|
+
limit = 100;
|
|
5839
|
+
}
|
|
5840
|
+
const request = {
|
|
5841
|
+
'market': '',
|
|
5842
|
+
'position_id': 0,
|
|
5843
|
+
'offset': 0,
|
|
5844
|
+
'limit': limit,
|
|
5845
|
+
};
|
|
5846
|
+
if (symbol !== undefined) {
|
|
5847
|
+
const market = this.market(symbol);
|
|
5848
|
+
request['market'] = market['id'];
|
|
5849
|
+
}
|
|
5850
|
+
if (since !== undefined) {
|
|
5851
|
+
request['start_time'] = since;
|
|
5852
|
+
}
|
|
5853
|
+
if (until !== undefined) {
|
|
5854
|
+
request['end_time'] = until;
|
|
5855
|
+
}
|
|
5856
|
+
const response = await this.v1PerpetualPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
5857
|
+
//
|
|
5858
|
+
// {
|
|
5859
|
+
// code: '0',
|
|
5860
|
+
// data: {
|
|
5861
|
+
// limit: '100',
|
|
5862
|
+
// offset: '0',
|
|
5863
|
+
// records: [
|
|
5864
|
+
// {
|
|
5865
|
+
// bkr_price: '0',
|
|
5866
|
+
// leverage: '3',
|
|
5867
|
+
// liq_price: '0',
|
|
5868
|
+
// margin_amount: '5.33236666666666666666',
|
|
5869
|
+
// margin_change: '3',
|
|
5870
|
+
// market: 'XRPUSDT',
|
|
5871
|
+
// position_amount: '11',
|
|
5872
|
+
// position_id: '297155652',
|
|
5873
|
+
// position_type: '2',
|
|
5874
|
+
// settle_price: '0.6361',
|
|
5875
|
+
// time: '1711050906.382891',
|
|
5876
|
+
// type: '1',
|
|
5877
|
+
// user_id: '3685860'
|
|
5878
|
+
// }
|
|
5879
|
+
// ]
|
|
5880
|
+
// },
|
|
5881
|
+
// message: 'OK'
|
|
5882
|
+
// }
|
|
5883
|
+
//
|
|
5884
|
+
const data = this.safeDict(response, 'data', {});
|
|
5885
|
+
const records = this.safeList(data, 'records', []);
|
|
5886
|
+
const modifications = this.parseMarginModifications(records, undefined, 'market', 'swap');
|
|
5887
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
5888
|
+
}
|
|
5795
5889
|
}
|
|
5796
5890
|
|
|
5797
5891
|
module.exports = coinex;
|
package/dist/cjs/src/coinsph.js
CHANGED
|
@@ -1574,6 +1574,8 @@ class coinsph extends coinsph$1 {
|
|
|
1574
1574
|
'symbol': symbol,
|
|
1575
1575
|
'maker': this.safeNumber(fee, 'makerCommission'),
|
|
1576
1576
|
'taker': this.safeNumber(fee, 'takerCommission'),
|
|
1577
|
+
'percentage': undefined,
|
|
1578
|
+
'tierBased': undefined,
|
|
1577
1579
|
};
|
|
1578
1580
|
}
|
|
1579
1581
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
package/dist/cjs/src/delta.js
CHANGED