ccxt 4.2.63 → 4.2.65
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 +565 -178
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +12 -0
- package/dist/cjs/src/binance.js +33 -12
- package/dist/cjs/src/bingx.js +58 -49
- package/dist/cjs/src/bitget.js +69 -1
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/blofin.js +46 -11
- package/dist/cjs/src/btcmarkets.js +12 -0
- package/dist/cjs/src/bybit.js +100 -7
- package/dist/cjs/src/coinbase.js +12 -2
- package/dist/cjs/src/delta.js +95 -1
- 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 +87 -62
- package/dist/cjs/src/pro/bitget.js +5 -5
- package/dist/cjs/src/pro/coinex.js +4 -4
- package/dist/cjs/src/pro/currencycom.js +1 -1
- 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/blofin.d.ts +1 -0
- package/js/src/abstract/krakenfutures.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +10 -0
- package/js/src/abstract/kucoinfutures.d.ts +10 -0
- package/js/src/base/Exchange.js +12 -0
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +33 -12
- package/js/src/bingx.js +58 -49
- package/js/src/bitget.d.ts +3 -1
- package/js/src/bitget.js +69 -1
- package/js/src/bitmex.js +3 -1
- package/js/src/blofin.d.ts +3 -1
- package/js/src/blofin.js +46 -11
- package/js/src/btcmarkets.js +12 -0
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +100 -7
- package/js/src/coinbase.js +12 -2
- package/js/src/delta.d.ts +3 -1
- package/js/src/delta.js +95 -1
- package/js/src/gate.d.ts +1 -1
- 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 +87 -62
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/bitget.js +5 -5
- package/js/src/pro/coinex.js +4 -4
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +1 -1
- package/js/src/pro/lbank.js +1 -1
- package/js/src/woo.d.ts +1 -1
- package/js/src/yobit.js +15 -15
- package/package.json +2 -2
- package/skip-tests.json +47 -22
package/dist/ccxt.browser.js
CHANGED
|
@@ -9731,6 +9731,18 @@ class Exchange {
|
|
|
9731
9731
|
return this.filterBySymbolSinceLimit(results, symbol, since, limit);
|
|
9732
9732
|
}
|
|
9733
9733
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
9734
|
+
/**
|
|
9735
|
+
* @method
|
|
9736
|
+
* @description calculates the presumptive fee that would be charged for an order
|
|
9737
|
+
* @param {string} symbol unified market symbol
|
|
9738
|
+
* @param {string} type 'market' or 'limit'
|
|
9739
|
+
* @param {string} side 'buy' or 'sell'
|
|
9740
|
+
* @param {float} amount how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
|
9741
|
+
* @param {float} price the price for the order to be filled at, in units of the quote currency
|
|
9742
|
+
* @param {string} takerOrMaker 'taker' or 'maker'
|
|
9743
|
+
* @param {object} params
|
|
9744
|
+
* @returns {object} contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
|
9745
|
+
*/
|
|
9734
9746
|
if (type === 'market' && takerOrMaker === 'maker') {
|
|
9735
9747
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' calculateFee() - you have provided incompatible arguments - "market" type order can not be "maker". Change either the "type" or the "takerOrMaker" argument to calculate the fee.');
|
|
9736
9748
|
}
|
|
@@ -20700,6 +20712,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20700
20712
|
* @see https://binance-docs.github.io/apidocs/futures/en/#check-server-time // swap
|
|
20701
20713
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#check-server-time // future
|
|
20702
20714
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
20715
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
20703
20716
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
20704
20717
|
*/
|
|
20705
20718
|
const defaultType = this.safeString2(this.options, 'fetchTime', 'defaultType', 'spot');
|
|
@@ -20960,14 +20973,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20960
20973
|
}
|
|
20961
20974
|
}
|
|
20962
20975
|
const promises = await Promise.all(promisesRaw);
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
markets = this.arrayConcat(markets, deliveryMarkets);
|
|
20970
|
-
markets = this.arrayConcat(markets, optionMarkets);
|
|
20976
|
+
let markets = [];
|
|
20977
|
+
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
20978
|
+
const promise = this.safeDict(promises, i);
|
|
20979
|
+
const promiseMarkets = this.safeList2(promise, 'symbols', 'optionSymbols', []);
|
|
20980
|
+
markets = this.arrayConcat(markets, promiseMarkets);
|
|
20981
|
+
}
|
|
20971
20982
|
//
|
|
20972
20983
|
// spot / margin
|
|
20973
20984
|
//
|
|
@@ -21497,6 +21508,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21497
21508
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
21498
21509
|
* @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
|
|
21499
21510
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the balance for a portfolio margin account
|
|
21511
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
21500
21512
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
21501
21513
|
*/
|
|
21502
21514
|
await this.loadMarkets();
|
|
@@ -22075,6 +22087,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22075
22087
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-order-book-ticker // future
|
|
22076
22088
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
22077
22089
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22090
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22078
22091
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
22079
22092
|
*/
|
|
22080
22093
|
await this.loadMarkets();
|
|
@@ -22115,6 +22128,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22115
22128
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
22116
22129
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
22117
22130
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22131
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22118
22132
|
* @returns {object} a dictionary of lastprices structures
|
|
22119
22133
|
*/
|
|
22120
22134
|
await this.loadMarkets();
|
|
@@ -22220,6 +22234,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22220
22234
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
|
|
22221
22235
|
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
22222
22236
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22237
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22223
22238
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
22224
22239
|
*/
|
|
22225
22240
|
await this.loadMarkets();
|
|
@@ -24646,6 +24661,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24646
24661
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
24647
24662
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch open orders in the portfolio margin account
|
|
24648
24663
|
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account conditional orders
|
|
24664
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
24649
24665
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
24650
24666
|
*/
|
|
24651
24667
|
await this.loadMarkets();
|
|
@@ -26789,6 +26805,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26789
26805
|
* @param {string} symbol unified market symbol
|
|
26790
26806
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
26791
26807
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
|
|
26808
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
26792
26809
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
26793
26810
|
*/
|
|
26794
26811
|
await this.loadMarkets();
|
|
@@ -26857,6 +26874,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26857
26874
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
26858
26875
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
26859
26876
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
26877
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
26860
26878
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
26861
26879
|
*/
|
|
26862
26880
|
await this.loadMarkets();
|
|
@@ -27114,6 +27132,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27114
27132
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27115
27133
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
27116
27134
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
27135
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27117
27136
|
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
27118
27137
|
*/
|
|
27119
27138
|
await this.loadMarkets();
|
|
@@ -27187,6 +27206,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27187
27206
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
27188
27207
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
27189
27208
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27209
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27190
27210
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
27191
27211
|
*/
|
|
27192
27212
|
await this.loadMarkets();
|
|
@@ -27810,6 +27830,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27810
27830
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
27811
27831
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27812
27832
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the leverage tiers for a portfolio margin account
|
|
27833
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27813
27834
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
27814
27835
|
*/
|
|
27815
27836
|
await this.loadMarkets();
|
|
@@ -28124,6 +28145,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28124
28145
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
28125
28146
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28126
28147
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
|
|
28148
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28127
28149
|
* @returns {object} data on account positions
|
|
28128
28150
|
*/
|
|
28129
28151
|
if (symbols !== undefined) {
|
|
@@ -28177,6 +28199,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28177
28199
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
28178
28200
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28179
28201
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
|
|
28202
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28180
28203
|
* @returns {object} data on the positions risk
|
|
28181
28204
|
*/
|
|
28182
28205
|
if (symbols !== undefined) {
|
|
@@ -28336,6 +28359,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28336
28359
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28337
28360
|
* @param {int} [params.until] timestamp in ms of the latest funding history entry
|
|
28338
28361
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the funding history for a portfolio margin account
|
|
28362
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28339
28363
|
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
28340
28364
|
*/
|
|
28341
28365
|
await this.loadMarkets();
|
|
@@ -28520,6 +28544,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28520
28544
|
* @param {string} symbol not used by binance setPositionMode ()
|
|
28521
28545
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28522
28546
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to set the position mode for a portfolio margin account
|
|
28547
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28523
28548
|
* @returns {object} response from the exchange
|
|
28524
28549
|
*/
|
|
28525
28550
|
const defaultType = this.safeString(this.options, 'defaultType', 'future');
|
|
@@ -28548,7 +28573,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28548
28573
|
response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
28549
28574
|
}
|
|
28550
28575
|
}
|
|
28551
|
-
else {
|
|
28576
|
+
else if (this.isLinear(type, subType)) {
|
|
28552
28577
|
if (isPortfolioMargin) {
|
|
28553
28578
|
response = await this.papiPostUmPositionSideDual(this.extend(request, params));
|
|
28554
28579
|
}
|
|
@@ -28556,6 +28581,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28556
28581
|
response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
28557
28582
|
}
|
|
28558
28583
|
}
|
|
28584
|
+
else {
|
|
28585
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' setPositionMode() supports linear and inverse contracts only');
|
|
28586
|
+
}
|
|
28559
28587
|
//
|
|
28560
28588
|
// {
|
|
28561
28589
|
// "code": 200,
|
|
@@ -28575,6 +28603,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28575
28603
|
* @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
|
28576
28604
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
28577
28605
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28606
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28578
28607
|
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
28579
28608
|
*/
|
|
28580
28609
|
await this.loadMarkets();
|
|
@@ -28849,6 +28878,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28849
28878
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
28850
28879
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
28851
28880
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the ledger for a portfolio margin account
|
|
28881
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28852
28882
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
28853
28883
|
*/
|
|
28854
28884
|
await this.loadMarkets();
|
|
@@ -29992,6 +30022,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
29992
30022
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
29993
30023
|
* @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
29994
30024
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch liquidations in a portfolio margin account
|
|
30025
|
+
* @param {string} [params.type] "spot"
|
|
30026
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
29995
30027
|
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
29996
30028
|
*/
|
|
29997
30029
|
await this.loadMarkets();
|
|
@@ -30317,8 +30349,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30317
30349
|
* @name binance#fetchPositionMode
|
|
30318
30350
|
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
30319
30351
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
30320
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
30321
|
-
* @param {string} params.subType "linear" or "inverse"
|
|
30352
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30353
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
30322
30354
|
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
30323
30355
|
*/
|
|
30324
30356
|
let market = undefined;
|
|
@@ -30356,7 +30388,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30356
30388
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
30357
30389
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
30358
30390
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30359
|
-
* @
|
|
30391
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
30392
|
+
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
30360
30393
|
*/
|
|
30361
30394
|
await this.loadMarkets();
|
|
30362
30395
|
let market = undefined;
|
|
@@ -31284,7 +31317,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31284
31317
|
// }
|
|
31285
31318
|
// }
|
|
31286
31319
|
//
|
|
31287
|
-
const data = this.
|
|
31320
|
+
const data = this.safeDict(response, 'data');
|
|
31288
31321
|
return this.safeInteger(data, 'serverTime');
|
|
31289
31322
|
}
|
|
31290
31323
|
async fetchCurrencies(params = {}) {
|
|
@@ -31339,14 +31372,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31339
31372
|
// ],
|
|
31340
31373
|
// }
|
|
31341
31374
|
//
|
|
31342
|
-
const data = this.
|
|
31375
|
+
const data = this.safeList(response, 'data', []);
|
|
31343
31376
|
const result = {};
|
|
31344
31377
|
for (let i = 0; i < data.length; i++) {
|
|
31345
31378
|
const entry = data[i];
|
|
31346
31379
|
const currencyId = this.safeString(entry, 'coin');
|
|
31347
31380
|
const code = this.safeCurrencyCode(currencyId);
|
|
31348
31381
|
const name = this.safeString(entry, 'name');
|
|
31349
|
-
const networkList = this.
|
|
31382
|
+
const networkList = this.safeList(entry, 'networkList');
|
|
31350
31383
|
const networks = {};
|
|
31351
31384
|
let fee = undefined;
|
|
31352
31385
|
let active = undefined;
|
|
@@ -31356,8 +31389,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31356
31389
|
const rawNetwork = networkList[j];
|
|
31357
31390
|
const network = this.safeString(rawNetwork, 'network');
|
|
31358
31391
|
const networkCode = this.networkIdToCode(network);
|
|
31359
|
-
const isDefault = this.
|
|
31360
|
-
withdrawEnabled = this.
|
|
31392
|
+
const isDefault = this.safeBool(rawNetwork, 'isDefault');
|
|
31393
|
+
withdrawEnabled = this.safeBool(rawNetwork, 'withdrawEnable');
|
|
31361
31394
|
const limits = {
|
|
31362
31395
|
'amounts': { 'min': this.safeNumber(rawNetwork, 'withdrawMin'), 'max': this.safeNumber(rawNetwork, 'withdrawMax') },
|
|
31363
31396
|
};
|
|
@@ -31418,8 +31451,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31418
31451
|
// }
|
|
31419
31452
|
// }
|
|
31420
31453
|
//
|
|
31421
|
-
const data = this.
|
|
31422
|
-
const markets = this.
|
|
31454
|
+
const data = this.safeDict(response, 'data');
|
|
31455
|
+
const markets = this.safeList(data, 'symbols', []);
|
|
31423
31456
|
return this.parseMarkets(markets);
|
|
31424
31457
|
}
|
|
31425
31458
|
async fetchSwapMarkets(params) {
|
|
@@ -31447,7 +31480,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31447
31480
|
// ]
|
|
31448
31481
|
// }
|
|
31449
31482
|
//
|
|
31450
|
-
const markets = this.
|
|
31483
|
+
const markets = this.safeList(response, 'data', []);
|
|
31451
31484
|
return this.parseMarkets(markets);
|
|
31452
31485
|
}
|
|
31453
31486
|
parseMarket(market) {
|
|
@@ -31474,7 +31507,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31474
31507
|
if (settle !== undefined) {
|
|
31475
31508
|
symbol += ':' + settle;
|
|
31476
31509
|
}
|
|
31477
|
-
const fees = this.
|
|
31510
|
+
const fees = this.safeDict(this.fees, type, {});
|
|
31478
31511
|
const contractSize = this.safeNumber(market, 'size');
|
|
31479
31512
|
const isActive = this.safeString(market, 'status') === '1';
|
|
31480
31513
|
const isInverse = (spot) ? undefined : false;
|
|
@@ -31548,8 +31581,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31548
31581
|
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
31549
31582
|
}
|
|
31550
31583
|
const promises = await Promise.all(requests);
|
|
31551
|
-
const spotMarkets = this.
|
|
31552
|
-
const swapMarkets = this.
|
|
31584
|
+
const spotMarkets = this.safeList(promises, 0, []);
|
|
31585
|
+
const swapMarkets = this.safeList(promises, 1, []);
|
|
31553
31586
|
return this.arrayConcat(spotMarkets, swapMarkets);
|
|
31554
31587
|
}
|
|
31555
31588
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -31763,7 +31796,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31763
31796
|
// ]
|
|
31764
31797
|
// }
|
|
31765
31798
|
//
|
|
31766
|
-
const trades = this.
|
|
31799
|
+
const trades = this.safeList(response, 'data', []);
|
|
31767
31800
|
return this.parseTrades(trades, market, since, limit);
|
|
31768
31801
|
}
|
|
31769
31802
|
parseTrade(trade, market = undefined) {
|
|
@@ -31859,9 +31892,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31859
31892
|
const type = (cost === undefined) ? 'spot' : 'swap';
|
|
31860
31893
|
const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
|
|
31861
31894
|
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
31862
|
-
const m = this.
|
|
31895
|
+
const m = this.safeBool(trade, 'm');
|
|
31863
31896
|
const marketId = this.safeString(trade, 's');
|
|
31864
|
-
const isBuyerMaker = this.
|
|
31897
|
+
const isBuyerMaker = this.safeBool2(trade, 'buyerMaker', 'isBuyerMaker');
|
|
31865
31898
|
let takeOrMaker = undefined;
|
|
31866
31899
|
if ((isBuyerMaker !== undefined) || (m !== undefined)) {
|
|
31867
31900
|
takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
|
|
@@ -31873,11 +31906,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31873
31906
|
takeOrMaker = 'taker';
|
|
31874
31907
|
}
|
|
31875
31908
|
}
|
|
31876
|
-
const isBuyer = this.
|
|
31909
|
+
const isBuyer = this.safeBool(trade, 'isBuyer');
|
|
31877
31910
|
if (isBuyer !== undefined) {
|
|
31878
31911
|
side = isBuyer ? 'buy' : 'sell';
|
|
31879
31912
|
}
|
|
31880
|
-
const isMaker = this.
|
|
31913
|
+
const isMaker = this.safeBool(trade, 'isMaker');
|
|
31881
31914
|
if (isMaker !== undefined) {
|
|
31882
31915
|
takeOrMaker = isMaker ? 'maker' : 'taker';
|
|
31883
31916
|
}
|
|
@@ -31987,7 +32020,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31987
32020
|
// ]}
|
|
31988
32021
|
// }
|
|
31989
32022
|
//
|
|
31990
|
-
const orderbook = this.
|
|
32023
|
+
const orderbook = this.safeDict(response, 'data', {});
|
|
31991
32024
|
const timestamp = this.safeInteger2(orderbook, 'T', 'ts');
|
|
31992
32025
|
return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1);
|
|
31993
32026
|
}
|
|
@@ -32023,7 +32056,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32023
32056
|
// ]
|
|
32024
32057
|
// }
|
|
32025
32058
|
//
|
|
32026
|
-
const data = this.
|
|
32059
|
+
const data = this.safeList(response, 'data', []);
|
|
32027
32060
|
return this.parseFundingRate(data, market);
|
|
32028
32061
|
}
|
|
32029
32062
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
@@ -32039,7 +32072,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32039
32072
|
await this.loadMarkets();
|
|
32040
32073
|
symbols = this.marketSymbols(symbols, 'swap', true);
|
|
32041
32074
|
const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
|
|
32042
|
-
const data = this.
|
|
32075
|
+
const data = this.safeList(response, 'data', []);
|
|
32043
32076
|
const filteredResponse = [];
|
|
32044
32077
|
for (let i = 0; i < data.length; i++) {
|
|
32045
32078
|
const item = data[i];
|
|
@@ -32136,7 +32169,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32136
32169
|
// ]
|
|
32137
32170
|
// }
|
|
32138
32171
|
//
|
|
32139
|
-
const data = this.
|
|
32172
|
+
const data = this.safeList(response, 'data', []);
|
|
32140
32173
|
const rates = [];
|
|
32141
32174
|
for (let i = 0; i < data.length; i++) {
|
|
32142
32175
|
const entry = data[i];
|
|
@@ -32181,7 +32214,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32181
32214
|
// }
|
|
32182
32215
|
// }
|
|
32183
32216
|
//
|
|
32184
|
-
const data = this.
|
|
32217
|
+
const data = this.safeDict(response, 'data', {});
|
|
32185
32218
|
return this.parseOpenInterest(data, market);
|
|
32186
32219
|
}
|
|
32187
32220
|
parseOpenInterest(interest, market = undefined) {
|
|
@@ -32515,7 +32548,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32515
32548
|
// ]
|
|
32516
32549
|
// }
|
|
32517
32550
|
//
|
|
32518
|
-
const positions = this.
|
|
32551
|
+
const positions = this.safeList(response, 'data', []);
|
|
32519
32552
|
return this.parsePositions(positions, symbols);
|
|
32520
32553
|
}
|
|
32521
32554
|
parsePosition(position, market = undefined) {
|
|
@@ -32550,7 +32583,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32550
32583
|
//
|
|
32551
32584
|
let marketId = this.safeString(position, 'symbol', '');
|
|
32552
32585
|
marketId = marketId.replace('/', '-'); // standard return different format
|
|
32553
|
-
const isolated = this.
|
|
32586
|
+
const isolated = this.safeBool(position, 'isolated');
|
|
32554
32587
|
let marginMode = undefined;
|
|
32555
32588
|
if (isolated !== undefined) {
|
|
32556
32589
|
marginMode = isolated ? 'isolated' : 'cross';
|
|
@@ -32713,6 +32746,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32713
32746
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
32714
32747
|
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
32715
32748
|
const trailingPercent = this.safeString2(params, 'trailingPercent', 'priceRate');
|
|
32749
|
+
const trailingType = this.safeString(params, 'trailingType', 'TRAILING_STOP_MARKET');
|
|
32716
32750
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
32717
32751
|
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
32718
32752
|
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
@@ -32759,7 +32793,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32759
32793
|
}
|
|
32760
32794
|
}
|
|
32761
32795
|
else if (isTrailing) {
|
|
32762
|
-
request['type'] =
|
|
32796
|
+
request['type'] = trailingType;
|
|
32763
32797
|
if (isTrailingAmountOrder) {
|
|
32764
32798
|
request['price'] = this.parseToNumeric(trailingAmount);
|
|
32765
32799
|
}
|
|
@@ -32814,7 +32848,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32814
32848
|
}
|
|
32815
32849
|
request['positionSide'] = positionSide;
|
|
32816
32850
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
32817
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
32851
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
32818
32852
|
}
|
|
32819
32853
|
return this.extend(request, params);
|
|
32820
32854
|
}
|
|
@@ -32845,14 +32879,22 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32845
32879
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
32846
32880
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
32847
32881
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
32882
|
+
* @param {boolean} [params.test] *swap only* whether to use the test endpoint or not, default is false
|
|
32848
32883
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
32849
32884
|
*/
|
|
32850
32885
|
await this.loadMarkets();
|
|
32851
32886
|
const market = this.market(symbol);
|
|
32887
|
+
const test = this.safeBool(params, 'test', false);
|
|
32888
|
+
params = this.omit(params, 'test');
|
|
32852
32889
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
32853
32890
|
let response = undefined;
|
|
32854
32891
|
if (market['swap']) {
|
|
32855
|
-
|
|
32892
|
+
if (test) {
|
|
32893
|
+
response = await this.swapV2PrivatePostTradeOrderTest(request);
|
|
32894
|
+
}
|
|
32895
|
+
else {
|
|
32896
|
+
response = await this.swapV2PrivatePostTradeOrder(request);
|
|
32897
|
+
}
|
|
32856
32898
|
}
|
|
32857
32899
|
else {
|
|
32858
32900
|
response = await this.spotV1PrivatePostTradeOrder(request);
|
|
@@ -32935,7 +32977,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32935
32977
|
const side = this.safeString(rawOrder, 'side');
|
|
32936
32978
|
const amount = this.safeNumber(rawOrder, 'amount');
|
|
32937
32979
|
const price = this.safeNumber(rawOrder, 'price');
|
|
32938
|
-
const orderParams = this.
|
|
32980
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
32939
32981
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
32940
32982
|
ordersRequests.push(orderRequest);
|
|
32941
32983
|
}
|
|
@@ -32995,8 +33037,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32995
33037
|
// }
|
|
32996
33038
|
// }
|
|
32997
33039
|
//
|
|
32998
|
-
const data = this.
|
|
32999
|
-
const result = this.
|
|
33040
|
+
const data = this.safeDict(response, 'data', {});
|
|
33041
|
+
const result = this.safeList(data, 'orders', []);
|
|
33000
33042
|
return this.parseOrders(result, market);
|
|
33001
33043
|
}
|
|
33002
33044
|
parseOrderSide(side) {
|
|
@@ -33729,8 +33771,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33729
33771
|
// }
|
|
33730
33772
|
// }
|
|
33731
33773
|
//
|
|
33732
|
-
const data = this.
|
|
33733
|
-
const orders = this.
|
|
33774
|
+
const data = this.safeDict(response, 'data', {});
|
|
33775
|
+
const orders = this.safeList(data, 'orders', []);
|
|
33734
33776
|
return this.parseOrders(orders, market, since, limit);
|
|
33735
33777
|
}
|
|
33736
33778
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -33844,7 +33886,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33844
33886
|
*/
|
|
33845
33887
|
await this.loadMarkets();
|
|
33846
33888
|
const currency = this.currency(code);
|
|
33847
|
-
const accountsByType = this.
|
|
33889
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
33848
33890
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
33849
33891
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
33850
33892
|
const request = {
|
|
@@ -33887,7 +33929,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33887
33929
|
if (code !== undefined) {
|
|
33888
33930
|
currency = this.currency(code);
|
|
33889
33931
|
}
|
|
33890
|
-
const accountsByType = this.
|
|
33932
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
33891
33933
|
const fromAccount = this.safeString(params, 'fromAccount');
|
|
33892
33934
|
const toAccount = this.safeString(params, 'toAccount');
|
|
33893
33935
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
@@ -33920,7 +33962,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33920
33962
|
// ]
|
|
33921
33963
|
// }
|
|
33922
33964
|
//
|
|
33923
|
-
const rows = this.
|
|
33965
|
+
const rows = this.safeList(response, 'rows', []);
|
|
33924
33966
|
return this.parseTransfers(rows, currency, since, limit);
|
|
33925
33967
|
}
|
|
33926
33968
|
parseTransfer(transfer, currency = undefined) {
|
|
@@ -33928,7 +33970,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33928
33970
|
const timestamp = this.safeInteger(transfer, 'timestamp');
|
|
33929
33971
|
const currencyCode = this.safeCurrencyCode(undefined, currency);
|
|
33930
33972
|
const status = this.safeString(transfer, 'status');
|
|
33931
|
-
const accountsById = this.
|
|
33973
|
+
const accountsById = this.safeDict(this.options, 'accountsById', {});
|
|
33932
33974
|
const typeId = this.safeString(transfer, 'type');
|
|
33933
33975
|
const typeIdSplit = typeId.split('_');
|
|
33934
33976
|
const fromId = this.safeString(typeIdSplit, 0);
|
|
@@ -33986,7 +34028,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33986
34028
|
// }
|
|
33987
34029
|
// }
|
|
33988
34030
|
//
|
|
33989
|
-
const data = this.
|
|
34031
|
+
const data = this.safeList(this.safeDict(response, 'data'), 'data');
|
|
33990
34032
|
const parsed = this.parseDepositAddresses(data, [currency['code']], false);
|
|
33991
34033
|
return this.indexBy(parsed, 'network');
|
|
33992
34034
|
}
|
|
@@ -34439,8 +34481,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34439
34481
|
let fills = undefined;
|
|
34440
34482
|
if (market['spot']) {
|
|
34441
34483
|
response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
|
|
34442
|
-
const data = this.
|
|
34443
|
-
fills = this.
|
|
34484
|
+
const data = this.safeDict(response, 'data', {});
|
|
34485
|
+
fills = this.safeList(data, 'fills', []);
|
|
34444
34486
|
//
|
|
34445
34487
|
// {
|
|
34446
34488
|
// "code": 0,
|
|
@@ -34471,8 +34513,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34471
34513
|
params = this.omit(params, 'tradingUnit');
|
|
34472
34514
|
request['tradingUnit'] = tradingUnit;
|
|
34473
34515
|
response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
|
|
34474
|
-
const data = this.
|
|
34475
|
-
fills = this.
|
|
34516
|
+
const data = this.safeDict(response, 'data', {});
|
|
34517
|
+
fills = this.safeList(data, 'fill_orders', []);
|
|
34476
34518
|
//
|
|
34477
34519
|
// {
|
|
34478
34520
|
// "code": "0",
|
|
@@ -34525,7 +34567,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34525
34567
|
// ]
|
|
34526
34568
|
// }
|
|
34527
34569
|
//
|
|
34528
|
-
const networkList = this.
|
|
34570
|
+
const networkList = this.safeList(fee, 'networkList', []);
|
|
34529
34571
|
const networkListLength = networkList.length;
|
|
34530
34572
|
const result = {
|
|
34531
34573
|
'info': fee,
|
|
@@ -34543,7 +34585,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34543
34585
|
for (let i = 0; i < networkListLength; i++) {
|
|
34544
34586
|
const network = networkList[i];
|
|
34545
34587
|
const networkId = this.safeString(network, 'network');
|
|
34546
|
-
const isDefault = this.
|
|
34588
|
+
const isDefault = this.safeBool(network, 'isDefault');
|
|
34547
34589
|
const currencyCode = this.safeString(currency, 'code');
|
|
34548
34590
|
const networkCode = this.networkIdToCode(networkId, currencyCode);
|
|
34549
34591
|
result['networks'][networkCode] = {
|
|
@@ -34698,8 +34740,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34698
34740
|
// }
|
|
34699
34741
|
// }
|
|
34700
34742
|
//
|
|
34701
|
-
const data = this.
|
|
34702
|
-
const liquidations = this.
|
|
34743
|
+
const data = this.safeDict(response, 'data', {});
|
|
34744
|
+
const liquidations = this.safeList(data, 'orders', []);
|
|
34703
34745
|
return this.parseLiquidations(liquidations, market, since, limit);
|
|
34704
34746
|
}
|
|
34705
34747
|
parseLiquidation(liquidation, market = undefined) {
|
|
@@ -34772,7 +34814,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34772
34814
|
// }
|
|
34773
34815
|
// }
|
|
34774
34816
|
//
|
|
34775
|
-
const data = this.
|
|
34817
|
+
const data = this.safeDict(response, 'data');
|
|
34776
34818
|
return this.parseOrder(data);
|
|
34777
34819
|
}
|
|
34778
34820
|
async closeAllPositions(params = {}) {
|
|
@@ -34810,8 +34852,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34810
34852
|
// }
|
|
34811
34853
|
// }
|
|
34812
34854
|
//
|
|
34813
|
-
const data = this.
|
|
34814
|
-
const success = this.
|
|
34855
|
+
const data = this.safeDict(response, 'data', {});
|
|
34856
|
+
const success = this.safeList(data, 'success', []);
|
|
34815
34857
|
const positions = [];
|
|
34816
34858
|
for (let i = 0; i < success.length; i++) {
|
|
34817
34859
|
const position = this.parsePosition({ 'positionId': success[i] });
|
|
@@ -34906,7 +34948,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34906
34948
|
* @param {string} [params.newClientOrderId] custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
|
|
34907
34949
|
* @param {string} [params.positionSide] *contract only* position direction, required for single position as BOTH, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
|
|
34908
34950
|
* @param {string} [params.reduceOnly] *contract only* true or false, default=false for single position mode. this parameter is not accepted for both long and short positions mode
|
|
34909
|
-
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market, Max = 1
|
|
34951
|
+
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1
|
|
34910
34952
|
* @param {string} [params.workingType] *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE
|
|
34911
34953
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
34912
34954
|
*/
|
|
@@ -35024,7 +35066,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
35024
35066
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
|
|
35025
35067
|
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
35026
35068
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
35027
|
-
* @returns {object}
|
|
35069
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
35028
35070
|
*/
|
|
35029
35071
|
await this.loadMarkets();
|
|
35030
35072
|
const market = this.market(symbol);
|
|
@@ -44930,7 +44972,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44930
44972
|
'fetchLeverage': true,
|
|
44931
44973
|
'fetchLeverageTiers': false,
|
|
44932
44974
|
'fetchLiquidations': false,
|
|
44933
|
-
'fetchMarginMode':
|
|
44975
|
+
'fetchMarginMode': true,
|
|
44934
44976
|
'fetchMarketLeverageTiers': true,
|
|
44935
44977
|
'fetchMarkets': true,
|
|
44936
44978
|
'fetchMarkOHLCV': true,
|
|
@@ -53150,6 +53192,74 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53150
53192
|
const orderInfo = this.safeValue(data, 'successList', []);
|
|
53151
53193
|
return this.parsePositions(orderInfo, undefined, params);
|
|
53152
53194
|
}
|
|
53195
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
53196
|
+
/**
|
|
53197
|
+
* @method
|
|
53198
|
+
* @name bitget#fetchMarginMode
|
|
53199
|
+
* @description fetches the margin mode of a trading pair
|
|
53200
|
+
* @see https://www.bitget.com/api-doc/contract/account/Get-Single-Account
|
|
53201
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
53202
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
53203
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
53204
|
+
*/
|
|
53205
|
+
await this.loadMarkets();
|
|
53206
|
+
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
53207
|
+
let market = undefined;
|
|
53208
|
+
if (sandboxMode) {
|
|
53209
|
+
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
53210
|
+
market = this.market(sandboxSymbol);
|
|
53211
|
+
}
|
|
53212
|
+
else {
|
|
53213
|
+
market = this.market(symbol);
|
|
53214
|
+
}
|
|
53215
|
+
let productType = undefined;
|
|
53216
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
53217
|
+
const request = {
|
|
53218
|
+
'symbol': market['id'],
|
|
53219
|
+
'marginCoin': market['settleId'],
|
|
53220
|
+
'productType': productType,
|
|
53221
|
+
};
|
|
53222
|
+
const response = await this.privateMixGetV2MixAccountAccount(this.extend(request, params));
|
|
53223
|
+
//
|
|
53224
|
+
// {
|
|
53225
|
+
// "code": "00000",
|
|
53226
|
+
// "msg": "success",
|
|
53227
|
+
// "requestTime": 1709791216652,
|
|
53228
|
+
// "data": {
|
|
53229
|
+
// "marginCoin": "USDT",
|
|
53230
|
+
// "locked": "0",
|
|
53231
|
+
// "available": "19.88811074",
|
|
53232
|
+
// "crossedMaxAvailable": "19.88811074",
|
|
53233
|
+
// "isolatedMaxAvailable": "19.88811074",
|
|
53234
|
+
// "maxTransferOut": "19.88811074",
|
|
53235
|
+
// "accountEquity": "19.88811074",
|
|
53236
|
+
// "usdtEquity": "19.888110749166",
|
|
53237
|
+
// "btcEquity": "0.000302183391",
|
|
53238
|
+
// "crossedRiskRate": "0",
|
|
53239
|
+
// "crossedMarginLeverage": 20,
|
|
53240
|
+
// "isolatedLongLever": 20,
|
|
53241
|
+
// "isolatedShortLever": 20,
|
|
53242
|
+
// "marginMode": "crossed",
|
|
53243
|
+
// "posMode": "hedge_mode",
|
|
53244
|
+
// "unrealizedPL": "0",
|
|
53245
|
+
// "coupon": "0",
|
|
53246
|
+
// "crossedUnrealizedPL": "0",
|
|
53247
|
+
// "isolatedUnrealizedPL": ""
|
|
53248
|
+
// }
|
|
53249
|
+
// }
|
|
53250
|
+
//
|
|
53251
|
+
const data = this.safeDict(response, 'data', {});
|
|
53252
|
+
return this.parseMarginMode(data, market);
|
|
53253
|
+
}
|
|
53254
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
53255
|
+
let marginType = this.safeString(marginMode, 'marginMode');
|
|
53256
|
+
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
53257
|
+
return {
|
|
53258
|
+
'info': marginMode,
|
|
53259
|
+
'symbol': market['symbol'],
|
|
53260
|
+
'marginMode': marginType,
|
|
53261
|
+
};
|
|
53262
|
+
}
|
|
53153
53263
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
53154
53264
|
if (!response) {
|
|
53155
53265
|
return undefined; // fallback to default error handler
|
|
@@ -61433,7 +61543,9 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61433
61543
|
if (until !== undefined) {
|
|
61434
61544
|
request['endTime'] = this.iso8601(until);
|
|
61435
61545
|
}
|
|
61436
|
-
|
|
61546
|
+
if ((since === undefined) && (until === undefined)) {
|
|
61547
|
+
request['reverse'] = true;
|
|
61548
|
+
}
|
|
61437
61549
|
const response = await this.publicGetFunding(this.extend(request, params));
|
|
61438
61550
|
//
|
|
61439
61551
|
// [
|
|
@@ -77038,6 +77150,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77038
77150
|
'fetchLeverage': true,
|
|
77039
77151
|
'fetchLeverages': true,
|
|
77040
77152
|
'fetchLeverageTiers': false,
|
|
77153
|
+
'fetchMarginMode': true,
|
|
77154
|
+
'fetchMarginModes': false,
|
|
77041
77155
|
'fetchMarketLeverageTiers': false,
|
|
77042
77156
|
'fetchMarkets': true,
|
|
77043
77157
|
'fetchMarkOHLCV': false,
|
|
@@ -77141,6 +77255,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77141
77255
|
'account/balance': 1,
|
|
77142
77256
|
'account/positions': 1,
|
|
77143
77257
|
'account/leverage-info': 1,
|
|
77258
|
+
'account/margin-mode': 1,
|
|
77144
77259
|
'account/batch-leverage-info': 1,
|
|
77145
77260
|
'trade/orders-tpsl-pending': 1,
|
|
77146
77261
|
'trade/orders-history': 1,
|
|
@@ -77334,7 +77449,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77334
77449
|
const strikePrice = undefined;
|
|
77335
77450
|
const optionType = undefined;
|
|
77336
77451
|
const tickSize = this.safeString(market, 'tickSize');
|
|
77337
|
-
const fees = this.
|
|
77452
|
+
const fees = this.safeDict2(this.fees, type, 'trading', {});
|
|
77338
77453
|
const taker = this.safeNumber(fees, 'taker');
|
|
77339
77454
|
const maker = this.safeNumber(fees, 'maker');
|
|
77340
77455
|
let maxLeverage = this.safeString(market, 'maxLeverage', '100');
|
|
@@ -77435,7 +77550,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77435
77550
|
// }
|
|
77436
77551
|
//
|
|
77437
77552
|
const data = this.safeList(response, 'data', []);
|
|
77438
|
-
const first = this.
|
|
77553
|
+
const first = this.safeDict(data, 0, {});
|
|
77439
77554
|
const timestamp = this.safeInteger(first, 'ts');
|
|
77440
77555
|
return this.parseOrderBook(first, symbol, timestamp);
|
|
77441
77556
|
}
|
|
@@ -77491,7 +77606,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77491
77606
|
};
|
|
77492
77607
|
const response = await this.publicGetMarketTickers(this.extend(request, params));
|
|
77493
77608
|
const data = this.safeList(response, 'data', []);
|
|
77494
|
-
const first = this.
|
|
77609
|
+
const first = this.safeDict(data, 0, {});
|
|
77495
77610
|
return this.parseTicker(first, market);
|
|
77496
77611
|
}
|
|
77497
77612
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
@@ -77951,8 +78066,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77951
78066
|
if (postOnly) {
|
|
77952
78067
|
request['type'] = 'post_only';
|
|
77953
78068
|
}
|
|
77954
|
-
const stopLoss = this.
|
|
77955
|
-
const takeProfit = this.
|
|
78069
|
+
const stopLoss = this.safeDict(params, 'stopLoss');
|
|
78070
|
+
const takeProfit = this.safeDict(params, 'takeProfit');
|
|
77956
78071
|
params = this.omit(params, ['stopLoss', 'takeProfit']);
|
|
77957
78072
|
const isStopLoss = stopLoss !== undefined;
|
|
77958
78073
|
const isTakeProfit = takeProfit !== undefined;
|
|
@@ -78245,7 +78360,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78245
78360
|
const side = this.safeString(rawOrder, 'side');
|
|
78246
78361
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
78247
78362
|
const price = this.safeValue(rawOrder, 'price');
|
|
78248
|
-
const orderParams = this.
|
|
78363
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
78249
78364
|
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
78365
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
|
|
78251
78366
|
ordersRequests.push(orderRequest);
|
|
@@ -78284,7 +78399,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78284
78399
|
if (limit !== undefined) {
|
|
78285
78400
|
request['limit'] = limit; // default 100, max 100
|
|
78286
78401
|
}
|
|
78287
|
-
const isStop = this.
|
|
78402
|
+
const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
|
|
78288
78403
|
let method = undefined;
|
|
78289
78404
|
[method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersPending');
|
|
78290
78405
|
const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);
|
|
@@ -78612,7 +78727,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78612
78727
|
await this.loadMarkets();
|
|
78613
78728
|
const market = this.market(symbol);
|
|
78614
78729
|
const request = [];
|
|
78615
|
-
const options = this.
|
|
78730
|
+
const options = this.safeDict(this.options, 'cancelOrders', {});
|
|
78616
78731
|
const defaultMethod = this.safeString(options, 'method', 'privatePostTradeCancelBatchOrders');
|
|
78617
78732
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
78618
78733
|
const clientOrderIds = this.parseIds(this.safeValue(params, 'clientOrderId'));
|
|
@@ -78679,7 +78794,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78679
78794
|
*/
|
|
78680
78795
|
await this.loadMarkets();
|
|
78681
78796
|
const currency = this.currency(code);
|
|
78682
|
-
const accountsByType = this.
|
|
78797
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
78683
78798
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
78684
78799
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
78685
78800
|
const request = {
|
|
@@ -79012,7 +79127,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79012
79127
|
request['clientOrderId'] = clientOrderId;
|
|
79013
79128
|
}
|
|
79014
79129
|
const response = await this.privatePostTradeClosePosition(this.extend(request, params));
|
|
79015
|
-
return this.
|
|
79130
|
+
return this.safeDict(response, 'data');
|
|
79016
79131
|
}
|
|
79017
79132
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
79018
79133
|
/**
|
|
@@ -79047,7 +79162,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79047
79162
|
if (since !== undefined) {
|
|
79048
79163
|
request['begin'] = since;
|
|
79049
79164
|
}
|
|
79050
|
-
const isStop = this.
|
|
79165
|
+
const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
|
|
79051
79166
|
let method = undefined;
|
|
79052
79167
|
[method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersHistory');
|
|
79053
79168
|
const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);
|
|
@@ -79061,6 +79176,38 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79061
79176
|
const data = this.safeList(response, 'data', []);
|
|
79062
79177
|
return this.parseOrders(data, market, since, limit);
|
|
79063
79178
|
}
|
|
79179
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
79180
|
+
/**
|
|
79181
|
+
* @method
|
|
79182
|
+
* @name blofin#fetchMarginMode
|
|
79183
|
+
* @description fetches the margin mode of a trading pair
|
|
79184
|
+
* @see https://docs.blofin.com/index.html#get-margin-mode
|
|
79185
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
79186
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
79187
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
79188
|
+
*/
|
|
79189
|
+
await this.loadMarkets();
|
|
79190
|
+
const market = this.market(symbol);
|
|
79191
|
+
const response = await this.privateGetAccountMarginMode(params);
|
|
79192
|
+
//
|
|
79193
|
+
// {
|
|
79194
|
+
// "code": "0",
|
|
79195
|
+
// "msg": "success",
|
|
79196
|
+
// "data": {
|
|
79197
|
+
// "marginMode": "cross"
|
|
79198
|
+
// }
|
|
79199
|
+
// }
|
|
79200
|
+
//
|
|
79201
|
+
const data = this.safeDict(response, 'data', {});
|
|
79202
|
+
return this.parseMarginMode(data, market);
|
|
79203
|
+
}
|
|
79204
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
79205
|
+
return {
|
|
79206
|
+
'info': marginMode,
|
|
79207
|
+
'symbol': market['symbol'],
|
|
79208
|
+
'marginMode': this.safeString(marginMode, 'marginMode'),
|
|
79209
|
+
};
|
|
79210
|
+
}
|
|
79064
79211
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
79065
79212
|
if (response === undefined) {
|
|
79066
79213
|
return undefined; // fallback to default error handler
|
|
@@ -81601,6 +81748,18 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
81601
81748
|
return await this.privateDeleteOrdersId(this.extend(request, params));
|
|
81602
81749
|
}
|
|
81603
81750
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
81751
|
+
/**
|
|
81752
|
+
* @method
|
|
81753
|
+
* @description calculates the presumptive fee that would be charged for an order
|
|
81754
|
+
* @param {string} symbol unified market symbol
|
|
81755
|
+
* @param {string} type not used by btcmarkets.calculateFee
|
|
81756
|
+
* @param {string} side not used by btcmarkets.calculateFee
|
|
81757
|
+
* @param {float} amount how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
|
81758
|
+
* @param {float} price the price for the order to be filled at, in units of the quote currency
|
|
81759
|
+
* @param {string} takerOrMaker 'taker' or 'maker'
|
|
81760
|
+
* @param {object} params
|
|
81761
|
+
* @returns {object} contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
|
81762
|
+
*/
|
|
81604
81763
|
const market = this.markets[symbol];
|
|
81605
81764
|
let currency = undefined;
|
|
81606
81765
|
let cost = undefined;
|
|
@@ -86696,8 +86855,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
86696
86855
|
const market = this.market(symbols[0]);
|
|
86697
86856
|
let category = undefined;
|
|
86698
86857
|
[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
|
|
86858
|
+
if (category === 'inverse') {
|
|
86859
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrders does not allow inverse orders');
|
|
86701
86860
|
}
|
|
86702
86861
|
const request = {
|
|
86703
86862
|
'category': category,
|
|
@@ -87177,6 +87336,87 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
87177
87336
|
const result = this.safeValue(response, 'result', {});
|
|
87178
87337
|
return this.parseOrder(result, market);
|
|
87179
87338
|
}
|
|
87339
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
87340
|
+
/**
|
|
87341
|
+
* @method
|
|
87342
|
+
* @name bybit#cancelOrders
|
|
87343
|
+
* @description cancel multiple orders
|
|
87344
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/batch-cancel
|
|
87345
|
+
* @param {string[]} ids order ids
|
|
87346
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
87347
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
87348
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
87349
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
87350
|
+
*/
|
|
87351
|
+
if (symbol === undefined) {
|
|
87352
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
87353
|
+
}
|
|
87354
|
+
await this.loadMarkets();
|
|
87355
|
+
const market = this.market(symbol);
|
|
87356
|
+
let category = undefined;
|
|
87357
|
+
[category, params] = this.getBybitType('cancelOrders', market, params);
|
|
87358
|
+
if (category === 'inverse') {
|
|
87359
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelOrders does not allow inverse orders');
|
|
87360
|
+
}
|
|
87361
|
+
const ordersRequests = [];
|
|
87362
|
+
const clientOrderIds = this.safeList2(params, 'clientOrderIds', 'clientOids', []);
|
|
87363
|
+
params = this.omit(params, ['clientOrderIds', 'clientOids']);
|
|
87364
|
+
for (let i = 0; i < clientOrderIds.length; i++) {
|
|
87365
|
+
ordersRequests.push({
|
|
87366
|
+
'symbol': market['id'],
|
|
87367
|
+
'orderLinkId': this.safeString(clientOrderIds, i),
|
|
87368
|
+
});
|
|
87369
|
+
}
|
|
87370
|
+
for (let i = 0; i < ids.length; i++) {
|
|
87371
|
+
ordersRequests.push({
|
|
87372
|
+
'symbol': market['id'],
|
|
87373
|
+
'orderId': this.safeString(ids, i),
|
|
87374
|
+
});
|
|
87375
|
+
}
|
|
87376
|
+
const request = {
|
|
87377
|
+
'category': category,
|
|
87378
|
+
'request': ordersRequests,
|
|
87379
|
+
};
|
|
87380
|
+
const response = await this.privatePostV5OrderCancelBatch(this.extend(request, params));
|
|
87381
|
+
//
|
|
87382
|
+
// {
|
|
87383
|
+
// "retCode": "0",
|
|
87384
|
+
// "retMsg": "OK",
|
|
87385
|
+
// "result": {
|
|
87386
|
+
// "list": [
|
|
87387
|
+
// {
|
|
87388
|
+
// "category": "spot",
|
|
87389
|
+
// "symbol": "BTCUSDT",
|
|
87390
|
+
// "orderId": "1636282505818800896",
|
|
87391
|
+
// "orderLinkId": "1636282505818800897"
|
|
87392
|
+
// },
|
|
87393
|
+
// {
|
|
87394
|
+
// "category": "spot",
|
|
87395
|
+
// "symbol": "BTCUSDT",
|
|
87396
|
+
// "orderId": "1636282505818800898",
|
|
87397
|
+
// "orderLinkId": "1636282505818800899"
|
|
87398
|
+
// }
|
|
87399
|
+
// ]
|
|
87400
|
+
// },
|
|
87401
|
+
// "retExtInfo": {
|
|
87402
|
+
// "list": [
|
|
87403
|
+
// {
|
|
87404
|
+
// "code": "0",
|
|
87405
|
+
// "msg": "OK"
|
|
87406
|
+
// },
|
|
87407
|
+
// {
|
|
87408
|
+
// "code": "0",
|
|
87409
|
+
// "msg": "OK"
|
|
87410
|
+
// }
|
|
87411
|
+
// ]
|
|
87412
|
+
// },
|
|
87413
|
+
// "time": "1709796158501"
|
|
87414
|
+
// }
|
|
87415
|
+
//
|
|
87416
|
+
const result = this.safeDict(response, 'result', {});
|
|
87417
|
+
const row = this.safeList(result, 'list', []);
|
|
87418
|
+
return this.parseOrders(row, market);
|
|
87419
|
+
}
|
|
87180
87420
|
async cancelAllUsdcOrders(symbol = undefined, params = {}) {
|
|
87181
87421
|
if (symbol === undefined) {
|
|
87182
87422
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelAllUsdcOrders() requires a symbol argument');
|
|
@@ -90139,7 +90379,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90139
90379
|
// }
|
|
90140
90380
|
//
|
|
90141
90381
|
const marketId = this.safeString(fee, 'symbol');
|
|
90142
|
-
const
|
|
90382
|
+
const defaultType = (market !== undefined) ? market['type'] : 'contract';
|
|
90383
|
+
const symbol = this.safeSymbol(marketId, market, undefined, defaultType);
|
|
90143
90384
|
return {
|
|
90144
90385
|
'info': fee,
|
|
90145
90386
|
'symbol': symbol,
|
|
@@ -90159,12 +90400,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90159
90400
|
*/
|
|
90160
90401
|
await this.loadMarkets();
|
|
90161
90402
|
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
90403
|
const request = {
|
|
90166
90404
|
'symbol': market['id'],
|
|
90167
90405
|
};
|
|
90406
|
+
let category = undefined;
|
|
90407
|
+
if (market['linear']) {
|
|
90408
|
+
category = 'linear';
|
|
90409
|
+
}
|
|
90410
|
+
else if (market['inverse']) {
|
|
90411
|
+
category = 'inverse';
|
|
90412
|
+
}
|
|
90413
|
+
else if (market['spot']) {
|
|
90414
|
+
category = 'spot';
|
|
90415
|
+
}
|
|
90416
|
+
else {
|
|
90417
|
+
category = 'option';
|
|
90418
|
+
}
|
|
90419
|
+
request['category'] = category;
|
|
90168
90420
|
const response = await this.privateGetV5AccountFeeRate(this.extend(request, params));
|
|
90169
90421
|
//
|
|
90170
90422
|
// {
|
|
@@ -90186,7 +90438,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
90186
90438
|
const result = this.safeValue(response, 'result', {});
|
|
90187
90439
|
const fees = this.safeValue(result, 'list', []);
|
|
90188
90440
|
const first = this.safeValue(fees, 0, {});
|
|
90189
|
-
return this.parseTradingFee(first);
|
|
90441
|
+
return this.parseTradingFee(first, market);
|
|
90190
90442
|
}
|
|
90191
90443
|
async fetchTradingFees(params = {}) {
|
|
90192
90444
|
/**
|
|
@@ -96416,7 +96668,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96416
96668
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
96417
96669
|
const version = api[0];
|
|
96418
96670
|
const signed = api[1] === 'private';
|
|
96419
|
-
const
|
|
96671
|
+
const isV3 = version === 'v3';
|
|
96672
|
+
const pathPart = (isV3) ? 'api/v3' : 'v2';
|
|
96420
96673
|
let fullPath = '/' + pathPart + '/' + this.implodeParams(path, params);
|
|
96421
96674
|
const query = this.omit(params, this.extractParams(path));
|
|
96422
96675
|
const savedPath = fullPath;
|
|
@@ -96460,8 +96713,17 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96460
96713
|
payload = body;
|
|
96461
96714
|
}
|
|
96462
96715
|
}
|
|
96463
|
-
|
|
96716
|
+
else {
|
|
96717
|
+
if (!isV3) {
|
|
96718
|
+
if (Object.keys(query).length) {
|
|
96719
|
+
payload += '?' + this.urlencode(query);
|
|
96720
|
+
}
|
|
96721
|
+
}
|
|
96722
|
+
}
|
|
96723
|
+
// v3: 'GET' doesn't need payload in the signature. inside url is enough
|
|
96464
96724
|
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
96725
|
+
// v2: 'GET' require payload in the signature
|
|
96726
|
+
// https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
|
96465
96727
|
const auth = timestampString + method + savedPath + payload;
|
|
96466
96728
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
96467
96729
|
headers = {
|
|
@@ -119058,7 +119320,8 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
119058
119320
|
'fetchLedger': true,
|
|
119059
119321
|
'fetchLeverage': true,
|
|
119060
119322
|
'fetchLeverageTiers': false,
|
|
119061
|
-
'fetchMarginMode':
|
|
119323
|
+
'fetchMarginMode': true,
|
|
119324
|
+
'fetchMarginModes': false,
|
|
119062
119325
|
'fetchMarketLeverageTiers': false,
|
|
119063
119326
|
'fetchMarkets': true,
|
|
119064
119327
|
'fetchMarkOHLCV': true,
|
|
@@ -122208,6 +122471,99 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
122208
122471
|
const position = this.parsePosition(this.safeValue(response, 'result', {}));
|
|
122209
122472
|
return [position];
|
|
122210
122473
|
}
|
|
122474
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
122475
|
+
/**
|
|
122476
|
+
* @method
|
|
122477
|
+
* @name delta#fetchMarginMode
|
|
122478
|
+
* @description fetches the margin mode of a trading pair
|
|
122479
|
+
* @see https://docs.delta.exchange/#get-user
|
|
122480
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
122481
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
122482
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
122483
|
+
*/
|
|
122484
|
+
await this.loadMarkets();
|
|
122485
|
+
let market = undefined;
|
|
122486
|
+
if (symbol !== undefined) {
|
|
122487
|
+
market = this.market(symbol);
|
|
122488
|
+
}
|
|
122489
|
+
const response = await this.privateGetProfile(params);
|
|
122490
|
+
//
|
|
122491
|
+
// {
|
|
122492
|
+
// "result": {
|
|
122493
|
+
// "is_password_set": true,
|
|
122494
|
+
// "kyc_expiry_date": null,
|
|
122495
|
+
// "phishing_code": "12345",
|
|
122496
|
+
// "preferences": {
|
|
122497
|
+
// "favorites": []
|
|
122498
|
+
// },
|
|
122499
|
+
// "is_kyc_provisioned": false,
|
|
122500
|
+
// "country": "Canada",
|
|
122501
|
+
// "margin_mode": "isolated",
|
|
122502
|
+
// "mfa_updated_at": "2023-07-19T01:04:43Z",
|
|
122503
|
+
// "last_name": "",
|
|
122504
|
+
// "oauth_apple_active": false,
|
|
122505
|
+
// "pf_index_symbol": null,
|
|
122506
|
+
// "proof_of_identity_status": "approved",
|
|
122507
|
+
// "dob": null,
|
|
122508
|
+
// "email": "abc_123@gmail.com",
|
|
122509
|
+
// "force_change_password": false,
|
|
122510
|
+
// "nick_name": "still-breeze-123",
|
|
122511
|
+
// "oauth_google_active": false,
|
|
122512
|
+
// "phone_verification_status": "verified",
|
|
122513
|
+
// "id": 12345678,
|
|
122514
|
+
// "last_seen": null,
|
|
122515
|
+
// "is_withdrawal_enabled": true,
|
|
122516
|
+
// "force_change_mfa": false,
|
|
122517
|
+
// "enable_bots": false,
|
|
122518
|
+
// "kyc_verified_on": null,
|
|
122519
|
+
// "created_at": "2023-07-19T01:02:32Z",
|
|
122520
|
+
// "withdrawal_blocked_till": null,
|
|
122521
|
+
// "proof_of_address_status": "approved",
|
|
122522
|
+
// "is_password_change_blocked": false,
|
|
122523
|
+
// "is_mfa_enabled": true,
|
|
122524
|
+
// "is_kyc_done": true,
|
|
122525
|
+
// "oauth": null,
|
|
122526
|
+
// "account_name": "Main",
|
|
122527
|
+
// "sub_account_permissions": null,
|
|
122528
|
+
// "phone_number": null,
|
|
122529
|
+
// "tracking_info": {
|
|
122530
|
+
// "ga_cid": "1234.4321",
|
|
122531
|
+
// "is_kyc_gtm_tracked": true,
|
|
122532
|
+
// "sub_account_config": {
|
|
122533
|
+
// "cross": 2,
|
|
122534
|
+
// "isolated": 2,
|
|
122535
|
+
// "portfolio": 2
|
|
122536
|
+
// }
|
|
122537
|
+
// },
|
|
122538
|
+
// "first_name": "",
|
|
122539
|
+
// "phone_verified_on": null,
|
|
122540
|
+
// "seen_intro": false,
|
|
122541
|
+
// "password_updated_at": null,
|
|
122542
|
+
// "is_login_enabled": true,
|
|
122543
|
+
// "registration_date": "2023-07-19T01:02:32Z",
|
|
122544
|
+
// "permissions": {},
|
|
122545
|
+
// "max_sub_accounts_limit": 2,
|
|
122546
|
+
// "country_calling_code": null,
|
|
122547
|
+
// "is_sub_account": false,
|
|
122548
|
+
// "is_kyc_refresh_required": false
|
|
122549
|
+
// },
|
|
122550
|
+
// "success": true
|
|
122551
|
+
// }
|
|
122552
|
+
//
|
|
122553
|
+
const result = this.safeDict(response, 'result', {});
|
|
122554
|
+
return this.parseMarginMode(result, market);
|
|
122555
|
+
}
|
|
122556
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
122557
|
+
let symbol = undefined;
|
|
122558
|
+
if (market !== undefined) {
|
|
122559
|
+
symbol = market['symbol'];
|
|
122560
|
+
}
|
|
122561
|
+
return {
|
|
122562
|
+
'info': marginMode,
|
|
122563
|
+
'symbol': symbol,
|
|
122564
|
+
'marginMode': this.safeString(marginMode, 'margin_mode'),
|
|
122565
|
+
};
|
|
122566
|
+
}
|
|
122211
122567
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
122212
122568
|
const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
122213
122569
|
let url = this.urls['api'][api] + requestPath;
|
|
@@ -140196,12 +140552,12 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140196
140552
|
'webApiEnable': true,
|
|
140197
140553
|
'webApiRetries': 10,
|
|
140198
140554
|
},
|
|
140555
|
+
'fetchUsdtMarkets': ['btcusdt', 'ethusdt'],
|
|
140199
140556
|
'fetchCurrencies': {
|
|
140200
140557
|
'webApiEnable': true,
|
|
140201
140558
|
'webApiRetries': 5,
|
|
140202
140559
|
'webApiMuteFailure': true,
|
|
140203
140560
|
},
|
|
140204
|
-
'fetchUsdtMarkets': ['btcusdt', 'ethusdt'],
|
|
140205
140561
|
'fetchTickerMethod': 'fetchTickerV1',
|
|
140206
140562
|
'networks': {
|
|
140207
140563
|
'BTC': 'bitcoin',
|
|
@@ -140340,9 +140696,11 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140340
140696
|
*/
|
|
140341
140697
|
const method = this.safeValue(this.options, 'fetchMarketsMethod', 'fetch_markets_from_api');
|
|
140342
140698
|
if (method === 'fetch_markets_from_web') {
|
|
140343
|
-
const
|
|
140344
|
-
|
|
140345
|
-
|
|
140699
|
+
const promises = [];
|
|
140700
|
+
promises.push(this.fetchMarketsFromWeb(params)); // get usd markets
|
|
140701
|
+
promises.push(this.fetchUSDTMarkets(params)); // get usdt markets
|
|
140702
|
+
const promisesResult = await Promise.all(promises);
|
|
140703
|
+
return this.arrayConcat(promisesResult[0], promisesResult[1]);
|
|
140346
140704
|
}
|
|
140347
140705
|
return await this.fetchMarketsFromAPI(params);
|
|
140348
140706
|
}
|
|
@@ -140450,6 +140808,9 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
140450
140808
|
'post_only': true,
|
|
140451
140809
|
'limit_only': true,
|
|
140452
140810
|
};
|
|
140811
|
+
if (status === undefined) {
|
|
140812
|
+
return true; // as defaulted below
|
|
140813
|
+
}
|
|
140453
140814
|
return this.safeBool(statuses, status, true);
|
|
140454
140815
|
}
|
|
140455
140816
|
async fetchUSDTMarkets(params = {}) {
|
|
@@ -144280,7 +144641,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
144280
144641
|
* @see https://api.hitbtc.com/#get-futures-position-parameters
|
|
144281
144642
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
144282
144643
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
144283
|
-
* @returns {object}
|
|
144644
|
+
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
144284
144645
|
*/
|
|
144285
144646
|
await this.loadMarkets();
|
|
144286
144647
|
let market = undefined;
|
|
@@ -167668,6 +168029,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
167668
168029
|
'executions',
|
|
167669
168030
|
'triggers',
|
|
167670
168031
|
'accountlogcsv',
|
|
168032
|
+
'account-log',
|
|
167671
168033
|
'market/{symbol}/orders',
|
|
167672
168034
|
'market/{symbol}/executions',
|
|
167673
168035
|
],
|
|
@@ -170242,6 +170604,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170242
170604
|
'futuresPrivate': 'https://api-futures.kucoin.com',
|
|
170243
170605
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
|
170244
170606
|
'webExchange': 'https://kucoin.com/_api',
|
|
170607
|
+
'broker': 'https://api-broker.kucoin.com',
|
|
170245
170608
|
},
|
|
170246
170609
|
'www': 'https://www.kucoin.com',
|
|
170247
170610
|
'doc': [
|
|
@@ -170354,7 +170717,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170354
170717
|
'project/list': 10,
|
|
170355
170718
|
'project/marketInterestRate': 7.5,
|
|
170356
170719
|
'redeem/orders': 10,
|
|
170357
|
-
'purchase/orders': 10,
|
|
170720
|
+
'purchase/orders': 10,
|
|
170721
|
+
// broker
|
|
170722
|
+
'broker/api/rebase/download': 3,
|
|
170358
170723
|
},
|
|
170359
170724
|
'post': {
|
|
170360
170725
|
// account
|
|
@@ -170500,6 +170865,23 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170500
170865
|
'currency/currency/chain-info': 1, // this is temporary from webApi
|
|
170501
170866
|
},
|
|
170502
170867
|
},
|
|
170868
|
+
'broker': {
|
|
170869
|
+
'get': {
|
|
170870
|
+
'broker/nd/info': 2,
|
|
170871
|
+
'broker/nd/account': 2,
|
|
170872
|
+
'broker/nd/account/apikey': 2,
|
|
170873
|
+
'broker/nd/rebase/download': 3,
|
|
170874
|
+
},
|
|
170875
|
+
'post': {
|
|
170876
|
+
'broker/nd/transfer': 1,
|
|
170877
|
+
'broker/nd/account': 3,
|
|
170878
|
+
'broker/nd/account/apikey': 3,
|
|
170879
|
+
'broker/nd/account/update-apikey': 3,
|
|
170880
|
+
},
|
|
170881
|
+
'delete': {
|
|
170882
|
+
'broker/nd/account/apikey': 3,
|
|
170883
|
+
},
|
|
170884
|
+
},
|
|
170503
170885
|
},
|
|
170504
170886
|
'timeframes': {
|
|
170505
170887
|
'1m': '1min',
|
|
@@ -171017,7 +171399,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171017
171399
|
// }
|
|
171018
171400
|
// }
|
|
171019
171401
|
//
|
|
171020
|
-
const data = this.
|
|
171402
|
+
const data = this.safeDict(response, 'data', {});
|
|
171021
171403
|
const status = this.safeString(data, 'status');
|
|
171022
171404
|
return {
|
|
171023
171405
|
'status': (status === 'open') ? 'ok' : 'maintenance',
|
|
@@ -171063,8 +171445,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171063
171445
|
// ]
|
|
171064
171446
|
// }
|
|
171065
171447
|
//
|
|
171066
|
-
const data = this.
|
|
171067
|
-
const options = this.
|
|
171448
|
+
const data = this.safeList(response, 'data');
|
|
171449
|
+
const options = this.safeDict(this.options, 'fetchMarkets', {});
|
|
171068
171450
|
const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
|
|
171069
171451
|
let tickersResponse = {};
|
|
171070
171452
|
if (fetchTickersFees) {
|
|
@@ -171098,8 +171480,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171098
171480
|
// }
|
|
171099
171481
|
// }
|
|
171100
171482
|
//
|
|
171101
|
-
const tickersData = this.
|
|
171102
|
-
const tickers = this.
|
|
171483
|
+
const tickersData = this.safeDict(tickersResponse, 'data', {});
|
|
171484
|
+
const tickers = this.safeList(tickersData, 'ticker', []);
|
|
171103
171485
|
const tickersByMarketId = this.indexBy(tickers, 'symbol');
|
|
171104
171486
|
const result = [];
|
|
171105
171487
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -171109,7 +171491,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171109
171491
|
const base = this.safeCurrencyCode(baseId);
|
|
171110
171492
|
const quote = this.safeCurrencyCode(quoteId);
|
|
171111
171493
|
// const quoteIncrement = this.safeNumber (market, 'quoteIncrement');
|
|
171112
|
-
const ticker = this.
|
|
171494
|
+
const ticker = this.safeDict(tickersByMarketId, id, {});
|
|
171113
171495
|
const makerFeeRate = this.safeString(ticker, 'makerFeeRate');
|
|
171114
171496
|
const takerFeeRate = this.safeString(ticker, 'takerFeeRate');
|
|
171115
171497
|
const makerCoefficient = this.safeString(ticker, 'makerCoefficient');
|
|
@@ -171125,11 +171507,11 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171125
171507
|
'settleId': undefined,
|
|
171126
171508
|
'type': 'spot',
|
|
171127
171509
|
'spot': true,
|
|
171128
|
-
'margin': this.
|
|
171510
|
+
'margin': this.safeBool(market, 'isMarginEnabled'),
|
|
171129
171511
|
'swap': false,
|
|
171130
171512
|
'future': false,
|
|
171131
171513
|
'option': false,
|
|
171132
|
-
'active': this.
|
|
171514
|
+
'active': this.safeBool(market, 'enableTrading'),
|
|
171133
171515
|
'contract': false,
|
|
171134
171516
|
'linear': undefined,
|
|
171135
171517
|
'inverse': undefined,
|
|
@@ -171259,7 +171641,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171259
171641
|
let isWithdrawEnabled = undefined;
|
|
171260
171642
|
let isDepositEnabled = undefined;
|
|
171261
171643
|
const networks = {};
|
|
171262
|
-
const chains = this.
|
|
171644
|
+
const chains = this.safeList(entry, 'chains', []);
|
|
171263
171645
|
const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
|
|
171264
171646
|
const rawPrecision = this.safeString(entry, 'precision');
|
|
171265
171647
|
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
@@ -171287,7 +171669,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171287
171669
|
else {
|
|
171288
171670
|
isDepositEnabled = isDepositEnabled || chainDepositEnabled;
|
|
171289
171671
|
}
|
|
171290
|
-
const chainExtraData = this.
|
|
171672
|
+
const chainExtraData = this.safeDict(extraChainsData, chainId, {});
|
|
171291
171673
|
networks[networkCode] = {
|
|
171292
171674
|
'info': chain,
|
|
171293
171675
|
'id': chainId,
|
|
@@ -171362,7 +171744,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171362
171744
|
// ]
|
|
171363
171745
|
// }
|
|
171364
171746
|
//
|
|
171365
|
-
const data = this.
|
|
171747
|
+
const data = this.safeList(response, 'data', []);
|
|
171366
171748
|
const result = [];
|
|
171367
171749
|
for (let i = 0; i < data.length; i++) {
|
|
171368
171750
|
const account = data[i];
|
|
@@ -171450,7 +171832,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171450
171832
|
// }
|
|
171451
171833
|
// }
|
|
171452
171834
|
//
|
|
171453
|
-
const data = this.
|
|
171835
|
+
const data = this.safeDict(response, 'data');
|
|
171454
171836
|
return this.parseDepositWithdrawFee(data, currency);
|
|
171455
171837
|
}
|
|
171456
171838
|
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
@@ -171481,7 +171863,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171481
171863
|
},
|
|
171482
171864
|
'networks': {},
|
|
171483
171865
|
};
|
|
171484
|
-
const isWithdrawEnabled = this.
|
|
171866
|
+
const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
|
|
171485
171867
|
if (isWithdrawEnabled) {
|
|
171486
171868
|
result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
|
|
171487
171869
|
result['withdraw']['percentage'] = false;
|
|
@@ -171508,7 +171890,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171508
171890
|
//
|
|
171509
171891
|
const defaultType = this.safeString2(this.options, methodName, 'defaultType', 'trade');
|
|
171510
171892
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
171511
|
-
const accountsByType = this.
|
|
171893
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
171512
171894
|
const type = this.safeString(accountsByType, requestedType);
|
|
171513
171895
|
if (type === undefined) {
|
|
171514
171896
|
const keys = Object.keys(accountsByType);
|
|
@@ -171649,8 +172031,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171649
172031
|
// }
|
|
171650
172032
|
// }
|
|
171651
172033
|
//
|
|
171652
|
-
const data = this.
|
|
171653
|
-
const tickers = this.
|
|
172034
|
+
const data = this.safeDict(response, 'data', {});
|
|
172035
|
+
const tickers = this.safeList(data, 'ticker', []);
|
|
171654
172036
|
const time = this.safeInteger(data, 'time');
|
|
171655
172037
|
const result = {};
|
|
171656
172038
|
for (let i = 0; i < tickers.length; i++) {
|
|
@@ -171780,7 +172162,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171780
172162
|
// ]
|
|
171781
172163
|
// }
|
|
171782
172164
|
//
|
|
171783
|
-
const data = this.
|
|
172165
|
+
const data = this.safeList(response, 'data', []);
|
|
171784
172166
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
171785
172167
|
}
|
|
171786
172168
|
async createDepositAddress(code, params = {}) {
|
|
@@ -171808,7 +172190,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171808
172190
|
// {"code":"260000","msg":"Deposit address already exists."}
|
|
171809
172191
|
// BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
|
171810
172192
|
// BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
|
171811
|
-
const data = this.
|
|
172193
|
+
const data = this.safeDict(response, 'data', {});
|
|
171812
172194
|
return this.parseDepositAddress(data, currency);
|
|
171813
172195
|
}
|
|
171814
172196
|
async fetchDepositAddress(code, params = {}) {
|
|
@@ -171903,7 +172285,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171903
172285
|
// }
|
|
171904
172286
|
//
|
|
171905
172287
|
this.options['versions']['private']['GET']['deposit-addresses'] = version;
|
|
171906
|
-
const chains = this.
|
|
172288
|
+
const chains = this.safeList(response, 'data', []);
|
|
171907
172289
|
const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
|
|
171908
172290
|
'currency': currency['id'],
|
|
171909
172291
|
});
|
|
@@ -171976,7 +172358,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171976
172358
|
// ]
|
|
171977
172359
|
// }
|
|
171978
172360
|
//
|
|
171979
|
-
const data = this.
|
|
172361
|
+
const data = this.safeDict(response, 'data', {});
|
|
171980
172362
|
const timestamp = this.safeInteger(data, 'time');
|
|
171981
172363
|
const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1);
|
|
171982
172364
|
orderbook['nonce'] = this.safeInteger(data, 'sequence');
|
|
@@ -172078,7 +172460,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172078
172460
|
// }
|
|
172079
172461
|
// }
|
|
172080
172462
|
//
|
|
172081
|
-
const data = this.
|
|
172463
|
+
const data = this.safeDict(response, 'data', {});
|
|
172082
172464
|
return this.parseOrder(data, market);
|
|
172083
172465
|
}
|
|
172084
172466
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
@@ -172206,8 +172588,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172206
172588
|
// },
|
|
172207
172589
|
// }
|
|
172208
172590
|
//
|
|
172209
|
-
let data = this.
|
|
172210
|
-
data = this.
|
|
172591
|
+
let data = this.safeDict(response, 'data', {});
|
|
172592
|
+
data = this.safeList(data, 'data', []);
|
|
172211
172593
|
return this.parseOrders(data);
|
|
172212
172594
|
}
|
|
172213
172595
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -172324,7 +172706,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172324
172706
|
// }
|
|
172325
172707
|
// }
|
|
172326
172708
|
//
|
|
172327
|
-
const data = this.
|
|
172709
|
+
const data = this.safeDict(response, 'data', {});
|
|
172328
172710
|
return this.parseOrder(data, market);
|
|
172329
172711
|
}
|
|
172330
172712
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -172348,7 +172730,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172348
172730
|
await this.loadMarkets();
|
|
172349
172731
|
const request = {};
|
|
172350
172732
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
172351
|
-
const stop = this.
|
|
172733
|
+
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
172352
172734
|
const hf = this.safeBool(params, 'hf', false);
|
|
172353
172735
|
if (hf) {
|
|
172354
172736
|
if (symbol === undefined) {
|
|
@@ -172548,7 +172930,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172548
172930
|
// ]
|
|
172549
172931
|
// }
|
|
172550
172932
|
// }
|
|
172551
|
-
const responseData = this.
|
|
172933
|
+
const responseData = this.safeDict(response, 'data', {});
|
|
172552
172934
|
const orders = this.safeValue(responseData, 'items', responseData);
|
|
172553
172935
|
return this.parseOrders(orders, market, since, limit);
|
|
172554
172936
|
}
|
|
@@ -172684,7 +173066,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172684
173066
|
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
172685
173067
|
}
|
|
172686
173068
|
}
|
|
172687
|
-
let responseData = this.
|
|
173069
|
+
let responseData = this.safeDict(response, 'data', {});
|
|
172688
173070
|
if (Array.isArray(responseData)) {
|
|
172689
173071
|
responseData = this.safeValue(responseData, 0);
|
|
172690
173072
|
}
|
|
@@ -172819,7 +173201,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172819
173201
|
const responseStop = this.safeString(order, 'stop');
|
|
172820
173202
|
const stop = responseStop !== undefined;
|
|
172821
173203
|
const stopTriggered = this.safeBool(order, 'stopTriggered', false);
|
|
172822
|
-
const isActive = this.
|
|
173204
|
+
const isActive = this.safeBool2(order, 'isActive', 'active');
|
|
172823
173205
|
const responseStatus = this.safeString(order, 'status');
|
|
172824
173206
|
let status = undefined;
|
|
172825
173207
|
if (isActive !== undefined) {
|
|
@@ -172852,7 +173234,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172852
173234
|
'symbol': this.safeSymbol(marketId, market, '-'),
|
|
172853
173235
|
'type': this.safeString(order, 'type'),
|
|
172854
173236
|
'timeInForce': this.safeString(order, 'timeInForce'),
|
|
172855
|
-
'postOnly': this.
|
|
173237
|
+
'postOnly': this.safeBool(order, 'postOnly'),
|
|
172856
173238
|
'side': this.safeString(order, 'side'),
|
|
172857
173239
|
'amount': this.safeString(order, 'size'),
|
|
172858
173240
|
'price': this.safeString(order, 'price'),
|
|
@@ -172992,13 +173374,13 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172992
173374
|
// ]
|
|
172993
173375
|
// }
|
|
172994
173376
|
//
|
|
172995
|
-
const data = this.
|
|
173377
|
+
const data = this.safeDict(response, 'data', {});
|
|
172996
173378
|
let trades = undefined;
|
|
172997
173379
|
if (parseResponseData) {
|
|
172998
173380
|
trades = data;
|
|
172999
173381
|
}
|
|
173000
173382
|
else {
|
|
173001
|
-
trades = this.
|
|
173383
|
+
trades = this.safeList(data, 'items', []);
|
|
173002
173384
|
}
|
|
173003
173385
|
return this.parseTrades(trades, market, since, limit);
|
|
173004
173386
|
}
|
|
@@ -173041,7 +173423,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173041
173423
|
// ]
|
|
173042
173424
|
// }
|
|
173043
173425
|
//
|
|
173044
|
-
const trades = this.
|
|
173426
|
+
const trades = this.safeList(response, 'data', []);
|
|
173045
173427
|
return this.parseTrades(trades, market, since, limit);
|
|
173046
173428
|
}
|
|
173047
173429
|
parseTrade(trade, market = undefined) {
|
|
@@ -173203,8 +173585,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173203
173585
|
// ]
|
|
173204
173586
|
// }
|
|
173205
173587
|
//
|
|
173206
|
-
const data = this.
|
|
173207
|
-
const first = this.
|
|
173588
|
+
const data = this.safeList(response, 'data', []);
|
|
173589
|
+
const first = this.safeDict(data, 0);
|
|
173208
173590
|
const marketId = this.safeString(first, 'symbol');
|
|
173209
173591
|
return {
|
|
173210
173592
|
'info': response,
|
|
@@ -173265,7 +173647,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173265
173647
|
// }
|
|
173266
173648
|
// }
|
|
173267
173649
|
//
|
|
173268
|
-
const data = this.
|
|
173650
|
+
const data = this.safeDict(response, 'data', {});
|
|
173269
173651
|
return this.parseTransaction(data, currency);
|
|
173270
173652
|
}
|
|
173271
173653
|
parseTransactionStatus(status) {
|
|
@@ -173365,7 +173747,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173365
173747
|
updated = updated * 1000;
|
|
173366
173748
|
}
|
|
173367
173749
|
}
|
|
173368
|
-
const internal = this.
|
|
173750
|
+
const internal = this.safeBool(transaction, 'isInner');
|
|
173369
173751
|
const tag = this.safeString(transaction, 'memo');
|
|
173370
173752
|
return {
|
|
173371
173753
|
'info': transaction,
|
|
@@ -173591,7 +173973,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173591
173973
|
}
|
|
173592
173974
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
173593
173975
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
173594
|
-
const accountsByType = this.
|
|
173976
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
173595
173977
|
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
173596
173978
|
params = this.omit(params, 'type');
|
|
173597
173979
|
const isHf = this.safeBool(params, 'hf', false);
|
|
@@ -173673,7 +174055,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173673
174055
|
// }
|
|
173674
174056
|
// }
|
|
173675
174057
|
//
|
|
173676
|
-
const data = this.
|
|
174058
|
+
const data = this.safeList(response, 'data', []);
|
|
173677
174059
|
const result = {
|
|
173678
174060
|
'info': response,
|
|
173679
174061
|
'timestamp': undefined,
|
|
@@ -173685,8 +174067,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173685
174067
|
const entry = assets[i];
|
|
173686
174068
|
const marketId = this.safeString(entry, 'symbol');
|
|
173687
174069
|
const symbol = this.safeSymbol(marketId, undefined, '_');
|
|
173688
|
-
const base = this.
|
|
173689
|
-
const quote = this.
|
|
174070
|
+
const base = this.safeDict(entry, 'baseAsset', {});
|
|
174071
|
+
const quote = this.safeDict(entry, 'quoteAsset', {});
|
|
173690
174072
|
const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
|
|
173691
174073
|
const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
|
|
173692
174074
|
const subResult = {};
|
|
@@ -173696,7 +174078,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173696
174078
|
}
|
|
173697
174079
|
}
|
|
173698
174080
|
else if (cross) {
|
|
173699
|
-
const accounts = this.
|
|
174081
|
+
const accounts = this.safeList(data, 'accounts', []);
|
|
173700
174082
|
for (let i = 0; i < accounts.length; i++) {
|
|
173701
174083
|
const balance = accounts[i];
|
|
173702
174084
|
const currencyId = this.safeString(balance, 'currency');
|
|
@@ -173781,7 +174163,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173781
174163
|
// }
|
|
173782
174164
|
// }
|
|
173783
174165
|
//
|
|
173784
|
-
const data = this.
|
|
174166
|
+
const data = this.safeDict(response, 'data');
|
|
173785
174167
|
return this.parseTransfer(data, currency);
|
|
173786
174168
|
}
|
|
173787
174169
|
else {
|
|
@@ -173813,7 +174195,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173813
174195
|
// }
|
|
173814
174196
|
// }
|
|
173815
174197
|
//
|
|
173816
|
-
const data = this.
|
|
174198
|
+
const data = this.safeDict(response, 'data');
|
|
173817
174199
|
return this.parseTransfer(data, currency);
|
|
173818
174200
|
}
|
|
173819
174201
|
}
|
|
@@ -173857,7 +174239,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173857
174239
|
const rawStatus = this.safeString(transfer, 'status');
|
|
173858
174240
|
const accountFromRaw = this.safeStringLower(transfer, 'payAccountType');
|
|
173859
174241
|
const accountToRaw = this.safeStringLower(transfer, 'recAccountType');
|
|
173860
|
-
const accountsByType = this.
|
|
174242
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
173861
174243
|
const accountFrom = this.safeString(accountsByType, accountFromRaw, accountFromRaw);
|
|
173862
174244
|
const accountTo = this.safeString(accountsByType, accountToRaw, accountToRaw);
|
|
173863
174245
|
return {
|
|
@@ -174027,7 +174409,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174027
174409
|
await this.loadAccounts();
|
|
174028
174410
|
let paginate = false;
|
|
174029
174411
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
174030
|
-
const isHf = this.
|
|
174412
|
+
const isHf = this.safeBool(params, 'hf');
|
|
174031
174413
|
params = this.omit(params, 'hf');
|
|
174032
174414
|
if (paginate) {
|
|
174033
174415
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
@@ -174109,9 +174491,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174109
174491
|
return this.parseLedger(items, currency, since, limit);
|
|
174110
174492
|
}
|
|
174111
174493
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
174112
|
-
const versions = this.
|
|
174113
|
-
const apiVersions = this.
|
|
174114
|
-
const methodVersions = this.
|
|
174494
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
174495
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
174496
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
174115
174497
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
174116
174498
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
174117
174499
|
if (version === 'v3' && ('v3' in config)) {
|
|
@@ -174255,8 +174637,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174255
174637
|
// }
|
|
174256
174638
|
// }
|
|
174257
174639
|
//
|
|
174258
|
-
const data = this.
|
|
174259
|
-
const assets = (marginMode === 'isolated') ? this.
|
|
174640
|
+
const data = this.safeDict(response, 'data', {});
|
|
174641
|
+
const assets = (marginMode === 'isolated') ? this.safeList(data, 'assets', []) : this.safeList(data, 'accounts', []);
|
|
174260
174642
|
return this.parseBorrowInterests(assets, undefined);
|
|
174261
174643
|
}
|
|
174262
174644
|
parseBorrowInterest(info, market = undefined) {
|
|
@@ -174309,7 +174691,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174309
174691
|
market = this.safeMarket(marketId, market);
|
|
174310
174692
|
const symbol = this.safeString(market, 'symbol');
|
|
174311
174693
|
const timestamp = this.safeInteger(info, 'createdAt');
|
|
174312
|
-
const isolatedBase = this.
|
|
174694
|
+
const isolatedBase = this.safeDict(info, 'baseAsset', {});
|
|
174313
174695
|
let amountBorrowed = undefined;
|
|
174314
174696
|
let interest = undefined;
|
|
174315
174697
|
let currencyId = undefined;
|
|
@@ -174367,7 +174749,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174367
174749
|
// }
|
|
174368
174750
|
// }
|
|
174369
174751
|
//
|
|
174370
|
-
const data = this.
|
|
174752
|
+
const data = this.safeDict(response, 'data', {});
|
|
174371
174753
|
return this.parseMarginLoan(data, currency);
|
|
174372
174754
|
}
|
|
174373
174755
|
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -174406,7 +174788,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174406
174788
|
// }
|
|
174407
174789
|
// }
|
|
174408
174790
|
//
|
|
174409
|
-
const data = this.
|
|
174791
|
+
const data = this.safeDict(response, 'data', {});
|
|
174410
174792
|
return this.parseMarginLoan(data, currency);
|
|
174411
174793
|
}
|
|
174412
174794
|
async repayCrossMargin(code, amount, params = {}) {
|
|
@@ -174439,7 +174821,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174439
174821
|
// }
|
|
174440
174822
|
// }
|
|
174441
174823
|
//
|
|
174442
|
-
const data = this.
|
|
174824
|
+
const data = this.safeDict(response, 'data', {});
|
|
174443
174825
|
return this.parseMarginLoan(data, currency);
|
|
174444
174826
|
}
|
|
174445
174827
|
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -174476,7 +174858,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174476
174858
|
// }
|
|
174477
174859
|
// }
|
|
174478
174860
|
//
|
|
174479
|
-
const data = this.
|
|
174861
|
+
const data = this.safeDict(response, 'data', {});
|
|
174480
174862
|
return this.parseMarginLoan(data, currency);
|
|
174481
174863
|
}
|
|
174482
174864
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -174528,7 +174910,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174528
174910
|
// },
|
|
174529
174911
|
// ]
|
|
174530
174912
|
//
|
|
174531
|
-
const data = this.
|
|
174913
|
+
const data = this.safeList(response, 'data', []);
|
|
174532
174914
|
return this.parseDepositWithdrawFees(data, codes, 'currency');
|
|
174533
174915
|
}
|
|
174534
174916
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
@@ -174537,9 +174919,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174537
174919
|
// ↑ ↑
|
|
174538
174920
|
// ↑ ↑
|
|
174539
174921
|
//
|
|
174540
|
-
const versions = this.
|
|
174541
|
-
const apiVersions = this.
|
|
174542
|
-
const methodVersions = this.
|
|
174922
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
174923
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
174924
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
174543
174925
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
174544
174926
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
174545
174927
|
params = this.omit(params, 'version');
|
|
@@ -174564,7 +174946,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174564
174946
|
url = url + endpoint;
|
|
174565
174947
|
const isFuturePrivate = (api === 'futuresPrivate');
|
|
174566
174948
|
const isPrivate = (api === 'private');
|
|
174567
|
-
|
|
174949
|
+
const isBroker = (api === 'private');
|
|
174950
|
+
if (isPrivate || isFuturePrivate || isBroker) {
|
|
174568
174951
|
this.checkRequiredCredentials();
|
|
174569
174952
|
const timestamp = this.nonce().toString();
|
|
174570
174953
|
headers = this.extend({
|
|
@@ -174583,7 +174966,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174583
174966
|
const payload = timestamp + method + endpoint + endpart;
|
|
174584
174967
|
const signature = this.hmac(this.encode(payload), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J, 'base64');
|
|
174585
174968
|
headers['KC-API-SIGN'] = signature;
|
|
174586
|
-
let partner = this.
|
|
174969
|
+
let partner = this.safeDict(this.options, 'partner', {});
|
|
174587
174970
|
partner = isFuturePrivate ? this.safeValue(partner, 'future', partner) : this.safeValue(partner, 'spot', partner);
|
|
174588
174971
|
const partnerId = this.safeString(partner, 'id');
|
|
174589
174972
|
const partnerSecret = this.safeString2(partner, 'secret', 'key');
|
|
@@ -174593,6 +174976,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174593
174976
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature;
|
|
174594
174977
|
headers['KC-API-PARTNER'] = partnerId;
|
|
174595
174978
|
}
|
|
174979
|
+
if (isBroker) {
|
|
174980
|
+
const brokerName = this.safeString(partner, 'name');
|
|
174981
|
+
headers['KC-BROKER-NAME'] = brokerName;
|
|
174982
|
+
}
|
|
174596
174983
|
}
|
|
174597
174984
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
174598
174985
|
}
|
|
@@ -230409,7 +230796,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
230409
230796
|
if (feeAmount !== undefined) {
|
|
230410
230797
|
const feeCurrency = this.safeString(fee, 'feeCoin');
|
|
230411
230798
|
feeObject = {
|
|
230412
|
-
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringAbs(feeAmount),
|
|
230799
|
+
'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringAbs(feeAmount)),
|
|
230413
230800
|
'currency': this.safeCurrencyCode(feeCurrency),
|
|
230414
230801
|
};
|
|
230415
230802
|
}
|
|
@@ -230422,10 +230809,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
230422
230809
|
if (side === 'buy' && market['spot'] && (type === 'market')) {
|
|
230423
230810
|
cost = this.safeString(order, 'newSize', cost);
|
|
230424
230811
|
}
|
|
230425
|
-
|
|
230426
|
-
if (market['spot'] && (rawStatus !== 'live')) {
|
|
230427
|
-
|
|
230428
|
-
}
|
|
230812
|
+
const filled = this.safeString2(order, 'accBaseVolume', 'baseVolume');
|
|
230813
|
+
// if (market['spot'] && (rawStatus !== 'live')) {
|
|
230814
|
+
// filled = Precise.stringDiv (cost, avgPrice);
|
|
230815
|
+
// }
|
|
230429
230816
|
let amount = this.safeString(order, 'baseVolume');
|
|
230430
230817
|
if (!market['spot'] || !(side === 'buy' && type === 'market')) {
|
|
230431
230818
|
amount = this.safeString(order, 'newSize', amount);
|
|
@@ -243930,7 +244317,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243930
244317
|
const messageHash = 'authenticated:spot';
|
|
243931
244318
|
let future = this.safeValue(client.subscriptions, messageHash);
|
|
243932
244319
|
if (future !== undefined) {
|
|
243933
|
-
return future;
|
|
244320
|
+
return await future;
|
|
243934
244321
|
}
|
|
243935
244322
|
const requestId = this.requestId();
|
|
243936
244323
|
const subscribe = {
|
|
@@ -243950,13 +244337,13 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243950
244337
|
};
|
|
243951
244338
|
future = this.watch(url, messageHash, request, requestId, subscribe);
|
|
243952
244339
|
client.subscriptions[messageHash] = future;
|
|
243953
|
-
return future;
|
|
244340
|
+
return await future;
|
|
243954
244341
|
}
|
|
243955
244342
|
else {
|
|
243956
244343
|
const messageHash = 'authenticated:swap';
|
|
243957
244344
|
let future = this.safeValue(client.subscriptions, messageHash);
|
|
243958
244345
|
if (future !== undefined) {
|
|
243959
|
-
return future;
|
|
244346
|
+
return await future;
|
|
243960
244347
|
}
|
|
243961
244348
|
const requestId = this.requestId();
|
|
243962
244349
|
const subscribe = {
|
|
@@ -243976,7 +244363,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
243976
244363
|
};
|
|
243977
244364
|
future = this.watch(url, messageHash, request, requestId, subscribe);
|
|
243978
244365
|
client.subscriptions[messageHash] = future;
|
|
243979
|
-
return future;
|
|
244366
|
+
return await future;
|
|
243980
244367
|
}
|
|
243981
244368
|
}
|
|
243982
244369
|
}
|
|
@@ -245632,7 +246019,7 @@ class currencycom extends _currencycom_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
245632
246019
|
'fee': undefined,
|
|
245633
246020
|
};
|
|
245634
246021
|
}
|
|
245635
|
-
handleTrades(client, message
|
|
246022
|
+
handleTrades(client, message) {
|
|
245636
246023
|
//
|
|
245637
246024
|
// {
|
|
245638
246025
|
// "status": "OK",
|
|
@@ -261085,7 +261472,7 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
261085
261472
|
// },
|
|
261086
261473
|
// type: 'kbar',
|
|
261087
261474
|
// pair: 'btc_usdt',
|
|
261088
|
-
// TS: '2022-10-02T12:44:15.
|
|
261475
|
+
// TS: '2022-10-02T12:44:15.865'
|
|
261089
261476
|
// }
|
|
261090
261477
|
//
|
|
261091
261478
|
const marketId = this.safeString(message, 'pair');
|
|
@@ -306532,15 +306919,15 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306532
306919
|
});
|
|
306533
306920
|
}
|
|
306534
306921
|
parseBalance(response) {
|
|
306535
|
-
const balances = this.
|
|
306922
|
+
const balances = this.safeDict(response, 'return', {});
|
|
306536
306923
|
const timestamp = this.safeInteger(balances, 'server_time');
|
|
306537
306924
|
const result = {
|
|
306538
306925
|
'info': response,
|
|
306539
306926
|
'timestamp': timestamp,
|
|
306540
306927
|
'datetime': this.iso8601(timestamp),
|
|
306541
306928
|
};
|
|
306542
|
-
const free = this.
|
|
306543
|
-
const total = this.
|
|
306929
|
+
const free = this.safeDict(balances, 'funds', {});
|
|
306930
|
+
const total = this.safeDict(balances, 'funds_incl_orders', {});
|
|
306544
306931
|
const currencyIds = Object.keys(this.extend(free, total));
|
|
306545
306932
|
for (let i = 0; i < currencyIds.length; i++) {
|
|
306546
306933
|
const currencyId = currencyIds[i];
|
|
@@ -306618,7 +307005,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306618
307005
|
// },
|
|
306619
307006
|
// }
|
|
306620
307007
|
//
|
|
306621
|
-
const markets = this.
|
|
307008
|
+
const markets = this.safeDict(response, 'pairs', {});
|
|
306622
307009
|
const keys = Object.keys(markets);
|
|
306623
307010
|
const result = [];
|
|
306624
307011
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -306906,7 +307293,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306906
307293
|
'currency': feeCurrencyCode,
|
|
306907
307294
|
};
|
|
306908
307295
|
}
|
|
306909
|
-
const isYourOrder = this.
|
|
307296
|
+
const isYourOrder = this.safeString(trade, 'is_your_order');
|
|
306910
307297
|
if (isYourOrder !== undefined) {
|
|
306911
307298
|
if (fee === undefined) {
|
|
306912
307299
|
const feeInNumbers = this.calculateFee(symbol, type, side, amount, price, 'taker');
|
|
@@ -306973,7 +307360,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
306973
307360
|
return [];
|
|
306974
307361
|
}
|
|
306975
307362
|
}
|
|
306976
|
-
const result = this.
|
|
307363
|
+
const result = this.safeList(response, market['id'], []);
|
|
306977
307364
|
return this.parseTrades(result, market, since, limit);
|
|
306978
307365
|
}
|
|
306979
307366
|
async fetchTradingFees(params = {}) {
|
|
@@ -307006,12 +307393,12 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307006
307393
|
// },
|
|
307007
307394
|
// }
|
|
307008
307395
|
//
|
|
307009
|
-
const pairs = this.
|
|
307396
|
+
const pairs = this.safeDict(response, 'pairs', {});
|
|
307010
307397
|
const marketIds = Object.keys(pairs);
|
|
307011
307398
|
const result = {};
|
|
307012
307399
|
for (let i = 0; i < marketIds.length; i++) {
|
|
307013
307400
|
const marketId = marketIds[i];
|
|
307014
|
-
const pair = this.
|
|
307401
|
+
const pair = this.safeDict(pairs, marketId, {});
|
|
307015
307402
|
const symbol = this.safeSymbol(marketId, undefined, '_');
|
|
307016
307403
|
const takerString = this.safeString(pair, 'fee_buyer');
|
|
307017
307404
|
const makerString = this.safeString(pair, 'fee_seller');
|
|
@@ -307075,7 +307462,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307075
307462
|
// }
|
|
307076
307463
|
// }
|
|
307077
307464
|
//
|
|
307078
|
-
const result = this.
|
|
307465
|
+
const result = this.safeDict(response, 'return');
|
|
307079
307466
|
return this.parseOrder(result, market);
|
|
307080
307467
|
}
|
|
307081
307468
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -307113,7 +307500,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307113
307500
|
// }
|
|
307114
307501
|
// }
|
|
307115
307502
|
//
|
|
307116
|
-
const result = this.
|
|
307503
|
+
const result = this.safeDict(response, 'return', {});
|
|
307117
307504
|
return this.parseOrder(result);
|
|
307118
307505
|
}
|
|
307119
307506
|
parseOrderStatus(status) {
|
|
@@ -307244,7 +307631,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307244
307631
|
};
|
|
307245
307632
|
const response = await this.privatePostOrderInfo(this.extend(request, params));
|
|
307246
307633
|
id = id.toString();
|
|
307247
|
-
const orders = this.
|
|
307634
|
+
const orders = this.safeDict(response, 'return', {});
|
|
307248
307635
|
//
|
|
307249
307636
|
// {
|
|
307250
307637
|
// "success":1,
|
|
@@ -307309,7 +307696,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307309
307696
|
// }
|
|
307310
307697
|
// }
|
|
307311
307698
|
//
|
|
307312
|
-
const result = this.
|
|
307699
|
+
const result = this.safeDict(response, 'return', {});
|
|
307313
307700
|
return this.parseOrders(result, market, since, limit);
|
|
307314
307701
|
}
|
|
307315
307702
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -307363,7 +307750,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307363
307750
|
// }
|
|
307364
307751
|
// }
|
|
307365
307752
|
//
|
|
307366
|
-
const trades = this.
|
|
307753
|
+
const trades = this.safeDict(response, 'return', {});
|
|
307367
307754
|
const ids = Object.keys(trades);
|
|
307368
307755
|
const result = [];
|
|
307369
307756
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -307411,7 +307798,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307411
307798
|
await this.loadMarkets();
|
|
307412
307799
|
const currency = this.currency(code);
|
|
307413
307800
|
let currencyId = currency['id'];
|
|
307414
|
-
const networks = this.
|
|
307801
|
+
const networks = this.safeDict(this.options, 'networks', {});
|
|
307415
307802
|
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
307416
307803
|
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
307417
307804
|
if (network !== undefined) {
|
|
@@ -307578,7 +307965,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
307578
307965
|
//
|
|
307579
307966
|
// To cover points 1, 2, 3 and 4 combined this handler should work like this:
|
|
307580
307967
|
//
|
|
307581
|
-
let success = this.
|
|
307968
|
+
let success = this.safeValue(response, 'success'); // don't replace with safeBool here
|
|
307582
307969
|
if (typeof success === 'string') {
|
|
307583
307970
|
if ((success === 'true') || (success === '1')) {
|
|
307584
307971
|
success = true;
|
|
@@ -316377,7 +316764,7 @@ SOFTWARE.
|
|
|
316377
316764
|
|
|
316378
316765
|
//-----------------------------------------------------------------------------
|
|
316379
316766
|
// this is updated by vss.js when building
|
|
316380
|
-
const version = '4.2.
|
|
316767
|
+
const version = '4.2.65';
|
|
316381
316768
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
316382
316769
|
//-----------------------------------------------------------------------------
|
|
316383
316770
|
|