ccxt 4.2.64 → 4.2.66
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/dist/ccxt.browser.js +358 -96
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +12 -0
- package/dist/cjs/src/bigone.js +6 -2
- package/dist/cjs/src/binance.js +26 -3
- package/dist/cjs/src/bingx.js +13 -4
- package/dist/cjs/src/bitfinex2.js +4 -4
- package/dist/cjs/src/bitget.js +16 -2
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/blofin.js +35 -0
- package/dist/cjs/src/btcmarkets.js +12 -0
- package/dist/cjs/src/coinbase.js +12 -2
- package/dist/cjs/src/delta.js +95 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/kucoin.js +85 -61
- package/dist/cjs/src/pro/bitfinex2.js +5 -4
- package/dist/cjs/src/pro/bitget.js +3 -3
- package/dist/cjs/src/pro/bitmart.js +28 -6
- package/dist/cjs/src/pro/currencycom.js +1 -1
- package/doc/manual.rst +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitget.d.ts +5 -0
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +9 -0
- package/js/src/abstract/kucoinfutures.d.ts +9 -0
- package/js/src/base/Exchange.js +12 -0
- package/js/src/bigone.js +6 -2
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +26 -3
- package/js/src/bingx.js +13 -4
- package/js/src/bitfinex2.js +4 -4
- package/js/src/bitget.js +16 -2
- package/js/src/bitmex.js +3 -1
- package/js/src/blofin.d.ts +3 -1
- package/js/src/blofin.js +35 -0
- package/js/src/btcmarkets.js +12 -0
- 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/hitbtc.js +1 -1
- package/js/src/kucoin.js +85 -61
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +5 -4
- package/js/src/pro/bitget.js +3 -3
- package/js/src/pro/bitmart.js +28 -6
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +1 -1
- package/js/src/woo.d.ts +1 -1
- package/package.json +2 -2
- package/skip-tests.json +35 -13
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
|
}
|
|
@@ -17469,7 +17481,11 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
17469
17481
|
}
|
|
17470
17482
|
}
|
|
17471
17483
|
request['type'] = uppercaseType;
|
|
17472
|
-
|
|
17484
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
17485
|
+
if (clientOrderId !== undefined) {
|
|
17486
|
+
request['client_order_id'] = clientOrderId;
|
|
17487
|
+
}
|
|
17488
|
+
params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce', 'clientOrderId']);
|
|
17473
17489
|
const response = await this.privatePostOrders(this.extend(request, params));
|
|
17474
17490
|
//
|
|
17475
17491
|
// {
|
|
@@ -17750,7 +17766,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
17750
17766
|
}
|
|
17751
17767
|
else if (method === 'POST') {
|
|
17752
17768
|
headers['Content-Type'] = 'application/json';
|
|
17753
|
-
body = query;
|
|
17769
|
+
body = this.json(query);
|
|
17754
17770
|
}
|
|
17755
17771
|
}
|
|
17756
17772
|
headers['User-Agent'] = 'ccxt/' + this.id + '-' + this.version;
|
|
@@ -20700,6 +20716,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20700
20716
|
* @see https://binance-docs.github.io/apidocs/futures/en/#check-server-time // swap
|
|
20701
20717
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#check-server-time // future
|
|
20702
20718
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
20719
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
20703
20720
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
20704
20721
|
*/
|
|
20705
20722
|
const defaultType = this.safeString2(this.options, 'fetchTime', 'defaultType', 'spot');
|
|
@@ -21495,6 +21512,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21495
21512
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
21496
21513
|
* @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
|
|
21497
21514
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the balance for a portfolio margin account
|
|
21515
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
21498
21516
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
21499
21517
|
*/
|
|
21500
21518
|
await this.loadMarkets();
|
|
@@ -22073,6 +22091,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22073
22091
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-order-book-ticker // future
|
|
22074
22092
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
22075
22093
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22094
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22076
22095
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
22077
22096
|
*/
|
|
22078
22097
|
await this.loadMarkets();
|
|
@@ -22113,6 +22132,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22113
22132
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
22114
22133
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
22115
22134
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22135
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22116
22136
|
* @returns {object} a dictionary of lastprices structures
|
|
22117
22137
|
*/
|
|
22118
22138
|
await this.loadMarkets();
|
|
@@ -22218,6 +22238,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22218
22238
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
|
|
22219
22239
|
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
22220
22240
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22241
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
22221
22242
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
22222
22243
|
*/
|
|
22223
22244
|
await this.loadMarkets();
|
|
@@ -24644,6 +24665,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24644
24665
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
24645
24666
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch open orders in the portfolio margin account
|
|
24646
24667
|
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account conditional orders
|
|
24668
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
24647
24669
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
24648
24670
|
*/
|
|
24649
24671
|
await this.loadMarkets();
|
|
@@ -26787,6 +26809,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26787
26809
|
* @param {string} symbol unified market symbol
|
|
26788
26810
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
26789
26811
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
|
|
26812
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
26790
26813
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
26791
26814
|
*/
|
|
26792
26815
|
await this.loadMarkets();
|
|
@@ -26855,6 +26878,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26855
26878
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
26856
26879
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
26857
26880
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
26881
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
26858
26882
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
26859
26883
|
*/
|
|
26860
26884
|
await this.loadMarkets();
|
|
@@ -27112,6 +27136,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27112
27136
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27113
27137
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
27114
27138
|
* @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)
|
|
27139
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27115
27140
|
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
27116
27141
|
*/
|
|
27117
27142
|
await this.loadMarkets();
|
|
@@ -27185,6 +27210,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27185
27210
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
27186
27211
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
27187
27212
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27213
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27188
27214
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
27189
27215
|
*/
|
|
27190
27216
|
await this.loadMarkets();
|
|
@@ -27808,6 +27834,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27808
27834
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
27809
27835
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27810
27836
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the leverage tiers for a portfolio margin account
|
|
27837
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
27811
27838
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
27812
27839
|
*/
|
|
27813
27840
|
await this.loadMarkets();
|
|
@@ -28122,6 +28149,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28122
28149
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
28123
28150
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28124
28151
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
|
|
28152
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28125
28153
|
* @returns {object} data on account positions
|
|
28126
28154
|
*/
|
|
28127
28155
|
if (symbols !== undefined) {
|
|
@@ -28175,6 +28203,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28175
28203
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
28176
28204
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28177
28205
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
|
|
28206
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28178
28207
|
* @returns {object} data on the positions risk
|
|
28179
28208
|
*/
|
|
28180
28209
|
if (symbols !== undefined) {
|
|
@@ -28334,6 +28363,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28334
28363
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28335
28364
|
* @param {int} [params.until] timestamp in ms of the latest funding history entry
|
|
28336
28365
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the funding history for a portfolio margin account
|
|
28366
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28337
28367
|
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
28338
28368
|
*/
|
|
28339
28369
|
await this.loadMarkets();
|
|
@@ -28518,6 +28548,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28518
28548
|
* @param {string} symbol not used by binance setPositionMode ()
|
|
28519
28549
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28520
28550
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to set the position mode for a portfolio margin account
|
|
28551
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28521
28552
|
* @returns {object} response from the exchange
|
|
28522
28553
|
*/
|
|
28523
28554
|
const defaultType = this.safeString(this.options, 'defaultType', 'future');
|
|
@@ -28546,7 +28577,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28546
28577
|
response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
28547
28578
|
}
|
|
28548
28579
|
}
|
|
28549
|
-
else {
|
|
28580
|
+
else if (this.isLinear(type, subType)) {
|
|
28550
28581
|
if (isPortfolioMargin) {
|
|
28551
28582
|
response = await this.papiPostUmPositionSideDual(this.extend(request, params));
|
|
28552
28583
|
}
|
|
@@ -28554,6 +28585,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28554
28585
|
response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
28555
28586
|
}
|
|
28556
28587
|
}
|
|
28588
|
+
else {
|
|
28589
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' setPositionMode() supports linear and inverse contracts only');
|
|
28590
|
+
}
|
|
28557
28591
|
//
|
|
28558
28592
|
// {
|
|
28559
28593
|
// "code": 200,
|
|
@@ -28573,6 +28607,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28573
28607
|
* @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
|
28574
28608
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
28575
28609
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28610
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28576
28611
|
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
28577
28612
|
*/
|
|
28578
28613
|
await this.loadMarkets();
|
|
@@ -28847,6 +28882,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28847
28882
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
28848
28883
|
* @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)
|
|
28849
28884
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the ledger for a portfolio margin account
|
|
28885
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
28850
28886
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
28851
28887
|
*/
|
|
28852
28888
|
await this.loadMarkets();
|
|
@@ -29990,6 +30026,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
29990
30026
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
29991
30027
|
* @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)
|
|
29992
30028
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch liquidations in a portfolio margin account
|
|
30029
|
+
* @param {string} [params.type] "spot"
|
|
30030
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
29993
30031
|
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
29994
30032
|
*/
|
|
29995
30033
|
await this.loadMarkets();
|
|
@@ -30315,8 +30353,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30315
30353
|
* @name binance#fetchPositionMode
|
|
30316
30354
|
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
30317
30355
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
30318
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
30319
|
-
* @param {string} params.subType "linear" or "inverse"
|
|
30356
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30357
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
30320
30358
|
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
30321
30359
|
*/
|
|
30322
30360
|
let market = undefined;
|
|
@@ -30354,6 +30392,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30354
30392
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
30355
30393
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
30356
30394
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30395
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
30357
30396
|
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
30358
30397
|
*/
|
|
30359
30398
|
await this.loadMarkets();
|
|
@@ -32711,6 +32750,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32711
32750
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
32712
32751
|
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
32713
32752
|
const trailingPercent = this.safeString2(params, 'trailingPercent', 'priceRate');
|
|
32753
|
+
const trailingType = this.safeString(params, 'trailingType', 'TRAILING_STOP_MARKET');
|
|
32714
32754
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
32715
32755
|
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
32716
32756
|
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
@@ -32757,7 +32797,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32757
32797
|
}
|
|
32758
32798
|
}
|
|
32759
32799
|
else if (isTrailing) {
|
|
32760
|
-
request['type'] =
|
|
32800
|
+
request['type'] = trailingType;
|
|
32761
32801
|
if (isTrailingAmountOrder) {
|
|
32762
32802
|
request['price'] = this.parseToNumeric(trailingAmount);
|
|
32763
32803
|
}
|
|
@@ -32812,7 +32852,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32812
32852
|
}
|
|
32813
32853
|
request['positionSide'] = positionSide;
|
|
32814
32854
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
32815
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
32855
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
32816
32856
|
}
|
|
32817
32857
|
return this.extend(request, params);
|
|
32818
32858
|
}
|
|
@@ -32843,14 +32883,22 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
32843
32883
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
32844
32884
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
32845
32885
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
32886
|
+
* @param {boolean} [params.test] *swap only* whether to use the test endpoint or not, default is false
|
|
32846
32887
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
32847
32888
|
*/
|
|
32848
32889
|
await this.loadMarkets();
|
|
32849
32890
|
const market = this.market(symbol);
|
|
32891
|
+
const test = this.safeBool(params, 'test', false);
|
|
32892
|
+
params = this.omit(params, 'test');
|
|
32850
32893
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
32851
32894
|
let response = undefined;
|
|
32852
32895
|
if (market['swap']) {
|
|
32853
|
-
|
|
32896
|
+
if (test) {
|
|
32897
|
+
response = await this.swapV2PrivatePostTradeOrderTest(request);
|
|
32898
|
+
}
|
|
32899
|
+
else {
|
|
32900
|
+
response = await this.swapV2PrivatePostTradeOrder(request);
|
|
32901
|
+
}
|
|
32854
32902
|
}
|
|
32855
32903
|
else {
|
|
32856
32904
|
response = await this.spotV1PrivatePostTradeOrder(request);
|
|
@@ -34904,7 +34952,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34904
34952
|
* @param {string} [params.newClientOrderId] custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
|
|
34905
34953
|
* @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
|
|
34906
34954
|
* @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
|
|
34907
|
-
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market, Max = 1
|
|
34955
|
+
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1
|
|
34908
34956
|
* @param {string} [params.workingType] *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE
|
|
34909
34957
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
34910
34958
|
*/
|
|
@@ -43152,10 +43200,10 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
43152
43200
|
}
|
|
43153
43201
|
const reversedArray = [];
|
|
43154
43202
|
const rawRates = this.filterBySymbolSinceLimit(rates, symbol, since, limit);
|
|
43155
|
-
const
|
|
43156
|
-
|
|
43157
|
-
|
|
43158
|
-
const valueAtIndex = rawRates[
|
|
43203
|
+
const ratesLength = rawRates.length;
|
|
43204
|
+
for (let i = 0; i < ratesLength; i++) {
|
|
43205
|
+
const index = ratesLength - i - 1;
|
|
43206
|
+
const valueAtIndex = rawRates[index];
|
|
43159
43207
|
reversedArray.push(valueAtIndex);
|
|
43160
43208
|
}
|
|
43161
43209
|
return reversedArray;
|
|
@@ -45215,6 +45263,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45215
45263
|
'v2/spot/wallet/transfer': 2,
|
|
45216
45264
|
'v2/spot/wallet/subaccount-transfer': 2,
|
|
45217
45265
|
'v2/spot/wallet/withdrawal': 2,
|
|
45266
|
+
'v2/spot/wallet/cancel-withdrawal': 2,
|
|
45267
|
+
'v2/spot/wallet/modify-deposit-account': 2,
|
|
45218
45268
|
},
|
|
45219
45269
|
},
|
|
45220
45270
|
'mix': {
|
|
@@ -45559,9 +45609,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45559
45609
|
'v2/convert/currencies': 2,
|
|
45560
45610
|
'v2/convert/quoted-price': 2,
|
|
45561
45611
|
'v2/convert/convert-record': 2,
|
|
45612
|
+
'v2/convert/bgb-convert-coin-list': 2,
|
|
45613
|
+
'v2/convert/bgb-convert-records': 2,
|
|
45562
45614
|
},
|
|
45563
45615
|
'post': {
|
|
45564
45616
|
'v2/convert/trade': 2,
|
|
45617
|
+
'v2/convert/bgb-convert': 2,
|
|
45565
45618
|
},
|
|
45566
45619
|
},
|
|
45567
45620
|
'earn': {
|
|
@@ -49766,6 +49819,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49766
49819
|
* @name bitget#cancelAllOrders
|
|
49767
49820
|
* @description cancel all open orders
|
|
49768
49821
|
* @see https://www.bitget.com/api-doc/spot/trade/Cancel-Symbol-Orders
|
|
49822
|
+
* @see https://www.bitget.com/api-doc/spot/plan/Batch-Cancel-Plan-Order
|
|
49769
49823
|
* @see https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders
|
|
49770
49824
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
|
49771
49825
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
|
@@ -49793,7 +49847,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49793
49847
|
const request = {
|
|
49794
49848
|
'symbol': market['id'],
|
|
49795
49849
|
};
|
|
49796
|
-
const stop = this.
|
|
49850
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
49797
49851
|
params = this.omit(params, ['stop', 'trigger']);
|
|
49798
49852
|
let response = undefined;
|
|
49799
49853
|
if (market['spot']) {
|
|
@@ -49806,7 +49860,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49806
49860
|
}
|
|
49807
49861
|
}
|
|
49808
49862
|
else {
|
|
49809
|
-
|
|
49863
|
+
if (stop) {
|
|
49864
|
+
const stopRequest = {
|
|
49865
|
+
'symbolList': [market['id']],
|
|
49866
|
+
};
|
|
49867
|
+
response = await this.privateSpotPostV2SpotTradeBatchCancelPlanOrder(this.extend(stopRequest, params));
|
|
49868
|
+
}
|
|
49869
|
+
else {
|
|
49870
|
+
response = await this.privateSpotPostV2SpotTradeCancelSymbolOrder(this.extend(request, params));
|
|
49871
|
+
}
|
|
49810
49872
|
}
|
|
49811
49873
|
}
|
|
49812
49874
|
else {
|
|
@@ -61499,7 +61561,9 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61499
61561
|
if (until !== undefined) {
|
|
61500
61562
|
request['endTime'] = this.iso8601(until);
|
|
61501
61563
|
}
|
|
61502
|
-
|
|
61564
|
+
if ((since === undefined) && (until === undefined)) {
|
|
61565
|
+
request['reverse'] = true;
|
|
61566
|
+
}
|
|
61503
61567
|
const response = await this.publicGetFunding(this.extend(request, params));
|
|
61504
61568
|
//
|
|
61505
61569
|
// [
|
|
@@ -77104,6 +77168,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77104
77168
|
'fetchLeverage': true,
|
|
77105
77169
|
'fetchLeverages': true,
|
|
77106
77170
|
'fetchLeverageTiers': false,
|
|
77171
|
+
'fetchMarginMode': true,
|
|
77172
|
+
'fetchMarginModes': false,
|
|
77107
77173
|
'fetchMarketLeverageTiers': false,
|
|
77108
77174
|
'fetchMarkets': true,
|
|
77109
77175
|
'fetchMarkOHLCV': false,
|
|
@@ -77207,6 +77273,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77207
77273
|
'account/balance': 1,
|
|
77208
77274
|
'account/positions': 1,
|
|
77209
77275
|
'account/leverage-info': 1,
|
|
77276
|
+
'account/margin-mode': 1,
|
|
77210
77277
|
'account/batch-leverage-info': 1,
|
|
77211
77278
|
'trade/orders-tpsl-pending': 1,
|
|
77212
77279
|
'trade/orders-history': 1,
|
|
@@ -79127,6 +79194,38 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
79127
79194
|
const data = this.safeList(response, 'data', []);
|
|
79128
79195
|
return this.parseOrders(data, market, since, limit);
|
|
79129
79196
|
}
|
|
79197
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
79198
|
+
/**
|
|
79199
|
+
* @method
|
|
79200
|
+
* @name blofin#fetchMarginMode
|
|
79201
|
+
* @description fetches the margin mode of a trading pair
|
|
79202
|
+
* @see https://docs.blofin.com/index.html#get-margin-mode
|
|
79203
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
79204
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
79205
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
79206
|
+
*/
|
|
79207
|
+
await this.loadMarkets();
|
|
79208
|
+
const market = this.market(symbol);
|
|
79209
|
+
const response = await this.privateGetAccountMarginMode(params);
|
|
79210
|
+
//
|
|
79211
|
+
// {
|
|
79212
|
+
// "code": "0",
|
|
79213
|
+
// "msg": "success",
|
|
79214
|
+
// "data": {
|
|
79215
|
+
// "marginMode": "cross"
|
|
79216
|
+
// }
|
|
79217
|
+
// }
|
|
79218
|
+
//
|
|
79219
|
+
const data = this.safeDict(response, 'data', {});
|
|
79220
|
+
return this.parseMarginMode(data, market);
|
|
79221
|
+
}
|
|
79222
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
79223
|
+
return {
|
|
79224
|
+
'info': marginMode,
|
|
79225
|
+
'symbol': market['symbol'],
|
|
79226
|
+
'marginMode': this.safeString(marginMode, 'marginMode'),
|
|
79227
|
+
};
|
|
79228
|
+
}
|
|
79130
79229
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
79131
79230
|
if (response === undefined) {
|
|
79132
79231
|
return undefined; // fallback to default error handler
|
|
@@ -81667,6 +81766,18 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
81667
81766
|
return await this.privateDeleteOrdersId(this.extend(request, params));
|
|
81668
81767
|
}
|
|
81669
81768
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
81769
|
+
/**
|
|
81770
|
+
* @method
|
|
81771
|
+
* @description calculates the presumptive fee that would be charged for an order
|
|
81772
|
+
* @param {string} symbol unified market symbol
|
|
81773
|
+
* @param {string} type not used by btcmarkets.calculateFee
|
|
81774
|
+
* @param {string} side not used by btcmarkets.calculateFee
|
|
81775
|
+
* @param {float} amount how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
|
81776
|
+
* @param {float} price the price for the order to be filled at, in units of the quote currency
|
|
81777
|
+
* @param {string} takerOrMaker 'taker' or 'maker'
|
|
81778
|
+
* @param {object} params
|
|
81779
|
+
* @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
|
|
81780
|
+
*/
|
|
81670
81781
|
const market = this.markets[symbol];
|
|
81671
81782
|
let currency = undefined;
|
|
81672
81783
|
let cost = undefined;
|
|
@@ -96575,7 +96686,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96575
96686
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
96576
96687
|
const version = api[0];
|
|
96577
96688
|
const signed = api[1] === 'private';
|
|
96578
|
-
const
|
|
96689
|
+
const isV3 = version === 'v3';
|
|
96690
|
+
const pathPart = (isV3) ? 'api/v3' : 'v2';
|
|
96579
96691
|
let fullPath = '/' + pathPart + '/' + this.implodeParams(path, params);
|
|
96580
96692
|
const query = this.omit(params, this.extractParams(path));
|
|
96581
96693
|
const savedPath = fullPath;
|
|
@@ -96619,8 +96731,17 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96619
96731
|
payload = body;
|
|
96620
96732
|
}
|
|
96621
96733
|
}
|
|
96622
|
-
|
|
96734
|
+
else {
|
|
96735
|
+
if (!isV3) {
|
|
96736
|
+
if (Object.keys(query).length) {
|
|
96737
|
+
payload += '?' + this.urlencode(query);
|
|
96738
|
+
}
|
|
96739
|
+
}
|
|
96740
|
+
}
|
|
96741
|
+
// v3: 'GET' doesn't need payload in the signature. inside url is enough
|
|
96623
96742
|
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
96743
|
+
// v2: 'GET' require payload in the signature
|
|
96744
|
+
// https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
|
96624
96745
|
const auth = timestampString + method + savedPath + payload;
|
|
96625
96746
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
96626
96747
|
headers = {
|
|
@@ -119217,7 +119338,8 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
119217
119338
|
'fetchLedger': true,
|
|
119218
119339
|
'fetchLeverage': true,
|
|
119219
119340
|
'fetchLeverageTiers': false,
|
|
119220
|
-
'fetchMarginMode':
|
|
119341
|
+
'fetchMarginMode': true,
|
|
119342
|
+
'fetchMarginModes': false,
|
|
119221
119343
|
'fetchMarketLeverageTiers': false,
|
|
119222
119344
|
'fetchMarkets': true,
|
|
119223
119345
|
'fetchMarkOHLCV': true,
|
|
@@ -122367,6 +122489,99 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
122367
122489
|
const position = this.parsePosition(this.safeValue(response, 'result', {}));
|
|
122368
122490
|
return [position];
|
|
122369
122491
|
}
|
|
122492
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
122493
|
+
/**
|
|
122494
|
+
* @method
|
|
122495
|
+
* @name delta#fetchMarginMode
|
|
122496
|
+
* @description fetches the margin mode of a trading pair
|
|
122497
|
+
* @see https://docs.delta.exchange/#get-user
|
|
122498
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
122499
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
122500
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
122501
|
+
*/
|
|
122502
|
+
await this.loadMarkets();
|
|
122503
|
+
let market = undefined;
|
|
122504
|
+
if (symbol !== undefined) {
|
|
122505
|
+
market = this.market(symbol);
|
|
122506
|
+
}
|
|
122507
|
+
const response = await this.privateGetProfile(params);
|
|
122508
|
+
//
|
|
122509
|
+
// {
|
|
122510
|
+
// "result": {
|
|
122511
|
+
// "is_password_set": true,
|
|
122512
|
+
// "kyc_expiry_date": null,
|
|
122513
|
+
// "phishing_code": "12345",
|
|
122514
|
+
// "preferences": {
|
|
122515
|
+
// "favorites": []
|
|
122516
|
+
// },
|
|
122517
|
+
// "is_kyc_provisioned": false,
|
|
122518
|
+
// "country": "Canada",
|
|
122519
|
+
// "margin_mode": "isolated",
|
|
122520
|
+
// "mfa_updated_at": "2023-07-19T01:04:43Z",
|
|
122521
|
+
// "last_name": "",
|
|
122522
|
+
// "oauth_apple_active": false,
|
|
122523
|
+
// "pf_index_symbol": null,
|
|
122524
|
+
// "proof_of_identity_status": "approved",
|
|
122525
|
+
// "dob": null,
|
|
122526
|
+
// "email": "abc_123@gmail.com",
|
|
122527
|
+
// "force_change_password": false,
|
|
122528
|
+
// "nick_name": "still-breeze-123",
|
|
122529
|
+
// "oauth_google_active": false,
|
|
122530
|
+
// "phone_verification_status": "verified",
|
|
122531
|
+
// "id": 12345678,
|
|
122532
|
+
// "last_seen": null,
|
|
122533
|
+
// "is_withdrawal_enabled": true,
|
|
122534
|
+
// "force_change_mfa": false,
|
|
122535
|
+
// "enable_bots": false,
|
|
122536
|
+
// "kyc_verified_on": null,
|
|
122537
|
+
// "created_at": "2023-07-19T01:02:32Z",
|
|
122538
|
+
// "withdrawal_blocked_till": null,
|
|
122539
|
+
// "proof_of_address_status": "approved",
|
|
122540
|
+
// "is_password_change_blocked": false,
|
|
122541
|
+
// "is_mfa_enabled": true,
|
|
122542
|
+
// "is_kyc_done": true,
|
|
122543
|
+
// "oauth": null,
|
|
122544
|
+
// "account_name": "Main",
|
|
122545
|
+
// "sub_account_permissions": null,
|
|
122546
|
+
// "phone_number": null,
|
|
122547
|
+
// "tracking_info": {
|
|
122548
|
+
// "ga_cid": "1234.4321",
|
|
122549
|
+
// "is_kyc_gtm_tracked": true,
|
|
122550
|
+
// "sub_account_config": {
|
|
122551
|
+
// "cross": 2,
|
|
122552
|
+
// "isolated": 2,
|
|
122553
|
+
// "portfolio": 2
|
|
122554
|
+
// }
|
|
122555
|
+
// },
|
|
122556
|
+
// "first_name": "",
|
|
122557
|
+
// "phone_verified_on": null,
|
|
122558
|
+
// "seen_intro": false,
|
|
122559
|
+
// "password_updated_at": null,
|
|
122560
|
+
// "is_login_enabled": true,
|
|
122561
|
+
// "registration_date": "2023-07-19T01:02:32Z",
|
|
122562
|
+
// "permissions": {},
|
|
122563
|
+
// "max_sub_accounts_limit": 2,
|
|
122564
|
+
// "country_calling_code": null,
|
|
122565
|
+
// "is_sub_account": false,
|
|
122566
|
+
// "is_kyc_refresh_required": false
|
|
122567
|
+
// },
|
|
122568
|
+
// "success": true
|
|
122569
|
+
// }
|
|
122570
|
+
//
|
|
122571
|
+
const result = this.safeDict(response, 'result', {});
|
|
122572
|
+
return this.parseMarginMode(result, market);
|
|
122573
|
+
}
|
|
122574
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
122575
|
+
let symbol = undefined;
|
|
122576
|
+
if (market !== undefined) {
|
|
122577
|
+
symbol = market['symbol'];
|
|
122578
|
+
}
|
|
122579
|
+
return {
|
|
122580
|
+
'info': marginMode,
|
|
122581
|
+
'symbol': symbol,
|
|
122582
|
+
'marginMode': this.safeString(marginMode, 'margin_mode'),
|
|
122583
|
+
};
|
|
122584
|
+
}
|
|
122370
122585
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
122371
122586
|
const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
122372
122587
|
let url = this.urls['api'][api] + requestPath;
|
|
@@ -143648,10 +143863,10 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
143648
143863
|
'symbol': market['id'],
|
|
143649
143864
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
143650
143865
|
};
|
|
143651
|
-
[request, params] = this.handleUntilOption('till', request, params);
|
|
143652
143866
|
if (since !== undefined) {
|
|
143653
143867
|
request['from'] = this.iso8601(since);
|
|
143654
143868
|
}
|
|
143869
|
+
[request, params] = this.handleUntilOption('till', request, params);
|
|
143655
143870
|
if (limit !== undefined) {
|
|
143656
143871
|
request['limit'] = limit;
|
|
143657
143872
|
}
|
|
@@ -170407,6 +170622,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170407
170622
|
'futuresPrivate': 'https://api-futures.kucoin.com',
|
|
170408
170623
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
|
170409
170624
|
'webExchange': 'https://kucoin.com/_api',
|
|
170625
|
+
'broker': 'https://api-broker.kucoin.com',
|
|
170410
170626
|
},
|
|
170411
170627
|
'www': 'https://www.kucoin.com',
|
|
170412
170628
|
'doc': [
|
|
@@ -170520,6 +170736,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170520
170736
|
'project/marketInterestRate': 7.5,
|
|
170521
170737
|
'redeem/orders': 10,
|
|
170522
170738
|
'purchase/orders': 10,
|
|
170739
|
+
// broker
|
|
170523
170740
|
'broker/api/rebase/download': 3,
|
|
170524
170741
|
},
|
|
170525
170742
|
'post': {
|
|
@@ -170666,6 +170883,23 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
170666
170883
|
'currency/currency/chain-info': 1, // this is temporary from webApi
|
|
170667
170884
|
},
|
|
170668
170885
|
},
|
|
170886
|
+
'broker': {
|
|
170887
|
+
'get': {
|
|
170888
|
+
'broker/nd/info': 2,
|
|
170889
|
+
'broker/nd/account': 2,
|
|
170890
|
+
'broker/nd/account/apikey': 2,
|
|
170891
|
+
'broker/nd/rebase/download': 3,
|
|
170892
|
+
},
|
|
170893
|
+
'post': {
|
|
170894
|
+
'broker/nd/transfer': 1,
|
|
170895
|
+
'broker/nd/account': 3,
|
|
170896
|
+
'broker/nd/account/apikey': 3,
|
|
170897
|
+
'broker/nd/account/update-apikey': 3,
|
|
170898
|
+
},
|
|
170899
|
+
'delete': {
|
|
170900
|
+
'broker/nd/account/apikey': 3,
|
|
170901
|
+
},
|
|
170902
|
+
},
|
|
170669
170903
|
},
|
|
170670
170904
|
'timeframes': {
|
|
170671
170905
|
'1m': '1min',
|
|
@@ -171183,7 +171417,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171183
171417
|
// }
|
|
171184
171418
|
// }
|
|
171185
171419
|
//
|
|
171186
|
-
const data = this.
|
|
171420
|
+
const data = this.safeDict(response, 'data', {});
|
|
171187
171421
|
const status = this.safeString(data, 'status');
|
|
171188
171422
|
return {
|
|
171189
171423
|
'status': (status === 'open') ? 'ok' : 'maintenance',
|
|
@@ -171229,8 +171463,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171229
171463
|
// ]
|
|
171230
171464
|
// }
|
|
171231
171465
|
//
|
|
171232
|
-
const data = this.
|
|
171233
|
-
const options = this.
|
|
171466
|
+
const data = this.safeList(response, 'data');
|
|
171467
|
+
const options = this.safeDict(this.options, 'fetchMarkets', {});
|
|
171234
171468
|
const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
|
|
171235
171469
|
let tickersResponse = {};
|
|
171236
171470
|
if (fetchTickersFees) {
|
|
@@ -171264,8 +171498,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171264
171498
|
// }
|
|
171265
171499
|
// }
|
|
171266
171500
|
//
|
|
171267
|
-
const tickersData = this.
|
|
171268
|
-
const tickers = this.
|
|
171501
|
+
const tickersData = this.safeDict(tickersResponse, 'data', {});
|
|
171502
|
+
const tickers = this.safeList(tickersData, 'ticker', []);
|
|
171269
171503
|
const tickersByMarketId = this.indexBy(tickers, 'symbol');
|
|
171270
171504
|
const result = [];
|
|
171271
171505
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -171275,7 +171509,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171275
171509
|
const base = this.safeCurrencyCode(baseId);
|
|
171276
171510
|
const quote = this.safeCurrencyCode(quoteId);
|
|
171277
171511
|
// const quoteIncrement = this.safeNumber (market, 'quoteIncrement');
|
|
171278
|
-
const ticker = this.
|
|
171512
|
+
const ticker = this.safeDict(tickersByMarketId, id, {});
|
|
171279
171513
|
const makerFeeRate = this.safeString(ticker, 'makerFeeRate');
|
|
171280
171514
|
const takerFeeRate = this.safeString(ticker, 'takerFeeRate');
|
|
171281
171515
|
const makerCoefficient = this.safeString(ticker, 'makerCoefficient');
|
|
@@ -171291,11 +171525,11 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171291
171525
|
'settleId': undefined,
|
|
171292
171526
|
'type': 'spot',
|
|
171293
171527
|
'spot': true,
|
|
171294
|
-
'margin': this.
|
|
171528
|
+
'margin': this.safeBool(market, 'isMarginEnabled'),
|
|
171295
171529
|
'swap': false,
|
|
171296
171530
|
'future': false,
|
|
171297
171531
|
'option': false,
|
|
171298
|
-
'active': this.
|
|
171532
|
+
'active': this.safeBool(market, 'enableTrading'),
|
|
171299
171533
|
'contract': false,
|
|
171300
171534
|
'linear': undefined,
|
|
171301
171535
|
'inverse': undefined,
|
|
@@ -171425,7 +171659,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171425
171659
|
let isWithdrawEnabled = undefined;
|
|
171426
171660
|
let isDepositEnabled = undefined;
|
|
171427
171661
|
const networks = {};
|
|
171428
|
-
const chains = this.
|
|
171662
|
+
const chains = this.safeList(entry, 'chains', []);
|
|
171429
171663
|
const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
|
|
171430
171664
|
const rawPrecision = this.safeString(entry, 'precision');
|
|
171431
171665
|
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
@@ -171453,7 +171687,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171453
171687
|
else {
|
|
171454
171688
|
isDepositEnabled = isDepositEnabled || chainDepositEnabled;
|
|
171455
171689
|
}
|
|
171456
|
-
const chainExtraData = this.
|
|
171690
|
+
const chainExtraData = this.safeDict(extraChainsData, chainId, {});
|
|
171457
171691
|
networks[networkCode] = {
|
|
171458
171692
|
'info': chain,
|
|
171459
171693
|
'id': chainId,
|
|
@@ -171528,7 +171762,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171528
171762
|
// ]
|
|
171529
171763
|
// }
|
|
171530
171764
|
//
|
|
171531
|
-
const data = this.
|
|
171765
|
+
const data = this.safeList(response, 'data', []);
|
|
171532
171766
|
const result = [];
|
|
171533
171767
|
for (let i = 0; i < data.length; i++) {
|
|
171534
171768
|
const account = data[i];
|
|
@@ -171616,7 +171850,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171616
171850
|
// }
|
|
171617
171851
|
// }
|
|
171618
171852
|
//
|
|
171619
|
-
const data = this.
|
|
171853
|
+
const data = this.safeDict(response, 'data');
|
|
171620
171854
|
return this.parseDepositWithdrawFee(data, currency);
|
|
171621
171855
|
}
|
|
171622
171856
|
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
@@ -171647,7 +171881,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171647
171881
|
},
|
|
171648
171882
|
'networks': {},
|
|
171649
171883
|
};
|
|
171650
|
-
const isWithdrawEnabled = this.
|
|
171884
|
+
const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
|
|
171651
171885
|
if (isWithdrawEnabled) {
|
|
171652
171886
|
result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
|
|
171653
171887
|
result['withdraw']['percentage'] = false;
|
|
@@ -171674,7 +171908,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171674
171908
|
//
|
|
171675
171909
|
const defaultType = this.safeString2(this.options, methodName, 'defaultType', 'trade');
|
|
171676
171910
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
171677
|
-
const accountsByType = this.
|
|
171911
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
171678
171912
|
const type = this.safeString(accountsByType, requestedType);
|
|
171679
171913
|
if (type === undefined) {
|
|
171680
171914
|
const keys = Object.keys(accountsByType);
|
|
@@ -171815,8 +172049,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171815
172049
|
// }
|
|
171816
172050
|
// }
|
|
171817
172051
|
//
|
|
171818
|
-
const data = this.
|
|
171819
|
-
const tickers = this.
|
|
172052
|
+
const data = this.safeDict(response, 'data', {});
|
|
172053
|
+
const tickers = this.safeList(data, 'ticker', []);
|
|
171820
172054
|
const time = this.safeInteger(data, 'time');
|
|
171821
172055
|
const result = {};
|
|
171822
172056
|
for (let i = 0; i < tickers.length; i++) {
|
|
@@ -171946,7 +172180,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171946
172180
|
// ]
|
|
171947
172181
|
// }
|
|
171948
172182
|
//
|
|
171949
|
-
const data = this.
|
|
172183
|
+
const data = this.safeList(response, 'data', []);
|
|
171950
172184
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
171951
172185
|
}
|
|
171952
172186
|
async createDepositAddress(code, params = {}) {
|
|
@@ -171974,7 +172208,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
171974
172208
|
// {"code":"260000","msg":"Deposit address already exists."}
|
|
171975
172209
|
// BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
|
171976
172210
|
// BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
|
171977
|
-
const data = this.
|
|
172211
|
+
const data = this.safeDict(response, 'data', {});
|
|
171978
172212
|
return this.parseDepositAddress(data, currency);
|
|
171979
172213
|
}
|
|
171980
172214
|
async fetchDepositAddress(code, params = {}) {
|
|
@@ -172069,7 +172303,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172069
172303
|
// }
|
|
172070
172304
|
//
|
|
172071
172305
|
this.options['versions']['private']['GET']['deposit-addresses'] = version;
|
|
172072
|
-
const chains = this.
|
|
172306
|
+
const chains = this.safeList(response, 'data', []);
|
|
172073
172307
|
const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
|
|
172074
172308
|
'currency': currency['id'],
|
|
172075
172309
|
});
|
|
@@ -172142,7 +172376,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172142
172376
|
// ]
|
|
172143
172377
|
// }
|
|
172144
172378
|
//
|
|
172145
|
-
const data = this.
|
|
172379
|
+
const data = this.safeDict(response, 'data', {});
|
|
172146
172380
|
const timestamp = this.safeInteger(data, 'time');
|
|
172147
172381
|
const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1);
|
|
172148
172382
|
orderbook['nonce'] = this.safeInteger(data, 'sequence');
|
|
@@ -172244,7 +172478,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172244
172478
|
// }
|
|
172245
172479
|
// }
|
|
172246
172480
|
//
|
|
172247
|
-
const data = this.
|
|
172481
|
+
const data = this.safeDict(response, 'data', {});
|
|
172248
172482
|
return this.parseOrder(data, market);
|
|
172249
172483
|
}
|
|
172250
172484
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
@@ -172372,8 +172606,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172372
172606
|
// },
|
|
172373
172607
|
// }
|
|
172374
172608
|
//
|
|
172375
|
-
let data = this.
|
|
172376
|
-
data = this.
|
|
172609
|
+
let data = this.safeDict(response, 'data', {});
|
|
172610
|
+
data = this.safeList(data, 'data', []);
|
|
172377
172611
|
return this.parseOrders(data);
|
|
172378
172612
|
}
|
|
172379
172613
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -172490,7 +172724,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172490
172724
|
// }
|
|
172491
172725
|
// }
|
|
172492
172726
|
//
|
|
172493
|
-
const data = this.
|
|
172727
|
+
const data = this.safeDict(response, 'data', {});
|
|
172494
172728
|
return this.parseOrder(data, market);
|
|
172495
172729
|
}
|
|
172496
172730
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -172514,7 +172748,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172514
172748
|
await this.loadMarkets();
|
|
172515
172749
|
const request = {};
|
|
172516
172750
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
172517
|
-
const stop = this.
|
|
172751
|
+
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
172518
172752
|
const hf = this.safeBool(params, 'hf', false);
|
|
172519
172753
|
if (hf) {
|
|
172520
172754
|
if (symbol === undefined) {
|
|
@@ -172714,7 +172948,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172714
172948
|
// ]
|
|
172715
172949
|
// }
|
|
172716
172950
|
// }
|
|
172717
|
-
const responseData = this.
|
|
172951
|
+
const responseData = this.safeDict(response, 'data', {});
|
|
172718
172952
|
const orders = this.safeValue(responseData, 'items', responseData);
|
|
172719
172953
|
return this.parseOrders(orders, market, since, limit);
|
|
172720
172954
|
}
|
|
@@ -172850,7 +173084,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172850
173084
|
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
172851
173085
|
}
|
|
172852
173086
|
}
|
|
172853
|
-
let responseData = this.
|
|
173087
|
+
let responseData = this.safeDict(response, 'data', {});
|
|
172854
173088
|
if (Array.isArray(responseData)) {
|
|
172855
173089
|
responseData = this.safeValue(responseData, 0);
|
|
172856
173090
|
}
|
|
@@ -172985,7 +173219,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172985
173219
|
const responseStop = this.safeString(order, 'stop');
|
|
172986
173220
|
const stop = responseStop !== undefined;
|
|
172987
173221
|
const stopTriggered = this.safeBool(order, 'stopTriggered', false);
|
|
172988
|
-
const isActive = this.
|
|
173222
|
+
const isActive = this.safeBool2(order, 'isActive', 'active');
|
|
172989
173223
|
const responseStatus = this.safeString(order, 'status');
|
|
172990
173224
|
let status = undefined;
|
|
172991
173225
|
if (isActive !== undefined) {
|
|
@@ -173018,7 +173252,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173018
173252
|
'symbol': this.safeSymbol(marketId, market, '-'),
|
|
173019
173253
|
'type': this.safeString(order, 'type'),
|
|
173020
173254
|
'timeInForce': this.safeString(order, 'timeInForce'),
|
|
173021
|
-
'postOnly': this.
|
|
173255
|
+
'postOnly': this.safeBool(order, 'postOnly'),
|
|
173022
173256
|
'side': this.safeString(order, 'side'),
|
|
173023
173257
|
'amount': this.safeString(order, 'size'),
|
|
173024
173258
|
'price': this.safeString(order, 'price'),
|
|
@@ -173158,13 +173392,13 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173158
173392
|
// ]
|
|
173159
173393
|
// }
|
|
173160
173394
|
//
|
|
173161
|
-
const data = this.
|
|
173395
|
+
const data = this.safeDict(response, 'data', {});
|
|
173162
173396
|
let trades = undefined;
|
|
173163
173397
|
if (parseResponseData) {
|
|
173164
173398
|
trades = data;
|
|
173165
173399
|
}
|
|
173166
173400
|
else {
|
|
173167
|
-
trades = this.
|
|
173401
|
+
trades = this.safeList(data, 'items', []);
|
|
173168
173402
|
}
|
|
173169
173403
|
return this.parseTrades(trades, market, since, limit);
|
|
173170
173404
|
}
|
|
@@ -173207,7 +173441,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173207
173441
|
// ]
|
|
173208
173442
|
// }
|
|
173209
173443
|
//
|
|
173210
|
-
const trades = this.
|
|
173444
|
+
const trades = this.safeList(response, 'data', []);
|
|
173211
173445
|
return this.parseTrades(trades, market, since, limit);
|
|
173212
173446
|
}
|
|
173213
173447
|
parseTrade(trade, market = undefined) {
|
|
@@ -173369,8 +173603,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173369
173603
|
// ]
|
|
173370
173604
|
// }
|
|
173371
173605
|
//
|
|
173372
|
-
const data = this.
|
|
173373
|
-
const first = this.
|
|
173606
|
+
const data = this.safeList(response, 'data', []);
|
|
173607
|
+
const first = this.safeDict(data, 0);
|
|
173374
173608
|
const marketId = this.safeString(first, 'symbol');
|
|
173375
173609
|
return {
|
|
173376
173610
|
'info': response,
|
|
@@ -173431,7 +173665,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173431
173665
|
// }
|
|
173432
173666
|
// }
|
|
173433
173667
|
//
|
|
173434
|
-
const data = this.
|
|
173668
|
+
const data = this.safeDict(response, 'data', {});
|
|
173435
173669
|
return this.parseTransaction(data, currency);
|
|
173436
173670
|
}
|
|
173437
173671
|
parseTransactionStatus(status) {
|
|
@@ -173531,7 +173765,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173531
173765
|
updated = updated * 1000;
|
|
173532
173766
|
}
|
|
173533
173767
|
}
|
|
173534
|
-
const internal = this.
|
|
173768
|
+
const internal = this.safeBool(transaction, 'isInner');
|
|
173535
173769
|
const tag = this.safeString(transaction, 'memo');
|
|
173536
173770
|
return {
|
|
173537
173771
|
'info': transaction,
|
|
@@ -173757,7 +173991,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173757
173991
|
}
|
|
173758
173992
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
173759
173993
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
173760
|
-
const accountsByType = this.
|
|
173994
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
173761
173995
|
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
173762
173996
|
params = this.omit(params, 'type');
|
|
173763
173997
|
const isHf = this.safeBool(params, 'hf', false);
|
|
@@ -173839,7 +174073,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173839
174073
|
// }
|
|
173840
174074
|
// }
|
|
173841
174075
|
//
|
|
173842
|
-
const data = this.
|
|
174076
|
+
const data = this.safeList(response, 'data', []);
|
|
173843
174077
|
const result = {
|
|
173844
174078
|
'info': response,
|
|
173845
174079
|
'timestamp': undefined,
|
|
@@ -173851,8 +174085,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173851
174085
|
const entry = assets[i];
|
|
173852
174086
|
const marketId = this.safeString(entry, 'symbol');
|
|
173853
174087
|
const symbol = this.safeSymbol(marketId, undefined, '_');
|
|
173854
|
-
const base = this.
|
|
173855
|
-
const quote = this.
|
|
174088
|
+
const base = this.safeDict(entry, 'baseAsset', {});
|
|
174089
|
+
const quote = this.safeDict(entry, 'quoteAsset', {});
|
|
173856
174090
|
const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
|
|
173857
174091
|
const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
|
|
173858
174092
|
const subResult = {};
|
|
@@ -173862,7 +174096,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173862
174096
|
}
|
|
173863
174097
|
}
|
|
173864
174098
|
else if (cross) {
|
|
173865
|
-
const accounts = this.
|
|
174099
|
+
const accounts = this.safeList(data, 'accounts', []);
|
|
173866
174100
|
for (let i = 0; i < accounts.length; i++) {
|
|
173867
174101
|
const balance = accounts[i];
|
|
173868
174102
|
const currencyId = this.safeString(balance, 'currency');
|
|
@@ -173947,7 +174181,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173947
174181
|
// }
|
|
173948
174182
|
// }
|
|
173949
174183
|
//
|
|
173950
|
-
const data = this.
|
|
174184
|
+
const data = this.safeDict(response, 'data');
|
|
173951
174185
|
return this.parseTransfer(data, currency);
|
|
173952
174186
|
}
|
|
173953
174187
|
else {
|
|
@@ -173979,7 +174213,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
173979
174213
|
// }
|
|
173980
174214
|
// }
|
|
173981
174215
|
//
|
|
173982
|
-
const data = this.
|
|
174216
|
+
const data = this.safeDict(response, 'data');
|
|
173983
174217
|
return this.parseTransfer(data, currency);
|
|
173984
174218
|
}
|
|
173985
174219
|
}
|
|
@@ -174023,7 +174257,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174023
174257
|
const rawStatus = this.safeString(transfer, 'status');
|
|
174024
174258
|
const accountFromRaw = this.safeStringLower(transfer, 'payAccountType');
|
|
174025
174259
|
const accountToRaw = this.safeStringLower(transfer, 'recAccountType');
|
|
174026
|
-
const accountsByType = this.
|
|
174260
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
174027
174261
|
const accountFrom = this.safeString(accountsByType, accountFromRaw, accountFromRaw);
|
|
174028
174262
|
const accountTo = this.safeString(accountsByType, accountToRaw, accountToRaw);
|
|
174029
174263
|
return {
|
|
@@ -174193,7 +174427,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174193
174427
|
await this.loadAccounts();
|
|
174194
174428
|
let paginate = false;
|
|
174195
174429
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
174196
|
-
const isHf = this.
|
|
174430
|
+
const isHf = this.safeBool(params, 'hf');
|
|
174197
174431
|
params = this.omit(params, 'hf');
|
|
174198
174432
|
if (paginate) {
|
|
174199
174433
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
@@ -174275,9 +174509,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174275
174509
|
return this.parseLedger(items, currency, since, limit);
|
|
174276
174510
|
}
|
|
174277
174511
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
174278
|
-
const versions = this.
|
|
174279
|
-
const apiVersions = this.
|
|
174280
|
-
const methodVersions = this.
|
|
174512
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
174513
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
174514
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
174281
174515
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
174282
174516
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
174283
174517
|
if (version === 'v3' && ('v3' in config)) {
|
|
@@ -174421,8 +174655,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174421
174655
|
// }
|
|
174422
174656
|
// }
|
|
174423
174657
|
//
|
|
174424
|
-
const data = this.
|
|
174425
|
-
const assets = (marginMode === 'isolated') ? this.
|
|
174658
|
+
const data = this.safeDict(response, 'data', {});
|
|
174659
|
+
const assets = (marginMode === 'isolated') ? this.safeList(data, 'assets', []) : this.safeList(data, 'accounts', []);
|
|
174426
174660
|
return this.parseBorrowInterests(assets, undefined);
|
|
174427
174661
|
}
|
|
174428
174662
|
parseBorrowInterest(info, market = undefined) {
|
|
@@ -174475,7 +174709,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174475
174709
|
market = this.safeMarket(marketId, market);
|
|
174476
174710
|
const symbol = this.safeString(market, 'symbol');
|
|
174477
174711
|
const timestamp = this.safeInteger(info, 'createdAt');
|
|
174478
|
-
const isolatedBase = this.
|
|
174712
|
+
const isolatedBase = this.safeDict(info, 'baseAsset', {});
|
|
174479
174713
|
let amountBorrowed = undefined;
|
|
174480
174714
|
let interest = undefined;
|
|
174481
174715
|
let currencyId = undefined;
|
|
@@ -174533,7 +174767,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174533
174767
|
// }
|
|
174534
174768
|
// }
|
|
174535
174769
|
//
|
|
174536
|
-
const data = this.
|
|
174770
|
+
const data = this.safeDict(response, 'data', {});
|
|
174537
174771
|
return this.parseMarginLoan(data, currency);
|
|
174538
174772
|
}
|
|
174539
174773
|
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -174572,7 +174806,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174572
174806
|
// }
|
|
174573
174807
|
// }
|
|
174574
174808
|
//
|
|
174575
|
-
const data = this.
|
|
174809
|
+
const data = this.safeDict(response, 'data', {});
|
|
174576
174810
|
return this.parseMarginLoan(data, currency);
|
|
174577
174811
|
}
|
|
174578
174812
|
async repayCrossMargin(code, amount, params = {}) {
|
|
@@ -174605,7 +174839,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174605
174839
|
// }
|
|
174606
174840
|
// }
|
|
174607
174841
|
//
|
|
174608
|
-
const data = this.
|
|
174842
|
+
const data = this.safeDict(response, 'data', {});
|
|
174609
174843
|
return this.parseMarginLoan(data, currency);
|
|
174610
174844
|
}
|
|
174611
174845
|
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -174642,7 +174876,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174642
174876
|
// }
|
|
174643
174877
|
// }
|
|
174644
174878
|
//
|
|
174645
|
-
const data = this.
|
|
174879
|
+
const data = this.safeDict(response, 'data', {});
|
|
174646
174880
|
return this.parseMarginLoan(data, currency);
|
|
174647
174881
|
}
|
|
174648
174882
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -174694,7 +174928,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174694
174928
|
// },
|
|
174695
174929
|
// ]
|
|
174696
174930
|
//
|
|
174697
|
-
const data = this.
|
|
174931
|
+
const data = this.safeList(response, 'data', []);
|
|
174698
174932
|
return this.parseDepositWithdrawFees(data, codes, 'currency');
|
|
174699
174933
|
}
|
|
174700
174934
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
@@ -174703,9 +174937,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174703
174937
|
// ↑ ↑
|
|
174704
174938
|
// ↑ ↑
|
|
174705
174939
|
//
|
|
174706
|
-
const versions = this.
|
|
174707
|
-
const apiVersions = this.
|
|
174708
|
-
const methodVersions = this.
|
|
174940
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
174941
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
174942
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
174709
174943
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
174710
174944
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
174711
174945
|
params = this.omit(params, 'version');
|
|
@@ -174730,7 +174964,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174730
174964
|
url = url + endpoint;
|
|
174731
174965
|
const isFuturePrivate = (api === 'futuresPrivate');
|
|
174732
174966
|
const isPrivate = (api === 'private');
|
|
174733
|
-
|
|
174967
|
+
const isBroker = (api === 'private');
|
|
174968
|
+
if (isPrivate || isFuturePrivate || isBroker) {
|
|
174734
174969
|
this.checkRequiredCredentials();
|
|
174735
174970
|
const timestamp = this.nonce().toString();
|
|
174736
174971
|
headers = this.extend({
|
|
@@ -174749,7 +174984,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174749
174984
|
const payload = timestamp + method + endpoint + endpart;
|
|
174750
174985
|
const signature = this.hmac(this.encode(payload), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J, 'base64');
|
|
174751
174986
|
headers['KC-API-SIGN'] = signature;
|
|
174752
|
-
let partner = this.
|
|
174987
|
+
let partner = this.safeDict(this.options, 'partner', {});
|
|
174753
174988
|
partner = isFuturePrivate ? this.safeValue(partner, 'future', partner) : this.safeValue(partner, 'spot', partner);
|
|
174754
174989
|
const partnerId = this.safeString(partner, 'id');
|
|
174755
174990
|
const partnerSecret = this.safeString2(partner, 'secret', 'key');
|
|
@@ -174759,6 +174994,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
174759
174994
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature;
|
|
174760
174995
|
headers['KC-API-PARTNER'] = partnerId;
|
|
174761
174996
|
}
|
|
174997
|
+
if (isBroker) {
|
|
174998
|
+
const brokerName = this.safeString(partner, 'name');
|
|
174999
|
+
headers['KC-BROKER-NAME'] = brokerName;
|
|
175000
|
+
}
|
|
174762
175001
|
}
|
|
174763
175002
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
174764
175003
|
}
|
|
@@ -228437,11 +228676,12 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
228437
228676
|
const messageLength = message.length;
|
|
228438
228677
|
if (messageLength === 2) {
|
|
228439
228678
|
// initial snapshot
|
|
228440
|
-
|
|
228679
|
+
const trades = this.safeList(message, 1, []);
|
|
228441
228680
|
// needs to be reversed to make chronological order
|
|
228442
|
-
|
|
228443
|
-
for (let i = 0; i <
|
|
228444
|
-
const
|
|
228681
|
+
const length = trades.length;
|
|
228682
|
+
for (let i = 0; i < length; i++) {
|
|
228683
|
+
const index = length - i - 1;
|
|
228684
|
+
const parsed = this.parseWsTrade(trades[index], market);
|
|
228445
228685
|
stored.append(parsed);
|
|
228446
228686
|
}
|
|
228447
228687
|
}
|
|
@@ -229955,10 +230195,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
229955
230195
|
}
|
|
229956
230196
|
const data = this.safeList(message, 'data', []);
|
|
229957
230197
|
const length = data.length;
|
|
229958
|
-
const maxLength = Math.max(length - 1, 0);
|
|
229959
230198
|
// fix chronological order by reversing
|
|
229960
|
-
for (let i =
|
|
229961
|
-
const
|
|
230199
|
+
for (let i = 0; i < length; i++) {
|
|
230200
|
+
const index = length - i - 1;
|
|
230201
|
+
const rawTrade = data[index];
|
|
229962
230202
|
const parsed = this.parseWsTrade(rawTrade, market);
|
|
229963
230203
|
stored.append(parsed);
|
|
229964
230204
|
}
|
|
@@ -231877,9 +232117,9 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
231877
232117
|
const isSwap = ('group' in message);
|
|
231878
232118
|
if (isSwap) {
|
|
231879
232119
|
// in swap, chronologically decreasing: 1709536849322, 1709536848954,
|
|
231880
|
-
|
|
231881
|
-
|
|
231882
|
-
symbol = this.handleTradeLoop(data[
|
|
232120
|
+
for (let i = 0; i < length; i++) {
|
|
232121
|
+
const index = length - i - 1;
|
|
232122
|
+
symbol = this.handleTradeLoop(data[index]);
|
|
231883
232123
|
}
|
|
231884
232124
|
}
|
|
231885
232125
|
else {
|
|
@@ -232521,7 +232761,17 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
232521
232761
|
}
|
|
232522
232762
|
//
|
|
232523
232763
|
// {"event":"error","message":"Unrecognized request: {\"event\":\"subscribe\",\"channel\":\"spot/depth:BTC-USDT\"}","errorCode":30039}
|
|
232524
|
-
//
|
|
232764
|
+
//
|
|
232765
|
+
// subscribe events on spot:
|
|
232766
|
+
//
|
|
232767
|
+
// {"event":"subscribe", "topic":"spot/kline1m:BTC_USDT" }
|
|
232768
|
+
//
|
|
232769
|
+
// subscribe on contracts:
|
|
232770
|
+
//
|
|
232771
|
+
// {"action":"subscribe", "group":"futures/klineBin1m:BTCUSDT", "success":true, "request":{"action":"subscribe", "args":[ "futures/klineBin1m:BTCUSDT" ] } }
|
|
232772
|
+
//
|
|
232773
|
+
// regular updates - spot
|
|
232774
|
+
//
|
|
232525
232775
|
// {
|
|
232526
232776
|
// "table": "spot/depth",
|
|
232527
232777
|
// "action": "partial",
|
|
@@ -232542,10 +232792,21 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
232542
232792
|
// ]
|
|
232543
232793
|
// }
|
|
232544
232794
|
//
|
|
232795
|
+
// regular updates - contracts
|
|
232796
|
+
//
|
|
232797
|
+
// {
|
|
232798
|
+
// group: "futures/klineBin1m:BTCUSDT",
|
|
232799
|
+
// data: {
|
|
232800
|
+
// symbol: "BTCUSDT",
|
|
232801
|
+
// items: [ { o: "67944.7", "h": .... } ],
|
|
232802
|
+
// },
|
|
232803
|
+
// }
|
|
232804
|
+
//
|
|
232545
232805
|
// { data: '', table: "spot/user/order" }
|
|
232546
232806
|
//
|
|
232547
|
-
|
|
232548
|
-
|
|
232807
|
+
// the only realiable way (for both spot & swap) is to check 'data' key
|
|
232808
|
+
const isDataUpdate = ('data' in message);
|
|
232809
|
+
if (!isDataUpdate) {
|
|
232549
232810
|
const event = this.safeString2(message, 'event', 'action');
|
|
232550
232811
|
if (event !== undefined) {
|
|
232551
232812
|
const methods = {
|
|
@@ -232561,6 +232822,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
232561
232822
|
}
|
|
232562
232823
|
}
|
|
232563
232824
|
else {
|
|
232825
|
+
const channel = this.safeString2(message, 'table', 'group');
|
|
232564
232826
|
const methods = {
|
|
232565
232827
|
'depth': this.handleOrderBook,
|
|
232566
232828
|
'ticker': this.handleTicker,
|
|
@@ -245798,7 +246060,7 @@ class currencycom extends _currencycom_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
245798
246060
|
'fee': undefined,
|
|
245799
246061
|
};
|
|
245800
246062
|
}
|
|
245801
|
-
handleTrades(client, message
|
|
246063
|
+
handleTrades(client, message) {
|
|
245802
246064
|
//
|
|
245803
246065
|
// {
|
|
245804
246066
|
// "status": "OK",
|
|
@@ -316543,7 +316805,7 @@ SOFTWARE.
|
|
|
316543
316805
|
|
|
316544
316806
|
//-----------------------------------------------------------------------------
|
|
316545
316807
|
// this is updated by vss.js when building
|
|
316546
|
-
const version = '4.2.
|
|
316808
|
+
const version = '4.2.66';
|
|
316547
316809
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
316548
316810
|
//-----------------------------------------------------------------------------
|
|
316549
316811
|
|