ccxt 4.2.63 → 4.2.64
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 +1 -1
- package/dist/ccxt.browser.js +271 -105
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +7 -9
- package/dist/cjs/src/bingx.js +45 -45
- package/dist/cjs/src/bitget.js +69 -1
- package/dist/cjs/src/blofin.js +11 -11
- package/dist/cjs/src/bybit.js +100 -7
- package/dist/cjs/src/gemini.js +9 -4
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/krakenfutures.js +1 -0
- package/dist/cjs/src/kucoin.js +2 -1
- package/dist/cjs/src/pro/bitget.js +5 -5
- package/dist/cjs/src/pro/coinex.js +4 -4
- package/dist/cjs/src/pro/lbank.js +1 -1
- package/dist/cjs/src/yobit.js +15 -15
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/krakenfutures.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/binance.js +7 -9
- package/js/src/bingx.js +45 -45
- package/js/src/bitget.d.ts +3 -1
- package/js/src/bitget.js +69 -1
- package/js/src/blofin.js +11 -11
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +100 -7
- package/js/src/gemini.js +9 -4
- package/js/src/hitbtc.js +1 -1
- package/js/src/krakenfutures.js +1 -0
- package/js/src/kucoin.js +2 -1
- package/js/src/pro/bitget.js +5 -5
- package/js/src/pro/coinex.js +4 -4
- package/js/src/pro/lbank.js +1 -1
- package/js/src/yobit.js +15 -15
- package/package.json +1 -1
- package/skip-tests.json +14 -11
package/dist/ccxt.browser.js
CHANGED
|
@@ -20960,14 +20960,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20960
20960
|
}
|
|
20961
20961
|
}
|
|
20962
20962
|
const promises = await Promise.all(promisesRaw);
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
markets = this.arrayConcat(markets, deliveryMarkets);
|
|
20970
|
-
markets = this.arrayConcat(markets, optionMarkets);
|
|
20963
|
+
let markets = [];
|
|
20964
|
+
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
20965
|
+
const promise = this.safeDict(promises, i);
|
|
20966
|
+
const promiseMarkets = this.safeList2(promise, 'symbols', 'optionSymbols', []);
|
|
20967
|
+
markets = this.arrayConcat(markets, promiseMarkets);
|
|
20968
|
+
}
|
|
20971
20969
|
//
|
|
20972
20970
|
// spot / margin
|
|
20973
20971
|
//
|
|
@@ -30356,7 +30354,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30356
30354
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
30357
30355
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
30358
30356
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30359
|
-
* @returns {object}
|
|
30357
|
+
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
30360
30358
|
*/
|
|
30361
30359
|
await this.loadMarkets();
|
|
30362
30360
|
let market = undefined;
|
|
@@ -31284,7 +31282,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31284
31282
|
// }
|
|
31285
31283
|
// }
|
|
31286
31284
|
//
|
|
31287
|
-
const data = this.
|
|
31285
|
+
const data = this.safeDict(response, 'data');
|
|
31288
31286
|
return this.safeInteger(data, 'serverTime');
|
|
31289
31287
|
}
|
|
31290
31288
|
async fetchCurrencies(params = {}) {
|
|
@@ -31339,14 +31337,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31339
31337
|
// ],
|
|
31340
31338
|
// }
|
|
31341
31339
|
//
|
|
31342
|
-
const data = this.
|
|
31340
|
+
const data = this.safeList(response, 'data', []);
|
|
31343
31341
|
const result = {};
|
|
31344
31342
|
for (let i = 0; i < data.length; i++) {
|
|
31345
31343
|
const entry = data[i];
|
|
31346
31344
|
const currencyId = this.safeString(entry, 'coin');
|
|
31347
31345
|
const code = this.safeCurrencyCode(currencyId);
|
|
31348
31346
|
const name = this.safeString(entry, 'name');
|
|
31349
|
-
const networkList = this.
|
|
31347
|
+
const networkList = this.safeList(entry, 'networkList');
|
|
31350
31348
|
const networks = {};
|
|
31351
31349
|
let fee = undefined;
|
|
31352
31350
|
let active = undefined;
|
|
@@ -31356,8 +31354,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31356
31354
|
const rawNetwork = networkList[j];
|
|
31357
31355
|
const network = this.safeString(rawNetwork, 'network');
|
|
31358
31356
|
const networkCode = this.networkIdToCode(network);
|
|
31359
|
-
const isDefault = this.
|
|
31360
|
-
withdrawEnabled = this.
|
|
31357
|
+
const isDefault = this.safeBool(rawNetwork, 'isDefault');
|
|
31358
|
+
withdrawEnabled = this.safeBool(rawNetwork, 'withdrawEnable');
|
|
31361
31359
|
const limits = {
|
|
31362
31360
|
'amounts': { 'min': this.safeNumber(rawNetwork, 'withdrawMin'), 'max': this.safeNumber(rawNetwork, 'withdrawMax') },
|
|
31363
31361
|
};
|
|
@@ -31418,8 +31416,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31418
31416
|
// }
|
|
31419
31417
|
// }
|
|
31420
31418
|
//
|
|
31421
|
-
const data = this.
|
|
31422
|
-
const markets = this.
|
|
31419
|
+
const data = this.safeDict(response, 'data');
|
|
31420
|
+
const markets = this.safeList(data, 'symbols', []);
|
|
31423
31421
|
return this.parseMarkets(markets);
|
|
31424
31422
|
}
|
|
31425
31423
|
async fetchSwapMarkets(params) {
|
|
@@ -31447,7 +31445,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31447
31445
|
// ]
|
|
31448
31446
|
// }
|
|
31449
31447
|
//
|
|
31450
|
-
const markets = this.
|
|
31448
|
+
const markets = this.safeList(response, 'data', []);
|
|
31451
31449
|
return this.parseMarkets(markets);
|
|
31452
31450
|
}
|
|
31453
31451
|
parseMarket(market) {
|
|
@@ -31474,7 +31472,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31474
31472
|
if (settle !== undefined) {
|
|
31475
31473
|
symbol += ':' + settle;
|
|
31476
31474
|
}
|
|
31477
|
-
const fees = this.
|
|
31475
|
+
const fees = this.safeDict(this.fees, type, {});
|
|
31478
31476
|
const contractSize = this.safeNumber(market, 'size');
|
|
31479
31477
|
const isActive = this.safeString(market, 'status') === '1';
|
|
31480
31478
|
const isInverse = (spot) ? undefined : false;
|
|
@@ -31548,8 +31546,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31548
31546
|
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
31549
31547
|
}
|
|
31550
31548
|
const promises = await Promise.all(requests);
|
|
31551
|
-
const spotMarkets = this.
|
|
31552
|
-
const swapMarkets = this.
|
|
31549
|
+
const spotMarkets = this.safeList(promises, 0, []);
|
|
31550
|
+
const swapMarkets = this.safeList(promises, 1, []);
|
|
31553
31551
|
return this.arrayConcat(spotMarkets, swapMarkets);
|
|
31554
31552
|
}
|
|
31555
31553
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -31763,7 +31761,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31763
31761
|
// ]
|
|
31764
31762
|
// }
|
|
31765
31763
|
//
|
|
31766
|
-
const trades = this.
|
|
31764
|
+
const trades = this.safeList(response, 'data', []);
|
|
31767
31765
|
return this.parseTrades(trades, market, since, limit);
|
|
31768
31766
|
}
|
|
31769
31767
|
parseTrade(trade, market = undefined) {
|
|
@@ -31859,9 +31857,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31859
31857
|
const type = (cost === undefined) ? 'spot' : 'swap';
|
|
31860
31858
|
const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
|
|
31861
31859
|
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
31862
|
-
const m = this.
|
|
31860
|
+
const m = this.safeBool(trade, 'm');
|
|
31863
31861
|
const marketId = this.safeString(trade, 's');
|
|
31864
|
-
const isBuyerMaker = this.
|
|
31862
|
+
const isBuyerMaker = this.safeBool2(trade, 'buyerMaker', 'isBuyerMaker');
|
|
31865
31863
|
let takeOrMaker = undefined;
|
|
31866
31864
|
if ((isBuyerMaker !== undefined) || (m !== undefined)) {
|
|
31867
31865
|
takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
|
|
@@ -31873,11 +31871,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31873
31871
|
takeOrMaker = 'taker';
|
|
31874
31872
|
}
|
|
31875
31873
|
}
|
|
31876
|
-
const isBuyer = this.
|
|
31874
|
+
const isBuyer = this.safeBool(trade, 'isBuyer');
|
|
31877
31875
|
if (isBuyer !== undefined) {
|
|
31878
31876
|
side = isBuyer ? 'buy' : 'sell';
|
|
31879
31877
|
}
|
|
31880
|
-
const isMaker = this.
|
|
31878
|
+
const isMaker = this.safeBool(trade, 'isMaker');
|
|
31881
31879
|
if (isMaker !== undefined) {
|
|
31882
31880
|
takeOrMaker = isMaker ? 'maker' : 'taker';
|
|
31883
31881
|
}
|
|
@@ -31987,7 +31985,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31987
31985
|
// ]}
|
|
31988
31986
|
// }
|
|
31989
31987
|
//
|
|
31990
|
-
const orderbook = this.
|
|
31988
|
+
const orderbook = this.safeDict(response, 'data', {});
|
|
31991
31989
|
const timestamp = this.safeInteger2(orderbook, 'T', 'ts');
|
|
31992
31990
|
return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1);
|
|
31993
31991
|
}
|
|
@@ -32023,7 +32021,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32023
32021
|
// ]
|
|
32024
32022
|
// }
|
|
32025
32023
|
//
|
|
32026
|
-
const data = this.
|
|
32024
|
+
const data = this.safeList(response, 'data', []);
|
|
32027
32025
|
return this.parseFundingRate(data, market);
|
|
32028
32026
|
}
|
|
32029
32027
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
@@ -32039,7 +32037,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32039
32037
|
await this.loadMarkets();
|
|
32040
32038
|
symbols = this.marketSymbols(symbols, 'swap', true);
|
|
32041
32039
|
const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
|
|
32042
|
-
const data = this.
|
|
32040
|
+
const data = this.safeList(response, 'data', []);
|
|
32043
32041
|
const filteredResponse = [];
|
|
32044
32042
|
for (let i = 0; i < data.length; i++) {
|
|
32045
32043
|
const item = data[i];
|
|
@@ -32136,7 +32134,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32136
32134
|
// ]
|
|
32137
32135
|
// }
|
|
32138
32136
|
//
|
|
32139
|
-
const data = this.
|
|
32137
|
+
const data = this.safeList(response, 'data', []);
|
|
32140
32138
|
const rates = [];
|
|
32141
32139
|
for (let i = 0; i < data.length; i++) {
|
|
32142
32140
|
const entry = data[i];
|
|
@@ -32181,7 +32179,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32181
32179
|
// }
|
|
32182
32180
|
// }
|
|
32183
32181
|
//
|
|
32184
|
-
const data = this.
|
|
32182
|
+
const data = this.safeDict(response, 'data', {});
|
|
32185
32183
|
return this.parseOpenInterest(data, market);
|
|
32186
32184
|
}
|
|
32187
32185
|
parseOpenInterest(interest, market = undefined) {
|
|
@@ -32515,7 +32513,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32515
32513
|
// ]
|
|
32516
32514
|
// }
|
|
32517
32515
|
//
|
|
32518
|
-
const positions = this.
|
|
32516
|
+
const positions = this.safeList(response, 'data', []);
|
|
32519
32517
|
return this.parsePositions(positions, symbols);
|
|
32520
32518
|
}
|
|
32521
32519
|
parsePosition(position, market = undefined) {
|
|
@@ -32550,7 +32548,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32550
32548
|
//
|
|
32551
32549
|
let marketId = this.safeString(position, 'symbol', '');
|
|
32552
32550
|
marketId = marketId.replace('/', '-'); // standard return different format
|
|
32553
|
-
const isolated = this.
|
|
32551
|
+
const isolated = this.safeBool(position, 'isolated');
|
|
32554
32552
|
let marginMode = undefined;
|
|
32555
32553
|
if (isolated !== undefined) {
|
|
32556
32554
|
marginMode = isolated ? 'isolated' : 'cross';
|
|
@@ -32935,7 +32933,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32935
32933
|
const side = this.safeString(rawOrder, 'side');
|
|
32936
32934
|
const amount = this.safeNumber(rawOrder, 'amount');
|
|
32937
32935
|
const price = this.safeNumber(rawOrder, 'price');
|
|
32938
|
-
const orderParams = this.
|
|
32936
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
32939
32937
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
32940
32938
|
ordersRequests.push(orderRequest);
|
|
32941
32939
|
}
|
|
@@ -32995,8 +32993,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32995
32993
|
// }
|
|
32996
32994
|
// }
|
|
32997
32995
|
//
|
|
32998
|
-
const data = this.
|
|
32999
|
-
const result = this.
|
|
32996
|
+
const data = this.safeDict(response, 'data', {});
|
|
32997
|
+
const result = this.safeList(data, 'orders', []);
|
|
33000
32998
|
return this.parseOrders(result, market);
|
|
33001
32999
|
}
|
|
33002
33000
|
parseOrderSide(side) {
|
|
@@ -33729,8 +33727,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33729
33727
|
// }
|
|
33730
33728
|
// }
|
|
33731
33729
|
//
|
|
33732
|
-
const data = this.
|
|
33733
|
-
const orders = this.
|
|
33730
|
+
const data = this.safeDict(response, 'data', {});
|
|
33731
|
+
const orders = this.safeList(data, 'orders', []);
|
|
33734
33732
|
return this.parseOrders(orders, market, since, limit);
|
|
33735
33733
|
}
|
|
33736
33734
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -33844,7 +33842,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33844
33842
|
*/
|
|
33845
33843
|
await this.loadMarkets();
|
|
33846
33844
|
const currency = this.currency(code);
|
|
33847
|
-
const accountsByType = this.
|
|
33845
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
33848
33846
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
33849
33847
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
33850
33848
|
const request = {
|
|
@@ -33887,7 +33885,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33887
33885
|
if (code !== undefined) {
|
|
33888
33886
|
currency = this.currency(code);
|
|
33889
33887
|
}
|
|
33890
|
-
const accountsByType = this.
|
|
33888
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
33891
33889
|
const fromAccount = this.safeString(params, 'fromAccount');
|
|
33892
33890
|
const toAccount = this.safeString(params, 'toAccount');
|
|
33893
33891
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
@@ -33920,7 +33918,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33920
33918
|
// ]
|
|
33921
33919
|
// }
|
|
33922
33920
|
//
|
|
33923
|
-
const rows = this.
|
|
33921
|
+
const rows = this.safeList(response, 'rows', []);
|
|
33924
33922
|
return this.parseTransfers(rows, currency, since, limit);
|
|
33925
33923
|
}
|
|
33926
33924
|
parseTransfer(transfer, currency = undefined) {
|
|
@@ -33928,7 +33926,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33928
33926
|
const timestamp = this.safeInteger(transfer, 'timestamp');
|
|
33929
33927
|
const currencyCode = this.safeCurrencyCode(undefined, currency);
|
|
33930
33928
|
const status = this.safeString(transfer, 'status');
|
|
33931
|
-
const accountsById = this.
|
|
33929
|
+
const accountsById = this.safeDict(this.options, 'accountsById', {});
|
|
33932
33930
|
const typeId = this.safeString(transfer, 'type');
|
|
33933
33931
|
const typeIdSplit = typeId.split('_');
|
|
33934
33932
|
const fromId = this.safeString(typeIdSplit, 0);
|
|
@@ -33986,7 +33984,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33986
33984
|
// }
|
|
33987
33985
|
// }
|
|
33988
33986
|
//
|
|
33989
|
-
const data = this.
|
|
33987
|
+
const data = this.safeList(this.safeDict(response, 'data'), 'data');
|
|
33990
33988
|
const parsed = this.parseDepositAddresses(data, [currency['code']], false);
|
|
33991
33989
|
return this.indexBy(parsed, 'network');
|
|
33992
33990
|
}
|
|
@@ -34439,8 +34437,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34439
34437
|
let fills = undefined;
|
|
34440
34438
|
if (market['spot']) {
|
|
34441
34439
|
response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
|
|
34442
|
-
const data = this.
|
|
34443
|
-
fills = this.
|
|
34440
|
+
const data = this.safeDict(response, 'data', {});
|
|
34441
|
+
fills = this.safeList(data, 'fills', []);
|
|
34444
34442
|
//
|
|
34445
34443
|
// {
|
|
34446
34444
|
// "code": 0,
|
|
@@ -34471,8 +34469,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34471
34469
|
params = this.omit(params, 'tradingUnit');
|
|
34472
34470
|
request['tradingUnit'] = tradingUnit;
|
|
34473
34471
|
response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
|
|
34474
|
-
const data = this.
|
|
34475
|
-
fills = this.
|
|
34472
|
+
const data = this.safeDict(response, 'data', {});
|
|
34473
|
+
fills = this.safeList(data, 'fill_orders', []);
|
|
34476
34474
|
//
|
|
34477
34475
|
// {
|
|
34478
34476
|
// "code": "0",
|
|
@@ -34525,7 +34523,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34525
34523
|
// ]
|
|
34526
34524
|
// }
|
|
34527
34525
|
//
|
|
34528
|
-
const networkList = this.
|
|
34526
|
+
const networkList = this.safeList(fee, 'networkList', []);
|
|
34529
34527
|
const networkListLength = networkList.length;
|
|
34530
34528
|
const result = {
|
|
34531
34529
|
'info': fee,
|
|
@@ -34543,7 +34541,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34543
34541
|
for (let i = 0; i < networkListLength; i++) {
|
|
34544
34542
|
const network = networkList[i];
|
|
34545
34543
|
const networkId = this.safeString(network, 'network');
|
|
34546
|
-
const isDefault = this.
|
|
34544
|
+
const isDefault = this.safeBool(network, 'isDefault');
|
|
34547
34545
|
const currencyCode = this.safeString(currency, 'code');
|
|
34548
34546
|
const networkCode = this.networkIdToCode(networkId, currencyCode);
|
|
34549
34547
|
result['networks'][networkCode] = {
|
|
@@ -34698,8 +34696,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34698
34696
|
// }
|
|
34699
34697
|
// }
|
|
34700
34698
|
//
|
|
34701
|
-
const data = this.
|
|
34702
|
-
const liquidations = this.
|
|
34699
|
+
const data = this.safeDict(response, 'data', {});
|
|
34700
|
+
const liquidations = this.safeList(data, 'orders', []);
|
|
34703
34701
|
return this.parseLiquidations(liquidations, market, since, limit);
|
|
34704
34702
|
}
|
|
34705
34703
|
parseLiquidation(liquidation, market = undefined) {
|
|
@@ -34772,7 +34770,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34772
34770
|
// }
|
|
34773
34771
|
// }
|
|
34774
34772
|
//
|
|
34775
|
-
const data = this.
|
|
34773
|
+
const data = this.safeDict(response, 'data');
|
|
34776
34774
|
return this.parseOrder(data);
|
|
34777
34775
|
}
|
|
34778
34776
|
async closeAllPositions(params = {}) {
|
|
@@ -34810,8 +34808,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34810
34808
|
// }
|
|
34811
34809
|
// }
|
|
34812
34810
|
//
|
|
34813
|
-
const data = this.
|
|
34814
|
-
const success = this.
|
|
34811
|
+
const data = this.safeDict(response, 'data', {});
|
|
34812
|
+
const success = this.safeList(data, 'success', []);
|
|
34815
34813
|
const positions = [];
|
|
34816
34814
|
for (let i = 0; i < success.length; i++) {
|
|
34817
34815
|
const position = this.parsePosition({ 'positionId': success[i] });
|
|
@@ -35024,7 +35022,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
35024
35022
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
|
|
35025
35023
|
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
35026
35024
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
35027
|
-
* @returns {object}
|
|
35025
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
35028
35026
|
*/
|
|
35029
35027
|
await this.loadMarkets();
|
|
35030
35028
|
const market = this.market(symbol);
|
|
@@ -44930,7 +44928,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44930
44928
|
'fetchLeverage': true,
|
|
44931
44929
|
'fetchLeverageTiers': false,
|
|
44932
44930
|
'fetchLiquidations': false,
|
|
44933
|
-
'fetchMarginMode':
|
|
44931
|
+
'fetchMarginMode': true,
|
|
44934
44932
|
'fetchMarketLeverageTiers': true,
|
|
44935
44933
|
'fetchMarkets': true,
|
|
44936
44934
|
'fetchMarkOHLCV': true,
|
|
@@ -53150,6 +53148,74 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53150
53148
|
const orderInfo = this.safeValue(data, 'successList', []);
|
|
53151
53149
|
return this.parsePositions(orderInfo, undefined, params);
|
|
53152
53150
|
}
|
|
53151
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
53152
|
+
/**
|
|
53153
|
+
* @method
|
|
53154
|
+
* @name bitget#fetchMarginMode
|
|
53155
|
+
* @description fetches the margin mode of a trading pair
|
|
53156
|
+
* @see https://www.bitget.com/api-doc/contract/account/Get-Single-Account
|
|
53157
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
53158
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
53159
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
53160
|
+
*/
|
|
53161
|
+
await this.loadMarkets();
|
|
53162
|
+
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
53163
|
+
let market = undefined;
|
|
53164
|
+
if (sandboxMode) {
|
|
53165
|
+
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
53166
|
+
market = this.market(sandboxSymbol);
|
|
53167
|
+
}
|
|
53168
|
+
else {
|
|
53169
|
+
market = this.market(symbol);
|
|
53170
|
+
}
|
|
53171
|
+
let productType = undefined;
|
|
53172
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
53173
|
+
const request = {
|
|
53174
|
+
'symbol': market['id'],
|
|
53175
|
+
'marginCoin': market['settleId'],
|
|
53176
|
+
'productType': productType,
|
|
53177
|
+
};
|
|
53178
|
+
const response = await this.privateMixGetV2MixAccountAccount(this.extend(request, params));
|
|
53179
|
+
//
|
|
53180
|
+
// {
|
|
53181
|
+
// "code": "00000",
|
|
53182
|
+
// "msg": "success",
|
|
53183
|
+
// "requestTime": 1709791216652,
|
|
53184
|
+
// "data": {
|
|
53185
|
+
// "marginCoin": "USDT",
|
|
53186
|
+
// "locked": "0",
|
|
53187
|
+
// "available": "19.88811074",
|
|
53188
|
+
// "crossedMaxAvailable": "19.88811074",
|
|
53189
|
+
// "isolatedMaxAvailable": "19.88811074",
|
|
53190
|
+
// "maxTransferOut": "19.88811074",
|
|
53191
|
+
// "accountEquity": "19.88811074",
|
|
53192
|
+
// "usdtEquity": "19.888110749166",
|
|
53193
|
+
// "btcEquity": "0.000302183391",
|
|
53194
|
+
// "crossedRiskRate": "0",
|
|
53195
|
+
// "crossedMarginLeverage": 20,
|
|
53196
|
+
// "isolatedLongLever": 20,
|
|
53197
|
+
// "isolatedShortLever": 20,
|
|
53198
|
+
// "marginMode": "crossed",
|
|
53199
|
+
// "posMode": "hedge_mode",
|
|
53200
|
+
// "unrealizedPL": "0",
|
|
53201
|
+
// "coupon": "0",
|
|
53202
|
+
// "crossedUnrealizedPL": "0",
|
|
53203
|
+
// "isolatedUnrealizedPL": ""
|
|
53204
|
+
// }
|
|
53205
|
+
// }
|
|
53206
|
+
//
|
|
53207
|
+
const data = this.safeDict(response, 'data', {});
|
|
53208
|
+
return this.parseMarginMode(data, market);
|
|
53209
|
+
}
|
|
53210
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
53211
|
+
let marginType = this.safeString(marginMode, 'marginMode');
|
|
53212
|
+
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
53213
|
+
return {
|
|
53214
|
+
'info': marginMode,
|
|
53215
|
+
'symbol': market['symbol'],
|
|
53216
|
+
'marginMode': marginType,
|
|
53217
|
+
};
|
|
53218
|
+
}
|
|
53153
53219
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
53154
53220
|
if (!response) {
|
|
53155
53221
|
return undefined; // fallback to default error handler
|
|
@@ -77334,7 +77400,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77334
77400
|
const strikePrice = undefined;
|
|
77335
77401
|
const optionType = undefined;
|
|
77336
77402
|
const tickSize = this.safeString(market, 'tickSize');
|
|
77337
|
-
const fees = this.
|
|
77403
|
+
const fees = this.safeDict2(this.fees, type, 'trading', {});
|
|
77338
77404
|
const taker = this.safeNumber(fees, 'taker');
|
|
77339
77405
|
const maker = this.safeNumber(fees, 'maker');
|
|
77340
77406
|
let maxLeverage = this.safeString(market, 'maxLeverage', '100');
|
|
@@ -77435,7 +77501,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77435
77501
|
// }
|
|
77436
77502
|
//
|
|
77437
77503
|
const data = this.safeList(response, 'data', []);
|
|
77438
|
-
const first = this.
|
|
77504
|
+
const first = this.safeDict(data, 0, {});
|
|
77439
77505
|
const timestamp = this.safeInteger(first, 'ts');
|
|
77440
77506
|
return this.parseOrderBook(first, symbol, timestamp);
|
|
77441
77507
|
}
|
|
@@ -77491,7 +77557,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77491
77557
|
};
|
|
77492
77558
|
const response = await this.publicGetMarketTickers(this.extend(request, params));
|
|
77493
77559
|
const data = this.safeList(response, 'data', []);
|
|
77494
|
-
const first = this.
|
|
77560
|
+
const first = this.safeDict(data, 0, {});
|
|
77495
77561
|
return this.parseTicker(first, market);
|
|
77496
77562
|
}
|
|
77497
77563
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
@@ -77951,8 +78017,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77951
78017
|
if (postOnly) {
|
|
77952
78018
|
request['type'] = 'post_only';
|
|
77953
78019
|
}
|
|
77954
|
-
const stopLoss = this.
|
|
77955
|
-
const takeProfit = this.
|
|
78020
|
+
const stopLoss = this.safeDict(params, 'stopLoss');
|
|
78021
|
+
const takeProfit = this.safeDict(params, 'takeProfit');
|
|
77956
78022
|
params = this.omit(params, ['stopLoss', 'takeProfit']);
|
|
77957
78023
|
const isStopLoss = stopLoss !== undefined;
|
|
77958
78024
|
const isTakeProfit = takeProfit !== undefined;
|
|
@@ -78245,7 +78311,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78245
78311
|
const side = this.safeString(rawOrder, 'side');
|
|
78246
78312
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
78247
78313
|
const price = this.safeValue(rawOrder, 'price');
|
|
78248
|
-
const orderParams = this.
|
|
78314
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
78249
78315
|
const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params
|
|
78250
78316
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
|
|
78251
78317
|
ordersRequests.push(orderRequest);
|
|
@@ -78284,7 +78350,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78284
78350
|
if (limit !== undefined) {
|
|
78285
78351
|
request['limit'] = limit; // default 100, max 100
|
|
78286
78352
|
}
|
|
78287
|
-
const isStop = this.
|
|
78353
|
+
const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
|
|
78288
78354
|
let method = undefined;
|
|
78289
78355
|
[method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersPending');
|
|
78290
78356
|
const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);
|
|
@@ -78612,7 +78678,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78612
78678
|
await this.loadMarkets();
|
|
78613
78679
|
const market = this.market(symbol);
|
|
78614
78680
|
const request = [];
|
|
78615
|
-
const options = this.
|
|
78681
|
+
const options = this.safeDict(this.options, 'cancelOrders', {});
|
|
78616
78682
|
const defaultMethod = this.safeString(options, 'method', 'privatePostTradeCancelBatchOrders');
|
|
78617
78683
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
78618
78684
|
const clientOrderIds = this.parseIds(this.safeValue(params, 'clientOrderId'));
|
|
@@ -78679,7 +78745,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78679
78745
|
*/
|
|
78680
78746
|
await this.loadMarkets();
|
|
78681
78747
|
const currency = this.currency(code);
|
|
78682
|
-
const accountsByType = this.
|
|
78748
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
78683
78749
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
78684
78750
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
78685
78751
|
const request = {
|
|
@@ -79012,7 +79078,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79012
79078
|
request['clientOrderId'] = clientOrderId;
|
|
79013
79079
|
}
|
|
79014
79080
|
const response = await this.privatePostTradeClosePosition(this.extend(request, params));
|
|
79015
|
-
return this.
|
|
79081
|
+
return this.safeDict(response, 'data');
|
|
79016
79082
|
}
|
|
79017
79083
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
79018
79084
|
/**
|
|
@@ -79047,7 +79113,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79047
79113
|
if (since !== undefined) {
|
|
79048
79114
|
request['begin'] = since;
|
|
79049
79115
|
}
|
|
79050
|
-
const isStop = this.
|
|
79116
|
+
const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
|
|
79051
79117
|
let method = undefined;
|
|
79052
79118
|
[method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersHistory');
|
|
79053
79119
|
const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);
|
|
@@ -86696,8 +86762,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
86696
86762
|
const market = this.market(symbols[0]);
|
|
86697
86763
|
let category = undefined;
|
|
86698
86764
|
[category, params] = this.getBybitType('createOrders', market, params);
|
|
86699
|
-
if (
|
|
86700
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrders does not allow
|
|
86765
|
+
if (category === 'inverse') {
|
|
86766
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrders does not allow inverse orders');
|
|
86701
86767
|
}
|
|
86702
86768
|
const request = {
|
|
86703
86769
|
'category': category,
|
|
@@ -87177,6 +87243,87 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
87177
87243
|
const result = this.safeValue(response, 'result', {});
|
|
87178
87244
|
return this.parseOrder(result, market);
|
|
87179
87245
|
}
|
|
87246
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
87247
|
+
/**
|
|
87248
|
+
* @method
|
|
87249
|
+
* @name bybit#cancelOrders
|
|
87250
|
+
* @description cancel multiple orders
|
|
87251
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/batch-cancel
|
|
87252
|
+
* @param {string[]} ids order ids
|
|
87253
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
87254
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
87255
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
87256
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
87257
|
+
*/
|
|
87258
|
+
if (symbol === undefined) {
|
|
87259
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
87260
|
+
}
|
|
87261
|
+
await this.loadMarkets();
|
|
87262
|
+
const market = this.market(symbol);
|
|
87263
|
+
let category = undefined;
|
|
87264
|
+
[category, params] = this.getBybitType('cancelOrders', market, params);
|
|
87265
|
+
if (category === 'inverse') {
|
|
87266
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelOrders does not allow inverse orders');
|
|
87267
|
+
}
|
|
87268
|
+
const ordersRequests = [];
|
|
87269
|
+
const clientOrderIds = this.safeList2(params, 'clientOrderIds', 'clientOids', []);
|
|
87270
|
+
params = this.omit(params, ['clientOrderIds', 'clientOids']);
|
|
87271
|
+
for (let i = 0; i < clientOrderIds.length; i++) {
|
|
87272
|
+
ordersRequests.push({
|
|
87273
|
+
'symbol': market['id'],
|
|
87274
|
+
'orderLinkId': this.safeString(clientOrderIds, i),
|
|
87275
|
+
});
|
|
87276
|
+
}
|
|
87277
|
+
for (let i = 0; i < ids.length; i++) {
|
|
87278
|
+
ordersRequests.push({
|
|
87279
|
+
'symbol': market['id'],
|
|
87280
|
+
'orderId': this.safeString(ids, i),
|
|
87281
|
+
});
|
|
87282
|
+
}
|
|
87283
|
+
const request = {
|
|
87284
|
+
'category': category,
|
|
87285
|
+
'request': ordersRequests,
|
|
87286
|
+
};
|
|
87287
|
+
const response = await this.privatePostV5OrderCancelBatch(this.extend(request, params));
|
|
87288
|
+
//
|
|
87289
|
+
// {
|
|
87290
|
+
// "retCode": "0",
|
|
87291
|
+
// "retMsg": "OK",
|
|
87292
|
+
// "result": {
|
|
87293
|
+
// "list": [
|
|
87294
|
+
// {
|
|
87295
|
+
// "category": "spot",
|
|
87296
|
+
// "symbol": "BTCUSDT",
|
|
87297
|
+
// "orderId": "1636282505818800896",
|
|
87298
|
+
// "orderLinkId": "1636282505818800897"
|
|
87299
|
+
// },
|
|
87300
|
+
// {
|
|
87301
|
+
// "category": "spot",
|
|
87302
|
+
// "symbol": "BTCUSDT",
|
|
87303
|
+
// "orderId": "1636282505818800898",
|
|
87304
|
+
// "orderLinkId": "1636282505818800899"
|
|
87305
|
+
// }
|
|
87306
|
+
// ]
|
|
87307
|
+
// },
|
|
87308
|
+
// "retExtInfo": {
|
|
87309
|
+
// "list": [
|
|
87310
|
+
// {
|
|
87311
|
+
// "code": "0",
|
|
87312
|
+
// "msg": "OK"
|
|
87313
|
+
// },
|
|
87314
|
+
// {
|
|
87315
|
+
// "code": "0",
|
|
87316
|
+
// "msg": "OK"
|
|
87317
|
+
// }
|
|
87318
|
+
// ]
|
|
87319
|
+
// },
|
|
87320
|
+
// "time": "1709796158501"
|
|
87321
|
+
// }
|
|
87322
|
+
//
|
|
87323
|
+
const result = this.safeDict(response, 'result', {});
|
|
87324
|
+
const row = this.safeList(result, 'list', []);
|
|
87325
|
+
return this.parseOrders(row, market);
|
|
87326
|
+
}
|
|
87180
87327
|
async cancelAllUsdcOrders(symbol = undefined, params = {}) {
|
|
87181
87328
|
if (symbol === undefined) {
|
|
87182
87329
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelAllUsdcOrders() requires a symbol argument');
|
|
@@ -90139,7 +90286,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90139
90286
|
// }
|
|
90140
90287
|
//
|
|
90141
90288
|
const marketId = this.safeString(fee, 'symbol');
|
|
90142
|
-
const
|
|
90289
|
+
const defaultType = (market !== undefined) ? market['type'] : 'contract';
|
|
90290
|
+
const symbol = this.safeSymbol(marketId, market, undefined, defaultType);
|
|
90143
90291
|
return {
|
|
90144
90292
|
'info': fee,
|
|
90145
90293
|
'symbol': symbol,
|
|
@@ -90159,12 +90307,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90159
90307
|
*/
|
|
90160
90308
|
await this.loadMarkets();
|
|
90161
90309
|
const market = this.market(symbol);
|
|
90162
|
-
if (market['spot']) {
|
|
90163
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTradingFee() is not supported for spot market');
|
|
90164
|
-
}
|
|
90165
90310
|
const request = {
|
|
90166
90311
|
'symbol': market['id'],
|
|
90167
90312
|
};
|
|
90313
|
+
let category = undefined;
|
|
90314
|
+
if (market['linear']) {
|
|
90315
|
+
category = 'linear';
|
|
90316
|
+
}
|
|
90317
|
+
else if (market['inverse']) {
|
|
90318
|
+
category = 'inverse';
|
|
90319
|
+
}
|
|
90320
|
+
else if (market['spot']) {
|
|
90321
|
+
category = 'spot';
|
|
90322
|
+
}
|
|
90323
|
+
else {
|
|
90324
|
+
category = 'option';
|
|
90325
|
+
}
|
|
90326
|
+
request['category'] = category;
|
|
90168
90327
|
const response = await this.privateGetV5AccountFeeRate(this.extend(request, params));
|
|
90169
90328
|
//
|
|
90170
90329
|
// {
|
|
@@ -90186,7 +90345,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90186
90345
|
const result = this.safeValue(response, 'result', {});
|
|
90187
90346
|
const fees = this.safeValue(result, 'list', []);
|
|
90188
90347
|
const first = this.safeValue(fees, 0, {});
|
|
90189
|
-
return this.parseTradingFee(first);
|
|
90348
|
+
return this.parseTradingFee(first, market);
|
|
90190
90349
|
}
|
|
90191
90350
|
async fetchTradingFees(params = {}) {
|
|
90192
90351
|
/**
|
|
@@ -140196,12 +140355,12 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140196
140355
|
'webApiEnable': true,
|
|
140197
140356
|
'webApiRetries': 10,
|
|
140198
140357
|
},
|
|
140358
|
+
'fetchUsdtMarkets': ['btcusdt', 'ethusdt'],
|
|
140199
140359
|
'fetchCurrencies': {
|
|
140200
140360
|
'webApiEnable': true,
|
|
140201
140361
|
'webApiRetries': 5,
|
|
140202
140362
|
'webApiMuteFailure': true,
|
|
140203
140363
|
},
|
|
140204
|
-
'fetchUsdtMarkets': ['btcusdt', 'ethusdt'],
|
|
140205
140364
|
'fetchTickerMethod': 'fetchTickerV1',
|
|
140206
140365
|
'networks': {
|
|
140207
140366
|
'BTC': 'bitcoin',
|
|
@@ -140340,9 +140499,11 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140340
140499
|
*/
|
|
140341
140500
|
const method = this.safeValue(this.options, 'fetchMarketsMethod', 'fetch_markets_from_api');
|
|
140342
140501
|
if (method === 'fetch_markets_from_web') {
|
|
140343
|
-
const
|
|
140344
|
-
|
|
140345
|
-
|
|
140502
|
+
const promises = [];
|
|
140503
|
+
promises.push(this.fetchMarketsFromWeb(params)); // get usd markets
|
|
140504
|
+
promises.push(this.fetchUSDTMarkets(params)); // get usdt markets
|
|
140505
|
+
const promisesResult = await Promise.all(promises);
|
|
140506
|
+
return this.arrayConcat(promisesResult[0], promisesResult[1]);
|
|
140346
140507
|
}
|
|
140347
140508
|
return await this.fetchMarketsFromAPI(params);
|
|
140348
140509
|
}
|
|
@@ -140450,6 +140611,9 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140450
140611
|
'post_only': true,
|
|
140451
140612
|
'limit_only': true,
|
|
140452
140613
|
};
|
|
140614
|
+
if (status === undefined) {
|
|
140615
|
+
return true; // as defaulted below
|
|
140616
|
+
}
|
|
140453
140617
|
return this.safeBool(statuses, status, true);
|
|
140454
140618
|
}
|
|
140455
140619
|
async fetchUSDTMarkets(params = {}) {
|
|
@@ -144280,7 +144444,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
144280
144444
|
* @see https://api.hitbtc.com/#get-futures-position-parameters
|
|
144281
144445
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
144282
144446
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
144283
|
-
* @returns {object}
|
|
144447
|
+
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
144284
144448
|
*/
|
|
144285
144449
|
await this.loadMarkets();
|
|
144286
144450
|
let market = undefined;
|
|
@@ -167668,6 +167832,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
167668
167832
|
'executions',
|
|
167669
167833
|
'triggers',
|
|
167670
167834
|
'accountlogcsv',
|
|
167835
|
+
'account-log',
|
|
167671
167836
|
'market/{symbol}/orders',
|
|
167672
167837
|
'market/{symbol}/executions',
|
|
167673
167838
|
],
|
|
@@ -170354,7 +170519,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170354
170519
|
'project/list': 10,
|
|
170355
170520
|
'project/marketInterestRate': 7.5,
|
|
170356
170521
|
'redeem/orders': 10,
|
|
170357
|
-
'purchase/orders': 10,
|
|
170522
|
+
'purchase/orders': 10,
|
|
170523
|
+
'broker/api/rebase/download': 3,
|
|
170358
170524
|
},
|
|
170359
170525
|
'post': {
|
|
170360
170526
|
// account
|
|
@@ -230409,7 +230575,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
230409
230575
|
if (feeAmount !== undefined) {
|
|
230410
230576
|
const feeCurrency = this.safeString(fee, 'feeCoin');
|
|
230411
230577
|
feeObject = {
|
|
230412
|
-
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringAbs(feeAmount),
|
|
230578
|
+
'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringAbs(feeAmount)),
|
|
230413
230579
|
'currency': this.safeCurrencyCode(feeCurrency),
|
|
230414
230580
|
};
|
|
230415
230581
|
}
|
|
@@ -230422,10 +230588,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
230422
230588
|
if (side === 'buy' && market['spot'] && (type === 'market')) {
|
|
230423
230589
|
cost = this.safeString(order, 'newSize', cost);
|
|
230424
230590
|
}
|
|
230425
|
-
|
|
230426
|
-
if (market['spot'] && (rawStatus !== 'live')) {
|
|
230427
|
-
|
|
230428
|
-
}
|
|
230591
|
+
const filled = this.safeString2(order, 'accBaseVolume', 'baseVolume');
|
|
230592
|
+
// if (market['spot'] && (rawStatus !== 'live')) {
|
|
230593
|
+
// filled = Precise.stringDiv (cost, avgPrice);
|
|
230594
|
+
// }
|
|
230429
230595
|
let amount = this.safeString(order, 'baseVolume');
|
|
230430
230596
|
if (!market['spot'] || !(side === 'buy' && type === 'market')) {
|
|
230431
230597
|
amount = this.safeString(order, 'newSize', amount);
|
|
@@ -243930,7 +244096,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243930
244096
|
const messageHash = 'authenticated:spot';
|
|
243931
244097
|
let future = this.safeValue(client.subscriptions, messageHash);
|
|
243932
244098
|
if (future !== undefined) {
|
|
243933
|
-
return future;
|
|
244099
|
+
return await future;
|
|
243934
244100
|
}
|
|
243935
244101
|
const requestId = this.requestId();
|
|
243936
244102
|
const subscribe = {
|
|
@@ -243950,13 +244116,13 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243950
244116
|
};
|
|
243951
244117
|
future = this.watch(url, messageHash, request, requestId, subscribe);
|
|
243952
244118
|
client.subscriptions[messageHash] = future;
|
|
243953
|
-
return future;
|
|
244119
|
+
return await future;
|
|
243954
244120
|
}
|
|
243955
244121
|
else {
|
|
243956
244122
|
const messageHash = 'authenticated:swap';
|
|
243957
244123
|
let future = this.safeValue(client.subscriptions, messageHash);
|
|
243958
244124
|
if (future !== undefined) {
|
|
243959
|
-
return future;
|
|
244125
|
+
return await future;
|
|
243960
244126
|
}
|
|
243961
244127
|
const requestId = this.requestId();
|
|
243962
244128
|
const subscribe = {
|
|
@@ -243976,7 +244142,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243976
244142
|
};
|
|
243977
244143
|
future = this.watch(url, messageHash, request, requestId, subscribe);
|
|
243978
244144
|
client.subscriptions[messageHash] = future;
|
|
243979
|
-
return future;
|
|
244145
|
+
return await future;
|
|
243980
244146
|
}
|
|
243981
244147
|
}
|
|
243982
244148
|
}
|
|
@@ -261085,7 +261251,7 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
261085
261251
|
// },
|
|
261086
261252
|
// type: 'kbar',
|
|
261087
261253
|
// pair: 'btc_usdt',
|
|
261088
|
-
// TS: '2022-10-02T12:44:15.
|
|
261254
|
+
// TS: '2022-10-02T12:44:15.865'
|
|
261089
261255
|
// }
|
|
261090
261256
|
//
|
|
261091
261257
|
const marketId = this.safeString(message, 'pair');
|
|
@@ -306532,15 +306698,15 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306532
306698
|
});
|
|
306533
306699
|
}
|
|
306534
306700
|
parseBalance(response) {
|
|
306535
|
-
const balances = this.
|
|
306701
|
+
const balances = this.safeDict(response, 'return', {});
|
|
306536
306702
|
const timestamp = this.safeInteger(balances, 'server_time');
|
|
306537
306703
|
const result = {
|
|
306538
306704
|
'info': response,
|
|
306539
306705
|
'timestamp': timestamp,
|
|
306540
306706
|
'datetime': this.iso8601(timestamp),
|
|
306541
306707
|
};
|
|
306542
|
-
const free = this.
|
|
306543
|
-
const total = this.
|
|
306708
|
+
const free = this.safeDict(balances, 'funds', {});
|
|
306709
|
+
const total = this.safeDict(balances, 'funds_incl_orders', {});
|
|
306544
306710
|
const currencyIds = Object.keys(this.extend(free, total));
|
|
306545
306711
|
for (let i = 0; i < currencyIds.length; i++) {
|
|
306546
306712
|
const currencyId = currencyIds[i];
|
|
@@ -306618,7 +306784,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306618
306784
|
// },
|
|
306619
306785
|
// }
|
|
306620
306786
|
//
|
|
306621
|
-
const markets = this.
|
|
306787
|
+
const markets = this.safeDict(response, 'pairs', {});
|
|
306622
306788
|
const keys = Object.keys(markets);
|
|
306623
306789
|
const result = [];
|
|
306624
306790
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -306906,7 +307072,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306906
307072
|
'currency': feeCurrencyCode,
|
|
306907
307073
|
};
|
|
306908
307074
|
}
|
|
306909
|
-
const isYourOrder = this.
|
|
307075
|
+
const isYourOrder = this.safeString(trade, 'is_your_order');
|
|
306910
307076
|
if (isYourOrder !== undefined) {
|
|
306911
307077
|
if (fee === undefined) {
|
|
306912
307078
|
const feeInNumbers = this.calculateFee(symbol, type, side, amount, price, 'taker');
|
|
@@ -306973,7 +307139,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306973
307139
|
return [];
|
|
306974
307140
|
}
|
|
306975
307141
|
}
|
|
306976
|
-
const result = this.
|
|
307142
|
+
const result = this.safeList(response, market['id'], []);
|
|
306977
307143
|
return this.parseTrades(result, market, since, limit);
|
|
306978
307144
|
}
|
|
306979
307145
|
async fetchTradingFees(params = {}) {
|
|
@@ -307006,12 +307172,12 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307006
307172
|
// },
|
|
307007
307173
|
// }
|
|
307008
307174
|
//
|
|
307009
|
-
const pairs = this.
|
|
307175
|
+
const pairs = this.safeDict(response, 'pairs', {});
|
|
307010
307176
|
const marketIds = Object.keys(pairs);
|
|
307011
307177
|
const result = {};
|
|
307012
307178
|
for (let i = 0; i < marketIds.length; i++) {
|
|
307013
307179
|
const marketId = marketIds[i];
|
|
307014
|
-
const pair = this.
|
|
307180
|
+
const pair = this.safeDict(pairs, marketId, {});
|
|
307015
307181
|
const symbol = this.safeSymbol(marketId, undefined, '_');
|
|
307016
307182
|
const takerString = this.safeString(pair, 'fee_buyer');
|
|
307017
307183
|
const makerString = this.safeString(pair, 'fee_seller');
|
|
@@ -307075,7 +307241,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307075
307241
|
// }
|
|
307076
307242
|
// }
|
|
307077
307243
|
//
|
|
307078
|
-
const result = this.
|
|
307244
|
+
const result = this.safeDict(response, 'return');
|
|
307079
307245
|
return this.parseOrder(result, market);
|
|
307080
307246
|
}
|
|
307081
307247
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -307113,7 +307279,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307113
307279
|
// }
|
|
307114
307280
|
// }
|
|
307115
307281
|
//
|
|
307116
|
-
const result = this.
|
|
307282
|
+
const result = this.safeDict(response, 'return', {});
|
|
307117
307283
|
return this.parseOrder(result);
|
|
307118
307284
|
}
|
|
307119
307285
|
parseOrderStatus(status) {
|
|
@@ -307244,7 +307410,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307244
307410
|
};
|
|
307245
307411
|
const response = await this.privatePostOrderInfo(this.extend(request, params));
|
|
307246
307412
|
id = id.toString();
|
|
307247
|
-
const orders = this.
|
|
307413
|
+
const orders = this.safeDict(response, 'return', {});
|
|
307248
307414
|
//
|
|
307249
307415
|
// {
|
|
307250
307416
|
// "success":1,
|
|
@@ -307309,7 +307475,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307309
307475
|
// }
|
|
307310
307476
|
// }
|
|
307311
307477
|
//
|
|
307312
|
-
const result = this.
|
|
307478
|
+
const result = this.safeDict(response, 'return', {});
|
|
307313
307479
|
return this.parseOrders(result, market, since, limit);
|
|
307314
307480
|
}
|
|
307315
307481
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -307363,7 +307529,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307363
307529
|
// }
|
|
307364
307530
|
// }
|
|
307365
307531
|
//
|
|
307366
|
-
const trades = this.
|
|
307532
|
+
const trades = this.safeDict(response, 'return', {});
|
|
307367
307533
|
const ids = Object.keys(trades);
|
|
307368
307534
|
const result = [];
|
|
307369
307535
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -307411,7 +307577,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307411
307577
|
await this.loadMarkets();
|
|
307412
307578
|
const currency = this.currency(code);
|
|
307413
307579
|
let currencyId = currency['id'];
|
|
307414
|
-
const networks = this.
|
|
307580
|
+
const networks = this.safeDict(this.options, 'networks', {});
|
|
307415
307581
|
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
307416
307582
|
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
307417
307583
|
if (network !== undefined) {
|
|
@@ -307578,7 +307744,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307578
307744
|
//
|
|
307579
307745
|
// To cover points 1, 2, 3 and 4 combined this handler should work like this:
|
|
307580
307746
|
//
|
|
307581
|
-
let success = this.
|
|
307747
|
+
let success = this.safeValue(response, 'success'); // don't replace with safeBool here
|
|
307582
307748
|
if (typeof success === 'string') {
|
|
307583
307749
|
if ((success === 'true') || (success === '1')) {
|
|
307584
307750
|
success = true;
|
|
@@ -316377,7 +316543,7 @@ SOFTWARE.
|
|
|
316377
316543
|
|
|
316378
316544
|
//-----------------------------------------------------------------------------
|
|
316379
316545
|
// this is updated by vss.js when building
|
|
316380
|
-
const version = '4.2.
|
|
316546
|
+
const version = '4.2.64';
|
|
316381
316547
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
316382
316548
|
//-----------------------------------------------------------------------------
|
|
316383
316549
|
|