ccxt 4.2.58 → 4.2.60
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/CHANGELOG.md +83 -0
- package/README.md +3 -3
- package/build.sh +1 -1
- package/cleanup.sh +3 -0
- package/dist/ccxt.browser.js +716 -382
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/base/Exchange.js +2 -0
- package/dist/cjs/src/binance.js +2 -2
- package/dist/cjs/src/bingx.js +41 -3
- package/dist/cjs/src/bitfinex2.js +21 -4
- package/dist/cjs/src/bitget.js +10 -3
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/blofin.js +60 -2
- package/dist/cjs/src/coinbase.js +24 -14
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/kraken.js +42 -39
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/binance.js +17 -4
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +51 -89
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinex.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/deribit.js +201 -84
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/mexc.js +5 -3
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/wazirx.js +6 -1
- package/dist/cjs/src/woo.js +159 -79
- 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/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/base/Exchange.js +2 -0
- package/js/src/binance.js +2 -2
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +41 -3
- package/js/src/bitfinex2.js +21 -4
- package/js/src/bitget.js +10 -3
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/bitmex.js +1 -1
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +60 -2
- package/js/src/coinbase.js +24 -14
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/kraken.js +42 -39
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +1 -1
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +1 -1
- package/js/src/pro/binance.js +17 -4
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.d.ts +2 -2
- package/js/src/pro/bitmart.js +51 -89
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinex.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/deribit.d.ts +5 -0
- package/js/src/pro/deribit.js +202 -85
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/independentreserve.js +1 -1
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/mexc.js +6 -4
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/wazirx.js +6 -1
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +159 -79
- package/package.json +1 -1
- package/skip-tests.json +44 -18
package/dist/ccxt.browser.js
CHANGED
|
@@ -4394,11 +4394,10 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
4394
4394
|
];
|
|
4395
4395
|
}
|
|
4396
4396
|
parseBalance(response) {
|
|
4397
|
-
const timestamp = this.milliseconds();
|
|
4398
4397
|
const result = {
|
|
4399
4398
|
'info': response,
|
|
4400
|
-
'timestamp':
|
|
4401
|
-
'datetime':
|
|
4399
|
+
'timestamp': undefined,
|
|
4400
|
+
'datetime': undefined,
|
|
4402
4401
|
};
|
|
4403
4402
|
const balances = this.safeValue(response, 'data', []);
|
|
4404
4403
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -4412,11 +4411,10 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
4412
4411
|
return this.safeBalance(result);
|
|
4413
4412
|
}
|
|
4414
4413
|
parseMarginBalance(response) {
|
|
4415
|
-
const timestamp = this.milliseconds();
|
|
4416
4414
|
const result = {
|
|
4417
4415
|
'info': response,
|
|
4418
|
-
'timestamp':
|
|
4419
|
-
'datetime':
|
|
4416
|
+
'timestamp': undefined,
|
|
4417
|
+
'datetime': undefined,
|
|
4420
4418
|
};
|
|
4421
4419
|
const balances = this.safeValue(response, 'data', []);
|
|
4422
4420
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -4433,11 +4431,10 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
4433
4431
|
return this.safeBalance(result);
|
|
4434
4432
|
}
|
|
4435
4433
|
parseSwapBalance(response) {
|
|
4436
|
-
const timestamp = this.milliseconds();
|
|
4437
4434
|
const result = {
|
|
4438
4435
|
'info': response,
|
|
4439
|
-
'timestamp':
|
|
4440
|
-
'datetime':
|
|
4436
|
+
'timestamp': undefined,
|
|
4437
|
+
'datetime': undefined,
|
|
4441
4438
|
};
|
|
4442
4439
|
const data = this.safeValue(response, 'data', {});
|
|
4443
4440
|
const collaterals = this.safeValue(data, 'collaterals', []);
|
|
@@ -4459,6 +4456,8 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
4459
4456
|
* @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
|
|
4460
4457
|
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
4461
4458
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4459
|
+
* @param {string} [params.type] wallet type, 'spot', 'margin', or 'swap'
|
|
4460
|
+
* @param {string} [params.marginMode] 'cross' or undefined, for spot margin trading, value of 'isolated' is invalid
|
|
4462
4461
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
4463
4462
|
*/
|
|
4464
4463
|
await this.loadMarkets();
|
|
@@ -6821,12 +6820,11 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
6821
6820
|
//
|
|
6822
6821
|
const status = this.safeInteger(transfer, 'code');
|
|
6823
6822
|
const currencyCode = this.safeCurrencyCode(undefined, currency);
|
|
6824
|
-
const timestamp = this.milliseconds();
|
|
6825
6823
|
return {
|
|
6826
6824
|
'info': transfer,
|
|
6827
6825
|
'id': undefined,
|
|
6828
|
-
'timestamp':
|
|
6829
|
-
'datetime':
|
|
6826
|
+
'timestamp': undefined,
|
|
6827
|
+
'datetime': undefined,
|
|
6830
6828
|
'currency': currencyCode,
|
|
6831
6829
|
'amount': undefined,
|
|
6832
6830
|
'fromAccount': undefined,
|
|
@@ -10914,6 +10912,8 @@ class Exchange {
|
|
|
10914
10912
|
params = this.omit(params, [optionName, defaultOptionName]);
|
|
10915
10913
|
}
|
|
10916
10914
|
else {
|
|
10915
|
+
// handle routed methods like "watchTrades > watchTradesForSymbols" (or "watchTicker > watchTickers")
|
|
10916
|
+
[methodName, params] = this.handleParamString(params, 'callerMethodName', methodName);
|
|
10917
10917
|
// check if exchange has properties for this method
|
|
10918
10918
|
const exchangeWideMethodOptions = this.safeValue(this.options, methodName);
|
|
10919
10919
|
if (exchangeWideMethodOptions !== undefined) {
|
|
@@ -22948,7 +22948,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22948
22948
|
let stopPriceIsRequired = false;
|
|
22949
22949
|
let quantityIsRequired = false;
|
|
22950
22950
|
if (uppercaseType === 'MARKET') {
|
|
22951
|
-
const quoteOrderQty = this.
|
|
22951
|
+
const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
|
|
22952
22952
|
if (quoteOrderQty) {
|
|
22953
22953
|
const quoteOrderQtyNew = this.safeValue2(params, 'quoteOrderQty', 'cost');
|
|
22954
22954
|
const precision = market['precision']['price'];
|
|
@@ -28456,7 +28456,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
28456
28456
|
// POST https://fapi.binance.com/fapi/v1/marginType 400 Bad Request
|
|
28457
28457
|
// binanceusdm
|
|
28458
28458
|
if (e instanceof _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.MarginModeAlreadySet) {
|
|
28459
|
-
const throwMarginModeAlreadySet = this.
|
|
28459
|
+
const throwMarginModeAlreadySet = this.safeBool(this.options, 'throwMarginModeAlreadySet', false);
|
|
28460
28460
|
if (throwMarginModeAlreadySet) {
|
|
28461
28461
|
throw e;
|
|
28462
28462
|
}
|
|
@@ -30871,6 +30871,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30871
30871
|
'fetchFundingRates': true,
|
|
30872
30872
|
'fetchLeverage': true,
|
|
30873
30873
|
'fetchLiquidations': false,
|
|
30874
|
+
'fetchMarginMode': true,
|
|
30874
30875
|
'fetchMarkets': true,
|
|
30875
30876
|
'fetchMarkOHLCV': true,
|
|
30876
30877
|
'fetchMyLiquidations': true,
|
|
@@ -31261,7 +31262,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31261
31262
|
if (!this.checkRequiredCredentials(false)) {
|
|
31262
31263
|
return undefined;
|
|
31263
31264
|
}
|
|
31264
|
-
const isSandbox = this.
|
|
31265
|
+
const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
|
|
31265
31266
|
if (isSandbox) {
|
|
31266
31267
|
return undefined;
|
|
31267
31268
|
}
|
|
@@ -31505,7 +31506,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31505
31506
|
* @returns {object[]} an array of objects representing market data
|
|
31506
31507
|
*/
|
|
31507
31508
|
const requests = [this.fetchSwapMarkets(params)];
|
|
31508
|
-
const isSandbox = this.
|
|
31509
|
+
const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
|
|
31509
31510
|
if (!isSandbox) {
|
|
31510
31511
|
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
31511
31512
|
}
|
|
@@ -34978,11 +34979,48 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34978
34979
|
const data = this.safeDict(response, 'data');
|
|
34979
34980
|
return this.parseOrder(data, market);
|
|
34980
34981
|
}
|
|
34982
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
34983
|
+
/**
|
|
34984
|
+
* @method
|
|
34985
|
+
* @name bingx#fetchMarginMode
|
|
34986
|
+
* @description fetches the margin mode of the trading pair
|
|
34987
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
|
|
34988
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
34989
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
34990
|
+
* @returns {object} Struct of MarginMode
|
|
34991
|
+
*/
|
|
34992
|
+
await this.loadMarkets();
|
|
34993
|
+
const market = this.market(symbol);
|
|
34994
|
+
const request = {
|
|
34995
|
+
'symbol': market['id'],
|
|
34996
|
+
};
|
|
34997
|
+
const response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
|
|
34998
|
+
//
|
|
34999
|
+
// {
|
|
35000
|
+
// "code": 0,
|
|
35001
|
+
// "msg": "",
|
|
35002
|
+
// "data": {
|
|
35003
|
+
// "marginType": "CROSSED"
|
|
35004
|
+
// }
|
|
35005
|
+
// }
|
|
35006
|
+
//
|
|
35007
|
+
const data = this.safeDict(response, 'data', {});
|
|
35008
|
+
return this.parseMarginMode(data, market);
|
|
35009
|
+
}
|
|
35010
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
35011
|
+
let marginType = this.safeStringLower(marginMode, 'marginType');
|
|
35012
|
+
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
35013
|
+
return {
|
|
35014
|
+
'info': marginMode,
|
|
35015
|
+
'symbol': market['symbol'],
|
|
35016
|
+
'marginMode': marginType,
|
|
35017
|
+
};
|
|
35018
|
+
}
|
|
34981
35019
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
34982
35020
|
const type = section[0];
|
|
34983
35021
|
const version = section[1];
|
|
34984
35022
|
const access = section[2];
|
|
34985
|
-
const isSandbox = this.
|
|
35023
|
+
const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
|
|
34986
35024
|
if (isSandbox && (type !== 'swap')) {
|
|
34987
35025
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
|
|
34988
35026
|
}
|
|
@@ -40024,8 +40062,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
40024
40062
|
'spot': true,
|
|
40025
40063
|
'margin': true,
|
|
40026
40064
|
'swap': true,
|
|
40027
|
-
'future':
|
|
40028
|
-
'option':
|
|
40065
|
+
'future': false,
|
|
40066
|
+
'option': false,
|
|
40029
40067
|
'addMargin': false,
|
|
40030
40068
|
'borrowCrossMargin': false,
|
|
40031
40069
|
'borrowIsolatedMargin': false,
|
|
@@ -40036,6 +40074,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
40036
40074
|
'createLimitOrder': true,
|
|
40037
40075
|
'createMarketOrder': true,
|
|
40038
40076
|
'createOrder': true,
|
|
40077
|
+
'createPostOnlyOrder': true,
|
|
40039
40078
|
'createReduceOnlyOrder': true,
|
|
40040
40079
|
'createStopLimitOrder': true,
|
|
40041
40080
|
'createStopMarketOrder': true,
|
|
@@ -40046,8 +40085,11 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
40046
40085
|
'editOrder': true,
|
|
40047
40086
|
'fetchBalance': true,
|
|
40048
40087
|
'fetchBorrowInterest': false,
|
|
40049
|
-
'
|
|
40088
|
+
'fetchBorrowRate': false,
|
|
40050
40089
|
'fetchBorrowRateHistory': false,
|
|
40090
|
+
'fetchBorrowRateHistories': false,
|
|
40091
|
+
'fetchBorrowRates': false,
|
|
40092
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
40051
40093
|
'fetchClosedOrder': true,
|
|
40052
40094
|
'fetchClosedOrders': true,
|
|
40053
40095
|
'fetchCrossBorrowRate': false,
|
|
@@ -40076,6 +40118,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
40076
40118
|
'fetchOpenOrder': true,
|
|
40077
40119
|
'fetchOpenOrders': true,
|
|
40078
40120
|
'fetchOrder': true,
|
|
40121
|
+
'fetchOrderBook': true,
|
|
40122
|
+
'fetchOrderBooks': false,
|
|
40079
40123
|
'fetchOrderTrades': true,
|
|
40080
40124
|
'fetchPosition': false,
|
|
40081
40125
|
'fetchPositionMode': false,
|
|
@@ -40095,6 +40139,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
40095
40139
|
'setMargin': true,
|
|
40096
40140
|
'setMarginMode': false,
|
|
40097
40141
|
'setPositionMode': false,
|
|
40142
|
+
'signIn': false,
|
|
40143
|
+
'transfer': true,
|
|
40098
40144
|
'withdraw': true,
|
|
40099
40145
|
},
|
|
40100
40146
|
'timeframes': {
|
|
@@ -41527,7 +41573,16 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
41527
41573
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
41528
41574
|
* @param {float} [price] the price of the order, in units of the quote currency, ignored in market orders
|
|
41529
41575
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
41530
|
-
* @
|
|
41576
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
41577
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
41578
|
+
* @param {bool} [params.postOnly]
|
|
41579
|
+
* @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
|
|
41580
|
+
* @param {int} [params.flags] additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates)
|
|
41581
|
+
* @param {int} [params.lev] leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive.
|
|
41582
|
+
* @param {string} [params.price_traling] The trailing price for a trailing stop order
|
|
41583
|
+
* @param {string} [params.price_aux_limit] Order price for stop limit orders
|
|
41584
|
+
* @param {string} [params.price_oco_stop] OCO stop price
|
|
41585
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
41531
41586
|
*/
|
|
41532
41587
|
const market = this.market(symbol);
|
|
41533
41588
|
let amountString = this.amountToPrecision(symbol, amount);
|
|
@@ -47682,8 +47737,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
47682
47737
|
const currencyCode = this.safeCurrencyCode(this.safeString(feeStructure, 'feeCoin'));
|
|
47683
47738
|
fee = {
|
|
47684
47739
|
'currency': currencyCode,
|
|
47685
|
-
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(feeStructure, 'totalFee')),
|
|
47686
47740
|
};
|
|
47741
|
+
const feeCostString = this.safeString(feeStructure, 'totalFee');
|
|
47742
|
+
const deduction = this.safeString(feeStructure, 'deduction') === 'yes' ? true : false;
|
|
47743
|
+
if (deduction) {
|
|
47744
|
+
fee['cost'] = feeCostString;
|
|
47745
|
+
}
|
|
47746
|
+
else {
|
|
47747
|
+
fee['cost'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(feeCostString);
|
|
47748
|
+
}
|
|
47687
47749
|
}
|
|
47688
47750
|
return this.safeTrade({
|
|
47689
47751
|
'info': trade,
|
|
@@ -48782,7 +48844,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48782
48844
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order
|
|
48783
48845
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
48784
48846
|
* @param {string} type 'market' or 'limit'
|
|
48785
|
-
* @param {string} side 'buy' or 'sell'
|
|
48847
|
+
* @param {string} side 'buy' or 'sell'
|
|
48786
48848
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
48787
48849
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
48788
48850
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -49267,7 +49329,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49267
49329
|
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent']);
|
|
49268
49330
|
let response = undefined;
|
|
49269
49331
|
if (market['spot']) {
|
|
49270
|
-
const editMarketBuyOrderRequiresPrice = this.
|
|
49332
|
+
const editMarketBuyOrderRequiresPrice = this.safeBool(this.options, 'editMarketBuyOrderRequiresPrice', true);
|
|
49271
49333
|
if (editMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
|
|
49272
49334
|
if (price === undefined) {
|
|
49273
49335
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' editOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the editMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
|
|
@@ -54740,6 +54802,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
54740
54802
|
},
|
|
54741
54803
|
'networks': {
|
|
54742
54804
|
'ERC20': 'ERC20',
|
|
54805
|
+
'SOL': 'SOL',
|
|
54743
54806
|
'BTC': 'BTC',
|
|
54744
54807
|
'TRC20': 'TRC20',
|
|
54745
54808
|
// todo: should be TRX after unification
|
|
@@ -54762,7 +54825,6 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
54762
54825
|
'FIO': 'FIO',
|
|
54763
54826
|
'SCRT': 'SCRT',
|
|
54764
54827
|
'IOTX': 'IOTX',
|
|
54765
|
-
'SOL': 'SOL',
|
|
54766
54828
|
'ALGO': 'ALGO',
|
|
54767
54829
|
'ATOM': 'ATOM',
|
|
54768
54830
|
'DOT': 'DOT',
|
|
@@ -57315,6 +57377,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
57315
57377
|
* @method
|
|
57316
57378
|
* @name bitmart#fetchDepositAddress
|
|
57317
57379
|
* @description fetch the deposit address for a currency associated with this account
|
|
57380
|
+
* @see https://developer-pro.bitmart.com/en/spot/#deposit-address-keyed
|
|
57318
57381
|
* @param {string} code unified currency code
|
|
57319
57382
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
57320
57383
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -57337,40 +57400,57 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
57337
57400
|
}
|
|
57338
57401
|
const response = await this.privateGetAccountV1DepositAddress(this.extend(request, params));
|
|
57339
57402
|
//
|
|
57340
|
-
//
|
|
57341
|
-
//
|
|
57342
|
-
//
|
|
57343
|
-
//
|
|
57344
|
-
//
|
|
57345
|
-
//
|
|
57346
|
-
//
|
|
57347
|
-
//
|
|
57348
|
-
//
|
|
57349
|
-
//
|
|
57350
|
-
//
|
|
57403
|
+
// {
|
|
57404
|
+
// "message": "OK",
|
|
57405
|
+
// "code": 1000,
|
|
57406
|
+
// "trace": "0e6edd79-f77f-4251-abe5-83ba75d06c1a",
|
|
57407
|
+
// "data": {
|
|
57408
|
+
// currency: 'ETH',
|
|
57409
|
+
// chain: 'Ethereum',
|
|
57410
|
+
// address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',
|
|
57411
|
+
// address_memo: ''
|
|
57412
|
+
// }
|
|
57413
|
+
// }
|
|
57351
57414
|
//
|
|
57352
57415
|
const data = this.safeValue(response, 'data', {});
|
|
57353
|
-
|
|
57354
|
-
|
|
57355
|
-
|
|
57416
|
+
return this.parseDepositAddress(data, currency);
|
|
57417
|
+
}
|
|
57418
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
57419
|
+
//
|
|
57420
|
+
// {
|
|
57421
|
+
// currency: 'ETH',
|
|
57422
|
+
// chain: 'Ethereum',
|
|
57423
|
+
// address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',
|
|
57424
|
+
// address_memo: ''
|
|
57425
|
+
// }
|
|
57426
|
+
//
|
|
57427
|
+
const currencyId = this.safeString(depositAddress, 'currency');
|
|
57428
|
+
const address = this.safeString(depositAddress, 'address');
|
|
57429
|
+
const chain = this.safeString(depositAddress, 'chain');
|
|
57356
57430
|
let network = undefined;
|
|
57431
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
57357
57432
|
if (chain !== undefined) {
|
|
57358
57433
|
const parts = chain.split('-');
|
|
57359
|
-
const
|
|
57360
|
-
|
|
57434
|
+
const partsLength = parts.length;
|
|
57435
|
+
const networkId = this.safeString(parts, partsLength - 1);
|
|
57436
|
+
network = this.safeNetworkCode(networkId, currency);
|
|
57361
57437
|
}
|
|
57362
57438
|
this.checkAddress(address);
|
|
57363
57439
|
return {
|
|
57364
|
-
'
|
|
57440
|
+
'info': depositAddress,
|
|
57441
|
+
'currency': this.safeString(currency, 'code'),
|
|
57365
57442
|
'address': address,
|
|
57366
|
-
'tag':
|
|
57443
|
+
'tag': this.safeString(depositAddress, 'address_memo'),
|
|
57367
57444
|
'network': network,
|
|
57368
|
-
'info': response,
|
|
57369
57445
|
};
|
|
57370
57446
|
}
|
|
57371
|
-
|
|
57372
|
-
|
|
57373
|
-
|
|
57447
|
+
safeNetworkCode(networkId, currency = undefined) {
|
|
57448
|
+
const name = this.safeString(currency, 'name');
|
|
57449
|
+
if (networkId === name) {
|
|
57450
|
+
const code = this.safeString(currency, 'code');
|
|
57451
|
+
return code;
|
|
57452
|
+
}
|
|
57453
|
+
return this.networkIdToCode(networkId);
|
|
57374
57454
|
}
|
|
57375
57455
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
57376
57456
|
/**
|
|
@@ -60225,7 +60305,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60225
60305
|
request['endTime'] = this.iso8601(until);
|
|
60226
60306
|
}
|
|
60227
60307
|
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
60228
|
-
const fetchOHLCVOpenTimestamp = this.
|
|
60308
|
+
const fetchOHLCVOpenTimestamp = this.safeBool(this.options, 'fetchOHLCVOpenTimestamp', true);
|
|
60229
60309
|
// if since is not set, they will return candles starting from 2017-01-01
|
|
60230
60310
|
if (since !== undefined) {
|
|
60231
60311
|
let timestamp = since;
|
|
@@ -76868,6 +76948,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
76868
76948
|
'fetchLedger': true,
|
|
76869
76949
|
'fetchLedgerEntry': undefined,
|
|
76870
76950
|
'fetchLeverage': true,
|
|
76951
|
+
'fetchLeverages': true,
|
|
76871
76952
|
'fetchLeverageTiers': false,
|
|
76872
76953
|
'fetchMarketLeverageTiers': false,
|
|
76873
76954
|
'fetchMarkets': true,
|
|
@@ -76972,6 +77053,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
76972
77053
|
'account/balance': 1,
|
|
76973
77054
|
'account/positions': 1,
|
|
76974
77055
|
'account/leverage-info': 1,
|
|
77056
|
+
'account/batch-leverage-info': 1,
|
|
76975
77057
|
'trade/orders-tpsl-pending': 1,
|
|
76976
77058
|
'trade/orders-history': 1,
|
|
76977
77059
|
'trade/orders-tpsl-history': 1,
|
|
@@ -77276,7 +77358,7 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
77276
77358
|
const symbol = market['symbol'];
|
|
77277
77359
|
const last = this.safeString(ticker, 'last');
|
|
77278
77360
|
const open = this.safeString(ticker, 'open24h');
|
|
77279
|
-
const spot = this.
|
|
77361
|
+
const spot = this.safeBool(market, 'spot', false);
|
|
77280
77362
|
const quoteVolume = spot ? this.safeString(ticker, 'volCurrency24h') : undefined;
|
|
77281
77363
|
const baseVolume = this.safeString(ticker, 'vol24h');
|
|
77282
77364
|
const high = this.safeString(ticker, 'high24h');
|
|
@@ -78669,12 +78751,68 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78669
78751
|
'takeProfitPrice': undefined,
|
|
78670
78752
|
});
|
|
78671
78753
|
}
|
|
78754
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
78755
|
+
/**
|
|
78756
|
+
* @method
|
|
78757
|
+
* @name blofin#fetchLeverages
|
|
78758
|
+
* @description fetch the set leverage for all contract markets
|
|
78759
|
+
* @see https://docs.blofin.com/index.html#get-multiple-leverage
|
|
78760
|
+
* @param {string[]} symbols a list of unified market symbols, required on blofin
|
|
78761
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
78762
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
78763
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
78764
|
+
*/
|
|
78765
|
+
await this.loadMarkets();
|
|
78766
|
+
if (symbols === undefined) {
|
|
78767
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchLeverages() requires a symbols argument');
|
|
78768
|
+
}
|
|
78769
|
+
let marginMode = undefined;
|
|
78770
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverages', params);
|
|
78771
|
+
if (marginMode === undefined) {
|
|
78772
|
+
marginMode = this.safeString(params, 'marginMode', 'cross'); // cross as default marginMode
|
|
78773
|
+
}
|
|
78774
|
+
if ((marginMode !== 'cross') && (marginMode !== 'isolated')) {
|
|
78775
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchLeverages() requires a marginMode parameter that must be either cross or isolated');
|
|
78776
|
+
}
|
|
78777
|
+
symbols = this.marketSymbols(symbols);
|
|
78778
|
+
let instIds = '';
|
|
78779
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
78780
|
+
const entry = symbols[i];
|
|
78781
|
+
const entryMarket = this.market(entry);
|
|
78782
|
+
if (i > 0) {
|
|
78783
|
+
instIds = instIds + ',' + entryMarket['id'];
|
|
78784
|
+
}
|
|
78785
|
+
else {
|
|
78786
|
+
instIds = instIds + entryMarket['id'];
|
|
78787
|
+
}
|
|
78788
|
+
}
|
|
78789
|
+
const request = {
|
|
78790
|
+
'instId': instIds,
|
|
78791
|
+
'marginMode': marginMode,
|
|
78792
|
+
};
|
|
78793
|
+
const response = await this.privateGetAccountBatchLeverageInfo(this.extend(request, params));
|
|
78794
|
+
//
|
|
78795
|
+
// {
|
|
78796
|
+
// "code": "0",
|
|
78797
|
+
// "msg": "success",
|
|
78798
|
+
// "data": [
|
|
78799
|
+
// {
|
|
78800
|
+
// "leverage": "3",
|
|
78801
|
+
// "marginMode": "cross",
|
|
78802
|
+
// "instId": "BTC-USDT"
|
|
78803
|
+
// },
|
|
78804
|
+
// ]
|
|
78805
|
+
// }
|
|
78806
|
+
//
|
|
78807
|
+
const leverages = this.safeList(response, 'data', []);
|
|
78808
|
+
return this.parseLeverages(leverages, symbols, 'instId');
|
|
78809
|
+
}
|
|
78672
78810
|
async fetchLeverage(symbol, params = {}) {
|
|
78673
78811
|
/**
|
|
78674
78812
|
* @method
|
|
78675
78813
|
* @name blofin#fetchLeverage
|
|
78676
78814
|
* @description fetch the set leverage for a market
|
|
78677
|
-
* @see https://blofin.com/
|
|
78815
|
+
* @see https://docs.blofin.com/index.html#get-leverage
|
|
78678
78816
|
* @param {string} symbol unified market symbol
|
|
78679
78817
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
78680
78818
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
@@ -95534,10 +95672,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95534
95672
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
95535
95673
|
*/
|
|
95536
95674
|
await this.loadMarkets();
|
|
95675
|
+
const maxLimit = 300;
|
|
95676
|
+
limit = (limit === undefined) ? maxLimit : Math.min(limit, maxLimit);
|
|
95537
95677
|
let paginate = false;
|
|
95538
95678
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
95539
95679
|
if (paginate) {
|
|
95540
|
-
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params,
|
|
95680
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimit - 1);
|
|
95541
95681
|
}
|
|
95542
95682
|
const market = this.market(symbol);
|
|
95543
95683
|
const request = {
|
|
@@ -95547,20 +95687,20 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95547
95687
|
const until = this.safeValueN(params, ['until', 'till', 'end']);
|
|
95548
95688
|
params = this.omit(params, ['until', 'till']);
|
|
95549
95689
|
const duration = this.parseTimeframe(timeframe);
|
|
95550
|
-
const
|
|
95690
|
+
const requestedDuration = limit * duration;
|
|
95551
95691
|
let sinceString = undefined;
|
|
95552
95692
|
if (since !== undefined) {
|
|
95553
95693
|
sinceString = this.numberToString(this.parseToInt(since / 1000));
|
|
95554
95694
|
}
|
|
95555
95695
|
else {
|
|
95556
95696
|
const now = this.seconds().toString();
|
|
95557
|
-
sinceString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringSub(now,
|
|
95697
|
+
sinceString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringSub(now, requestedDuration.toString());
|
|
95558
95698
|
}
|
|
95559
95699
|
request['start'] = sinceString;
|
|
95560
95700
|
let endString = this.numberToString(until);
|
|
95561
95701
|
if (until === undefined) {
|
|
95562
95702
|
// 300 candles max
|
|
95563
|
-
endString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(sinceString,
|
|
95703
|
+
endString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(sinceString, requestedDuration.toString());
|
|
95564
95704
|
}
|
|
95565
95705
|
request['end'] = endString;
|
|
95566
95706
|
const response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
|
|
@@ -95620,8 +95760,19 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95620
95760
|
const request = {
|
|
95621
95761
|
'product_id': market['id'],
|
|
95622
95762
|
};
|
|
95763
|
+
if (since !== undefined) {
|
|
95764
|
+
request['start'] = this.numberToString(this.parseToInt(since / 1000));
|
|
95765
|
+
}
|
|
95623
95766
|
if (limit !== undefined) {
|
|
95624
|
-
request['limit'] = limit;
|
|
95767
|
+
request['limit'] = Math.min(limit, 1000);
|
|
95768
|
+
}
|
|
95769
|
+
let until = undefined;
|
|
95770
|
+
[until, params] = this.handleOptionAndParams(params, 'fetchTrades', 'until');
|
|
95771
|
+
if (until !== undefined) {
|
|
95772
|
+
request['end'] = this.numberToString(this.parseToInt(until / 1000));
|
|
95773
|
+
}
|
|
95774
|
+
else if (since !== undefined) {
|
|
95775
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchTrades() requires a `until` parameter when you use `since` argument');
|
|
95625
95776
|
}
|
|
95626
95777
|
const response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
|
|
95627
95778
|
//
|
|
@@ -95755,7 +95906,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95755
95906
|
// }
|
|
95756
95907
|
// }
|
|
95757
95908
|
//
|
|
95758
|
-
const data = this.
|
|
95909
|
+
const data = this.safeDict(response, 'pricebook', {});
|
|
95759
95910
|
const time = this.safeString(data, 'time');
|
|
95760
95911
|
const timestamp = this.parse8601(time);
|
|
95761
95912
|
return this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks', 'price', 'size');
|
|
@@ -96208,7 +96359,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96208
96359
|
}
|
|
96209
96360
|
else {
|
|
96210
96361
|
this.checkRequiredCredentials();
|
|
96211
|
-
const
|
|
96362
|
+
const timestampString = this.seconds().toString();
|
|
96212
96363
|
let payload = '';
|
|
96213
96364
|
if (method !== 'GET') {
|
|
96214
96365
|
if (Object.keys(query).length) {
|
|
@@ -96216,17 +96367,14 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96216
96367
|
payload = body;
|
|
96217
96368
|
}
|
|
96218
96369
|
}
|
|
96219
|
-
|
|
96220
|
-
|
|
96221
|
-
|
|
96222
|
-
}
|
|
96223
|
-
}
|
|
96224
|
-
const auth = nonce + method + savedPath + payload;
|
|
96370
|
+
// 'GET' doesn't need payload in the signature. inside url is enough
|
|
96371
|
+
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
96372
|
+
const auth = timestampString + method + savedPath + payload;
|
|
96225
96373
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
96226
96374
|
headers = {
|
|
96227
96375
|
'CB-ACCESS-KEY': this.apiKey,
|
|
96228
96376
|
'CB-ACCESS-SIGN': signature,
|
|
96229
|
-
'CB-ACCESS-TIMESTAMP':
|
|
96377
|
+
'CB-ACCESS-TIMESTAMP': timestampString,
|
|
96230
96378
|
'Content-Type': 'application/json',
|
|
96231
96379
|
};
|
|
96232
96380
|
}
|
|
@@ -144161,7 +144309,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
144161
144309
|
if ((network !== undefined) && (code === 'USDT')) {
|
|
144162
144310
|
const parsedNetwork = this.safeString(networks, network);
|
|
144163
144311
|
if (parsedNetwork !== undefined) {
|
|
144164
|
-
request['
|
|
144312
|
+
request['network_code'] = parsedNetwork;
|
|
144165
144313
|
}
|
|
144166
144314
|
params = this.omit(params, 'network');
|
|
144167
144315
|
}
|
|
@@ -149670,7 +149818,10 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
149670
149818
|
amountString = this.safeString(trade, 'trade_volume', amountString);
|
|
149671
149819
|
const costString = this.safeString(trade, 'trade_turnover');
|
|
149672
149820
|
let fee = undefined;
|
|
149673
|
-
let feeCost = this.
|
|
149821
|
+
let feeCost = this.safeString(trade, 'filled-fees');
|
|
149822
|
+
if (feeCost === undefined) {
|
|
149823
|
+
feeCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString(trade, 'trade_fee'));
|
|
149824
|
+
}
|
|
149674
149825
|
const feeCurrencyId = this.safeString2(trade, 'fee-currency', 'fee_asset');
|
|
149675
149826
|
let feeCurrency = this.safeCurrencyCode(feeCurrencyId);
|
|
149676
149827
|
const filledPoints = this.safeString(trade, 'filled-points');
|
|
@@ -162239,7 +162390,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162239
162390
|
'name': 'Kraken',
|
|
162240
162391
|
'countries': ['US'],
|
|
162241
162392
|
'version': '0',
|
|
162242
|
-
|
|
162393
|
+
// rate-limits: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
|
|
162394
|
+
// for public: 1 req/s
|
|
162395
|
+
// for private: every second 0.33 weight added to your allowed capacity (some private endpoints need 1 weight, some need 2)
|
|
162396
|
+
'rateLimit': 1000,
|
|
162243
162397
|
'certified': false,
|
|
162244
162398
|
'pro': true,
|
|
162245
162399
|
'has': {
|
|
@@ -162369,7 +162523,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162369
162523
|
},
|
|
162370
162524
|
'public': {
|
|
162371
162525
|
'get': {
|
|
162372
|
-
//
|
|
162526
|
+
// rate-limits explained in comment in the top of this file
|
|
162373
162527
|
'Assets': 1,
|
|
162374
162528
|
'AssetPairs': 1,
|
|
162375
162529
|
'Depth': 1,
|
|
@@ -162385,48 +162539,48 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162385
162539
|
'post': {
|
|
162386
162540
|
'AddOrder': 0,
|
|
162387
162541
|
'AddOrderBatch': 0,
|
|
162388
|
-
'AddExport':
|
|
162389
|
-
'Balance':
|
|
162390
|
-
'CancelAll':
|
|
162391
|
-
'CancelAllOrdersAfter':
|
|
162542
|
+
'AddExport': 3,
|
|
162543
|
+
'Balance': 3,
|
|
162544
|
+
'CancelAll': 3,
|
|
162545
|
+
'CancelAllOrdersAfter': 3,
|
|
162392
162546
|
'CancelOrder': 0,
|
|
162393
162547
|
'CancelOrderBatch': 0,
|
|
162394
|
-
'ClosedOrders':
|
|
162395
|
-
'DepositAddresses':
|
|
162396
|
-
'DepositMethods':
|
|
162397
|
-
'DepositStatus':
|
|
162548
|
+
'ClosedOrders': 3,
|
|
162549
|
+
'DepositAddresses': 3,
|
|
162550
|
+
'DepositMethods': 3,
|
|
162551
|
+
'DepositStatus': 3,
|
|
162398
162552
|
'EditOrder': 0,
|
|
162399
|
-
'ExportStatus':
|
|
162400
|
-
'GetWebSocketsToken':
|
|
162401
|
-
'Ledgers':
|
|
162402
|
-
'OpenOrders':
|
|
162403
|
-
'OpenPositions':
|
|
162404
|
-
'QueryLedgers':
|
|
162405
|
-
'QueryOrders':
|
|
162406
|
-
'QueryTrades':
|
|
162407
|
-
'RetrieveExport':
|
|
162408
|
-
'RemoveExport':
|
|
162409
|
-
'BalanceEx':
|
|
162410
|
-
'TradeBalance':
|
|
162411
|
-
'TradesHistory':
|
|
162412
|
-
'TradeVolume':
|
|
162413
|
-
'Withdraw':
|
|
162414
|
-
'WithdrawCancel':
|
|
162415
|
-
'WithdrawInfo':
|
|
162416
|
-
'WithdrawMethods':
|
|
162417
|
-
'WithdrawAddresses':
|
|
162418
|
-
'WithdrawStatus':
|
|
162419
|
-
'WalletTransfer':
|
|
162553
|
+
'ExportStatus': 3,
|
|
162554
|
+
'GetWebSocketsToken': 3,
|
|
162555
|
+
'Ledgers': 6,
|
|
162556
|
+
'OpenOrders': 3,
|
|
162557
|
+
'OpenPositions': 3,
|
|
162558
|
+
'QueryLedgers': 3,
|
|
162559
|
+
'QueryOrders': 3,
|
|
162560
|
+
'QueryTrades': 3,
|
|
162561
|
+
'RetrieveExport': 3,
|
|
162562
|
+
'RemoveExport': 3,
|
|
162563
|
+
'BalanceEx': 3,
|
|
162564
|
+
'TradeBalance': 3,
|
|
162565
|
+
'TradesHistory': 6,
|
|
162566
|
+
'TradeVolume': 3,
|
|
162567
|
+
'Withdraw': 3,
|
|
162568
|
+
'WithdrawCancel': 3,
|
|
162569
|
+
'WithdrawInfo': 3,
|
|
162570
|
+
'WithdrawMethods': 3,
|
|
162571
|
+
'WithdrawAddresses': 3,
|
|
162572
|
+
'WithdrawStatus': 3,
|
|
162573
|
+
'WalletTransfer': 3,
|
|
162420
162574
|
// sub accounts
|
|
162421
|
-
'CreateSubaccount':
|
|
162422
|
-
'AccountTransfer':
|
|
162575
|
+
'CreateSubaccount': 3,
|
|
162576
|
+
'AccountTransfer': 3,
|
|
162423
162577
|
// earn
|
|
162424
|
-
'Earn/Allocate':
|
|
162425
|
-
'Earn/Deallocate':
|
|
162426
|
-
'Earn/AllocateStatus':
|
|
162427
|
-
'Earn/DeallocateStatus':
|
|
162428
|
-
'Earn/Strategies':
|
|
162429
|
-
'Earn/Allocations':
|
|
162578
|
+
'Earn/Allocate': 3,
|
|
162579
|
+
'Earn/Deallocate': 3,
|
|
162580
|
+
'Earn/AllocateStatus': 3,
|
|
162581
|
+
'Earn/DeallocateStatus': 3,
|
|
162582
|
+
'Earn/Strategies': 3,
|
|
162583
|
+
'Earn/Allocations': 3,
|
|
162430
162584
|
},
|
|
162431
162585
|
},
|
|
162432
162586
|
},
|
|
@@ -172277,6 +172431,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
172277
172431
|
'addMargin': true,
|
|
172278
172432
|
'cancelAllOrders': true,
|
|
172279
172433
|
'cancelOrder': true,
|
|
172434
|
+
'closeAllPositions': false,
|
|
172280
172435
|
'closePosition': true,
|
|
172281
172436
|
'closePositions': false,
|
|
172282
172437
|
'createDepositAddress': true,
|
|
@@ -181200,7 +181355,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
181200
181355
|
const uppercaseHash = hash.toUpperCase();
|
|
181201
181356
|
let sign = undefined;
|
|
181202
181357
|
if (signatureMethod === 'RSA') {
|
|
181203
|
-
const cacheSecretAsPem = this.
|
|
181358
|
+
const cacheSecretAsPem = this.safeBool(this.options, 'cacheSecretAsPem', true);
|
|
181204
181359
|
let pem = undefined;
|
|
181205
181360
|
if (cacheSecretAsPem) {
|
|
181206
181361
|
pem = this.safeValue(this.options, 'pem');
|
|
@@ -190262,7 +190417,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
190262
190417
|
'source': this.safeString(this.options, 'broker', 'CCXT'),
|
|
190263
190418
|
};
|
|
190264
190419
|
}
|
|
190265
|
-
if ((method === 'POST') || (method === 'PUT')) {
|
|
190420
|
+
if ((method === 'POST') || (method === 'PUT') || (method === 'DELETE')) {
|
|
190266
190421
|
headers['Content-Type'] = 'application/json';
|
|
190267
190422
|
}
|
|
190268
190423
|
}
|
|
@@ -200056,7 +200211,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
200056
200211
|
// while fetchCurrencies is a public API method by design
|
|
200057
200212
|
// therefore we check the keys here
|
|
200058
200213
|
// and fallback to generating the currencies from the markets
|
|
200059
|
-
const isSandboxMode = this.
|
|
200214
|
+
const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
200060
200215
|
if (!this.checkRequiredCredentials(false) || isSandboxMode) {
|
|
200061
200216
|
return undefined;
|
|
200062
200217
|
}
|
|
@@ -212259,7 +212414,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
212259
212414
|
}
|
|
212260
212415
|
parseOrder(order, market = undefined) {
|
|
212261
212416
|
const isSwap = this.safeBool(market, 'swap', false);
|
|
212262
|
-
const hasPnl = ('closedPnl' in order);
|
|
212417
|
+
const hasPnl = ('closedPnl' in order) || ('closedPnlRv' in order) || ('totalPnlRv' in order);
|
|
212263
212418
|
if (isSwap || hasPnl) {
|
|
212264
212419
|
return this.parseSwapOrder(order, market);
|
|
212265
212420
|
}
|
|
@@ -222995,7 +223150,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222995
223150
|
this.setBalanceCache(client, type, isPortfolioMargin);
|
|
222996
223151
|
this.setPositionsCache(client, type, symbols, isPortfolioMargin);
|
|
222997
223152
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
222998
|
-
const awaitPositionsSnapshot = this.
|
|
223153
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
222999
223154
|
const cache = this.safeValue(this.positions, type);
|
|
223000
223155
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
223001
223156
|
const snapshot = await client.future(type + ':fetchPositionsSnapshot');
|
|
@@ -223129,8 +223284,21 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
223129
223284
|
// }
|
|
223130
223285
|
//
|
|
223131
223286
|
const marketId = this.safeString(position, 's');
|
|
223132
|
-
const
|
|
223133
|
-
const
|
|
223287
|
+
const contracts = this.safeString(position, 'pa');
|
|
223288
|
+
const contractsAbs = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringAbs(this.safeString(position, 'pa'));
|
|
223289
|
+
let positionSide = this.safeStringLower(position, 'ps');
|
|
223290
|
+
let hedged = true;
|
|
223291
|
+
if (positionSide === 'both') {
|
|
223292
|
+
hedged = false;
|
|
223293
|
+
if (!_base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringEq(contracts, '0')) {
|
|
223294
|
+
if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringLt(contracts, '0')) {
|
|
223295
|
+
positionSide = 'short';
|
|
223296
|
+
}
|
|
223297
|
+
else {
|
|
223298
|
+
positionSide = 'long';
|
|
223299
|
+
}
|
|
223300
|
+
}
|
|
223301
|
+
}
|
|
223134
223302
|
return this.safePosition({
|
|
223135
223303
|
'info': position,
|
|
223136
223304
|
'id': undefined,
|
|
@@ -223141,7 +223309,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
223141
223309
|
'entryPrice': this.safeNumber(position, 'ep'),
|
|
223142
223310
|
'unrealizedPnl': this.safeNumber(position, 'up'),
|
|
223143
223311
|
'percentage': undefined,
|
|
223144
|
-
'contracts': this.
|
|
223312
|
+
'contracts': this.parseNumber(contractsAbs),
|
|
223145
223313
|
'contractSize': undefined,
|
|
223146
223314
|
'markPrice': undefined,
|
|
223147
223315
|
'side': positionSide,
|
|
@@ -225601,7 +225769,7 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
225601
225769
|
'symbol': marketId,
|
|
225602
225770
|
};
|
|
225603
225771
|
const result = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash, { 'checksum': false });
|
|
225604
|
-
const checksum = this.
|
|
225772
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
225605
225773
|
if (checksum && !client.subscriptions[messageHash]['checksum'] && (channel === 'book')) {
|
|
225606
225774
|
client.subscriptions[messageHash]['checksum'] = true;
|
|
225607
225775
|
await client.send({
|
|
@@ -227251,7 +227419,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
227251
227419
|
this.handleDeltas(storedOrderBook['bids'], bids);
|
|
227252
227420
|
storedOrderBook['timestamp'] = timestamp;
|
|
227253
227421
|
storedOrderBook['datetime'] = this.iso8601(timestamp);
|
|
227254
|
-
const checksum = this.
|
|
227422
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
227255
227423
|
const isSnapshot = this.safeString(message, 'action') === 'snapshot'; // snapshot does not have a checksum
|
|
227256
227424
|
if (!isSnapshot && checksum) {
|
|
227257
227425
|
const storedAsks = storedOrderBook['asks'];
|
|
@@ -228588,11 +228756,12 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
228588
228756
|
}
|
|
228589
228757
|
return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
228590
228758
|
}
|
|
228591
|
-
async subscribeMultiple(channel, type, symbols, params = {}) {
|
|
228759
|
+
async subscribeMultiple(channel, type, symbols = undefined, params = {}) {
|
|
228760
|
+
symbols = this.marketSymbols(symbols, type, false, true);
|
|
228592
228761
|
const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
|
|
228593
228762
|
const channelType = (type === 'spot') ? 'spot' : 'futures';
|
|
228594
228763
|
const actionType = (type === 'spot') ? 'op' : 'action';
|
|
228595
|
-
|
|
228764
|
+
let rawSubscriptions = [];
|
|
228596
228765
|
const messageHashes = [];
|
|
228597
228766
|
for (let i = 0; i < symbols.length; i++) {
|
|
228598
228767
|
const market = this.market(symbols[i]);
|
|
@@ -228600,6 +228769,10 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
228600
228769
|
rawSubscriptions.push(message);
|
|
228601
228770
|
messageHashes.push(channel + ':' + market['symbol']);
|
|
228602
228771
|
}
|
|
228772
|
+
// as an exclusion, futures "tickers" need one generic request for all symbols
|
|
228773
|
+
if ((type !== 'spot') && (channel === 'ticker')) {
|
|
228774
|
+
rawSubscriptions = [channelType + '/' + channel];
|
|
228775
|
+
}
|
|
228603
228776
|
const request = {
|
|
228604
228777
|
'args': rawSubscriptions,
|
|
228605
228778
|
};
|
|
@@ -228802,13 +228975,8 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
228802
228975
|
*/
|
|
228803
228976
|
await this.loadMarkets();
|
|
228804
228977
|
symbol = this.symbol(symbol);
|
|
228805
|
-
const
|
|
228806
|
-
|
|
228807
|
-
[type, params] = this.handleMarketTypeAndParams('watchTicker', market, params);
|
|
228808
|
-
if (type === 'swap') {
|
|
228809
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTicker() does not support ' + type + ' markets. Use watchTickers() instead');
|
|
228810
|
-
}
|
|
228811
|
-
return await this.subscribe('ticker', symbol, type, params);
|
|
228978
|
+
const tickers = await this.watchTickers([symbol], params);
|
|
228979
|
+
return tickers[symbol];
|
|
228812
228980
|
}
|
|
228813
228981
|
async watchTickers(symbols = undefined, params = {}) {
|
|
228814
228982
|
/**
|
|
@@ -228822,40 +228990,12 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
228822
228990
|
*/
|
|
228823
228991
|
await this.loadMarkets();
|
|
228824
228992
|
const market = this.getMarketFromSymbols(symbols);
|
|
228825
|
-
let
|
|
228826
|
-
[
|
|
228827
|
-
const
|
|
228828
|
-
symbols = this.marketSymbols(symbols);
|
|
228829
|
-
let messageHash = 'tickers::' + type;
|
|
228830
|
-
if (symbols !== undefined) {
|
|
228831
|
-
messageHash += '::' + symbols.join(',');
|
|
228832
|
-
}
|
|
228833
|
-
let request = undefined;
|
|
228834
|
-
let tickers = undefined;
|
|
228835
|
-
const isSpot = (type === 'spot');
|
|
228836
|
-
if (isSpot) {
|
|
228837
|
-
if (symbols === undefined) {
|
|
228838
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchTickers() for ' + type + ' market type requires symbols argument to be provided');
|
|
228839
|
-
}
|
|
228840
|
-
const marketIds = this.marketIds(symbols);
|
|
228841
|
-
const finalArray = [];
|
|
228842
|
-
for (let i = 0; i < marketIds.length; i++) {
|
|
228843
|
-
finalArray.push('spot/ticker:' + marketIds[i]);
|
|
228844
|
-
}
|
|
228845
|
-
request = {
|
|
228846
|
-
'op': 'subscribe',
|
|
228847
|
-
'args': finalArray,
|
|
228848
|
-
};
|
|
228849
|
-
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
228850
|
-
}
|
|
228851
|
-
else {
|
|
228852
|
-
request = {
|
|
228853
|
-
'action': 'subscribe',
|
|
228854
|
-
'args': ['futures/ticker'],
|
|
228855
|
-
};
|
|
228856
|
-
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
228857
|
-
}
|
|
228993
|
+
let marketType = undefined;
|
|
228994
|
+
[marketType, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
|
|
228995
|
+
const ticker = await this.subscribeMultiple('ticker', marketType, symbols, params);
|
|
228858
228996
|
if (this.newUpdates) {
|
|
228997
|
+
const tickers = {};
|
|
228998
|
+
tickers[ticker['symbol']] = ticker;
|
|
228859
228999
|
return tickers;
|
|
228860
229000
|
}
|
|
228861
229001
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
@@ -229331,21 +229471,34 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
229331
229471
|
if (data === undefined) {
|
|
229332
229472
|
return;
|
|
229333
229473
|
}
|
|
229334
|
-
let stored = undefined;
|
|
229335
229474
|
let symbol = undefined;
|
|
229336
|
-
|
|
229337
|
-
|
|
229338
|
-
|
|
229339
|
-
|
|
229340
|
-
|
|
229341
|
-
|
|
229342
|
-
|
|
229343
|
-
this.trades[symbol] = stored;
|
|
229475
|
+
const length = data.length;
|
|
229476
|
+
const isSwap = ('group' in message);
|
|
229477
|
+
if (isSwap) {
|
|
229478
|
+
// in swap, chronologically decreasing: 1709536849322, 1709536848954,
|
|
229479
|
+
const maxLen = Math.max(length - 1, 0);
|
|
229480
|
+
for (let i = maxLen; i >= 0; i--) {
|
|
229481
|
+
symbol = this.handleTradeLoop(data[i]);
|
|
229344
229482
|
}
|
|
229345
|
-
stored.append(trade);
|
|
229346
229483
|
}
|
|
229347
|
-
|
|
229348
|
-
|
|
229484
|
+
else {
|
|
229485
|
+
// in spot, chronologically increasing: 1709536771200, 1709536771226,
|
|
229486
|
+
for (let i = 0; i < length; i++) {
|
|
229487
|
+
symbol = this.handleTradeLoop(data[i]);
|
|
229488
|
+
}
|
|
229489
|
+
}
|
|
229490
|
+
client.resolve(this.trades[symbol], 'trade:' + symbol);
|
|
229491
|
+
}
|
|
229492
|
+
handleTradeLoop(entry) {
|
|
229493
|
+
const trade = this.parseWsTrade(entry);
|
|
229494
|
+
const symbol = trade['symbol'];
|
|
229495
|
+
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
229496
|
+
if (this.safeValue(this.trades, symbol) === undefined) {
|
|
229497
|
+
this.trades[symbol] = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCache */ .ZL(tradesLimit);
|
|
229498
|
+
}
|
|
229499
|
+
const stored = this.trades[symbol];
|
|
229500
|
+
stored.append(trade);
|
|
229501
|
+
return symbol;
|
|
229349
229502
|
}
|
|
229350
229503
|
parseWsTrade(trade, market = undefined) {
|
|
229351
229504
|
// spot
|
|
@@ -229424,45 +229577,22 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
229424
229577
|
//
|
|
229425
229578
|
const table = this.safeString(message, 'table');
|
|
229426
229579
|
const isSpot = (table !== undefined);
|
|
229427
|
-
|
|
229428
|
-
if (data === undefined) {
|
|
229429
|
-
return;
|
|
229430
|
-
}
|
|
229580
|
+
let rawTickers = [];
|
|
229431
229581
|
if (isSpot) {
|
|
229432
|
-
|
|
229433
|
-
const ticker = this.parseTicker(data[i]);
|
|
229434
|
-
const symbol = ticker['symbol'];
|
|
229435
|
-
const marketId = this.safeString(ticker['info'], 'symbol');
|
|
229436
|
-
const messageHash = table + ':' + marketId;
|
|
229437
|
-
this.tickers[symbol] = ticker;
|
|
229438
|
-
client.resolve(ticker, messageHash);
|
|
229439
|
-
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
229440
|
-
}
|
|
229582
|
+
rawTickers = this.safeList(message, 'data', []);
|
|
229441
229583
|
}
|
|
229442
229584
|
else {
|
|
229443
|
-
|
|
229444
|
-
const ticker = this.parseWsSwapTicker(data);
|
|
229445
|
-
const symbol = this.safeString(ticker, 'symbol');
|
|
229446
|
-
this.tickers[symbol] = ticker;
|
|
229447
|
-
client.resolve(ticker, 'tickers::swap');
|
|
229448
|
-
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
229585
|
+
rawTickers = [this.safeValue(message, 'data', {})];
|
|
229449
229586
|
}
|
|
229450
|
-
|
|
229451
|
-
|
|
229452
|
-
|
|
229453
|
-
|
|
229454
|
-
|
|
229455
|
-
|
|
229456
|
-
|
|
229457
|
-
const
|
|
229458
|
-
|
|
229459
|
-
const symbolsString = parts[length - 1];
|
|
229460
|
-
const symbols = symbolsString.split(symbolsSeparator);
|
|
229461
|
-
if (this.inArray(symbol, symbols)) {
|
|
229462
|
-
const response = {};
|
|
229463
|
-
response[symbol] = result;
|
|
229464
|
-
client.resolve(response, messageHash);
|
|
229465
|
-
}
|
|
229587
|
+
if (!rawTickers.length) {
|
|
229588
|
+
return;
|
|
229589
|
+
}
|
|
229590
|
+
for (let i = 0; i < rawTickers.length; i++) {
|
|
229591
|
+
const ticker = isSpot ? this.parseTicker(rawTickers[i]) : this.parseWsSwapTicker(rawTickers[i]);
|
|
229592
|
+
const symbol = ticker['symbol'];
|
|
229593
|
+
this.tickers[symbol] = ticker;
|
|
229594
|
+
const messageHash = 'ticker:' + symbol;
|
|
229595
|
+
client.resolve(ticker, messageHash);
|
|
229466
229596
|
}
|
|
229467
229597
|
}
|
|
229468
229598
|
parseWsSwapTicker(ticker, market = undefined) {
|
|
@@ -234298,7 +234428,7 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
234298
234428
|
return messageHash;
|
|
234299
234429
|
}
|
|
234300
234430
|
checkMessageHashDoesNotExist(messageHash) {
|
|
234301
|
-
const supressMultipleWsRequestsError = this.
|
|
234431
|
+
const supressMultipleWsRequestsError = this.safeBool(this.options, 'supressMultipleWsRequestsError', false);
|
|
234302
234432
|
if (!supressMultipleWsRequestsError) {
|
|
234303
234433
|
const client = this.safeValue(this.clients, this.urls['api']['ws']);
|
|
234304
234434
|
if (client !== undefined) {
|
|
@@ -236302,7 +236432,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
236302
236432
|
this.setPositionsCache(client, symbols);
|
|
236303
236433
|
const cache = this.positions;
|
|
236304
236434
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
236305
|
-
const awaitPositionsSnapshot = this.
|
|
236435
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
236306
236436
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
236307
236437
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
236308
236438
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
|
@@ -241065,7 +241195,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
241065
241195
|
}
|
|
241066
241196
|
const url = this.urls['api']['ws'][type];
|
|
241067
241197
|
const messageHash = 'ohlcv';
|
|
241068
|
-
const watchOHLCVWarning = this.
|
|
241198
|
+
const watchOHLCVWarning = this.safeBool(this.options, 'watchOHLCVWarning', true);
|
|
241069
241199
|
const client = this.safeValue(this.clients, url, {});
|
|
241070
241200
|
const clientSub = this.safeValue(client, 'subscriptions', {});
|
|
241071
241201
|
const existingSubscription = this.safeValue(clientSub, messageHash);
|
|
@@ -242600,7 +242730,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
242600
242730
|
const client = this.client(url);
|
|
242601
242731
|
this.setPositionsCache(client, symbols);
|
|
242602
242732
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
242603
|
-
const awaitPositionsSnapshot = this.
|
|
242733
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
242604
242734
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
242605
242735
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
242606
242736
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
|
@@ -243663,10 +243793,13 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
243663
243793
|
'watchTicker': true,
|
|
243664
243794
|
'watchTickers': false,
|
|
243665
243795
|
'watchTrades': true,
|
|
243796
|
+
'watchTradesForSymbols': true,
|
|
243666
243797
|
'watchMyTrades': true,
|
|
243667
243798
|
'watchOrders': true,
|
|
243668
243799
|
'watchOrderBook': true,
|
|
243800
|
+
'watchOrderBookForSymbols': true,
|
|
243669
243801
|
'watchOHLCV': true,
|
|
243802
|
+
'watchOHLCVForSymbols': true,
|
|
243670
243803
|
},
|
|
243671
243804
|
'urls': {
|
|
243672
243805
|
'test': {
|
|
@@ -243677,18 +243810,31 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
243677
243810
|
},
|
|
243678
243811
|
},
|
|
243679
243812
|
'options': {
|
|
243680
|
-
'
|
|
243681
|
-
'
|
|
243682
|
-
|
|
243683
|
-
|
|
243684
|
-
|
|
243685
|
-
|
|
243686
|
-
|
|
243687
|
-
|
|
243688
|
-
|
|
243689
|
-
|
|
243690
|
-
|
|
243691
|
-
|
|
243813
|
+
'ws': {
|
|
243814
|
+
'timeframes': {
|
|
243815
|
+
'1m': '1',
|
|
243816
|
+
'3m': '3',
|
|
243817
|
+
'5m': '5',
|
|
243818
|
+
'15m': '15',
|
|
243819
|
+
'30m': '30',
|
|
243820
|
+
'1h': '60',
|
|
243821
|
+
'2h': '120',
|
|
243822
|
+
'4h': '180',
|
|
243823
|
+
'6h': '360',
|
|
243824
|
+
'12h': '720',
|
|
243825
|
+
'1d': '1D',
|
|
243826
|
+
},
|
|
243827
|
+
// watchTrades replacement
|
|
243828
|
+
'watchTradesForSymbols': {
|
|
243829
|
+
'interval': '100ms', // 100ms, agg2, raw
|
|
243830
|
+
},
|
|
243831
|
+
// watchOrderBook replacement
|
|
243832
|
+
'watchOrderBookForSymbols': {
|
|
243833
|
+
'interval': '100ms',
|
|
243834
|
+
'useDepthEndpoint': false,
|
|
243835
|
+
'depth': '20',
|
|
243836
|
+
'group': 'none', // none, 1, 2, 5, 10, 25, 100, 250
|
|
243837
|
+
},
|
|
243692
243838
|
},
|
|
243693
243839
|
'currencies': ['BTC', 'ETH', 'SOL', 'USDC'],
|
|
243694
243840
|
},
|
|
@@ -243868,27 +244014,31 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
243868
244014
|
* @param {str} [params.interval] specify aggregation and frequency of notifications. Possible values: 100ms, raw
|
|
243869
244015
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
243870
244016
|
*/
|
|
243871
|
-
|
|
243872
|
-
|
|
243873
|
-
|
|
243874
|
-
|
|
243875
|
-
|
|
243876
|
-
|
|
244017
|
+
params['callerMethodName'] = 'watchTrades';
|
|
244018
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
244019
|
+
}
|
|
244020
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
244021
|
+
/**
|
|
244022
|
+
* @method
|
|
244023
|
+
* @name deribit#watchTradesForSymbols
|
|
244024
|
+
* @description get the list of most recent trades for a list of symbols
|
|
244025
|
+
* @see https://docs.deribit.com/#trades-instrument_name-interval
|
|
244026
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
244027
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
244028
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
244029
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
244030
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
244031
|
+
*/
|
|
244032
|
+
let interval = undefined;
|
|
244033
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchTradesForSymbols', 'interval', '100ms');
|
|
243877
244034
|
if (interval === 'raw') {
|
|
243878
244035
|
await this.authenticate();
|
|
243879
244036
|
}
|
|
243880
|
-
const
|
|
243881
|
-
'jsonrpc': '2.0',
|
|
243882
|
-
'method': 'public/subscribe',
|
|
243883
|
-
'params': {
|
|
243884
|
-
'channels': [channel],
|
|
243885
|
-
},
|
|
243886
|
-
'id': this.requestId(),
|
|
243887
|
-
};
|
|
243888
|
-
const request = this.deepExtend(message, params);
|
|
243889
|
-
const trades = await this.watch(url, channel, request, channel, request);
|
|
244037
|
+
const trades = await this.watchMultipleWrapper('trades', interval, symbols, params);
|
|
243890
244038
|
if (this.newUpdates) {
|
|
243891
|
-
|
|
244039
|
+
const first = this.safeDict(trades, 0);
|
|
244040
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
244041
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
243892
244042
|
}
|
|
243893
244043
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
243894
244044
|
}
|
|
@@ -243914,26 +244064,27 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
243914
244064
|
// }
|
|
243915
244065
|
// }
|
|
243916
244066
|
//
|
|
243917
|
-
const params = this.
|
|
244067
|
+
const params = this.safeDict(message, 'params', {});
|
|
243918
244068
|
const channel = this.safeString(params, 'channel', '');
|
|
243919
244069
|
const parts = channel.split('.');
|
|
243920
244070
|
const marketId = this.safeString(parts, 1);
|
|
244071
|
+
const interval = this.safeString(parts, 2);
|
|
243921
244072
|
const symbol = this.safeSymbol(marketId);
|
|
243922
244073
|
const market = this.safeMarket(marketId);
|
|
243923
|
-
const trades = this.
|
|
243924
|
-
|
|
243925
|
-
if (stored === undefined) {
|
|
244074
|
+
const trades = this.safeList(params, 'data', []);
|
|
244075
|
+
if (this.safeValue(this.trades, symbol) === undefined) {
|
|
243926
244076
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
243927
|
-
|
|
243928
|
-
this.trades[symbol] = stored;
|
|
244077
|
+
this.trades[symbol] = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_1__/* .ArrayCache */ .ZL(limit);
|
|
243929
244078
|
}
|
|
244079
|
+
const stored = this.trades[symbol];
|
|
243930
244080
|
for (let i = 0; i < trades.length; i++) {
|
|
243931
244081
|
const trade = trades[i];
|
|
243932
244082
|
const parsed = this.parseTrade(trade, market);
|
|
243933
244083
|
stored.append(parsed);
|
|
243934
244084
|
}
|
|
243935
244085
|
this.trades[symbol] = stored;
|
|
243936
|
-
|
|
244086
|
+
const messageHash = 'trades|' + symbol + '|' + interval;
|
|
244087
|
+
client.resolve(this.trades[symbol], messageHash);
|
|
243937
244088
|
}
|
|
243938
244089
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
243939
244090
|
/**
|
|
@@ -244024,7 +244175,7 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244024
244175
|
/**
|
|
244025
244176
|
* @method
|
|
244026
244177
|
* @name deribit#watchOrderBook
|
|
244027
|
-
* @see https://docs.deribit.com/#
|
|
244178
|
+
* @see https://docs.deribit.com/#book-instrument_name-group-depth-interval
|
|
244028
244179
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
244029
244180
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
244030
244181
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -244032,25 +244183,39 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244032
244183
|
* @param {string} [params.interval] Frequency of notifications. Events will be aggregated over this interval. Possible values: 100ms, raw
|
|
244033
244184
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
244034
244185
|
*/
|
|
244035
|
-
|
|
244036
|
-
|
|
244037
|
-
|
|
244038
|
-
|
|
244039
|
-
|
|
244186
|
+
params['callerMethodName'] = 'watchOrderBook';
|
|
244187
|
+
return await this.watchOrderBookForSymbols([symbol], limit, params);
|
|
244188
|
+
}
|
|
244189
|
+
async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
|
|
244190
|
+
/**
|
|
244191
|
+
* @method
|
|
244192
|
+
* @name deribit#watchOrderBookForSymbols
|
|
244193
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
244194
|
+
* @see https://docs.deribit.com/#book-instrument_name-group-depth-interval
|
|
244195
|
+
* @param {string[]} symbols unified array of symbols
|
|
244196
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
244197
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
244198
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
244199
|
+
*/
|
|
244200
|
+
let interval = undefined;
|
|
244201
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'interval', '100ms');
|
|
244040
244202
|
if (interval === 'raw') {
|
|
244041
244203
|
await this.authenticate();
|
|
244042
244204
|
}
|
|
244043
|
-
|
|
244044
|
-
|
|
244045
|
-
|
|
244046
|
-
|
|
244047
|
-
|
|
244048
|
-
|
|
244049
|
-
|
|
244050
|
-
|
|
244051
|
-
|
|
244052
|
-
|
|
244053
|
-
|
|
244205
|
+
let descriptor = '';
|
|
244206
|
+
let useDepthEndpoint = undefined; // for more info, see comment in .options
|
|
244207
|
+
[useDepthEndpoint, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'useDepthEndpoint', false);
|
|
244208
|
+
if (useDepthEndpoint) {
|
|
244209
|
+
let depth = undefined;
|
|
244210
|
+
[depth, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'depth', '20');
|
|
244211
|
+
let group = undefined;
|
|
244212
|
+
[group, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'group', 'none');
|
|
244213
|
+
descriptor = group + '.' + depth + '.' + interval;
|
|
244214
|
+
}
|
|
244215
|
+
else {
|
|
244216
|
+
descriptor = interval;
|
|
244217
|
+
}
|
|
244218
|
+
const orderbook = await this.watchMultipleWrapper('book', descriptor, symbols, params);
|
|
244054
244219
|
return orderbook.limit();
|
|
244055
244220
|
}
|
|
244056
244221
|
handleOrderBook(client, message) {
|
|
@@ -244102,6 +244267,20 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244102
244267
|
const params = this.safeValue(message, 'params', {});
|
|
244103
244268
|
const data = this.safeValue(params, 'data', {});
|
|
244104
244269
|
const channel = this.safeString(params, 'channel');
|
|
244270
|
+
const parts = channel.split('.');
|
|
244271
|
+
let descriptor = '';
|
|
244272
|
+
const partsLength = parts.length;
|
|
244273
|
+
const isDetailed = partsLength === 5;
|
|
244274
|
+
if (isDetailed) {
|
|
244275
|
+
const group = this.safeString(parts, 2);
|
|
244276
|
+
const depth = this.safeString(parts, 3);
|
|
244277
|
+
const interval = this.safeString(parts, 4);
|
|
244278
|
+
descriptor = group + '.' + depth + '.' + interval;
|
|
244279
|
+
}
|
|
244280
|
+
else {
|
|
244281
|
+
const interval = this.safeString(parts, 2);
|
|
244282
|
+
descriptor = interval;
|
|
244283
|
+
}
|
|
244105
244284
|
const marketId = this.safeString(data, 'instrument_name');
|
|
244106
244285
|
const symbol = this.safeSymbol(marketId);
|
|
244107
244286
|
const timestamp = this.safeInteger(data, 'timestamp');
|
|
@@ -244118,7 +244297,8 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244118
244297
|
storedOrderBook['datetime'] = this.iso8601(timestamp);
|
|
244119
244298
|
storedOrderBook['symbol'] = symbol;
|
|
244120
244299
|
this.orderbooks[symbol] = storedOrderBook;
|
|
244121
|
-
|
|
244300
|
+
const messageHash = 'book|' + symbol + '|' + descriptor;
|
|
244301
|
+
client.resolve(storedOrderBook, messageHash);
|
|
244122
244302
|
}
|
|
244123
244303
|
cleanOrderBook(data) {
|
|
244124
244304
|
const bids = this.safeValue(data, 'bids', []);
|
|
@@ -244258,28 +244438,32 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244258
244438
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
244259
244439
|
*/
|
|
244260
244440
|
await this.loadMarkets();
|
|
244261
|
-
|
|
244262
|
-
const
|
|
244263
|
-
|
|
244264
|
-
|
|
244265
|
-
|
|
244266
|
-
|
|
244441
|
+
symbol = this.symbol(symbol);
|
|
244442
|
+
const ohlcvs = await this.watchOHLCVForSymbols([[symbol, timeframe]], since, limit, params);
|
|
244443
|
+
return ohlcvs[symbol][timeframe];
|
|
244444
|
+
}
|
|
244445
|
+
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
244446
|
+
/**
|
|
244447
|
+
* @method
|
|
244448
|
+
* @name deribit#watchOHLCVForSymbols
|
|
244449
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
244450
|
+
* @see https://docs.deribit.com/#chart-trades-instrument_name-resolution
|
|
244451
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
244452
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
244453
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
244454
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
244455
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
244456
|
+
*/
|
|
244457
|
+
const symbolsLength = symbolsAndTimeframes.length;
|
|
244458
|
+
if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
|
|
244459
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
|
|
244267
244460
|
}
|
|
244268
|
-
const
|
|
244269
|
-
const message = {
|
|
244270
|
-
'jsonrpc': '2.0',
|
|
244271
|
-
'method': 'public/subscribe',
|
|
244272
|
-
'params': {
|
|
244273
|
-
'channels': [channel],
|
|
244274
|
-
},
|
|
244275
|
-
'id': this.requestId(),
|
|
244276
|
-
};
|
|
244277
|
-
const request = this.deepExtend(message, params);
|
|
244278
|
-
const ohlcv = await this.watch(url, channel, request, channel, request);
|
|
244461
|
+
const [symbol, timeframe, candles] = await this.watchMultipleWrapper('chart.trades', undefined, symbolsAndTimeframes, params);
|
|
244279
244462
|
if (this.newUpdates) {
|
|
244280
|
-
limit =
|
|
244463
|
+
limit = candles.getLimit(symbol, limit);
|
|
244281
244464
|
}
|
|
244282
|
-
|
|
244465
|
+
const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
|
|
244466
|
+
return this.createOHLCVObject(symbol, timeframe, filtered);
|
|
244283
244467
|
}
|
|
244284
244468
|
handleOHLCV(client, message) {
|
|
244285
244469
|
//
|
|
@@ -244300,13 +244484,44 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244300
244484
|
// }
|
|
244301
244485
|
// }
|
|
244302
244486
|
//
|
|
244303
|
-
const params = this.
|
|
244487
|
+
const params = this.safeDict(message, 'params', {});
|
|
244304
244488
|
const channel = this.safeString(params, 'channel', '');
|
|
244305
244489
|
const parts = channel.split('.');
|
|
244306
244490
|
const marketId = this.safeString(parts, 2);
|
|
244307
|
-
const
|
|
244308
|
-
const
|
|
244309
|
-
const
|
|
244491
|
+
const rawTimeframe = this.safeString(parts, 3);
|
|
244492
|
+
const market = this.safeMarket(marketId);
|
|
244493
|
+
const symbol = market['symbol'];
|
|
244494
|
+
const wsOptions = this.safeDict(this.options, 'ws', {});
|
|
244495
|
+
const timeframes = this.safeDict(wsOptions, 'timeframes', {});
|
|
244496
|
+
const unifiedTimeframe = this.findTimeframe(rawTimeframe, timeframes);
|
|
244497
|
+
this.ohlcvs[symbol] = this.safeDict(this.ohlcvs, symbol, {});
|
|
244498
|
+
if (this.safeValue(this.ohlcvs[symbol], unifiedTimeframe) === undefined) {
|
|
244499
|
+
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
244500
|
+
this.ohlcvs[symbol][unifiedTimeframe] = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_1__/* .ArrayCacheByTimestamp */ .Py(limit);
|
|
244501
|
+
}
|
|
244502
|
+
const stored = this.ohlcvs[symbol][unifiedTimeframe];
|
|
244503
|
+
const ohlcv = this.safeDict(params, 'data', {});
|
|
244504
|
+
// data contains a single OHLCV candle
|
|
244505
|
+
const parsed = this.parseWsOHLCV(ohlcv, market);
|
|
244506
|
+
stored.append(parsed);
|
|
244507
|
+
this.ohlcvs[symbol][unifiedTimeframe] = stored;
|
|
244508
|
+
const resolveData = [symbol, unifiedTimeframe, stored];
|
|
244509
|
+
const messageHash = 'chart.trades|' + symbol + '|' + rawTimeframe;
|
|
244510
|
+
client.resolve(resolveData, messageHash);
|
|
244511
|
+
}
|
|
244512
|
+
parseWsOHLCV(ohlcv, market = undefined) {
|
|
244513
|
+
//
|
|
244514
|
+
// {
|
|
244515
|
+
// "c": "28909.0",
|
|
244516
|
+
// "o": "28915.4",
|
|
244517
|
+
// "h": "28915.4",
|
|
244518
|
+
// "l": "28896.1",
|
|
244519
|
+
// "v": "27.6919",
|
|
244520
|
+
// "T": 1696687499999,
|
|
244521
|
+
// "t": 1696687440000
|
|
244522
|
+
// }
|
|
244523
|
+
//
|
|
244524
|
+
return [
|
|
244310
244525
|
this.safeInteger(ohlcv, 'tick'),
|
|
244311
244526
|
this.safeNumber(ohlcv, 'open'),
|
|
244312
244527
|
this.safeNumber(ohlcv, 'high'),
|
|
@@ -244314,14 +244529,46 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
244314
244529
|
this.safeNumber(ohlcv, 'close'),
|
|
244315
244530
|
this.safeNumber(ohlcv, 'volume'),
|
|
244316
244531
|
];
|
|
244317
|
-
|
|
244318
|
-
|
|
244319
|
-
|
|
244320
|
-
|
|
244532
|
+
}
|
|
244533
|
+
async watchMultipleWrapper(channelName, channelDescriptor, symbolsArray = undefined, params = {}) {
|
|
244534
|
+
await this.loadMarkets();
|
|
244535
|
+
const url = this.urls['api']['ws'];
|
|
244536
|
+
const rawSubscriptions = [];
|
|
244537
|
+
const messageHashes = [];
|
|
244538
|
+
const isOHLCV = (channelName === 'chart.trades');
|
|
244539
|
+
const symbols = isOHLCV ? this.getListFromObjectValues(symbolsArray, 0) : symbolsArray;
|
|
244540
|
+
this.marketSymbols(symbols, undefined, false);
|
|
244541
|
+
for (let i = 0; i < symbolsArray.length; i++) {
|
|
244542
|
+
const current = symbolsArray[i];
|
|
244543
|
+
let market = undefined;
|
|
244544
|
+
if (isOHLCV) {
|
|
244545
|
+
market = this.market(current[0]);
|
|
244546
|
+
const unifiedTf = current[1];
|
|
244547
|
+
const rawTf = this.safeString(this.timeframes, unifiedTf, unifiedTf);
|
|
244548
|
+
channelDescriptor = rawTf;
|
|
244549
|
+
}
|
|
244550
|
+
else {
|
|
244551
|
+
market = this.market(current);
|
|
244552
|
+
}
|
|
244553
|
+
const message = channelName + '.' + market['id'] + '.' + channelDescriptor;
|
|
244554
|
+
rawSubscriptions.push(message);
|
|
244555
|
+
messageHashes.push(channelName + '|' + market['symbol'] + '|' + channelDescriptor);
|
|
244321
244556
|
}
|
|
244322
|
-
|
|
244323
|
-
|
|
244324
|
-
|
|
244557
|
+
const request = {
|
|
244558
|
+
'jsonrpc': '2.0',
|
|
244559
|
+
'method': 'public/subscribe',
|
|
244560
|
+
'params': {
|
|
244561
|
+
'channels': rawSubscriptions,
|
|
244562
|
+
},
|
|
244563
|
+
'id': this.requestId(),
|
|
244564
|
+
};
|
|
244565
|
+
const extendedRequest = this.deepExtend(request, params);
|
|
244566
|
+
const maxMessageByteLimit = 32768 - 1; // 'Message Too Big: limit 32768B'
|
|
244567
|
+
const jsonedText = this.json(extendedRequest);
|
|
244568
|
+
if (jsonedText.length >= maxMessageByteLimit) {
|
|
244569
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' requested subscription length over limit, try to reduce symbols amount');
|
|
244570
|
+
}
|
|
244571
|
+
return await this.watchMultiple(url, messageHashes, extendedRequest, rawSubscriptions);
|
|
244325
244572
|
}
|
|
244326
244573
|
handleMessage(client, message) {
|
|
244327
244574
|
//
|
|
@@ -245974,7 +246221,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245974
246221
|
const client = this.client(url);
|
|
245975
246222
|
this.setPositionsCache(client, type, symbols);
|
|
245976
246223
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
245977
|
-
const awaitPositionsSnapshot = this.
|
|
246224
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
245978
246225
|
const cache = this.safeValue(this.positions, type);
|
|
245979
246226
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
245980
246227
|
return await client.future(type + ':fetchPositionsSnapshot');
|
|
@@ -253330,7 +253577,7 @@ class independentreserve extends _independentreserve_js__WEBPACK_IMPORTED_MODULE
|
|
|
253330
253577
|
orderbook['timestamp'] = timestamp;
|
|
253331
253578
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
253332
253579
|
}
|
|
253333
|
-
const checksum = this.
|
|
253580
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
253334
253581
|
if (checksum && receivedSnapshot) {
|
|
253335
253582
|
const storedAsks = orderbook['asks'];
|
|
253336
253583
|
const storedBids = orderbook['bids'];
|
|
@@ -254121,7 +254368,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
254121
254368
|
}
|
|
254122
254369
|
// don't remove this line or I will poop on your face
|
|
254123
254370
|
orderbook.limit();
|
|
254124
|
-
const checksum = this.
|
|
254371
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
254125
254372
|
if (checksum) {
|
|
254126
254373
|
const priceString = this.safeString(example, 0);
|
|
254127
254374
|
const amountString = this.safeString(example, 1);
|
|
@@ -257671,7 +257918,7 @@ class kucoinfutures extends _kucoinfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
257671
257918
|
const client = this.client(url);
|
|
257672
257919
|
this.setPositionCache(client, symbol);
|
|
257673
257920
|
const fetchPositionSnapshot = this.handleOption('watchPosition', 'fetchPositionSnapshot', true);
|
|
257674
|
-
const awaitPositionSnapshot = this.
|
|
257921
|
+
const awaitPositionSnapshot = this.safeBool('watchPosition', 'awaitPositionSnapshot', true);
|
|
257675
257922
|
const currentPosition = this.getCurrentPosition(symbol);
|
|
257676
257923
|
if (fetchPositionSnapshot && awaitPositionSnapshot && currentPosition === undefined) {
|
|
257677
257924
|
const snapshot = await client.future('fetchPositionSnapshot:' + symbol);
|
|
@@ -260148,10 +260395,12 @@ class mexc extends _mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
260148
260395
|
}
|
|
260149
260396
|
}
|
|
260150
260397
|
handleDelta(orderbook, delta) {
|
|
260151
|
-
const
|
|
260398
|
+
const existingNonce = this.safeInteger(orderbook, 'nonce');
|
|
260152
260399
|
const deltaNonce = this.safeInteger2(delta, 'r', 'version');
|
|
260153
|
-
if (deltaNonce
|
|
260154
|
-
|
|
260400
|
+
if (deltaNonce < existingNonce) {
|
|
260401
|
+
// even when doing < comparison, this happens: https://app.travis-ci.com/github/ccxt/ccxt/builds/269234741#L1809
|
|
260402
|
+
// so, we just skip old updates
|
|
260403
|
+
return;
|
|
260155
260404
|
}
|
|
260156
260405
|
orderbook['nonce'] = deltaNonce;
|
|
260157
260406
|
const asks = this.safeValue(delta, 'asks', []);
|
|
@@ -262698,7 +262947,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
262698
262947
|
const storedBids = orderbook['bids'];
|
|
262699
262948
|
this.handleDeltas(storedAsks, asks);
|
|
262700
262949
|
this.handleDeltas(storedBids, bids);
|
|
262701
|
-
const checksum = this.
|
|
262950
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
262702
262951
|
if (checksum) {
|
|
262703
262952
|
const asksLength = storedAsks.length;
|
|
262704
262953
|
const bidsLength = storedBids.length;
|
|
@@ -272593,7 +272842,7 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
272593
272842
|
const client = this.client(url);
|
|
272594
272843
|
this.setPositionsCache(client, symbols);
|
|
272595
272844
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
272596
|
-
const awaitPositionsSnapshot = this.
|
|
272845
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
272597
272846
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
272598
272847
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
272599
272848
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
|
@@ -292577,7 +292826,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
292577
292826
|
'public': {
|
|
292578
292827
|
'get': {
|
|
292579
292828
|
'exchangeInfo': 1,
|
|
292580
|
-
'depth':
|
|
292829
|
+
'depth': 0.5,
|
|
292581
292830
|
'ping': 1,
|
|
292582
292831
|
'systemStatus': 1,
|
|
292583
292832
|
'tickers/24hr': 1,
|
|
@@ -292596,6 +292845,11 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
292596
292845
|
'openOrders': 1,
|
|
292597
292846
|
'order': 0.5,
|
|
292598
292847
|
'myTrades': 0.5,
|
|
292848
|
+
'coins': 12,
|
|
292849
|
+
'crypto/withdraws': 12,
|
|
292850
|
+
'crypto/deposits/address': 60,
|
|
292851
|
+
'sub_account/fund_transfer/history': 1,
|
|
292852
|
+
'sub_account/accounts': 1,
|
|
292599
292853
|
},
|
|
292600
292854
|
'post': {
|
|
292601
292855
|
'order': 0.1,
|
|
@@ -295835,10 +296089,10 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
295835
296089
|
'fetchPositionMode': false,
|
|
295836
296090
|
'fetchPositions': true,
|
|
295837
296091
|
'fetchPremiumIndexOHLCV': false,
|
|
295838
|
-
'fetchStatus':
|
|
296092
|
+
'fetchStatus': true,
|
|
295839
296093
|
'fetchTicker': false,
|
|
295840
296094
|
'fetchTickers': false,
|
|
295841
|
-
'fetchTime':
|
|
296095
|
+
'fetchTime': true,
|
|
295842
296096
|
'fetchTrades': true,
|
|
295843
296097
|
'fetchTradingFee': false,
|
|
295844
296098
|
'fetchTradingFees': true,
|
|
@@ -296075,6 +296329,67 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296075
296329
|
'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_2__/* .TICK_SIZE */ .sh,
|
|
296076
296330
|
});
|
|
296077
296331
|
}
|
|
296332
|
+
async fetchStatus(params = {}) {
|
|
296333
|
+
/**
|
|
296334
|
+
* @method
|
|
296335
|
+
* @name woo#fetchStatus
|
|
296336
|
+
* @description the latest known information on the availability of the exchange API
|
|
296337
|
+
* @see https://docs.woo.org/#get-system-maintenance-status-public
|
|
296338
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
296339
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
296340
|
+
*/
|
|
296341
|
+
const response = await this.v1PublicGetSystemInfo(params);
|
|
296342
|
+
//
|
|
296343
|
+
// {
|
|
296344
|
+
// "success": true,
|
|
296345
|
+
// "data": {
|
|
296346
|
+
// "status": "0",
|
|
296347
|
+
// "msg": "System is functioning properly."
|
|
296348
|
+
// },
|
|
296349
|
+
// "timestamp": "1709274106602"
|
|
296350
|
+
// }
|
|
296351
|
+
//
|
|
296352
|
+
const data = this.safeDict(response, 'data', {});
|
|
296353
|
+
let status = this.safeString(data, 'status');
|
|
296354
|
+
if (status === undefined) {
|
|
296355
|
+
status = 'error';
|
|
296356
|
+
}
|
|
296357
|
+
else if (status === '0') {
|
|
296358
|
+
status = 'ok';
|
|
296359
|
+
}
|
|
296360
|
+
else {
|
|
296361
|
+
status = 'maintenance';
|
|
296362
|
+
}
|
|
296363
|
+
return {
|
|
296364
|
+
'status': status,
|
|
296365
|
+
'updated': undefined,
|
|
296366
|
+
'eta': undefined,
|
|
296367
|
+
'url': undefined,
|
|
296368
|
+
'info': response,
|
|
296369
|
+
};
|
|
296370
|
+
}
|
|
296371
|
+
async fetchTime(params = {}) {
|
|
296372
|
+
/**
|
|
296373
|
+
* @method
|
|
296374
|
+
* @name woo#fetchTime
|
|
296375
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
296376
|
+
* @see https://docs.woo.org/#get-system-maintenance-status-public
|
|
296377
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
296378
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
296379
|
+
*/
|
|
296380
|
+
const response = await this.v1PublicGetSystemInfo(params);
|
|
296381
|
+
//
|
|
296382
|
+
// {
|
|
296383
|
+
// "success": true,
|
|
296384
|
+
// "data": {
|
|
296385
|
+
// "status": "0",
|
|
296386
|
+
// "msg": "System is functioning properly."
|
|
296387
|
+
// },
|
|
296388
|
+
// "timestamp": "1709274106602"
|
|
296389
|
+
// }
|
|
296390
|
+
//
|
|
296391
|
+
return this.safeInteger(response, 'timestamp');
|
|
296392
|
+
}
|
|
296078
296393
|
async fetchMarkets(params = {}) {
|
|
296079
296394
|
/**
|
|
296080
296395
|
* @method
|
|
@@ -296105,7 +296420,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296105
296420
|
// "success": true
|
|
296106
296421
|
// }
|
|
296107
296422
|
//
|
|
296108
|
-
const data = this.
|
|
296423
|
+
const data = this.safeList(response, 'rows', []);
|
|
296109
296424
|
return this.parseMarkets(data);
|
|
296110
296425
|
}
|
|
296111
296426
|
parseMarket(market) {
|
|
@@ -296241,7 +296556,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296241
296556
|
// ]
|
|
296242
296557
|
// }
|
|
296243
296558
|
//
|
|
296244
|
-
const resultResponse = this.
|
|
296559
|
+
const resultResponse = this.safeList(response, 'rows', []);
|
|
296245
296560
|
return this.parseTrades(resultResponse, market, since, limit);
|
|
296246
296561
|
}
|
|
296247
296562
|
parseTrade(trade, market = undefined) {
|
|
@@ -296357,7 +296672,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296357
296672
|
// "timestamp": 1673323685109
|
|
296358
296673
|
// }
|
|
296359
296674
|
//
|
|
296360
|
-
const data = this.
|
|
296675
|
+
const data = this.safeDict(response, 'data', {});
|
|
296361
296676
|
const maker = this.safeString(data, 'makerFeeRate');
|
|
296362
296677
|
const taker = this.safeString(data, 'takerFeeRate');
|
|
296363
296678
|
const result = {};
|
|
@@ -296444,7 +296759,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296444
296759
|
// "success": true
|
|
296445
296760
|
// }
|
|
296446
296761
|
//
|
|
296447
|
-
const tokenRows = this.
|
|
296762
|
+
const tokenRows = this.safeList(tokenResponse, 'rows', []);
|
|
296448
296763
|
const networksByCurrencyId = this.groupBy(tokenRows, 'balance_token');
|
|
296449
296764
|
const currencyIds = Object.keys(networksByCurrencyId);
|
|
296450
296765
|
for (let i = 0; i < currencyIds.length; i++) {
|
|
@@ -296604,7 +296919,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296604
296919
|
* @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
296605
296920
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
296606
296921
|
*/
|
|
296607
|
-
const reduceOnly = this.
|
|
296922
|
+
const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
296608
296923
|
params = this.omit(params, ['reduceOnly', 'reduce_only']);
|
|
296609
296924
|
const orderType = type.toUpperCase();
|
|
296610
296925
|
await this.loadMarkets();
|
|
@@ -296775,9 +297090,9 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296775
297090
|
// },
|
|
296776
297091
|
// "timestamp": "1686149372216"
|
|
296777
297092
|
// }
|
|
296778
|
-
const data = this.
|
|
297093
|
+
const data = this.safeDict(response, 'data');
|
|
296779
297094
|
if (data !== undefined) {
|
|
296780
|
-
const rows = this.
|
|
297095
|
+
const rows = this.safeList(data, 'rows', []);
|
|
296781
297096
|
return this.parseOrder(rows[0], market);
|
|
296782
297097
|
}
|
|
296783
297098
|
const order = this.parseOrder(response, market);
|
|
@@ -296878,7 +297193,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296878
297193
|
// "timestamp": 0
|
|
296879
297194
|
// }
|
|
296880
297195
|
//
|
|
296881
|
-
const data = this.
|
|
297196
|
+
const data = this.safeDict(response, 'data', {});
|
|
296882
297197
|
return this.parseOrder(data, market);
|
|
296883
297198
|
}
|
|
296884
297199
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -296952,8 +297267,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296952
297267
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
296953
297268
|
*/
|
|
296954
297269
|
await this.loadMarkets();
|
|
296955
|
-
const stop = this.
|
|
296956
|
-
params = this.omit(params, 'stop');
|
|
297270
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
297271
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
296957
297272
|
if (stop) {
|
|
296958
297273
|
return await this.v3PrivateDeleteAlgoOrdersPending(params);
|
|
296959
297274
|
}
|
|
@@ -296987,8 +297302,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
296987
297302
|
*/
|
|
296988
297303
|
await this.loadMarkets();
|
|
296989
297304
|
const market = (symbol !== undefined) ? this.market(symbol) : undefined;
|
|
296990
|
-
const stop = this.
|
|
296991
|
-
params = this.omit(params, 'stop');
|
|
297305
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
297306
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
296992
297307
|
const request = {};
|
|
296993
297308
|
const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
|
|
296994
297309
|
let response = undefined;
|
|
@@ -297062,9 +297377,9 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297062
297377
|
await this.loadMarkets();
|
|
297063
297378
|
const request = {};
|
|
297064
297379
|
let market = undefined;
|
|
297065
|
-
const stop = this.
|
|
297380
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
297066
297381
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
297067
|
-
params = this.omit(params, ['stop', 'trailing']);
|
|
297382
|
+
params = this.omit(params, ['stop', 'trailing', 'trigger']);
|
|
297068
297383
|
if (symbol !== undefined) {
|
|
297069
297384
|
market = this.market(symbol);
|
|
297070
297385
|
request['symbol'] = market['id'];
|
|
@@ -297122,7 +297437,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297122
297437
|
// }
|
|
297123
297438
|
//
|
|
297124
297439
|
const data = this.safeValue(response, 'data', response);
|
|
297125
|
-
const orders = this.
|
|
297440
|
+
const orders = this.safeList(data, 'rows');
|
|
297126
297441
|
return this.parseOrders(orders, market, since, limit, params);
|
|
297127
297442
|
}
|
|
297128
297443
|
parseTimeInForce(timeInForce) {
|
|
@@ -297224,7 +297539,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297224
297539
|
'type': orderType,
|
|
297225
297540
|
'timeInForce': this.parseTimeInForce(orderType),
|
|
297226
297541
|
'postOnly': undefined,
|
|
297227
|
-
'reduceOnly': this.
|
|
297542
|
+
'reduceOnly': this.safeBool(order, 'reduce_only'),
|
|
297228
297543
|
'side': side,
|
|
297229
297544
|
'price': price,
|
|
297230
297545
|
'stopPrice': stopPrice,
|
|
@@ -297382,7 +297697,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297382
297697
|
// }
|
|
297383
297698
|
//
|
|
297384
297699
|
}
|
|
297385
|
-
const rows = this.
|
|
297700
|
+
const rows = this.safeList(response, 'rows', []);
|
|
297386
297701
|
return this.parseOHLCVs(rows, market, timeframe, since, limit);
|
|
297387
297702
|
}
|
|
297388
297703
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -297435,7 +297750,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297435
297750
|
// }
|
|
297436
297751
|
// ]
|
|
297437
297752
|
// }
|
|
297438
|
-
const trades = this.
|
|
297753
|
+
const trades = this.safeList(response, 'rows', []);
|
|
297439
297754
|
return this.parseTrades(trades, market, since, limit, params);
|
|
297440
297755
|
}
|
|
297441
297756
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -297483,7 +297798,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297483
297798
|
// ...
|
|
297484
297799
|
// ]
|
|
297485
297800
|
// }
|
|
297486
|
-
const trades = this.
|
|
297801
|
+
const trades = this.safeList(response, 'rows', []);
|
|
297487
297802
|
return this.parseTrades(trades, market, since, limit, params);
|
|
297488
297803
|
}
|
|
297489
297804
|
async fetchAccounts(params = {}) {
|
|
@@ -297511,7 +297826,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297511
297826
|
// "success": true
|
|
297512
297827
|
// }
|
|
297513
297828
|
//
|
|
297514
|
-
const rows = this.
|
|
297829
|
+
const rows = this.safeList(response, 'rows', []);
|
|
297515
297830
|
return this.parseAccounts(rows, params);
|
|
297516
297831
|
}
|
|
297517
297832
|
parseAccount(account) {
|
|
@@ -297565,14 +297880,14 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297565
297880
|
// "timestamp": 1673323746259
|
|
297566
297881
|
// }
|
|
297567
297882
|
//
|
|
297568
|
-
const data = this.
|
|
297883
|
+
const data = this.safeDict(response, 'data');
|
|
297569
297884
|
return this.parseBalance(data);
|
|
297570
297885
|
}
|
|
297571
297886
|
parseBalance(response) {
|
|
297572
297887
|
const result = {
|
|
297573
297888
|
'info': response,
|
|
297574
297889
|
};
|
|
297575
|
-
const balances = this.
|
|
297890
|
+
const balances = this.safeList(response, 'holding', []);
|
|
297576
297891
|
for (let i = 0; i < balances.length; i++) {
|
|
297577
297892
|
const balance = balances[i];
|
|
297578
297893
|
const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
|
|
@@ -297849,6 +298164,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297849
298164
|
/**
|
|
297850
298165
|
* @method
|
|
297851
298166
|
* @name woo#transfer
|
|
298167
|
+
* @see https://docs.woo.org/#get-transfer-history
|
|
297852
298168
|
* @description transfer currency internally between wallets on the same account
|
|
297853
298169
|
* @param {string} code unified currency code
|
|
297854
298170
|
* @param {float} amount amount to transfer
|
|
@@ -297861,7 +298177,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297861
298177
|
const currency = this.currency(code);
|
|
297862
298178
|
const request = {
|
|
297863
298179
|
'token': currency['id'],
|
|
297864
|
-
'amount': this.
|
|
298180
|
+
'amount': this.parseToNumeric(amount),
|
|
297865
298181
|
'from_application_id': fromAccount,
|
|
297866
298182
|
'to_application_id': toAccount,
|
|
297867
298183
|
};
|
|
@@ -297873,7 +298189,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297873
298189
|
// }
|
|
297874
298190
|
//
|
|
297875
298191
|
const transfer = this.parseTransfer(response, currency);
|
|
297876
|
-
const transferOptions = this.
|
|
298192
|
+
const transferOptions = this.safeDict(this.options, 'transfer', {});
|
|
297877
298193
|
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
297878
298194
|
if (fillResponseFromRequest) {
|
|
297879
298195
|
transfer['amount'] = amount;
|
|
@@ -297887,41 +298203,71 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297887
298203
|
* @method
|
|
297888
298204
|
* @name woo#fetchTransfers
|
|
297889
298205
|
* @description fetch a history of internal transfers made on an account
|
|
298206
|
+
* @see https://docs.woo.org/#get-transfer-history
|
|
297890
298207
|
* @param {string} code unified currency code of the currency transferred
|
|
297891
298208
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
297892
298209
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
297893
298210
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
298211
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
297894
298212
|
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
297895
298213
|
*/
|
|
297896
|
-
const request = {
|
|
297897
|
-
|
|
297898
|
-
|
|
297899
|
-
|
|
297900
|
-
|
|
298214
|
+
const request = {};
|
|
298215
|
+
if (limit !== undefined) {
|
|
298216
|
+
request['size'] = limit;
|
|
298217
|
+
}
|
|
298218
|
+
if (since !== undefined) {
|
|
298219
|
+
request['start_t'] = since;
|
|
298220
|
+
}
|
|
298221
|
+
const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
|
|
298222
|
+
params = this.omit(params, ['until', 'till']);
|
|
298223
|
+
if (until !== undefined) {
|
|
298224
|
+
request['end_t'] = until;
|
|
298225
|
+
}
|
|
298226
|
+
const response = await this.v1PrivateGetAssetMainSubTransferHistory(this.extend(request, params));
|
|
298227
|
+
//
|
|
298228
|
+
// {
|
|
298229
|
+
// "rows": [
|
|
298230
|
+
// {
|
|
298231
|
+
// "id": 46704,
|
|
298232
|
+
// "token": "USDT",
|
|
298233
|
+
// "amount": 30000.00000000,
|
|
298234
|
+
// "status": "COMPLETED",
|
|
298235
|
+
// "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
|
|
298236
|
+
// "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
|
|
298237
|
+
// "from_user": "LeverageLow",
|
|
298238
|
+
// "to_user": "dev",
|
|
298239
|
+
// "created_time": "1709022325.427",
|
|
298240
|
+
// "updated_time": "1709022325.542"
|
|
298241
|
+
// }
|
|
298242
|
+
// ],
|
|
298243
|
+
// "meta": {
|
|
298244
|
+
// "total": 50,
|
|
298245
|
+
// "records_per_page": 25,
|
|
298246
|
+
// "current_page": 1
|
|
298247
|
+
// },
|
|
298248
|
+
// "success": true
|
|
298249
|
+
// }
|
|
298250
|
+
//
|
|
298251
|
+
const data = this.safeList(response, 'rows', []);
|
|
298252
|
+
return this.parseTransfers(data, undefined, since, limit, params);
|
|
297901
298253
|
}
|
|
297902
298254
|
parseTransfer(transfer, currency = undefined) {
|
|
297903
298255
|
//
|
|
297904
|
-
//
|
|
297905
|
-
//
|
|
297906
|
-
//
|
|
297907
|
-
//
|
|
297908
|
-
//
|
|
297909
|
-
//
|
|
297910
|
-
//
|
|
297911
|
-
//
|
|
297912
|
-
//
|
|
297913
|
-
//
|
|
297914
|
-
//
|
|
297915
|
-
//
|
|
297916
|
-
//
|
|
297917
|
-
// "amount": 1000,
|
|
297918
|
-
// "tx_id": "0x8a74c517bc104c8ebad0c3c3f64b1f302ed5f8bca598ae4459c63419038106b6",
|
|
297919
|
-
// "fee_token": null,
|
|
297920
|
-
// "fee_amount": null,
|
|
297921
|
-
// "status": "CONFIRMING"
|
|
297922
|
-
// }
|
|
298256
|
+
// fetchTransfers
|
|
298257
|
+
// {
|
|
298258
|
+
// "id": 46704,
|
|
298259
|
+
// "token": "USDT",
|
|
298260
|
+
// "amount": 30000.00000000,
|
|
298261
|
+
// "status": "COMPLETED",
|
|
298262
|
+
// "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
|
|
298263
|
+
// "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
|
|
298264
|
+
// "from_user": "LeverageLow",
|
|
298265
|
+
// "to_user": "dev",
|
|
298266
|
+
// "created_time": "1709022325.427",
|
|
298267
|
+
// "updated_time": "1709022325.542"
|
|
298268
|
+
// }
|
|
297923
298269
|
//
|
|
297924
|
-
//
|
|
298270
|
+
// transfer
|
|
297925
298271
|
// {
|
|
297926
298272
|
// "success": true,
|
|
297927
298273
|
// "id": 200
|
|
@@ -297930,22 +298276,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297930
298276
|
const networkizedCode = this.safeString(transfer, 'token');
|
|
297931
298277
|
const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
|
|
297932
298278
|
const code = currencyDefined['code'];
|
|
297933
|
-
let movementDirection = this.safeStringLower(transfer, 'token_side');
|
|
297934
|
-
if (movementDirection === 'withdraw') {
|
|
297935
|
-
movementDirection = 'withdrawal';
|
|
297936
|
-
}
|
|
297937
|
-
let fromAccount = undefined;
|
|
297938
|
-
let toAccount = undefined;
|
|
297939
|
-
if (movementDirection === 'withdraw') {
|
|
297940
|
-
fromAccount = undefined;
|
|
297941
|
-
toAccount = 'spot';
|
|
297942
|
-
}
|
|
297943
|
-
else if (movementDirection === 'deposit') {
|
|
297944
|
-
fromAccount = 'spot';
|
|
297945
|
-
toAccount = undefined;
|
|
297946
|
-
}
|
|
297947
298279
|
const timestamp = this.safeTimestamp(transfer, 'created_time');
|
|
297948
|
-
const success = this.
|
|
298280
|
+
const success = this.safeBool(transfer, 'success');
|
|
297949
298281
|
let status = undefined;
|
|
297950
298282
|
if (success !== undefined) {
|
|
297951
298283
|
status = success ? 'ok' : 'failed';
|
|
@@ -297956,8 +298288,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297956
298288
|
'datetime': this.iso8601(timestamp),
|
|
297957
298289
|
'currency': code,
|
|
297958
298290
|
'amount': this.safeNumber(transfer, 'amount'),
|
|
297959
|
-
'fromAccount':
|
|
297960
|
-
'toAccount':
|
|
298291
|
+
'fromAccount': this.safeString(transfer, 'from_application_id'),
|
|
298292
|
+
'toAccount': this.safeString(transfer, 'to_application_id'),
|
|
297961
298293
|
'status': this.parseTransferStatus(this.safeString(transfer, 'status', status)),
|
|
297962
298294
|
'info': transfer,
|
|
297963
298295
|
};
|
|
@@ -297995,11 +298327,11 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
297995
298327
|
if (tag !== undefined) {
|
|
297996
298328
|
request['extra'] = tag;
|
|
297997
298329
|
}
|
|
297998
|
-
const networks = this.
|
|
297999
|
-
const currencyNetworks = this.
|
|
298330
|
+
const networks = this.safeDict(this.options, 'networks', {});
|
|
298331
|
+
const currencyNetworks = this.safeDict(currency, 'networks', {});
|
|
298000
298332
|
const network = this.safeStringUpper(params, 'network');
|
|
298001
298333
|
const networkId = this.safeString(networks, network, network);
|
|
298002
|
-
const coinNetwork = this.
|
|
298334
|
+
const coinNetwork = this.safeDict(currencyNetworks, networkId, {});
|
|
298003
298335
|
const coinNetworkId = this.safeString(coinNetwork, 'id');
|
|
298004
298336
|
if (coinNetworkId === undefined) {
|
|
298005
298337
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' withdraw() require network parameter');
|
|
@@ -298085,7 +298417,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298085
298417
|
else {
|
|
298086
298418
|
this.checkRequiredCredentials();
|
|
298087
298419
|
if (method === 'POST' && (path === 'algo/order' || path === 'order')) {
|
|
298088
|
-
const isSandboxMode = this.
|
|
298420
|
+
const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
298089
298421
|
if (!isSandboxMode) {
|
|
298090
298422
|
const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
|
|
298091
298423
|
const brokerId = this.safeString(this.options, 'brokerId', applicationId);
|
|
@@ -298127,7 +298459,9 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298127
298459
|
body = auth;
|
|
298128
298460
|
}
|
|
298129
298461
|
else {
|
|
298130
|
-
|
|
298462
|
+
if (Object.keys(params).length) {
|
|
298463
|
+
url += '?' + auth;
|
|
298464
|
+
}
|
|
298131
298465
|
}
|
|
298132
298466
|
auth += '|' + ts;
|
|
298133
298467
|
headers['content-type'] = 'application/x-www-form-urlencoded';
|
|
@@ -298144,7 +298478,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298144
298478
|
// 400 Bad Request {"success":false,"code":-1012,"message":"Amount is required for buy market orders when margin disabled."}
|
|
298145
298479
|
// {"code":"-1011","message":"The system is under maintenance.","success":false}
|
|
298146
298480
|
//
|
|
298147
|
-
const success = this.
|
|
298481
|
+
const success = this.safeBool(response, 'success');
|
|
298148
298482
|
const errorCode = this.safeString(response, 'code');
|
|
298149
298483
|
if (!success) {
|
|
298150
298484
|
const feedback = this.id + ' ' + this.json(response);
|
|
@@ -298220,7 +298554,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298220
298554
|
// "success":true
|
|
298221
298555
|
// }
|
|
298222
298556
|
//
|
|
298223
|
-
const result = this.
|
|
298557
|
+
const result = this.safeList(response, 'rows', []);
|
|
298224
298558
|
return this.parseIncomes(result, market, since, limit);
|
|
298225
298559
|
}
|
|
298226
298560
|
parseFundingRate(fundingRate, market = undefined) {
|
|
@@ -298301,7 +298635,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298301
298635
|
// "timestamp":1653633985646
|
|
298302
298636
|
// }
|
|
298303
298637
|
//
|
|
298304
|
-
const rows = this.
|
|
298638
|
+
const rows = this.safeList(response, 'rows', []);
|
|
298305
298639
|
const result = this.parseFundingRates(rows);
|
|
298306
298640
|
return this.filterByArray(result, 'symbol', symbols);
|
|
298307
298641
|
}
|
|
@@ -298355,7 +298689,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298355
298689
|
// "timestamp":1653640814885
|
|
298356
298690
|
// }
|
|
298357
298691
|
//
|
|
298358
|
-
const result = this.
|
|
298692
|
+
const result = this.safeList(response, 'rows');
|
|
298359
298693
|
const rates = [];
|
|
298360
298694
|
for (let i = 0; i < result.length; i++) {
|
|
298361
298695
|
const entry = result[i];
|
|
@@ -298517,8 +298851,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
298517
298851
|
// "timestamp": 1673323880342
|
|
298518
298852
|
// }
|
|
298519
298853
|
//
|
|
298520
|
-
const result = this.
|
|
298521
|
-
const positions = this.
|
|
298854
|
+
const result = this.safeDict(response, 'data', {});
|
|
298855
|
+
const positions = this.safeList(result, 'positions', []);
|
|
298522
298856
|
return this.parsePositions(positions, symbols);
|
|
298523
298857
|
}
|
|
298524
298858
|
parsePosition(position, market = undefined) {
|
|
@@ -308172,7 +308506,7 @@ SOFTWARE.
|
|
|
308172
308506
|
|
|
308173
308507
|
//-----------------------------------------------------------------------------
|
|
308174
308508
|
// this is updated by vss.js when building
|
|
308175
|
-
const version = '4.2.
|
|
308509
|
+
const version = '4.2.60';
|
|
308176
308510
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
308177
308511
|
//-----------------------------------------------------------------------------
|
|
308178
308512
|
|