ccxt 4.4.3 → 4.4.5
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 +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/base/functions/misc.js +11 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/base/ws/WsClient.js +2 -1
- package/dist/cjs/src/binance.js +42 -15
- package/dist/cjs/src/binanceus.js +1 -0
- package/dist/cjs/src/bingx.js +1 -0
- package/dist/cjs/src/bitfinex2.js +7 -6
- package/dist/cjs/src/bitget.js +57 -100
- package/dist/cjs/src/bitmex.js +11 -10
- package/dist/cjs/src/bitso.js +5 -4
- package/dist/cjs/src/bitstamp.js +9 -9
- package/dist/cjs/src/blofin.js +21 -23
- package/dist/cjs/src/bybit.js +100 -26
- package/dist/cjs/src/coinbase.js +28 -7
- package/dist/cjs/src/coinbaseexchange.js +11 -11
- package/dist/cjs/src/coinlist.js +6 -5
- package/dist/cjs/src/coinmetro.js +3 -3
- package/dist/cjs/src/cryptocom.js +7 -5
- package/dist/cjs/src/currencycom.js +6 -6
- package/dist/cjs/src/delta.js +5 -5
- package/dist/cjs/src/digifinex.js +8 -6
- package/dist/cjs/src/gate.js +6 -5
- package/dist/cjs/src/hashkey.js +9 -7
- package/dist/cjs/src/htx.js +13 -16
- package/dist/cjs/src/hyperliquid.js +67 -114
- package/dist/cjs/src/kraken.js +8 -6
- package/dist/cjs/src/kucoin.js +9 -8
- package/dist/cjs/src/luno.js +10 -9
- package/dist/cjs/src/lykke.js +2 -2
- package/dist/cjs/src/mexc.js +42 -3
- package/dist/cjs/src/ndax.js +6 -5
- package/dist/cjs/src/okcoin.js +18 -27
- package/dist/cjs/src/okx.js +18 -26
- package/dist/cjs/src/p2b.js +2 -2
- package/dist/cjs/src/paradex.js +1 -1
- package/dist/cjs/src/pro/binance.js +6 -2
- package/dist/cjs/src/pro/binanceus.js +2 -1
- package/dist/cjs/src/pro/bybit.js +56 -0
- package/dist/cjs/src/pro/hyperliquid.js +16 -1
- package/dist/cjs/src/pro/mexc.js +83 -0
- package/dist/cjs/src/pro/paradex.js +1 -0
- package/dist/cjs/src/woo.js +7 -6
- package/dist/cjs/src/woofipro.js +8 -6
- package/dist/cjs/src/xt.js +4 -3
- package/dist/cjs/src/zonda.js +6 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +2 -2
- package/js/src/base/functions/misc.d.ts +2 -1
- package/js/src/base/functions/misc.js +11 -1
- package/js/src/base/types.d.ts +1 -1
- package/js/src/base/ws/WsClient.js +2 -2
- package/js/src/binance.d.ts +4 -20
- package/js/src/binance.js +42 -15
- package/js/src/binanceus.js +1 -0
- package/js/src/bingx.js +1 -0
- package/js/src/bitfinex2.d.ts +3 -19
- package/js/src/bitfinex2.js +7 -6
- package/js/src/bitget.d.ts +3 -20
- package/js/src/bitget.js +57 -100
- package/js/src/bitmex.d.ts +3 -22
- package/js/src/bitmex.js +11 -10
- package/js/src/bitso.d.ts +3 -19
- package/js/src/bitso.js +5 -4
- package/js/src/bitstamp.d.ts +3 -35
- package/js/src/bitstamp.js +9 -9
- package/js/src/blofin.d.ts +3 -15
- package/js/src/blofin.js +21 -23
- package/js/src/bybit.d.ts +3 -19
- package/js/src/bybit.js +100 -26
- package/js/src/coinbase.d.ts +3 -19
- package/js/src/coinbase.js +28 -7
- package/js/src/coinbaseexchange.d.ts +3 -19
- package/js/src/coinbaseexchange.js +11 -11
- package/js/src/coinlist.d.ts +3 -19
- package/js/src/coinlist.js +6 -5
- package/js/src/coinmetro.d.ts +3 -19
- package/js/src/coinmetro.js +3 -3
- package/js/src/cryptocom.d.ts +3 -22
- package/js/src/cryptocom.js +7 -5
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/currencycom.js +6 -6
- package/js/src/delta.d.ts +3 -19
- package/js/src/delta.js +5 -5
- package/js/src/digifinex.d.ts +3 -19
- package/js/src/digifinex.js +8 -6
- package/js/src/gate.d.ts +3 -19
- package/js/src/gate.js +6 -5
- package/js/src/hashkey.d.ts +3 -20
- package/js/src/hashkey.js +9 -7
- package/js/src/htx.d.ts +3 -19
- package/js/src/htx.js +13 -16
- package/js/src/hyperliquid.d.ts +3 -19
- package/js/src/hyperliquid.js +68 -115
- package/js/src/kraken.d.ts +5 -24
- package/js/src/kraken.js +8 -6
- package/js/src/kucoin.d.ts +3 -19
- package/js/src/kucoin.js +9 -8
- package/js/src/luno.d.ts +4 -20
- package/js/src/luno.js +10 -9
- package/js/src/lykke.js +2 -2
- package/js/src/mexc.js +42 -3
- package/js/src/ndax.d.ts +3 -19
- package/js/src/ndax.js +6 -5
- package/js/src/okcoin.d.ts +3 -19
- package/js/src/okcoin.js +18 -27
- package/js/src/okx.d.ts +3 -19
- package/js/src/okx.js +18 -26
- package/js/src/p2b.js +2 -2
- package/js/src/paradex.js +1 -1
- package/js/src/pro/binance.d.ts +140 -0
- package/js/src/pro/binance.js +6 -2
- package/js/src/pro/binanceus.js +2 -1
- package/js/src/pro/bybit.d.ts +2 -0
- package/js/src/pro/bybit.js +56 -0
- package/js/src/pro/hyperliquid.d.ts +1 -0
- package/js/src/pro/hyperliquid.js +16 -1
- package/js/src/pro/mexc.d.ts +4 -1
- package/js/src/pro/mexc.js +84 -1
- package/js/src/pro/paradex.js +1 -0
- package/js/src/woo.d.ts +3 -19
- package/js/src/woo.js +7 -6
- package/js/src/woofipro.d.ts +3 -19
- package/js/src/woofipro.js +8 -6
- package/js/src/xt.d.ts +3 -22
- package/js/src/xt.js +4 -3
- package/js/src/zonda.d.ts +3 -19
- package/js/src/zonda.js +6 -5
- package/package.json +1 -1
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -28,6 +28,7 @@ class mexc extends mexc$1 {
|
|
|
28
28
|
'watchOrders': true,
|
|
29
29
|
'watchTicker': true,
|
|
30
30
|
'watchTickers': true,
|
|
31
|
+
'watchBidsAsks': true,
|
|
31
32
|
'watchTrades': true,
|
|
32
33
|
'watchTradesForSymbols': false,
|
|
33
34
|
},
|
|
@@ -107,6 +108,7 @@ class mexc extends mexc$1 {
|
|
|
107
108
|
// "t": 1678643605721
|
|
108
109
|
// }
|
|
109
110
|
//
|
|
111
|
+
this.handleBidAsk(client, message);
|
|
110
112
|
const rawTicker = this.safeValue2(message, 'd', 'data');
|
|
111
113
|
const marketId = this.safeString2(message, 's', 'symbol');
|
|
112
114
|
const timestamp = this.safeInteger(message, 't');
|
|
@@ -235,6 +237,87 @@ class mexc extends mexc$1 {
|
|
|
235
237
|
'info': ticker,
|
|
236
238
|
}, market);
|
|
237
239
|
}
|
|
240
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
241
|
+
/**
|
|
242
|
+
* @method
|
|
243
|
+
* @name mexc#watchBidsAsks
|
|
244
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams
|
|
245
|
+
* @description watches best bid & ask for symbols
|
|
246
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
247
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
248
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
249
|
+
*/
|
|
250
|
+
await this.loadMarkets();
|
|
251
|
+
symbols = this.marketSymbols(symbols, undefined, true, false, true);
|
|
252
|
+
let marketType = undefined;
|
|
253
|
+
if (symbols === undefined) {
|
|
254
|
+
throw new errors.ArgumentsRequired(this.id + 'watchBidsAsks required symbols argument');
|
|
255
|
+
}
|
|
256
|
+
const markets = this.marketsForSymbols(symbols);
|
|
257
|
+
[marketType, params] = this.handleMarketTypeAndParams('watchBidsAsks', markets[0], params);
|
|
258
|
+
const isSpot = marketType === 'spot';
|
|
259
|
+
if (!isSpot) {
|
|
260
|
+
throw new errors.NotSupported(this.id + 'watchBidsAsks only support spot market');
|
|
261
|
+
}
|
|
262
|
+
const messageHashes = [];
|
|
263
|
+
const topics = [];
|
|
264
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
265
|
+
if (isSpot) {
|
|
266
|
+
const market = this.market(symbols[i]);
|
|
267
|
+
topics.push('spot@public.bookTicker.v3.api@' + market['id']);
|
|
268
|
+
}
|
|
269
|
+
messageHashes.push('bidask:' + symbols[i]);
|
|
270
|
+
}
|
|
271
|
+
const url = this.urls['api']['ws']['spot'];
|
|
272
|
+
const request = {
|
|
273
|
+
'method': 'SUBSCRIPTION',
|
|
274
|
+
'params': topics,
|
|
275
|
+
};
|
|
276
|
+
const ticker = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
277
|
+
if (this.newUpdates) {
|
|
278
|
+
const tickers = {};
|
|
279
|
+
tickers[ticker['symbol']] = ticker;
|
|
280
|
+
return tickers;
|
|
281
|
+
}
|
|
282
|
+
return this.filterByArray(this.bidsasks, 'symbol', symbols);
|
|
283
|
+
}
|
|
284
|
+
handleBidAsk(client, message) {
|
|
285
|
+
//
|
|
286
|
+
// {
|
|
287
|
+
// "c": "spot@public.bookTicker.v3.api@BTCUSDT",
|
|
288
|
+
// "d": {
|
|
289
|
+
// "A": "4.70432",
|
|
290
|
+
// "B": "6.714863",
|
|
291
|
+
// "a": "20744.54",
|
|
292
|
+
// "b": "20744.17"
|
|
293
|
+
// },
|
|
294
|
+
// "s": "BTCUSDT",
|
|
295
|
+
// "t": 1678643605721
|
|
296
|
+
// }
|
|
297
|
+
//
|
|
298
|
+
const parsedTicker = this.parseWsBidAsk(message);
|
|
299
|
+
const symbol = parsedTicker['symbol'];
|
|
300
|
+
this.bidsasks[symbol] = parsedTicker;
|
|
301
|
+
const messageHash = 'bidask:' + symbol;
|
|
302
|
+
client.resolve(parsedTicker, messageHash);
|
|
303
|
+
}
|
|
304
|
+
parseWsBidAsk(ticker, market = undefined) {
|
|
305
|
+
const data = this.safeDict(ticker, 'd');
|
|
306
|
+
const marketId = this.safeString(ticker, 's');
|
|
307
|
+
market = this.safeMarket(marketId, market);
|
|
308
|
+
const symbol = this.safeString(market, 'symbol');
|
|
309
|
+
const timestamp = this.safeInteger(ticker, 't');
|
|
310
|
+
return this.safeTicker({
|
|
311
|
+
'symbol': symbol,
|
|
312
|
+
'timestamp': timestamp,
|
|
313
|
+
'datetime': this.iso8601(timestamp),
|
|
314
|
+
'ask': this.safeNumber(data, 'a'),
|
|
315
|
+
'askVolume': this.safeNumber(data, 'A'),
|
|
316
|
+
'bid': this.safeNumber(data, 'b'),
|
|
317
|
+
'bidVolume': this.safeNumber(data, 'B'),
|
|
318
|
+
'info': ticker,
|
|
319
|
+
}, market);
|
|
320
|
+
}
|
|
238
321
|
async watchSpotPublic(channel, messageHash, params = {}) {
|
|
239
322
|
const url = this.urls['api']['ws']['spot'];
|
|
240
323
|
const request = {
|
|
@@ -221,6 +221,7 @@ class paradex extends paradex$1 {
|
|
|
221
221
|
* @method
|
|
222
222
|
* @name paradex#watchTickers
|
|
223
223
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
224
|
+
* @see https://docs.api.testnet.paradex.trade/#sub-markets_summary-operation
|
|
224
225
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
225
226
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
226
227
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -2141,9 +2141,9 @@ class woo extends woo$1 {
|
|
|
2141
2141
|
* @name woo#fetchLedger
|
|
2142
2142
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
2143
2143
|
* @see https://docs.woo.org/#get-asset-history
|
|
2144
|
-
* @param {string} code unified currency code, default is undefined
|
|
2144
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
2145
2145
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
2146
|
-
* @param {int} [limit] max number of ledger
|
|
2146
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
2147
2147
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2148
2148
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
2149
2149
|
*/
|
|
@@ -2154,12 +2154,14 @@ class woo extends woo$1 {
|
|
|
2154
2154
|
const networkizedCode = this.safeString(item, 'token');
|
|
2155
2155
|
const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
|
|
2156
2156
|
const code = currencyDefined['code'];
|
|
2157
|
+
currency = this.safeCurrency(code, currency);
|
|
2157
2158
|
const amount = this.safeNumber(item, 'amount');
|
|
2158
2159
|
const side = this.safeString(item, 'token_side');
|
|
2159
2160
|
const direction = (side === 'DEPOSIT') ? 'in' : 'out';
|
|
2160
2161
|
const timestamp = this.safeTimestamp(item, 'created_time');
|
|
2161
2162
|
const fee = this.parseTokenAndFeeTemp(item, 'fee_token', 'fee_amount');
|
|
2162
|
-
return {
|
|
2163
|
+
return this.safeLedgerEntry({
|
|
2164
|
+
'info': item,
|
|
2163
2165
|
'id': this.safeString(item, 'id'),
|
|
2164
2166
|
'currency': code,
|
|
2165
2167
|
'account': this.safeString(item, 'account'),
|
|
@@ -2169,13 +2171,12 @@ class woo extends woo$1 {
|
|
|
2169
2171
|
'amount': amount,
|
|
2170
2172
|
'before': undefined,
|
|
2171
2173
|
'after': undefined,
|
|
2172
|
-
'fee': fee,
|
|
2173
2174
|
'direction': direction,
|
|
2174
2175
|
'timestamp': timestamp,
|
|
2175
2176
|
'datetime': this.iso8601(timestamp),
|
|
2176
2177
|
'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
|
|
2177
|
-
'
|
|
2178
|
-
};
|
|
2178
|
+
'fee': fee,
|
|
2179
|
+
}, currency);
|
|
2179
2180
|
}
|
|
2180
2181
|
parseLedgerEntryType(type) {
|
|
2181
2182
|
const types = {
|
package/dist/cjs/src/woofipro.js
CHANGED
|
@@ -2119,13 +2119,15 @@ class woofipro extends woofipro$1 {
|
|
|
2119
2119
|
return [currency, this.safeList(data, 'rows', [])];
|
|
2120
2120
|
}
|
|
2121
2121
|
parseLedgerEntry(item, currency = undefined) {
|
|
2122
|
-
const
|
|
2122
|
+
const currencyId = this.safeString(item, 'token');
|
|
2123
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
2124
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
2123
2125
|
const amount = this.safeNumber(item, 'amount');
|
|
2124
2126
|
const side = this.safeString(item, 'token_side');
|
|
2125
2127
|
const direction = (side === 'DEPOSIT') ? 'in' : 'out';
|
|
2126
2128
|
const timestamp = this.safeInteger(item, 'created_time');
|
|
2127
2129
|
const fee = this.parseTokenAndFeeTemp(item, 'fee_token', 'fee_amount');
|
|
2128
|
-
return {
|
|
2130
|
+
return this.safeLedgerEntry({
|
|
2129
2131
|
'id': this.safeString(item, 'id'),
|
|
2130
2132
|
'currency': code,
|
|
2131
2133
|
'account': this.safeString(item, 'account'),
|
|
@@ -2141,7 +2143,7 @@ class woofipro extends woofipro$1 {
|
|
|
2141
2143
|
'datetime': this.iso8601(timestamp),
|
|
2142
2144
|
'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
|
|
2143
2145
|
'info': item,
|
|
2144
|
-
};
|
|
2146
|
+
}, currency);
|
|
2145
2147
|
}
|
|
2146
2148
|
parseLedgerEntryType(type) {
|
|
2147
2149
|
const types = {
|
|
@@ -2154,11 +2156,11 @@ class woofipro extends woofipro$1 {
|
|
|
2154
2156
|
/**
|
|
2155
2157
|
* @method
|
|
2156
2158
|
* @name woofipro#fetchLedger
|
|
2157
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
2159
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2158
2160
|
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
|
|
2159
|
-
* @param {string} code unified currency code, default is undefined
|
|
2161
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
2160
2162
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
2161
|
-
* @param {int} [limit] max number of ledger
|
|
2163
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
2162
2164
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2163
2165
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
2164
2166
|
*/
|
package/dist/cjs/src/xt.js
CHANGED
|
@@ -3597,8 +3597,10 @@ class xt extends xt$1 {
|
|
|
3597
3597
|
const side = this.safeString(item, 'side');
|
|
3598
3598
|
const direction = (side === 'ADD') ? 'in' : 'out';
|
|
3599
3599
|
const currencyId = this.safeString(item, 'coin');
|
|
3600
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
3600
3601
|
const timestamp = this.safeInteger(item, 'createdTime');
|
|
3601
|
-
return {
|
|
3602
|
+
return this.safeLedgerEntry({
|
|
3603
|
+
'info': item,
|
|
3602
3604
|
'id': this.safeString(item, 'id'),
|
|
3603
3605
|
'direction': direction,
|
|
3604
3606
|
'account': undefined,
|
|
@@ -3616,8 +3618,7 @@ class xt extends xt$1 {
|
|
|
3616
3618
|
'currency': undefined,
|
|
3617
3619
|
'cost': undefined,
|
|
3618
3620
|
},
|
|
3619
|
-
|
|
3620
|
-
};
|
|
3621
|
+
}, currency);
|
|
3621
3622
|
}
|
|
3622
3623
|
parseLedgerEntryType(type) {
|
|
3623
3624
|
const ledgerType = {
|
package/dist/cjs/src/zonda.js
CHANGED
|
@@ -819,11 +819,11 @@ class zonda extends zonda$1 {
|
|
|
819
819
|
/**
|
|
820
820
|
* @method
|
|
821
821
|
* @name zonda#fetchLedger
|
|
822
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
822
823
|
* @see https://docs.zondacrypto.exchange/reference/operations-history
|
|
823
|
-
* @
|
|
824
|
-
* @param {string} code unified currency code, default is undefined
|
|
824
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
825
825
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
826
|
-
* @param {int} [limit] max number of ledger
|
|
826
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
827
827
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
828
828
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
829
829
|
*/
|
|
@@ -1117,6 +1117,7 @@ class zonda extends zonda$1 {
|
|
|
1117
1117
|
const timestamp = this.safeInteger(item, 'time');
|
|
1118
1118
|
const balance = this.safeValue(item, 'balance', {});
|
|
1119
1119
|
const currencyId = this.safeString(balance, 'currency');
|
|
1120
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
1120
1121
|
const change = this.safeValue(item, 'change', {});
|
|
1121
1122
|
let amount = this.safeString(change, 'total');
|
|
1122
1123
|
let direction = 'in';
|
|
@@ -1128,7 +1129,7 @@ class zonda extends zonda$1 {
|
|
|
1128
1129
|
// that can be used to enrich the transfers with txid, address etc (you need to use info.detailId as a parameter)
|
|
1129
1130
|
const fundsBefore = this.safeValue(item, 'fundsBefore', {});
|
|
1130
1131
|
const fundsAfter = this.safeValue(item, 'fundsAfter', {});
|
|
1131
|
-
return {
|
|
1132
|
+
return this.safeLedgerEntry({
|
|
1132
1133
|
'info': item,
|
|
1133
1134
|
'id': this.safeString(item, 'historyId'),
|
|
1134
1135
|
'direction': direction,
|
|
@@ -1144,7 +1145,7 @@ class zonda extends zonda$1 {
|
|
|
1144
1145
|
'timestamp': timestamp,
|
|
1145
1146
|
'datetime': this.iso8601(timestamp),
|
|
1146
1147
|
'fee': undefined,
|
|
1147
|
-
};
|
|
1148
|
+
}, currency);
|
|
1148
1149
|
}
|
|
1149
1150
|
parseLedgerEntryType(type) {
|
|
1150
1151
|
const types = {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.4";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.5';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -756,7 +756,7 @@ export default class Exchange {
|
|
|
756
756
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
757
757
|
parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
|
|
758
758
|
parseAccount(account: Dict): Account;
|
|
759
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
759
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
760
760
|
parseOrder(order: Dict, market?: Market): Order;
|
|
761
761
|
fetchCrossBorrowRates(params?: {}): Promise<CrossBorrowRates>;
|
|
762
762
|
fetchIsolatedBorrowRates(params?: {}): Promise<IsolatedBorrowRates>;
|
|
@@ -888,7 +888,7 @@ export default class Exchange {
|
|
|
888
888
|
parseTrades(trades: any[], market?: Market, since?: Int, limit?: Int, params?: {}): Trade[];
|
|
889
889
|
parseTransactions(transactions: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): Transaction[];
|
|
890
890
|
parseTransfers(transfers: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): TransferEntry[];
|
|
891
|
-
parseLedger(data: any, currency?: Currency, since?: Int, limit?: Int, params?: {}):
|
|
891
|
+
parseLedger(data: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): LedgerEntry[];
|
|
892
892
|
nonce(): number;
|
|
893
893
|
setHeaders(headers: any): any;
|
|
894
894
|
marketId(symbol: string): string;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
import * as functions from './functions.js';
|
|
10
|
-
const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
|
|
10
|
+
const { isNode, selfIsDefined, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
|
|
11
11
|
import { keys as keysFunc, values as valuesFunc, vwap as vwapFunc } from './functions.js';
|
|
12
12
|
// import exceptions from "./errors.js"
|
|
13
13
|
import { // eslint-disable-line object-curly-newline
|
|
@@ -621,7 +621,7 @@ export default class Exchange {
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
else {
|
|
624
|
-
this.fetchImplementation = self.fetch;
|
|
624
|
+
this.fetchImplementation = (selfIsDefined()) ? self.fetch : fetch;
|
|
625
625
|
this.AbortError = DOMException;
|
|
626
626
|
this.FetchError = TypeError;
|
|
627
627
|
}
|
|
@@ -5,4 +5,5 @@ declare const extractParams: (string: string) => string[];
|
|
|
5
5
|
declare const implodeParams: (string: string, params: Dictionary<any> | any[]) => string;
|
|
6
6
|
declare function vwap(baseVolume: number, quoteVolume: number): Num;
|
|
7
7
|
declare function aggregate(bidasks: any): number[][];
|
|
8
|
-
|
|
8
|
+
declare function selfIsDefined(): boolean;
|
|
9
|
+
export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, selfIsDefined };
|
|
@@ -87,5 +87,15 @@ function aggregate(bidasks) {
|
|
|
87
87
|
}
|
|
88
88
|
return Object.keys(result).map((price) => [parseFloat(price), parseFloat(result[price])]); // TODO: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}', No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
function selfIsDefined() {
|
|
91
|
+
let selfIsDefined = false;
|
|
92
|
+
try {
|
|
93
|
+
selfIsDefined = self !== undefined;
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
selfIsDefined = false;
|
|
97
|
+
}
|
|
98
|
+
return selfIsDefined;
|
|
99
|
+
}
|
|
100
|
+
export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, selfIsDefined };
|
|
91
101
|
/* ------------------------------------------------------------------------ */
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
// eslint-disable-next-line no-shadow
|
|
8
8
|
import WebSocket from 'ws';
|
|
9
9
|
import Client from './Client.js';
|
|
10
|
-
import { sleep, isNode, milliseconds, } from '../../base/functions.js';
|
|
10
|
+
import { sleep, isNode, milliseconds, selfIsDefined, } from '../../base/functions.js';
|
|
11
11
|
import { Future } from './Future.js';
|
|
12
12
|
// eslint-disable-next-line no-restricted-globals
|
|
13
|
-
const WebSocketPlatform = isNode ? WebSocket : self.WebSocket;
|
|
13
|
+
const WebSocketPlatform = isNode || !selfIsDefined() ? WebSocket : self.WebSocket;
|
|
14
14
|
export default class WsClient extends Client {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
package/js/src/binance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/binance.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class binance
|
|
5
5
|
* @augments Exchange
|
|
@@ -246,25 +246,9 @@ export default class binance extends Exchange {
|
|
|
246
246
|
datetime: string;
|
|
247
247
|
};
|
|
248
248
|
parseSettlements(settlements: any, market: any): any[];
|
|
249
|
-
fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<
|
|
250
|
-
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<
|
|
251
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
252
|
-
id: string;
|
|
253
|
-
direction: any;
|
|
254
|
-
account: any;
|
|
255
|
-
referenceAccount: any;
|
|
256
|
-
referenceId: string;
|
|
257
|
-
type: string;
|
|
258
|
-
currency: string;
|
|
259
|
-
amount: number;
|
|
260
|
-
timestamp: number;
|
|
261
|
-
datetime: string;
|
|
262
|
-
before: any;
|
|
263
|
-
after: any;
|
|
264
|
-
status: any;
|
|
265
|
-
fee: any;
|
|
266
|
-
info: Dict;
|
|
267
|
-
};
|
|
249
|
+
fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<LedgerEntry>;
|
|
250
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
251
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
268
252
|
parseLedgerEntryType(type: any): string;
|
|
269
253
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
270
254
|
url: any;
|
package/js/src/binance.js
CHANGED
|
@@ -1202,6 +1202,7 @@ export default class binance extends Exchange {
|
|
|
1202
1202
|
// exchange-specific options
|
|
1203
1203
|
'options': {
|
|
1204
1204
|
'sandboxMode': false,
|
|
1205
|
+
'fetchMargins': true,
|
|
1205
1206
|
'fetchMarkets': [
|
|
1206
1207
|
'spot',
|
|
1207
1208
|
'linear',
|
|
@@ -2875,13 +2876,12 @@ export default class binance extends Exchange {
|
|
|
2875
2876
|
}
|
|
2876
2877
|
fetchMarkets.push(type);
|
|
2877
2878
|
}
|
|
2878
|
-
|
|
2879
|
+
const fetchMargins = this.safeBool(this.options, 'fetchMargins', false);
|
|
2879
2880
|
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
2880
2881
|
const marketType = fetchMarkets[i];
|
|
2881
2882
|
if (marketType === 'spot') {
|
|
2882
2883
|
promisesRaw.push(this.publicGetExchangeInfo(params));
|
|
2883
|
-
if (this.checkRequiredCredentials(false) && !sandboxMode) {
|
|
2884
|
-
fetchMargins = true;
|
|
2884
|
+
if (fetchMargins && this.checkRequiredCredentials(false) && !sandboxMode) {
|
|
2885
2885
|
promisesRaw.push(this.sapiGetMarginAllPairs(params));
|
|
2886
2886
|
promisesRaw.push(this.sapiGetMarginIsolatedAllPairs(params));
|
|
2887
2887
|
}
|
|
@@ -11222,17 +11222,42 @@ export default class binance extends Exchange {
|
|
|
11222
11222
|
return result;
|
|
11223
11223
|
}
|
|
11224
11224
|
async fetchLedgerEntry(id, code = undefined, params = {}) {
|
|
11225
|
+
/**
|
|
11226
|
+
* @method
|
|
11227
|
+
* @name binance#fetchLedgerEntry
|
|
11228
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
11229
|
+
* @see https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
|
|
11230
|
+
* @param {string} id the identification number of the ledger entry
|
|
11231
|
+
* @param {string} code unified currency code
|
|
11232
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
11233
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
11234
|
+
*/
|
|
11225
11235
|
await this.loadMarkets();
|
|
11226
11236
|
let type = undefined;
|
|
11227
11237
|
[type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
|
|
11228
|
-
const query = {
|
|
11229
|
-
'recordId': id,
|
|
11230
|
-
'type': type,
|
|
11231
|
-
};
|
|
11232
11238
|
if (type !== 'option') {
|
|
11233
|
-
throw new BadRequest(this.id + ' fetchLedgerEntry
|
|
11239
|
+
throw new BadRequest(this.id + ' fetchLedgerEntry() can only be used for type option');
|
|
11234
11240
|
}
|
|
11235
|
-
|
|
11241
|
+
this.checkRequiredArgument('fetchLedgerEntry', code, 'code');
|
|
11242
|
+
const currency = this.currency(code);
|
|
11243
|
+
const request = {
|
|
11244
|
+
'recordId': id,
|
|
11245
|
+
'currency': currency['id'],
|
|
11246
|
+
};
|
|
11247
|
+
const response = await this.eapiPrivateGetBill(this.extend(request, params));
|
|
11248
|
+
//
|
|
11249
|
+
// [
|
|
11250
|
+
// {
|
|
11251
|
+
// "id": "1125899906845701870",
|
|
11252
|
+
// "asset": "USDT",
|
|
11253
|
+
// "amount": "-0.16518203",
|
|
11254
|
+
// "type": "FEE",
|
|
11255
|
+
// "createDate": 1676621042489
|
|
11256
|
+
// }
|
|
11257
|
+
// ]
|
|
11258
|
+
//
|
|
11259
|
+
const first = this.safeDict(response, 0, response);
|
|
11260
|
+
return this.parseLedgerEntry(first, currency);
|
|
11236
11261
|
}
|
|
11237
11262
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11238
11263
|
/**
|
|
@@ -11244,9 +11269,9 @@ export default class binance extends Exchange {
|
|
|
11244
11269
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Income-History
|
|
11245
11270
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
|
|
11246
11271
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
|
|
11247
|
-
* @param {string} code unified currency code
|
|
11272
|
+
* @param {string} [code] unified currency code
|
|
11248
11273
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
11249
|
-
* @param {int} [limit] max number of ledger
|
|
11274
|
+
* @param {int} [limit] max number of ledger entries to return
|
|
11250
11275
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
11251
11276
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
11252
11277
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
@@ -11372,16 +11397,19 @@ export default class binance extends Exchange {
|
|
|
11372
11397
|
direction = 'in';
|
|
11373
11398
|
}
|
|
11374
11399
|
const currencyId = this.safeString(item, 'asset');
|
|
11400
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
11401
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
11375
11402
|
const timestamp = this.safeInteger2(item, 'createDate', 'time');
|
|
11376
11403
|
const type = this.safeString2(item, 'type', 'incomeType');
|
|
11377
|
-
return {
|
|
11404
|
+
return this.safeLedgerEntry({
|
|
11405
|
+
'info': item,
|
|
11378
11406
|
'id': this.safeString2(item, 'id', 'tranId'),
|
|
11379
11407
|
'direction': direction,
|
|
11380
11408
|
'account': undefined,
|
|
11381
11409
|
'referenceAccount': undefined,
|
|
11382
11410
|
'referenceId': this.safeString(item, 'tradeId'),
|
|
11383
11411
|
'type': this.parseLedgerEntryType(type),
|
|
11384
|
-
'currency':
|
|
11412
|
+
'currency': code,
|
|
11385
11413
|
'amount': this.parseNumber(amount),
|
|
11386
11414
|
'timestamp': timestamp,
|
|
11387
11415
|
'datetime': this.iso8601(timestamp),
|
|
@@ -11389,8 +11417,7 @@ export default class binance extends Exchange {
|
|
|
11389
11417
|
'after': undefined,
|
|
11390
11418
|
'status': undefined,
|
|
11391
11419
|
'fee': undefined,
|
|
11392
|
-
|
|
11393
|
-
};
|
|
11420
|
+
}, currency);
|
|
11394
11421
|
}
|
|
11395
11422
|
parseLedgerEntryType(type) {
|
|
11396
11423
|
const ledgerType = {
|
package/js/src/binanceus.js
CHANGED
package/js/src/bingx.js
CHANGED
package/js/src/bitfinex2.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bitfinex2.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict, LedgerEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bitfinex2
|
|
5
5
|
* @augments Exchange
|
|
@@ -79,24 +79,8 @@ export default class bitfinex2 extends Exchange {
|
|
|
79
79
|
};
|
|
80
80
|
handleErrors(statusCode: any, statusText: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
81
81
|
parseLedgerEntryType(type: Str): string;
|
|
82
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
83
|
-
|
|
84
|
-
direction: any;
|
|
85
|
-
account: any;
|
|
86
|
-
referenceId: string;
|
|
87
|
-
referenceAccount: any;
|
|
88
|
-
type: any;
|
|
89
|
-
currency: string;
|
|
90
|
-
amount: number;
|
|
91
|
-
timestamp: number;
|
|
92
|
-
datetime: string;
|
|
93
|
-
before: any;
|
|
94
|
-
after: number;
|
|
95
|
-
status: any;
|
|
96
|
-
fee: any;
|
|
97
|
-
info: Dict;
|
|
98
|
-
};
|
|
99
|
-
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
82
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
83
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
100
84
|
fetchFundingRate(symbol: string, params?: {}): Promise<any>;
|
|
101
85
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<{}>;
|
|
102
86
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
package/js/src/bitfinex2.js
CHANGED
|
@@ -2920,6 +2920,7 @@ export default class bitfinex2 extends Exchange {
|
|
|
2920
2920
|
const id = this.safeString(itemList, 0);
|
|
2921
2921
|
const currencyId = this.safeString(itemList, 1);
|
|
2922
2922
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
2923
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
2923
2924
|
const timestamp = this.safeInteger(itemList, 3);
|
|
2924
2925
|
const amount = this.safeNumber(itemList, 5);
|
|
2925
2926
|
const after = this.safeNumber(itemList, 6);
|
|
@@ -2929,7 +2930,8 @@ export default class bitfinex2 extends Exchange {
|
|
|
2929
2930
|
const first = this.safeStringLower(parts, 0);
|
|
2930
2931
|
type = this.parseLedgerEntryType(first);
|
|
2931
2932
|
}
|
|
2932
|
-
return {
|
|
2933
|
+
return this.safeLedgerEntry({
|
|
2934
|
+
'info': item,
|
|
2933
2935
|
'id': id,
|
|
2934
2936
|
'direction': undefined,
|
|
2935
2937
|
'account': undefined,
|
|
@@ -2944,18 +2946,17 @@ export default class bitfinex2 extends Exchange {
|
|
|
2944
2946
|
'after': after,
|
|
2945
2947
|
'status': undefined,
|
|
2946
2948
|
'fee': undefined,
|
|
2947
|
-
|
|
2948
|
-
};
|
|
2949
|
+
}, currency);
|
|
2949
2950
|
}
|
|
2950
2951
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2951
2952
|
/**
|
|
2952
2953
|
* @method
|
|
2953
2954
|
* @name bitfinex2#fetchLedger
|
|
2954
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
2955
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2955
2956
|
* @see https://docs.bitfinex.com/reference/rest-auth-ledgers
|
|
2956
|
-
* @param {string} code unified currency code, default is undefined
|
|
2957
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
2957
2958
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
2958
|
-
* @param {int} [limit] max number of ledger
|
|
2959
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined, max is 2500
|
|
2959
2960
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2960
2961
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
2961
2962
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|