ccxt 4.4.2 → 4.4.4
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 +49 -22
- package/dist/cjs/src/bingx.js +1 -0
- package/dist/cjs/src/bitfinex2.js +7 -6
- package/dist/cjs/src/bitget.js +10 -6
- package/dist/cjs/src/bitmart.js +3 -1
- package/dist/cjs/src/bitmex.js +11 -10
- package/dist/cjs/src/bitso.js +5 -4
- package/dist/cjs/src/bitstamp.js +33 -45
- package/dist/cjs/src/blofin.js +21 -23
- package/dist/cjs/src/bybit.js +22 -20
- 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 +9 -6
- 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/mexc.js +54 -2
- 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/pro/bybit.js +56 -0
- package/dist/cjs/src/pro/cryptocom.js +191 -21
- package/dist/cjs/src/pro/mexc.js +165 -3
- package/dist/cjs/src/pro/okx.js +6 -3
- package/dist/cjs/src/pro/oxfun.js +75 -0
- package/dist/cjs/src/pro/phemex.js +45 -1
- package/dist/cjs/src/pro/woofipro.js +67 -0
- package/dist/cjs/src/woo.js +7 -6
- package/dist/cjs/src/woofipro.js +8 -6
- package/dist/cjs/src/xt.js +10 -4
- package/dist/cjs/src/zonda.js +6 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- 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 +49 -22
- 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 -19
- package/js/src/bitget.js +10 -6
- package/js/src/bitmart.js +3 -1
- 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 +33 -45
- 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 +23 -21
- 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 +9 -6
- 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/mexc.js +54 -2
- 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/pro/bybit.d.ts +2 -0
- package/js/src/pro/bybit.js +56 -0
- package/js/src/pro/cryptocom.d.ts +7 -1
- package/js/src/pro/cryptocom.js +191 -21
- package/js/src/pro/mexc.d.ts +6 -1
- package/js/src/pro/mexc.js +166 -4
- package/js/src/pro/okx.js +6 -3
- package/js/src/pro/oxfun.d.ts +3 -0
- package/js/src/pro/oxfun.js +75 -0
- package/js/src/pro/phemex.d.ts +2 -1
- package/js/src/pro/phemex.js +45 -1
- package/js/src/pro/woofipro.d.ts +3 -0
- package/js/src/pro/woofipro.js +67 -0
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- 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 +10 -4
- package/js/src/zonda.d.ts +3 -19
- package/js/src/zonda.js +6 -5
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ class woofipro extends woofipro$1 {
|
|
|
21
21
|
'watchOrders': true,
|
|
22
22
|
'watchTicker': true,
|
|
23
23
|
'watchTickers': true,
|
|
24
|
+
'watchBidsAsks': true,
|
|
24
25
|
'watchTrades': true,
|
|
25
26
|
'watchTradesForSymbols': false,
|
|
26
27
|
'watchPositions': true,
|
|
@@ -288,6 +289,71 @@ class woofipro extends woofipro$1 {
|
|
|
288
289
|
}
|
|
289
290
|
client.resolve(result, topic);
|
|
290
291
|
}
|
|
292
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
293
|
+
/**
|
|
294
|
+
* @method
|
|
295
|
+
* @name woofipro#watchBidsAsks
|
|
296
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/bbos
|
|
297
|
+
* @description watches best bid & ask for symbols
|
|
298
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
299
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
300
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
301
|
+
*/
|
|
302
|
+
await this.loadMarkets();
|
|
303
|
+
symbols = this.marketSymbols(symbols);
|
|
304
|
+
const name = 'bbos';
|
|
305
|
+
const topic = name;
|
|
306
|
+
const request = {
|
|
307
|
+
'event': 'subscribe',
|
|
308
|
+
'topic': topic,
|
|
309
|
+
};
|
|
310
|
+
const message = this.extend(request, params);
|
|
311
|
+
const tickers = await this.watchPublic(topic, message);
|
|
312
|
+
return this.filterByArray(tickers, 'symbol', symbols);
|
|
313
|
+
}
|
|
314
|
+
handleBidAsk(client, message) {
|
|
315
|
+
//
|
|
316
|
+
// {
|
|
317
|
+
// "topic": "bbos",
|
|
318
|
+
// "ts": 1726212495000,
|
|
319
|
+
// "data": [
|
|
320
|
+
// {
|
|
321
|
+
// "symbol": "PERP_WOO_USDC",
|
|
322
|
+
// "ask": 0.16570,
|
|
323
|
+
// "askSize": 4224,
|
|
324
|
+
// "bid": 0.16553,
|
|
325
|
+
// "bidSize": 6645
|
|
326
|
+
// }
|
|
327
|
+
// ]
|
|
328
|
+
// }
|
|
329
|
+
//
|
|
330
|
+
const topic = this.safeString(message, 'topic');
|
|
331
|
+
const data = this.safeList(message, 'data', []);
|
|
332
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
333
|
+
const result = [];
|
|
334
|
+
for (let i = 0; i < data.length; i++) {
|
|
335
|
+
const ticker = this.parseWsBidAsk(this.extend(data[i], { 'ts': timestamp }));
|
|
336
|
+
this.tickers[ticker['symbol']] = ticker;
|
|
337
|
+
result.push(ticker);
|
|
338
|
+
}
|
|
339
|
+
client.resolve(result, topic);
|
|
340
|
+
}
|
|
341
|
+
parseWsBidAsk(ticker, market = undefined) {
|
|
342
|
+
const marketId = this.safeString(ticker, 'symbol');
|
|
343
|
+
market = this.safeMarket(marketId, market);
|
|
344
|
+
const symbol = this.safeString(market, 'symbol');
|
|
345
|
+
const timestamp = this.safeInteger(ticker, 'ts');
|
|
346
|
+
return this.safeTicker({
|
|
347
|
+
'symbol': symbol,
|
|
348
|
+
'timestamp': timestamp,
|
|
349
|
+
'datetime': this.iso8601(timestamp),
|
|
350
|
+
'ask': this.safeString(ticker, 'ask'),
|
|
351
|
+
'askVolume': this.safeString(ticker, 'askSize'),
|
|
352
|
+
'bid': this.safeString(ticker, 'bid'),
|
|
353
|
+
'bidVolume': this.safeString(ticker, 'bidSize'),
|
|
354
|
+
'info': ticker,
|
|
355
|
+
}, market);
|
|
356
|
+
}
|
|
291
357
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
292
358
|
/**
|
|
293
359
|
* @method
|
|
@@ -1202,6 +1268,7 @@ class woofipro extends woofipro$1 {
|
|
|
1202
1268
|
'algoexecutionreport': this.handleOrderUpdate,
|
|
1203
1269
|
'position': this.handlePositions,
|
|
1204
1270
|
'balance': this.handleBalance,
|
|
1271
|
+
'bbos': this.handleBidAsk,
|
|
1205
1272
|
};
|
|
1206
1273
|
const event = this.safeString(message, 'event');
|
|
1207
1274
|
let method = this.safeValue(methods, event);
|
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
|
@@ -1135,12 +1135,14 @@ class xt extends xt$1 {
|
|
|
1135
1135
|
let maxCost = undefined;
|
|
1136
1136
|
let minPrice = undefined;
|
|
1137
1137
|
let maxPrice = undefined;
|
|
1138
|
+
let amountPrecision = undefined;
|
|
1138
1139
|
for (let i = 0; i < filters.length; i++) {
|
|
1139
1140
|
const entry = filters[i];
|
|
1140
1141
|
const filter = this.safeString(entry, 'filter');
|
|
1141
1142
|
if (filter === 'QUANTITY') {
|
|
1142
1143
|
minAmount = this.safeNumber(entry, 'min');
|
|
1143
1144
|
maxAmount = this.safeNumber(entry, 'max');
|
|
1145
|
+
amountPrecision = this.safeNumber(entry, 'tickSize');
|
|
1144
1146
|
}
|
|
1145
1147
|
if (filter === 'QUOTE_QTY') {
|
|
1146
1148
|
minCost = this.safeNumber(entry, 'min');
|
|
@@ -1150,6 +1152,9 @@ class xt extends xt$1 {
|
|
|
1150
1152
|
maxPrice = this.safeNumber(entry, 'max');
|
|
1151
1153
|
}
|
|
1152
1154
|
}
|
|
1155
|
+
if (amountPrecision === undefined) {
|
|
1156
|
+
amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision')));
|
|
1157
|
+
}
|
|
1153
1158
|
const underlyingType = this.safeString(market, 'underlyingType');
|
|
1154
1159
|
let linear = undefined;
|
|
1155
1160
|
let inverse = undefined;
|
|
@@ -1232,7 +1237,7 @@ class xt extends xt$1 {
|
|
|
1232
1237
|
'optionType': undefined,
|
|
1233
1238
|
'precision': {
|
|
1234
1239
|
'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
|
|
1235
|
-
'amount':
|
|
1240
|
+
'amount': amountPrecision,
|
|
1236
1241
|
'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseCoinPrecision'))),
|
|
1237
1242
|
'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quoteCoinPrecision'))),
|
|
1238
1243
|
},
|
|
@@ -3592,8 +3597,10 @@ class xt extends xt$1 {
|
|
|
3592
3597
|
const side = this.safeString(item, 'side');
|
|
3593
3598
|
const direction = (side === 'ADD') ? 'in' : 'out';
|
|
3594
3599
|
const currencyId = this.safeString(item, 'coin');
|
|
3600
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
3595
3601
|
const timestamp = this.safeInteger(item, 'createdTime');
|
|
3596
|
-
return {
|
|
3602
|
+
return this.safeLedgerEntry({
|
|
3603
|
+
'info': item,
|
|
3597
3604
|
'id': this.safeString(item, 'id'),
|
|
3598
3605
|
'direction': direction,
|
|
3599
3606
|
'account': undefined,
|
|
@@ -3611,8 +3618,7 @@ class xt extends xt$1 {
|
|
|
3611
3618
|
'currency': undefined,
|
|
3612
3619
|
'cost': undefined,
|
|
3613
3620
|
},
|
|
3614
|
-
|
|
3615
|
-
};
|
|
3621
|
+
}, currency);
|
|
3616
3622
|
}
|
|
3617
3623
|
parseLedgerEntryType(type) {
|
|
3618
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.3";
|
|
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.4';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -83,6 +83,7 @@ interface Exchange {
|
|
|
83
83
|
privatePostSpotV4QueryTrades(params?: {}): Promise<implicitReturnType>;
|
|
84
84
|
privatePostSpotV4QueryOrderTrades(params?: {}): Promise<implicitReturnType>;
|
|
85
85
|
privatePostSpotV4CancelOrders(params?: {}): Promise<implicitReturnType>;
|
|
86
|
+
privatePostSpotV4CancelAll(params?: {}): Promise<implicitReturnType>;
|
|
86
87
|
privatePostSpotV4BatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
87
88
|
privatePostSpotV3CancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
88
89
|
privatePostSpotV2BatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -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
|
@@ -6403,8 +6403,8 @@ export default class binance extends Exchange {
|
|
|
6403
6403
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
|
|
6404
6404
|
let isPortfolioMargin = undefined;
|
|
6405
6405
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrders', 'papi', 'portfolioMargin', false);
|
|
6406
|
-
const isConditional = this.
|
|
6407
|
-
params = this.omit(params, ['stop', 'conditional', 'type']);
|
|
6406
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6407
|
+
params = this.omit(params, ['stop', 'trigger', 'conditional', 'type']);
|
|
6408
6408
|
let request = {
|
|
6409
6409
|
'symbol': market['id'],
|
|
6410
6410
|
};
|
|
@@ -6673,7 +6673,7 @@ export default class binance extends Exchange {
|
|
|
6673
6673
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
6674
6674
|
let isPortfolioMargin = undefined;
|
|
6675
6675
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
|
|
6676
|
-
const isConditional = this.safeBoolN(params, ['stop', '
|
|
6676
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6677
6677
|
if (symbol !== undefined) {
|
|
6678
6678
|
market = this.market(symbol);
|
|
6679
6679
|
request['symbol'] = market['id'];
|
|
@@ -6690,7 +6690,7 @@ export default class binance extends Exchange {
|
|
|
6690
6690
|
}
|
|
6691
6691
|
let subType = undefined;
|
|
6692
6692
|
[subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
|
|
6693
|
-
params = this.omit(params, ['type', 'stop', '
|
|
6693
|
+
params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
|
|
6694
6694
|
let response = undefined;
|
|
6695
6695
|
if (type === 'option') {
|
|
6696
6696
|
if (since !== undefined) {
|
|
@@ -6773,8 +6773,8 @@ export default class binance extends Exchange {
|
|
|
6773
6773
|
};
|
|
6774
6774
|
let isPortfolioMargin = undefined;
|
|
6775
6775
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', false);
|
|
6776
|
-
const isConditional = this.safeBoolN(params, ['stop', '
|
|
6777
|
-
params = this.omit(params, ['stop', '
|
|
6776
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6777
|
+
params = this.omit(params, ['stop', 'trigger', 'conditional']);
|
|
6778
6778
|
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
6779
6779
|
const orderIdRequest = isPortfolioMarginConditional ? 'strategyId' : 'orderId';
|
|
6780
6780
|
request[orderIdRequest] = id;
|
|
@@ -7089,7 +7089,7 @@ export default class binance extends Exchange {
|
|
|
7089
7089
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
7090
7090
|
let isPortfolioMargin = undefined;
|
|
7091
7091
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'papi', 'portfolioMargin', false);
|
|
7092
|
-
const isConditional = this.
|
|
7092
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
7093
7093
|
const request = {
|
|
7094
7094
|
'symbol': market['id'],
|
|
7095
7095
|
};
|
|
@@ -7115,7 +7115,7 @@ export default class binance extends Exchange {
|
|
|
7115
7115
|
request['orderId'] = id;
|
|
7116
7116
|
}
|
|
7117
7117
|
}
|
|
7118
|
-
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'conditional']);
|
|
7118
|
+
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional']);
|
|
7119
7119
|
let response = undefined;
|
|
7120
7120
|
if (market['option']) {
|
|
7121
7121
|
response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
|
|
@@ -7193,9 +7193,9 @@ export default class binance extends Exchange {
|
|
|
7193
7193
|
};
|
|
7194
7194
|
let isPortfolioMargin = undefined;
|
|
7195
7195
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', false);
|
|
7196
|
-
const isConditional = this.
|
|
7196
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
7197
7197
|
const type = this.safeString(params, 'type', market['type']);
|
|
7198
|
-
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
7198
|
+
params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
|
|
7199
7199
|
let marginMode = undefined;
|
|
7200
7200
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
7201
7201
|
let response = undefined;
|
|
@@ -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/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[]>;
|