ccxt 4.5.45 → 4.5.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/aftermath.js +1 -1
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +27 -0
- package/dist/cjs/src/binance.js +23 -17
- package/dist/cjs/src/bitfinex.js +6 -11
- package/dist/cjs/src/bitget.js +9 -4
- package/dist/cjs/src/bitmart.js +144 -21
- package/dist/cjs/src/bitmex.js +46 -0
- package/dist/cjs/src/bitstamp.js +14 -1
- package/dist/cjs/src/bittrade.js +1 -1
- package/dist/cjs/src/blofin.js +137 -29
- package/dist/cjs/src/bybit.js +58 -56
- package/dist/cjs/src/bydfi.js +102 -100
- package/dist/cjs/src/gate.js +37 -2
- package/dist/cjs/src/hollaex.js +1 -1
- package/dist/cjs/src/kraken.js +39 -29
- package/dist/cjs/src/kucoin.js +2161 -462
- package/dist/cjs/src/lighter.js +2 -2
- package/dist/cjs/src/okx.js +75 -58
- package/dist/cjs/src/paradex.js +2 -6
- package/dist/cjs/src/pro/bittrade.js +4 -0
- package/dist/cjs/src/pro/bydfi.js +19 -19
- package/dist/cjs/src/pro/gate.js +79 -54
- package/dist/cjs/src/pro/grvt.js +6 -4
- package/dist/cjs/src/pro/htx.js +4 -4
- package/dist/cjs/src/pro/lighter.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/whitebit.js +21 -2
- package/index.d.cts +2 -0
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/abstract/bitmart.d.ts +7 -0
- package/js/src/abstract/blofin.d.ts +28 -12
- package/js/src/abstract/bydfi.d.ts +29 -29
- package/js/src/abstract/kraken.d.ts +36 -29
- package/js/src/abstract/kucoin.d.ts +2 -0
- package/js/src/abstract/kucoinfutures.d.ts +2 -0
- package/js/src/aftermath.js +1 -1
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +27 -0
- package/js/src/binance.js +23 -17
- package/js/src/bitfinex.js +6 -11
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +9 -4
- package/js/src/bitmart.d.ts +18 -4
- package/js/src/bitmart.js +144 -21
- package/js/src/bitmex.d.ts +12 -0
- package/js/src/bitmex.js +46 -0
- package/js/src/bitstamp.js +14 -1
- package/js/src/bittrade.js +1 -1
- package/js/src/blofin.d.ts +2 -0
- package/js/src/blofin.js +137 -29
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +58 -56
- package/js/src/bydfi.d.ts +31 -31
- package/js/src/bydfi.js +102 -100
- package/js/src/gate.js +37 -2
- package/js/src/hollaex.js +1 -1
- package/js/src/kraken.js +39 -29
- package/js/src/kucoin.d.ts +249 -8
- package/js/src/kucoin.js +2161 -462
- package/js/src/lighter.js +2 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +75 -58
- package/js/src/paradex.d.ts +0 -1
- package/js/src/paradex.js +2 -6
- package/js/src/pro/bittrade.js +4 -0
- package/js/src/pro/bydfi.d.ts +18 -18
- package/js/src/pro/bydfi.js +19 -19
- package/js/src/pro/gate.d.ts +2 -2
- package/js/src/pro/gate.js +79 -54
- package/js/src/pro/grvt.js +6 -4
- package/js/src/pro/htx.js +4 -4
- package/js/src/pro/lighter.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/whitebit.d.ts +1 -1
- package/js/src/whitebit.js +21 -2
- package/package.json +2 -2
- package/dist/cjs/src/abstract/coincatch.js +0 -11
- package/dist/cjs/src/coincatch.js +0 -5495
- package/dist/cjs/src/pro/coincatch.js +0 -1563
- package/js/src/abstract/coincatch.d.ts +0 -97
- package/js/src/abstract/coincatch.js +0 -5
- package/js/src/coincatch.d.ts +0 -788
- package/js/src/coincatch.js +0 -5488
- package/js/src/pro/coincatch.d.ts +0 -207
- package/js/src/pro/coincatch.js +0 -1556
package/dist/cjs/src/lighter.js
CHANGED
|
@@ -508,7 +508,7 @@ class lighter extends lighter$1["default"] {
|
|
|
508
508
|
setSandboxMode(enable) {
|
|
509
509
|
super.setSandboxMode(enable);
|
|
510
510
|
this.options['sandboxMode'] = enable;
|
|
511
|
-
this.options['chainId'] = 300;
|
|
511
|
+
this.options['chainId'] = enable ? 300 : 304;
|
|
512
512
|
}
|
|
513
513
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
514
514
|
/**
|
|
@@ -1152,7 +1152,7 @@ class lighter extends lighter$1["default"] {
|
|
|
1152
1152
|
// "daily_chart": {},
|
|
1153
1153
|
// "market_config": {
|
|
1154
1154
|
// "market_margin_mode": 0,
|
|
1155
|
-
// "insurance_fund_account_index":
|
|
1155
|
+
// "insurance_fund_account_index": 281474976710654,
|
|
1156
1156
|
// "liquidation_mode": 0,
|
|
1157
1157
|
// "force_reduce_only": false,
|
|
1158
1158
|
// "trading_hours": ""
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1073,11 +1073,13 @@ class okx extends okx$1["default"] {
|
|
|
1073
1073
|
},
|
|
1074
1074
|
'networks': {
|
|
1075
1075
|
'BTC': 'Bitcoin',
|
|
1076
|
-
'BTCLN': 'Lightning',
|
|
1077
1076
|
'BTCLIGHTNING': 'Lightning',
|
|
1077
|
+
'BSC': 'BSC',
|
|
1078
1078
|
'BEP20': 'BSC',
|
|
1079
1079
|
'BRC20': 'BRC20',
|
|
1080
|
+
'ETH': 'ERC20',
|
|
1080
1081
|
'ERC20': 'ERC20',
|
|
1082
|
+
'TRX': 'TRC20',
|
|
1081
1083
|
'TRC20': 'TRC20',
|
|
1082
1084
|
'CRC20': 'Crypto',
|
|
1083
1085
|
'ACA': 'Acala',
|
|
@@ -1193,6 +1195,11 @@ class okx extends okx$1["default"] {
|
|
|
1193
1195
|
// "WBTCK-OKTC",
|
|
1194
1196
|
// "ZetaChain",
|
|
1195
1197
|
},
|
|
1198
|
+
'networksById': {
|
|
1199
|
+
'ERC20': 'ERC20',
|
|
1200
|
+
'TRC20': 'TRC20',
|
|
1201
|
+
'BEP20': 'BEP20',
|
|
1202
|
+
},
|
|
1196
1203
|
'fetchOpenInterestHistory': {
|
|
1197
1204
|
'timeframes': {
|
|
1198
1205
|
'5m': '5m',
|
|
@@ -1890,7 +1897,18 @@ class okx extends okx$1["default"] {
|
|
|
1890
1897
|
// }
|
|
1891
1898
|
//
|
|
1892
1899
|
const dataResponse = this.safeList(response, 'data', []);
|
|
1893
|
-
|
|
1900
|
+
const marketsWithoutTest = [];
|
|
1901
|
+
for (let i = 0; i < dataResponse.length; i++) {
|
|
1902
|
+
const data = dataResponse[i];
|
|
1903
|
+
if (this.isSandboxModeEnabled) {
|
|
1904
|
+
const instFamily = this.safeString(data, 'instFamily', '');
|
|
1905
|
+
if (instFamily.startsWith('TEST')) {
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
marketsWithoutTest.push(data);
|
|
1910
|
+
}
|
|
1911
|
+
return this.parseMarkets(marketsWithoutTest);
|
|
1894
1912
|
}
|
|
1895
1913
|
/**
|
|
1896
1914
|
* @method
|
|
@@ -1959,68 +1977,67 @@ class okx extends okx$1["default"] {
|
|
|
1959
1977
|
// }
|
|
1960
1978
|
//
|
|
1961
1979
|
const data = this.safeList(response, 'data', []);
|
|
1962
|
-
const result = {};
|
|
1963
1980
|
const dataByCurrencyId = this.groupBy(data, 'ccy');
|
|
1964
|
-
const
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
const chainPart = parts.join('-');
|
|
1984
|
-
const networkCode = this.networkIdToCode(chainPart, currency['code']);
|
|
1985
|
-
networks[networkCode] = {
|
|
1986
|
-
'id': networkId,
|
|
1987
|
-
'network': networkCode,
|
|
1988
|
-
'active': undefined,
|
|
1989
|
-
'deposit': this.safeBool(chain, 'canDep'),
|
|
1990
|
-
'withdraw': this.safeBool(chain, 'canWd'),
|
|
1991
|
-
'fee': this.safeNumber(chain, 'fee'),
|
|
1992
|
-
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
|
|
1993
|
-
'limits': {
|
|
1994
|
-
'withdraw': {
|
|
1995
|
-
'min': this.safeNumber(chain, 'minWd'),
|
|
1996
|
-
'max': this.safeNumber(chain, 'maxWd'),
|
|
1997
|
-
},
|
|
1998
|
-
},
|
|
1999
|
-
'info': chain,
|
|
2000
|
-
};
|
|
1981
|
+
const currencies = Object.values(dataByCurrencyId);
|
|
1982
|
+
return this.parseCurrencies(currencies);
|
|
1983
|
+
}
|
|
1984
|
+
parseCurrency(currency) {
|
|
1985
|
+
const chains = currency;
|
|
1986
|
+
// currencies are grouped by chain entries, so there is at least one entry
|
|
1987
|
+
const firstChain = this.safeDict(chains, 0, {});
|
|
1988
|
+
const currencyId = this.safeString(firstChain, 'ccy');
|
|
1989
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
1990
|
+
const networks = {};
|
|
1991
|
+
let type = 'crypto';
|
|
1992
|
+
const chainsLength = chains.length;
|
|
1993
|
+
for (let j = 0; j < chainsLength; j++) {
|
|
1994
|
+
const chain = chains[j];
|
|
1995
|
+
// allow empty string for rare fiat-currencies, e.g. TRY
|
|
1996
|
+
const networkId = this.safeString(chain, 'chain', ''); // USDT-BEP20, USDT-Avalance-C, etc
|
|
1997
|
+
if (networkId === '') {
|
|
1998
|
+
// only happens for fiat 'TRY' currency
|
|
1999
|
+
type = 'fiat';
|
|
2001
2000
|
}
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
'
|
|
2001
|
+
const idParts = networkId.split('-');
|
|
2002
|
+
const parts = this.arraySlice(idParts, 1);
|
|
2003
|
+
const chainPart = parts.join('-');
|
|
2004
|
+
const networkCode = this.networkIdToCode(chainPart, code);
|
|
2005
|
+
networks[networkCode] = {
|
|
2006
|
+
'id': networkId,
|
|
2007
|
+
'network': networkCode,
|
|
2008
2008
|
'active': undefined,
|
|
2009
|
-
'deposit':
|
|
2010
|
-
'withdraw':
|
|
2011
|
-
'fee':
|
|
2012
|
-
'precision':
|
|
2009
|
+
'deposit': this.safeBool(chain, 'canDep'),
|
|
2010
|
+
'withdraw': this.safeBool(chain, 'canWd'),
|
|
2011
|
+
'fee': this.safeNumber(chain, 'fee'),
|
|
2012
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
|
|
2013
2013
|
'limits': {
|
|
2014
|
-
'
|
|
2015
|
-
'min':
|
|
2016
|
-
'max':
|
|
2014
|
+
'withdraw': {
|
|
2015
|
+
'min': this.safeNumber(chain, 'minWd'),
|
|
2016
|
+
'max': this.safeNumber(chain, 'maxWd'),
|
|
2017
2017
|
},
|
|
2018
2018
|
},
|
|
2019
|
-
'
|
|
2020
|
-
|
|
2021
|
-
});
|
|
2019
|
+
'info': chain,
|
|
2020
|
+
};
|
|
2022
2021
|
}
|
|
2023
|
-
return
|
|
2022
|
+
return this.safeCurrencyStructure({
|
|
2023
|
+
'info': chains,
|
|
2024
|
+
'code': code,
|
|
2025
|
+
'id': currencyId,
|
|
2026
|
+
'name': this.safeString(firstChain, 'name'),
|
|
2027
|
+
'active': undefined,
|
|
2028
|
+
'deposit': undefined,
|
|
2029
|
+
'withdraw': undefined,
|
|
2030
|
+
'fee': undefined,
|
|
2031
|
+
'precision': undefined,
|
|
2032
|
+
'limits': {
|
|
2033
|
+
'amount': {
|
|
2034
|
+
'min': undefined,
|
|
2035
|
+
'max': undefined,
|
|
2036
|
+
},
|
|
2037
|
+
},
|
|
2038
|
+
'type': type,
|
|
2039
|
+
'networks': networks,
|
|
2040
|
+
});
|
|
2024
2041
|
}
|
|
2025
2042
|
/**
|
|
2026
2043
|
* @method
|
|
@@ -5405,7 +5422,7 @@ class okx extends okx$1["default"] {
|
|
|
5405
5422
|
if (fee === undefined) {
|
|
5406
5423
|
const currencies = await this.fetchCurrencies();
|
|
5407
5424
|
this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
|
|
5408
|
-
const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
|
|
5425
|
+
const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network, currency['code']), {});
|
|
5409
5426
|
fee = this.safeString(targetNetwork, 'fee');
|
|
5410
5427
|
if (fee === undefined) {
|
|
5411
5428
|
throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a "fee" string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set "0". Withdrawing to external digital asset address requires network transaction fee.');
|
package/dist/cjs/src/paradex.js
CHANGED
|
@@ -1344,10 +1344,6 @@ class paradex extends paradex$1["default"] {
|
|
|
1344
1344
|
};
|
|
1345
1345
|
return this.safeStringLower(types, type, type);
|
|
1346
1346
|
}
|
|
1347
|
-
convertShortString(str) {
|
|
1348
|
-
// TODO: add stringToBase16 in exchange
|
|
1349
|
-
return '0x' + this.binaryToBase16(this.base64ToBinary(this.stringToBase64(str)));
|
|
1350
|
-
}
|
|
1351
1347
|
scaleNumber(num) {
|
|
1352
1348
|
return Precise["default"].stringMul(num, '100000000');
|
|
1353
1349
|
}
|
|
@@ -1464,9 +1460,9 @@ class paradex extends paradex$1["default"] {
|
|
|
1464
1460
|
const now = this.nonce();
|
|
1465
1461
|
const orderReq = {
|
|
1466
1462
|
'timestamp': now * 1000,
|
|
1467
|
-
'market': this.
|
|
1463
|
+
'market': this.stringToBase16(request['market']),
|
|
1468
1464
|
'side': (orderSide === 'BUY') ? '1' : '2',
|
|
1469
|
-
'orderType': this.
|
|
1465
|
+
'orderType': this.stringToBase16(request['type']),
|
|
1470
1466
|
'size': this.scaleNumber(request['size']),
|
|
1471
1467
|
'price': (isMarket) ? '0' : this.scaleNumber(request['price']),
|
|
1472
1468
|
};
|
|
@@ -304,6 +304,7 @@ class bittrade extends bittrade$1["default"] {
|
|
|
304
304
|
// {
|
|
305
305
|
// "id": 1583473663565,
|
|
306
306
|
// "rep": "market.btcusdt.mbp.150",
|
|
307
|
+
// "ts": 1774979531056,
|
|
307
308
|
// "status": "ok",
|
|
308
309
|
// "data": {
|
|
309
310
|
// "seqNum": 104999417756,
|
|
@@ -322,10 +323,13 @@ class bittrade extends bittrade$1["default"] {
|
|
|
322
323
|
//
|
|
323
324
|
const symbol = this.safeString(subscription, 'symbol');
|
|
324
325
|
const messageHash = this.safeString(subscription, 'messageHash');
|
|
326
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
325
327
|
const orderbook = this.orderbooks[symbol];
|
|
326
328
|
const data = this.safeValue(message, 'data');
|
|
327
329
|
const snapshot = this.parseOrderBook(data, symbol);
|
|
328
330
|
snapshot['nonce'] = this.safeInteger(data, 'seqNum');
|
|
331
|
+
snapshot['timestamp'] = timestamp;
|
|
332
|
+
snapshot['datetime'] = this.iso8601(timestamp);
|
|
329
333
|
orderbook.reset(snapshot);
|
|
330
334
|
// unroll the accumulated deltas
|
|
331
335
|
const messages = orderbook.cache;
|
|
@@ -44,7 +44,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
44
44
|
},
|
|
45
45
|
'urls': {
|
|
46
46
|
'api': {
|
|
47
|
-
'ws': 'wss://stream.bydfi.com/v1/public/
|
|
47
|
+
'ws': 'wss://stream.bydfi.com/v1/public/fapi',
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
'options': {
|
|
@@ -143,7 +143,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
143
143
|
* @method
|
|
144
144
|
* @name bydfi#watchTicker
|
|
145
145
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
146
|
-
* @see https://developers.bydfi.com/en/
|
|
146
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#ticker-by-symbol
|
|
147
147
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
148
148
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
149
149
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
|
|
@@ -160,7 +160,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
160
160
|
* @method
|
|
161
161
|
* @name bydfi#unWatchTicker
|
|
162
162
|
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
163
|
-
* @see https://developers.bydfi.com/en/
|
|
163
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#ticker-by-symbol
|
|
164
164
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
165
165
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
166
166
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
|
|
@@ -172,8 +172,8 @@ class bydfi extends bydfi$1["default"] {
|
|
|
172
172
|
* @method
|
|
173
173
|
* @name bydfi#watchTickers
|
|
174
174
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
175
|
-
* @see https://developers.bydfi.com/en/
|
|
176
|
-
* @see https://developers.bydfi.com/en/
|
|
175
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#ticker-by-symbol
|
|
176
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#market-wide-ticker
|
|
177
177
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
178
178
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
179
179
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
|
|
@@ -204,8 +204,8 @@ class bydfi extends bydfi$1["default"] {
|
|
|
204
204
|
* @method
|
|
205
205
|
* @name bydfi#unWatchTickers
|
|
206
206
|
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
207
|
-
* @see https://developers.bydfi.com/en/
|
|
208
|
-
* @see https://developers.bydfi.com/en/
|
|
207
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#ticker-by-symbol
|
|
208
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#market-wide-ticker
|
|
209
209
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
210
210
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
211
211
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
|
|
@@ -289,7 +289,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
289
289
|
* @method
|
|
290
290
|
* @name bydfi#watchOHLCV
|
|
291
291
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
292
|
-
* @see https://developers.bydfi.com/en/
|
|
292
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#candlestick-data
|
|
293
293
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
294
294
|
* @param {string} timeframe the length of time each candle represents
|
|
295
295
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -305,7 +305,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
305
305
|
* @method
|
|
306
306
|
* @name bydfi#unWatchOHLCV
|
|
307
307
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
308
|
-
* @see https://developers.bydfi.com/en/
|
|
308
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#candlestick-data
|
|
309
309
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
310
310
|
* @param {string} timeframe the length of time each candle represents
|
|
311
311
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -318,7 +318,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
318
318
|
* @method
|
|
319
319
|
* @name bydfi#watchOHLCVForSymbols
|
|
320
320
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
321
|
-
* @see https://developers.bydfi.com/en/
|
|
321
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#candlestick-data
|
|
322
322
|
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
323
323
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
324
324
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
@@ -354,7 +354,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
354
354
|
* @method
|
|
355
355
|
* @name bydfi#unWatchOHLCVForSymbols
|
|
356
356
|
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
357
|
-
* @see https://developers.bydfi.com/en/
|
|
357
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#candlestick-data
|
|
358
358
|
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
359
359
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
360
360
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
@@ -422,7 +422,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
422
422
|
* @method
|
|
423
423
|
* @name bydfi#watchOrderBook
|
|
424
424
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
425
|
-
* @see https://developers.bydfi.com/en/
|
|
425
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#limited-depth-information
|
|
426
426
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
427
427
|
* @param {int} [limit] the maximum amount of order book entries to return (default and maxi is 100)
|
|
428
428
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -435,7 +435,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
435
435
|
* @method
|
|
436
436
|
* @name bydfi#unWatchOrderBook
|
|
437
437
|
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
438
|
-
* @see https://developers.bydfi.com/en/
|
|
438
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#limited-depth-information
|
|
439
439
|
* @param {string} symbol unified array of symbols
|
|
440
440
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
441
441
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
|
|
@@ -447,7 +447,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
447
447
|
* @method
|
|
448
448
|
* @name bydfi#watchOrderBookForSymbols
|
|
449
449
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
450
|
-
* @see https://developers.bydfi.com/en/
|
|
450
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#limited-depth-information
|
|
451
451
|
* @param {string[]} symbols unified array of symbols
|
|
452
452
|
* @param {int} [limit] the maximum amount of order book entries to return (default and max is 100)
|
|
453
453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -479,7 +479,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
479
479
|
* @method
|
|
480
480
|
* @name bydfi#unWatchOrderBookForSymbols
|
|
481
481
|
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
482
|
-
* @see https://developers.bydfi.com/en/
|
|
482
|
+
* @see https://developers.bydfi.com/en/futures/websocket-market#limited-depth-information
|
|
483
483
|
* @param {string[]} symbols unified array of symbols
|
|
484
484
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
485
485
|
* @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
|
|
@@ -538,7 +538,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
538
538
|
* @method
|
|
539
539
|
* @name bydfi#watchOrders
|
|
540
540
|
* @description watches information on multiple orders made by the user
|
|
541
|
-
* @see https://developers.bydfi.com/en/
|
|
541
|
+
* @see https://developers.bydfi.com/en/futures/websocket-account#order-trade-update-push
|
|
542
542
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
543
543
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
544
544
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -556,7 +556,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
556
556
|
* @method
|
|
557
557
|
* @name bydfi#watchOrdersForSymbols
|
|
558
558
|
* @description watches information on multiple orders made by the user
|
|
559
|
-
* @see https://developers.bydfi.com/en/
|
|
559
|
+
* @see https://developers.bydfi.com/en/futures/websocket-account#order-trade-update-push
|
|
560
560
|
* @param {string[]} symbols unified symbol of the market to fetch orders for
|
|
561
561
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
562
562
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -699,7 +699,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
699
699
|
* @method
|
|
700
700
|
* @name bydfi#watchPositions
|
|
701
701
|
* @description watch all open positions
|
|
702
|
-
* @see https://developers.bydfi.com/en/
|
|
702
|
+
* @see https://developers.bydfi.com/en/futures/websocket-account#balance-and-position-update-push
|
|
703
703
|
* @param {string[]} [symbols] list of unified market symbols
|
|
704
704
|
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
705
705
|
* @param {int} [limit] the maximum number of positions to retrieve
|
|
@@ -852,7 +852,7 @@ class bydfi extends bydfi$1["default"] {
|
|
|
852
852
|
* @method
|
|
853
853
|
* @name bydfi#watchBalance
|
|
854
854
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
855
|
-
* @see https://developers.bydfi.com/en/
|
|
855
|
+
* @see https://developers.bydfi.com/en/futures/websocket-account#balance-and-position-update-push
|
|
856
856
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
857
857
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
|
|
858
858
|
*/
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -51,6 +51,19 @@ class gate extends gate$1["default"] {
|
|
|
51
51
|
'watchMyLiquidations': true,
|
|
52
52
|
'watchMyLiquidationsForSymbols': true,
|
|
53
53
|
'watchPositions': true,
|
|
54
|
+
'unWatchTicker': false,
|
|
55
|
+
'unWatchTickers': false,
|
|
56
|
+
'unWatchOHLCV': false,
|
|
57
|
+
'unWatchOHLCVForSymbols': false,
|
|
58
|
+
'unWatchOrderBook': true,
|
|
59
|
+
'unWatchOrderBookForSymbols': false,
|
|
60
|
+
'unWatchTrades': true,
|
|
61
|
+
'unWatchTradesForSymbols': true,
|
|
62
|
+
'unWatchMyTrades': false,
|
|
63
|
+
'unWatchOrders': false,
|
|
64
|
+
'unWatchPositions': false,
|
|
65
|
+
'unWatchMarkPrices': false,
|
|
66
|
+
'unWatchMarkPrice': false,
|
|
54
67
|
},
|
|
55
68
|
'urls': {
|
|
56
69
|
'api': {
|
|
@@ -1033,11 +1046,11 @@ class gate extends gate$1["default"] {
|
|
|
1033
1046
|
/**
|
|
1034
1047
|
* @method
|
|
1035
1048
|
* @name gate#watchBalance
|
|
1049
|
+
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1036
1050
|
* @see https://www.gate.com/docs/developers/apiv4/ws/en/#spot-balance-channel
|
|
1037
1051
|
* @see https://www.gate.com/docs/developers/futures/ws/en/#balances-api
|
|
1038
1052
|
* @see https://www.gate.com/docs/developers/delivery/ws/en/#balances-api
|
|
1039
1053
|
* @see https://www.gate.com/docs/developers/options/ws/en/#balances-channel
|
|
1040
|
-
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1041
1054
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1042
1055
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
|
|
1043
1056
|
*/
|
|
@@ -1065,22 +1078,26 @@ class gate extends gate$1["default"] {
|
|
|
1065
1078
|
handleBalance(client, message) {
|
|
1066
1079
|
//
|
|
1067
1080
|
// spot order fill
|
|
1068
|
-
//
|
|
1069
|
-
//
|
|
1070
|
-
//
|
|
1071
|
-
//
|
|
1072
|
-
//
|
|
1073
|
-
//
|
|
1074
|
-
//
|
|
1075
|
-
//
|
|
1076
|
-
//
|
|
1077
|
-
//
|
|
1078
|
-
//
|
|
1079
|
-
//
|
|
1080
|
-
//
|
|
1081
|
-
//
|
|
1082
|
-
//
|
|
1083
|
-
//
|
|
1081
|
+
// {
|
|
1082
|
+
// "time": 1653664351,
|
|
1083
|
+
// "time_ms": 1605248616763,
|
|
1084
|
+
// "channel": "spot.balances",
|
|
1085
|
+
// "event": "update",
|
|
1086
|
+
// "result": [
|
|
1087
|
+
// {
|
|
1088
|
+
// "timestamp": "1667556323",
|
|
1089
|
+
// "timestamp_ms": "1667556323730",
|
|
1090
|
+
// "user": "1000001",
|
|
1091
|
+
// "currency": "USDT",
|
|
1092
|
+
// "change": "0",
|
|
1093
|
+
// "total": "222244.3827652",
|
|
1094
|
+
// "available": "222244.3827",
|
|
1095
|
+
// "freeze": "5",
|
|
1096
|
+
// "freeze_change": "5.000000",
|
|
1097
|
+
// "change_type": "order-create"
|
|
1098
|
+
// }
|
|
1099
|
+
// ]
|
|
1100
|
+
// }
|
|
1084
1101
|
//
|
|
1085
1102
|
// account transfer
|
|
1086
1103
|
//
|
|
@@ -1124,15 +1141,16 @@ class gate extends gate$1["default"] {
|
|
|
1124
1141
|
// }
|
|
1125
1142
|
//
|
|
1126
1143
|
const result = this.safeValue(message, 'result', []);
|
|
1127
|
-
const timestamp = this.safeInteger(message, 'time_ms');
|
|
1128
1144
|
this.balance['info'] = result;
|
|
1129
|
-
this.balance['timestamp'] = timestamp;
|
|
1130
|
-
this.balance['datetime'] = this.iso8601(timestamp);
|
|
1131
1145
|
for (let i = 0; i < result.length; i++) {
|
|
1132
1146
|
const rawBalance = result[i];
|
|
1133
1147
|
const account = this.account();
|
|
1134
1148
|
const currencyId = this.safeString(rawBalance, 'currency', 'USDT'); // when not present it is USDT
|
|
1135
1149
|
const code = this.safeCurrencyCode(currencyId);
|
|
1150
|
+
const timestamp = this.safeInteger2(rawBalance, 'time_ms', 'timestamp_ms');
|
|
1151
|
+
this.balance['timestamp'] = timestamp;
|
|
1152
|
+
this.balance['datetime'] = this.iso8601(timestamp);
|
|
1153
|
+
account['used'] = this.safeString(rawBalance, 'freeze');
|
|
1136
1154
|
account['free'] = this.safeString(rawBalance, 'available');
|
|
1137
1155
|
account['total'] = this.safeString2(rawBalance, 'total', 'balance');
|
|
1138
1156
|
this.balance[code] = account;
|
|
@@ -1323,11 +1341,11 @@ class gate extends gate$1["default"] {
|
|
|
1323
1341
|
/**
|
|
1324
1342
|
* @method
|
|
1325
1343
|
* @name gate#watchOrders
|
|
1344
|
+
* @description watches information on multiple orders made by the user
|
|
1326
1345
|
* @see https://www.gate.com/docs/developers/apiv4/ws/en/#orders-channel
|
|
1327
1346
|
* @see https://www.gate.com/docs/developers/futures/ws/en/#orders-api
|
|
1328
1347
|
* @see https://www.gate.com/docs/developers/delivery/ws/en/#orders-api
|
|
1329
1348
|
* @see https://www.gate.com/docs/developers/options/ws/en/#orders-channel
|
|
1330
|
-
* @description watches information on multiple orders made by the user
|
|
1331
1349
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1332
1350
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1333
1351
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -1374,39 +1392,46 @@ class gate extends gate$1["default"] {
|
|
|
1374
1392
|
}
|
|
1375
1393
|
handleOrder(client, message) {
|
|
1376
1394
|
//
|
|
1377
|
-
//
|
|
1378
|
-
//
|
|
1379
|
-
//
|
|
1380
|
-
//
|
|
1381
|
-
//
|
|
1382
|
-
//
|
|
1383
|
-
//
|
|
1384
|
-
//
|
|
1385
|
-
//
|
|
1386
|
-
//
|
|
1387
|
-
//
|
|
1388
|
-
//
|
|
1389
|
-
//
|
|
1390
|
-
//
|
|
1391
|
-
//
|
|
1392
|
-
//
|
|
1393
|
-
//
|
|
1394
|
-
//
|
|
1395
|
-
//
|
|
1396
|
-
//
|
|
1397
|
-
//
|
|
1398
|
-
//
|
|
1399
|
-
//
|
|
1400
|
-
//
|
|
1401
|
-
//
|
|
1402
|
-
//
|
|
1403
|
-
//
|
|
1404
|
-
//
|
|
1405
|
-
//
|
|
1406
|
-
//
|
|
1407
|
-
//
|
|
1408
|
-
//
|
|
1409
|
-
//
|
|
1395
|
+
// {
|
|
1396
|
+
// "time": 1774613210,
|
|
1397
|
+
// "time_ms": 1774613210392,
|
|
1398
|
+
// "channel": "spot.orders",
|
|
1399
|
+
// "event": "update",
|
|
1400
|
+
// "result": [
|
|
1401
|
+
// {
|
|
1402
|
+
// "id": "1036717689726",
|
|
1403
|
+
// "text": "apiv4",
|
|
1404
|
+
// "create_time": "1774613210",
|
|
1405
|
+
// "update_time": "1774613210",
|
|
1406
|
+
// "currency_pair": "BTC_USDT",
|
|
1407
|
+
// "type": "limit",
|
|
1408
|
+
// "account": "unified",
|
|
1409
|
+
// "side": "buy",
|
|
1410
|
+
// "amount": "0.1",
|
|
1411
|
+
// "price": "200",
|
|
1412
|
+
// "time_in_force": "gtc",
|
|
1413
|
+
// "left": "0.1",
|
|
1414
|
+
// "filled_amount": "0",
|
|
1415
|
+
// "filled_total": "0",
|
|
1416
|
+
// "avg_deal_price": "0",
|
|
1417
|
+
// "fee": "0",
|
|
1418
|
+
// "fee_currency": "BTC",
|
|
1419
|
+
// "point_fee": "0",
|
|
1420
|
+
// "gt_fee": "0",
|
|
1421
|
+
// "rebated_fee": "0",
|
|
1422
|
+
// "rebated_fee_currency": "BTC",
|
|
1423
|
+
// "create_time_ms": "1774613210391",
|
|
1424
|
+
// "update_time_ms": "1774613210391",
|
|
1425
|
+
// "user": 10406147,
|
|
1426
|
+
// "event": "put",
|
|
1427
|
+
// "stp_id": 0,
|
|
1428
|
+
// "stp_act": "-",
|
|
1429
|
+
// "finish_as": "open",
|
|
1430
|
+
// "biz_info": "ch:ccxt",
|
|
1431
|
+
// "amend_text": "-"
|
|
1432
|
+
// }
|
|
1433
|
+
// ]
|
|
1434
|
+
// }
|
|
1410
1435
|
//
|
|
1411
1436
|
const orders = this.safeValue(message, 'result', []);
|
|
1412
1437
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
package/dist/cjs/src/pro/grvt.js
CHANGED
|
@@ -40,7 +40,8 @@ class grvt extends grvt$1["default"] {
|
|
|
40
40
|
'channel': 'v1.book.s', // v1.book.s | v1.book.d
|
|
41
41
|
},
|
|
42
42
|
'watchTickers': {
|
|
43
|
-
'channel': 'v1.ticker.s',
|
|
43
|
+
'channel': 'v1.ticker.s',
|
|
44
|
+
'interval': 500, // raw, 50, 100, 200, 500, 1000, 5000
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
'streaming': {
|
|
@@ -154,6 +155,8 @@ class grvt extends grvt$1["default"] {
|
|
|
154
155
|
}
|
|
155
156
|
let channel = undefined;
|
|
156
157
|
[channel, params] = this.handleOptionAndParams(params, 'watchTickers', 'channel', 'v1.ticker.s');
|
|
158
|
+
let interval = undefined;
|
|
159
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchTickers', 'interval', 500);
|
|
157
160
|
await this.loadMarkets();
|
|
158
161
|
symbols = this.marketSymbols(symbols);
|
|
159
162
|
const rawHashes = [];
|
|
@@ -162,8 +165,7 @@ class grvt extends grvt$1["default"] {
|
|
|
162
165
|
const symbol = symbols[i];
|
|
163
166
|
const market = this.market(symbol);
|
|
164
167
|
const marketId = market['id'];
|
|
165
|
-
|
|
166
|
-
rawHashes.push(marketId + '@' + interval);
|
|
168
|
+
rawHashes.push(marketId + '@' + interval.toString());
|
|
167
169
|
messageHashes.push('ticker::' + market['symbol']);
|
|
168
170
|
}
|
|
169
171
|
const request = {
|
|
@@ -512,7 +514,7 @@ class grvt extends grvt$1["default"] {
|
|
|
512
514
|
const symbol = symbols[i];
|
|
513
515
|
const market = this.market(symbol);
|
|
514
516
|
const marketId = market['id'];
|
|
515
|
-
rawHashes.push(marketId + '@' + extraPart);
|
|
517
|
+
rawHashes.push(marketId + '@' + extraPart.toString());
|
|
516
518
|
messageHashes.push('orderbook::' + market['symbol']);
|
|
517
519
|
}
|
|
518
520
|
const request = {
|