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/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.4.
|
|
197
|
+
const version = '4.4.5';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
|
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// ----------------------------------------------------------------------------
|
|
53
|
-
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;
|
|
53
|
+
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;
|
|
54
54
|
// ----------------------------------------------------------------------------
|
|
55
55
|
/**
|
|
56
56
|
* @class Exchange
|
|
@@ -640,7 +640,7 @@ class Exchange {
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
else {
|
|
643
|
-
this.fetchImplementation = self.fetch;
|
|
643
|
+
this.fetchImplementation = (selfIsDefined()) ? self.fetch : fetch;
|
|
644
644
|
this.AbortError = DOMException;
|
|
645
645
|
this.FetchError = TypeError;
|
|
646
646
|
}
|
|
@@ -86,6 +86,16 @@ function aggregate(bidasks) {
|
|
|
86
86
|
}
|
|
87
87
|
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)
|
|
88
88
|
}
|
|
89
|
+
function selfIsDefined() {
|
|
90
|
+
let selfIsDefined = false;
|
|
91
|
+
try {
|
|
92
|
+
selfIsDefined = self !== undefined;
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
selfIsDefined = false;
|
|
96
|
+
}
|
|
97
|
+
return selfIsDefined;
|
|
98
|
+
}
|
|
89
99
|
/* ------------------------------------------------------------------------ */
|
|
90
100
|
|
|
91
101
|
exports.aggregate = aggregate;
|
|
@@ -93,4 +103,5 @@ exports.extractParams = extractParams;
|
|
|
93
103
|
exports.implodeParams = implodeParams;
|
|
94
104
|
exports.parseTimeframe = parseTimeframe;
|
|
95
105
|
exports.roundTimeframe = roundTimeframe;
|
|
106
|
+
exports.selfIsDefined = selfIsDefined;
|
|
96
107
|
exports.vwap = vwap;
|
|
@@ -156,4 +156,5 @@ exports.extractParams = misc.extractParams;
|
|
|
156
156
|
exports.implodeParams = misc.implodeParams;
|
|
157
157
|
exports.parseTimeframe = misc.parseTimeframe;
|
|
158
158
|
exports.roundTimeframe = misc.roundTimeframe;
|
|
159
|
+
exports.selfIsDefined = misc.selfIsDefined;
|
|
159
160
|
exports.vwap = misc.vwap;
|
|
@@ -6,6 +6,7 @@ var platform = require('../functions/platform.js');
|
|
|
6
6
|
require('../functions/encode.js');
|
|
7
7
|
require('../functions/crypto.js');
|
|
8
8
|
var time = require('../functions/time.js');
|
|
9
|
+
var misc = require('../functions/misc.js');
|
|
9
10
|
var Future = require('./Future.js');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14,7 +15,7 @@ var WebSocket__default = /*#__PURE__*/_interopDefaultLegacy(WebSocket);
|
|
|
14
15
|
|
|
15
16
|
// eslint-disable-next-line no-shadow
|
|
16
17
|
// eslint-disable-next-line no-restricted-globals
|
|
17
|
-
const WebSocketPlatform = platform.isNode ? WebSocket__default["default"] : self.WebSocket;
|
|
18
|
+
const WebSocketPlatform = platform.isNode || !misc.selfIsDefined() ? WebSocket__default["default"] : self.WebSocket;
|
|
18
19
|
class WsClient extends Client {
|
|
19
20
|
constructor() {
|
|
20
21
|
super(...arguments);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -1199,6 +1199,7 @@ class binance extends binance$1 {
|
|
|
1199
1199
|
// exchange-specific options
|
|
1200
1200
|
'options': {
|
|
1201
1201
|
'sandboxMode': false,
|
|
1202
|
+
'fetchMargins': true,
|
|
1202
1203
|
'fetchMarkets': [
|
|
1203
1204
|
'spot',
|
|
1204
1205
|
'linear',
|
|
@@ -2872,13 +2873,12 @@ class binance extends binance$1 {
|
|
|
2872
2873
|
}
|
|
2873
2874
|
fetchMarkets.push(type);
|
|
2874
2875
|
}
|
|
2875
|
-
|
|
2876
|
+
const fetchMargins = this.safeBool(this.options, 'fetchMargins', false);
|
|
2876
2877
|
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
2877
2878
|
const marketType = fetchMarkets[i];
|
|
2878
2879
|
if (marketType === 'spot') {
|
|
2879
2880
|
promisesRaw.push(this.publicGetExchangeInfo(params));
|
|
2880
|
-
if (this.checkRequiredCredentials(false) && !sandboxMode) {
|
|
2881
|
-
fetchMargins = true;
|
|
2881
|
+
if (fetchMargins && this.checkRequiredCredentials(false) && !sandboxMode) {
|
|
2882
2882
|
promisesRaw.push(this.sapiGetMarginAllPairs(params));
|
|
2883
2883
|
promisesRaw.push(this.sapiGetMarginIsolatedAllPairs(params));
|
|
2884
2884
|
}
|
|
@@ -11219,17 +11219,42 @@ class binance extends binance$1 {
|
|
|
11219
11219
|
return result;
|
|
11220
11220
|
}
|
|
11221
11221
|
async fetchLedgerEntry(id, code = undefined, params = {}) {
|
|
11222
|
+
/**
|
|
11223
|
+
* @method
|
|
11224
|
+
* @name binance#fetchLedgerEntry
|
|
11225
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
11226
|
+
* @see https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
|
|
11227
|
+
* @param {string} id the identification number of the ledger entry
|
|
11228
|
+
* @param {string} code unified currency code
|
|
11229
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
11230
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
11231
|
+
*/
|
|
11222
11232
|
await this.loadMarkets();
|
|
11223
11233
|
let type = undefined;
|
|
11224
11234
|
[type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
|
|
11225
|
-
const query = {
|
|
11226
|
-
'recordId': id,
|
|
11227
|
-
'type': type,
|
|
11228
|
-
};
|
|
11229
11235
|
if (type !== 'option') {
|
|
11230
|
-
throw new errors.BadRequest(this.id + ' fetchLedgerEntry
|
|
11236
|
+
throw new errors.BadRequest(this.id + ' fetchLedgerEntry() can only be used for type option');
|
|
11231
11237
|
}
|
|
11232
|
-
|
|
11238
|
+
this.checkRequiredArgument('fetchLedgerEntry', code, 'code');
|
|
11239
|
+
const currency = this.currency(code);
|
|
11240
|
+
const request = {
|
|
11241
|
+
'recordId': id,
|
|
11242
|
+
'currency': currency['id'],
|
|
11243
|
+
};
|
|
11244
|
+
const response = await this.eapiPrivateGetBill(this.extend(request, params));
|
|
11245
|
+
//
|
|
11246
|
+
// [
|
|
11247
|
+
// {
|
|
11248
|
+
// "id": "1125899906845701870",
|
|
11249
|
+
// "asset": "USDT",
|
|
11250
|
+
// "amount": "-0.16518203",
|
|
11251
|
+
// "type": "FEE",
|
|
11252
|
+
// "createDate": 1676621042489
|
|
11253
|
+
// }
|
|
11254
|
+
// ]
|
|
11255
|
+
//
|
|
11256
|
+
const first = this.safeDict(response, 0, response);
|
|
11257
|
+
return this.parseLedgerEntry(first, currency);
|
|
11233
11258
|
}
|
|
11234
11259
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11235
11260
|
/**
|
|
@@ -11241,9 +11266,9 @@ class binance extends binance$1 {
|
|
|
11241
11266
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Income-History
|
|
11242
11267
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
|
|
11243
11268
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
|
|
11244
|
-
* @param {string} code unified currency code
|
|
11269
|
+
* @param {string} [code] unified currency code
|
|
11245
11270
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
11246
|
-
* @param {int} [limit] max number of ledger
|
|
11271
|
+
* @param {int} [limit] max number of ledger entries to return
|
|
11247
11272
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
11248
11273
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
11249
11274
|
* @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)
|
|
@@ -11369,16 +11394,19 @@ class binance extends binance$1 {
|
|
|
11369
11394
|
direction = 'in';
|
|
11370
11395
|
}
|
|
11371
11396
|
const currencyId = this.safeString(item, 'asset');
|
|
11397
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
11398
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
11372
11399
|
const timestamp = this.safeInteger2(item, 'createDate', 'time');
|
|
11373
11400
|
const type = this.safeString2(item, 'type', 'incomeType');
|
|
11374
|
-
return {
|
|
11401
|
+
return this.safeLedgerEntry({
|
|
11402
|
+
'info': item,
|
|
11375
11403
|
'id': this.safeString2(item, 'id', 'tranId'),
|
|
11376
11404
|
'direction': direction,
|
|
11377
11405
|
'account': undefined,
|
|
11378
11406
|
'referenceAccount': undefined,
|
|
11379
11407
|
'referenceId': this.safeString(item, 'tradeId'),
|
|
11380
11408
|
'type': this.parseLedgerEntryType(type),
|
|
11381
|
-
'currency':
|
|
11409
|
+
'currency': code,
|
|
11382
11410
|
'amount': this.parseNumber(amount),
|
|
11383
11411
|
'timestamp': timestamp,
|
|
11384
11412
|
'datetime': this.iso8601(timestamp),
|
|
@@ -11386,8 +11414,7 @@ class binance extends binance$1 {
|
|
|
11386
11414
|
'after': undefined,
|
|
11387
11415
|
'status': undefined,
|
|
11388
11416
|
'fee': undefined,
|
|
11389
|
-
|
|
11390
|
-
};
|
|
11417
|
+
}, currency);
|
|
11391
11418
|
}
|
|
11392
11419
|
parseLedgerEntryType(type) {
|
|
11393
11420
|
const ledgerType = {
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -2917,6 +2917,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
2917
2917
|
const id = this.safeString(itemList, 0);
|
|
2918
2918
|
const currencyId = this.safeString(itemList, 1);
|
|
2919
2919
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
2920
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
2920
2921
|
const timestamp = this.safeInteger(itemList, 3);
|
|
2921
2922
|
const amount = this.safeNumber(itemList, 5);
|
|
2922
2923
|
const after = this.safeNumber(itemList, 6);
|
|
@@ -2926,7 +2927,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
2926
2927
|
const first = this.safeStringLower(parts, 0);
|
|
2927
2928
|
type = this.parseLedgerEntryType(first);
|
|
2928
2929
|
}
|
|
2929
|
-
return {
|
|
2930
|
+
return this.safeLedgerEntry({
|
|
2931
|
+
'info': item,
|
|
2930
2932
|
'id': id,
|
|
2931
2933
|
'direction': undefined,
|
|
2932
2934
|
'account': undefined,
|
|
@@ -2941,18 +2943,17 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
2941
2943
|
'after': after,
|
|
2942
2944
|
'status': undefined,
|
|
2943
2945
|
'fee': undefined,
|
|
2944
|
-
|
|
2945
|
-
};
|
|
2946
|
+
}, currency);
|
|
2946
2947
|
}
|
|
2947
2948
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2948
2949
|
/**
|
|
2949
2950
|
* @method
|
|
2950
2951
|
* @name bitfinex2#fetchLedger
|
|
2951
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
2952
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2952
2953
|
* @see https://docs.bitfinex.com/reference/rest-auth-ledgers
|
|
2953
|
-
* @param {string} code unified currency code, default is undefined
|
|
2954
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
2954
2955
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
2955
|
-
* @param {int} [limit] max number of ledger
|
|
2956
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined, max is 2500
|
|
2956
2957
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2957
2958
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
2958
2959
|
* @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)
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1533,6 +1533,7 @@ class bitget extends bitget$1 {
|
|
|
1533
1533
|
* @description retrieves data on all markets for bitget
|
|
1534
1534
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Symbols
|
|
1535
1535
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts
|
|
1536
|
+
* @see https://www.bitget.com/api-doc/margin/common/support-currencies
|
|
1536
1537
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1537
1538
|
* @returns {object[]} an array of objects representing market data
|
|
1538
1539
|
*/
|
|
@@ -1541,10 +1542,11 @@ class bitget extends bitget$1 {
|
|
|
1541
1542
|
if (sandboxMode) {
|
|
1542
1543
|
types = ['swap'];
|
|
1543
1544
|
}
|
|
1544
|
-
|
|
1545
|
+
const promises = [];
|
|
1546
|
+
let fetchMargins = false;
|
|
1545
1547
|
for (let i = 0; i < types.length; i++) {
|
|
1546
1548
|
const type = types[i];
|
|
1547
|
-
if (type === 'swap') {
|
|
1549
|
+
if ((type === 'swap') || (type === 'future')) {
|
|
1548
1550
|
let subTypes = undefined;
|
|
1549
1551
|
if (sandboxMode) {
|
|
1550
1552
|
// the following are simulated trading markets [ 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES' ];
|
|
@@ -1554,19 +1556,41 @@ class bitget extends bitget$1 {
|
|
|
1554
1556
|
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES'];
|
|
1555
1557
|
}
|
|
1556
1558
|
for (let j = 0; j < subTypes.length; j++) {
|
|
1557
|
-
promises.push(this.
|
|
1559
|
+
promises.push(this.publicMixGetV2MixMarketContracts(this.extend(params, {
|
|
1558
1560
|
'productType': subTypes[j],
|
|
1559
1561
|
})));
|
|
1560
1562
|
}
|
|
1561
1563
|
}
|
|
1564
|
+
else if (type === 'spot') {
|
|
1565
|
+
promises.push(this.publicSpotGetV2SpotPublicSymbols(params));
|
|
1566
|
+
fetchMargins = true;
|
|
1567
|
+
promises.push(this.publicMarginGetV2MarginCurrencies(params));
|
|
1568
|
+
}
|
|
1569
|
+
else {
|
|
1570
|
+
throw new errors.NotSupported(this.id + ' does not support ' + type + ' market');
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
const results = await Promise.all(promises);
|
|
1574
|
+
let markets = [];
|
|
1575
|
+
this.options['crossMarginPairsData'] = [];
|
|
1576
|
+
this.options['isolatedMarginPairsData'] = [];
|
|
1577
|
+
for (let i = 0; i < results.length; i++) {
|
|
1578
|
+
const res = this.safeDict(results, i);
|
|
1579
|
+
const data = this.safeList(res, 'data', []);
|
|
1580
|
+
const firstData = this.safeDict(data, 0, {});
|
|
1581
|
+
const isBorrowable = this.safeString(firstData, 'isBorrowable');
|
|
1582
|
+
if (fetchMargins && isBorrowable !== undefined) {
|
|
1583
|
+
const keysList = Object.keys(this.indexBy(data, 'symbol'));
|
|
1584
|
+
this.options['crossMarginPairsData'] = keysList;
|
|
1585
|
+
this.options['isolatedMarginPairsData'] = keysList;
|
|
1586
|
+
}
|
|
1562
1587
|
else {
|
|
1563
|
-
|
|
1588
|
+
markets = this.arrayConcat(markets, data);
|
|
1564
1589
|
}
|
|
1565
1590
|
}
|
|
1566
|
-
|
|
1567
|
-
let
|
|
1568
|
-
|
|
1569
|
-
result = this.arrayConcat(result, promises[i]);
|
|
1591
|
+
const result = [];
|
|
1592
|
+
for (let i = 0; i < markets.length; i++) {
|
|
1593
|
+
result.push(this.parseMarket(markets[i]));
|
|
1570
1594
|
}
|
|
1571
1595
|
return result;
|
|
1572
1596
|
}
|
|
@@ -1658,11 +1682,20 @@ class bitget extends bitget$1 {
|
|
|
1658
1682
|
let expiry = undefined;
|
|
1659
1683
|
let expiryDatetime = undefined;
|
|
1660
1684
|
const symbolType = this.safeString(market, 'symbolType');
|
|
1685
|
+
let marginModes = undefined;
|
|
1686
|
+
let isMarginTradingAllowed = false;
|
|
1661
1687
|
if (symbolType === undefined) {
|
|
1662
1688
|
type = 'spot';
|
|
1663
1689
|
spot = true;
|
|
1664
1690
|
pricePrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision')));
|
|
1665
1691
|
amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision')));
|
|
1692
|
+
const hasCrossMargin = this.inArray(marketId, this.options['crossMarginPairsData']);
|
|
1693
|
+
const hasIsolatedMargin = this.inArray(marketId, this.options['isolatedMarginPairsData']);
|
|
1694
|
+
marginModes = {
|
|
1695
|
+
'cross': hasCrossMargin,
|
|
1696
|
+
'isolated': hasIsolatedMargin,
|
|
1697
|
+
};
|
|
1698
|
+
isMarginTradingAllowed = hasCrossMargin || hasCrossMargin;
|
|
1666
1699
|
}
|
|
1667
1700
|
else {
|
|
1668
1701
|
if (symbolType === 'perpetual') {
|
|
@@ -1701,6 +1734,10 @@ class bitget extends bitget$1 {
|
|
|
1701
1734
|
preciseAmount.reduce();
|
|
1702
1735
|
const amountString = preciseAmount.toString();
|
|
1703
1736
|
amountPrecision = this.parseNumber(amountString);
|
|
1737
|
+
marginModes = {
|
|
1738
|
+
'cross': true,
|
|
1739
|
+
'isolated': true,
|
|
1740
|
+
};
|
|
1704
1741
|
}
|
|
1705
1742
|
const status = this.safeString2(market, 'status', 'symbolStatus');
|
|
1706
1743
|
let active = undefined;
|
|
@@ -1723,7 +1760,8 @@ class bitget extends bitget$1 {
|
|
|
1723
1760
|
'settleId': settleId,
|
|
1724
1761
|
'type': type,
|
|
1725
1762
|
'spot': spot,
|
|
1726
|
-
'margin':
|
|
1763
|
+
'margin': spot && isMarginTradingAllowed,
|
|
1764
|
+
'marginModes': marginModes,
|
|
1727
1765
|
'swap': swap,
|
|
1728
1766
|
'future': future,
|
|
1729
1767
|
'option': false,
|
|
@@ -1764,91 +1802,6 @@ class bitget extends bitget$1 {
|
|
|
1764
1802
|
'info': market,
|
|
1765
1803
|
};
|
|
1766
1804
|
}
|
|
1767
|
-
async fetchMarketsByType(type, params = {}) {
|
|
1768
|
-
let response = undefined;
|
|
1769
|
-
if (type === 'spot') {
|
|
1770
|
-
response = await this.publicSpotGetV2SpotPublicSymbols(params);
|
|
1771
|
-
}
|
|
1772
|
-
else if ((type === 'swap') || (type === 'future')) {
|
|
1773
|
-
response = await this.publicMixGetV2MixMarketContracts(params);
|
|
1774
|
-
}
|
|
1775
|
-
else {
|
|
1776
|
-
throw new errors.NotSupported(this.id + ' does not support ' + type + ' market');
|
|
1777
|
-
}
|
|
1778
|
-
//
|
|
1779
|
-
// spot
|
|
1780
|
-
//
|
|
1781
|
-
// {
|
|
1782
|
-
// "code": "00000",
|
|
1783
|
-
// "msg": "success",
|
|
1784
|
-
// "requestTime": 1700102364653,
|
|
1785
|
-
// "data": [
|
|
1786
|
-
// {
|
|
1787
|
-
// "symbol": "TRXUSDT",
|
|
1788
|
-
// "baseCoin": "TRX",
|
|
1789
|
-
// "quoteCoin": "USDT",
|
|
1790
|
-
// "minTradeAmount": "0",
|
|
1791
|
-
// "maxTradeAmount": "10000000000",
|
|
1792
|
-
// "takerFeeRate": "0.002",
|
|
1793
|
-
// "makerFeeRate": "0.002",
|
|
1794
|
-
// "pricePrecision": "6",
|
|
1795
|
-
// "quantityPrecision": "4",
|
|
1796
|
-
// "quotePrecision": "6",
|
|
1797
|
-
// "status": "online",
|
|
1798
|
-
// "minTradeUSDT": "5",
|
|
1799
|
-
// "buyLimitPriceRatio": "0.05",
|
|
1800
|
-
// "sellLimitPriceRatio": "0.05"
|
|
1801
|
-
// },
|
|
1802
|
-
// ]
|
|
1803
|
-
// }
|
|
1804
|
-
//
|
|
1805
|
-
// swap and future
|
|
1806
|
-
//
|
|
1807
|
-
// {
|
|
1808
|
-
// "code": "00000",
|
|
1809
|
-
// "msg": "success",
|
|
1810
|
-
// "requestTime": 1700102364709,
|
|
1811
|
-
// "data": [
|
|
1812
|
-
// {
|
|
1813
|
-
// "symbol": "BTCUSDT",
|
|
1814
|
-
// "baseCoin": "BTC",
|
|
1815
|
-
// "quoteCoin": "USDT",
|
|
1816
|
-
// "buyLimitPriceRatio": "0.01",
|
|
1817
|
-
// "sellLimitPriceRatio": "0.01",
|
|
1818
|
-
// "feeRateUpRatio": "0.005",
|
|
1819
|
-
// "makerFeeRate": "0.0002",
|
|
1820
|
-
// "takerFeeRate": "0.0006",
|
|
1821
|
-
// "openCostUpRatio": "0.01",
|
|
1822
|
-
// "supportMarginCoins": ["USDT"],
|
|
1823
|
-
// "minTradeNum": "0.001",
|
|
1824
|
-
// "priceEndStep": "1",
|
|
1825
|
-
// "volumePlace": "3",
|
|
1826
|
-
// "pricePlace": "1",
|
|
1827
|
-
// "sizeMultiplier": "0.001",
|
|
1828
|
-
// "symbolType": "perpetual",
|
|
1829
|
-
// "minTradeUSDT": "5",
|
|
1830
|
-
// "maxSymbolOrderNum": "200",
|
|
1831
|
-
// "maxProductOrderNum": "400",
|
|
1832
|
-
// "maxPositionNum": "150",
|
|
1833
|
-
// "symbolStatus": "normal",
|
|
1834
|
-
// "offTime": "-1",
|
|
1835
|
-
// "limitOpenTime": "-1",
|
|
1836
|
-
// "deliveryTime": "",
|
|
1837
|
-
// "deliveryStartTime": "",
|
|
1838
|
-
// "deliveryPeriod": "",
|
|
1839
|
-
// "launchTime": "",
|
|
1840
|
-
// "fundInterval": "8",
|
|
1841
|
-
// "minLever": "1",
|
|
1842
|
-
// "maxLever": "125",
|
|
1843
|
-
// "posLimit": "0.05",
|
|
1844
|
-
// "maintainTime": ""
|
|
1845
|
-
// },
|
|
1846
|
-
// ]
|
|
1847
|
-
// }
|
|
1848
|
-
//
|
|
1849
|
-
const data = this.safeValue(response, 'data', []);
|
|
1850
|
-
return this.parseMarkets(data);
|
|
1851
|
-
}
|
|
1852
1805
|
async fetchCurrencies(params = {}) {
|
|
1853
1806
|
/**
|
|
1854
1807
|
* @method
|
|
@@ -5901,12 +5854,12 @@ class bitget extends bitget$1 {
|
|
|
5901
5854
|
/**
|
|
5902
5855
|
* @method
|
|
5903
5856
|
* @name bitget#fetchLedger
|
|
5857
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
5904
5858
|
* @see https://www.bitget.com/api-doc/spot/account/Get-Account-Bills
|
|
5905
5859
|
* @see https://www.bitget.com/api-doc/contract/account/Get-Account-Bill
|
|
5906
|
-
* @
|
|
5907
|
-
* @param {string} code unified currency code, default is undefined
|
|
5860
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
5908
5861
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
5909
|
-
* @param {int} [limit] max number of ledger
|
|
5862
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
5910
5863
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5911
5864
|
* @param {int} [params.until] end time in ms
|
|
5912
5865
|
* @param {string} [params.symbol] *contract only* unified market symbol
|
|
@@ -6046,6 +5999,7 @@ class bitget extends bitget$1 {
|
|
|
6046
5999
|
//
|
|
6047
6000
|
const currencyId = this.safeString(item, 'coin');
|
|
6048
6001
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
6002
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
6049
6003
|
const timestamp = this.safeInteger(item, 'cTime');
|
|
6050
6004
|
const after = this.safeNumber(item, 'balance');
|
|
6051
6005
|
const fee = this.safeNumber2(item, 'fees', 'fee');
|
|
@@ -6055,7 +6009,7 @@ class bitget extends bitget$1 {
|
|
|
6055
6009
|
if (amountRaw.indexOf('-') >= 0) {
|
|
6056
6010
|
direction = 'out';
|
|
6057
6011
|
}
|
|
6058
|
-
return {
|
|
6012
|
+
return this.safeLedgerEntry({
|
|
6059
6013
|
'info': item,
|
|
6060
6014
|
'id': this.safeString(item, 'billId'),
|
|
6061
6015
|
'timestamp': timestamp,
|
|
@@ -6070,8 +6024,11 @@ class bitget extends bitget$1 {
|
|
|
6070
6024
|
'before': undefined,
|
|
6071
6025
|
'after': after,
|
|
6072
6026
|
'status': undefined,
|
|
6073
|
-
'fee':
|
|
6074
|
-
|
|
6027
|
+
'fee': {
|
|
6028
|
+
'currency': code,
|
|
6029
|
+
'cost': fee,
|
|
6030
|
+
},
|
|
6031
|
+
}, currency);
|
|
6075
6032
|
}
|
|
6076
6033
|
parseLedgerType(type) {
|
|
6077
6034
|
const types = {
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -1143,6 +1143,7 @@ class bitmex extends bitmex$1 {
|
|
|
1143
1143
|
const type = this.parseLedgerEntryType(this.safeString(item, 'transactType'));
|
|
1144
1144
|
const currencyId = this.safeString(item, 'currency');
|
|
1145
1145
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
1146
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
1146
1147
|
const amountString = this.safeString(item, 'amount');
|
|
1147
1148
|
let amount = this.convertToRealAmount(code, amountString);
|
|
1148
1149
|
let timestamp = this.parse8601(this.safeString(item, 'transactTime'));
|
|
@@ -1157,14 +1158,14 @@ class bitmex extends bitmex$1 {
|
|
|
1157
1158
|
feeCost = this.convertToRealAmount(code, feeCost);
|
|
1158
1159
|
}
|
|
1159
1160
|
const fee = {
|
|
1160
|
-
'cost': this.
|
|
1161
|
+
'cost': this.parseToNumeric(feeCost),
|
|
1161
1162
|
'currency': code,
|
|
1162
1163
|
};
|
|
1163
1164
|
let after = this.safeString(item, 'walletBalance');
|
|
1164
1165
|
if (after !== undefined) {
|
|
1165
1166
|
after = this.convertToRealAmount(code, after);
|
|
1166
1167
|
}
|
|
1167
|
-
const before = this.
|
|
1168
|
+
const before = this.parseToNumeric(Precise["default"].stringSub(this.numberToString(after), this.numberToString(amount)));
|
|
1168
1169
|
let direction = undefined;
|
|
1169
1170
|
if (Precise["default"].stringLt(amountString, '0')) {
|
|
1170
1171
|
direction = 'out';
|
|
@@ -1174,9 +1175,9 @@ class bitmex extends bitmex$1 {
|
|
|
1174
1175
|
direction = 'in';
|
|
1175
1176
|
}
|
|
1176
1177
|
const status = this.parseTransactionStatus(this.safeString(item, 'transactStatus'));
|
|
1177
|
-
return {
|
|
1178
|
-
'id': id,
|
|
1178
|
+
return this.safeLedgerEntry({
|
|
1179
1179
|
'info': item,
|
|
1180
|
+
'id': id,
|
|
1180
1181
|
'timestamp': timestamp,
|
|
1181
1182
|
'datetime': this.iso8601(timestamp),
|
|
1182
1183
|
'direction': direction,
|
|
@@ -1185,22 +1186,22 @@ class bitmex extends bitmex$1 {
|
|
|
1185
1186
|
'referenceAccount': referenceAccount,
|
|
1186
1187
|
'type': type,
|
|
1187
1188
|
'currency': code,
|
|
1188
|
-
'amount': amount,
|
|
1189
|
+
'amount': this.parseToNumeric(amount),
|
|
1189
1190
|
'before': before,
|
|
1190
|
-
'after': this.
|
|
1191
|
+
'after': this.parseToNumeric(after),
|
|
1191
1192
|
'status': status,
|
|
1192
1193
|
'fee': fee,
|
|
1193
|
-
};
|
|
1194
|
+
}, currency);
|
|
1194
1195
|
}
|
|
1195
1196
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1196
1197
|
/**
|
|
1197
1198
|
* @method
|
|
1198
1199
|
* @name bitmex#fetchLedger
|
|
1199
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
1200
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
1200
1201
|
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
1201
|
-
* @param {string} code unified currency code, default is undefined
|
|
1202
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
1202
1203
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
1203
|
-
* @param {int} [limit] max number of ledger
|
|
1204
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
1204
1205
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1205
1206
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1206
1207
|
*/
|
package/dist/cjs/src/bitso.js
CHANGED
|
@@ -191,10 +191,10 @@ class bitso extends bitso$1 {
|
|
|
191
191
|
/**
|
|
192
192
|
* @method
|
|
193
193
|
* @name bitso#fetchLedger
|
|
194
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
195
|
-
* @param {string} code unified currency code, default is undefined
|
|
194
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
195
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
196
196
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
197
|
-
* @param {int} [limit] max number of ledger
|
|
197
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
198
198
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
199
199
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
200
200
|
*/
|
|
@@ -303,6 +303,7 @@ class bitso extends bitso$1 {
|
|
|
303
303
|
const amount = this.safeString(firstBalance, 'amount');
|
|
304
304
|
const currencyId = this.safeString(firstBalance, 'currency');
|
|
305
305
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
306
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
306
307
|
const details = this.safeValue(item, 'details', {});
|
|
307
308
|
let referenceId = this.safeString2(details, 'fid', 'wid');
|
|
308
309
|
if (referenceId === undefined) {
|
|
@@ -327,6 +328,7 @@ class bitso extends bitso$1 {
|
|
|
327
328
|
}
|
|
328
329
|
const timestamp = this.parse8601(this.safeString(item, 'created_at'));
|
|
329
330
|
return this.safeLedgerEntry({
|
|
331
|
+
'info': item,
|
|
330
332
|
'id': this.safeString(item, 'eid'),
|
|
331
333
|
'direction': direction,
|
|
332
334
|
'account': undefined,
|
|
@@ -341,7 +343,6 @@ class bitso extends bitso$1 {
|
|
|
341
343
|
'after': undefined,
|
|
342
344
|
'status': 'ok',
|
|
343
345
|
'fee': fee,
|
|
344
|
-
'info': item,
|
|
345
346
|
}, currency);
|
|
346
347
|
}
|
|
347
348
|
async fetchMarkets(params = {}) {
|