ccxt 4.2.60 → 4.2.62
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 +6 -5
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +11280 -3407
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/hyperliquid.js +9 -0
- package/dist/cjs/src/base/Exchange.js +22 -1
- package/dist/cjs/src/base/functions/encode.js +5 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/bitfinex2.js +1 -1
- package/dist/cjs/src/bitget.js +74 -23
- package/dist/cjs/src/coinbase.js +108 -103
- package/dist/cjs/src/coinex.js +61 -1
- package/dist/cjs/src/hyperliquid.js +2035 -0
- package/dist/cjs/src/kraken.js +8 -2
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoinfutures.js +2 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/pro/bingx.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
- package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
- package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
- package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
- package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
- package/dist/cjs/src/tokocrypto.js +22 -2
- package/dist/cjs/src/wazirx.js +308 -3
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/coinbase.d.ts +3 -3
- package/js/src/abstract/hyperliquid.d.ts +9 -0
- package/js/src/abstract/hyperliquid.js +11 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +13 -1
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +5 -1
- package/js/src/bitfinex2.js +1 -1
- package/js/src/bitget.js +74 -23
- package/js/src/coinbase.js +108 -103
- package/js/src/coinex.d.ts +3 -1
- package/js/src/coinex.js +61 -1
- package/js/src/hyperliquid.d.ts +83 -0
- package/js/src/hyperliquid.js +2036 -0
- package/js/src/kraken.js +8 -2
- package/js/src/krakenfutures.d.ts +2 -1
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoinfutures.js +2 -2
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/pro/bingx.js +1 -0
- package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
- package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
- package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
- package/js/src/static_dependencies/ethers/address/address.js +162 -0
- package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
- package/js/src/static_dependencies/ethers/address/checks.js +119 -0
- package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
- package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
- package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
- package/js/src/static_dependencies/ethers/address/index.js +24 -0
- package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
- package/js/src/static_dependencies/ethers/bytes32.js +45 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
- package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/address.js +34 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
- package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
- package/js/src/static_dependencies/ethers/coders/array.js +162 -0
- package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
- package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
- package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
- package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
- package/js/src/static_dependencies/ethers/coders/null.js +29 -0
- package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/number.js +48 -0
- package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/string.js +26 -0
- package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
- package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
- package/js/src/static_dependencies/ethers/fragments.js +1252 -0
- package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
- package/js/src/static_dependencies/ethers/hash/index.js +15 -0
- package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
- package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
- package/js/src/static_dependencies/ethers/index.d.ts +19 -0
- package/js/src/static_dependencies/ethers/index.js +22 -0
- package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
- package/js/src/static_dependencies/ethers/interface.js +990 -0
- package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
- package/js/src/static_dependencies/ethers/typed.js +608 -0
- package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
- package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
- package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
- package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
- package/js/src/static_dependencies/ethers/utils/data.js +175 -0
- package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
- package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
- package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
- package/js/src/static_dependencies/ethers/utils/events.js +52 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
- package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
- package/js/src/static_dependencies/ethers/utils/index.js +38 -0
- package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
- package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
- package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
- package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
- package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
- package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
- package/js/src/static_dependencies/ethers/utils/units.js +88 -0
- package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
- package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
- package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
- package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
- package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
- package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
- package/js/src/tokocrypto.js +22 -2
- package/js/src/wazirx.d.ts +12 -1
- package/js/src/wazirx.js +308 -3
- package/package.json +1 -1
- package/skip-tests.json +18 -0
package/dist/cjs/ccxt.js
CHANGED
|
@@ -76,6 +76,7 @@ var hollaex = require('./src/hollaex.js');
|
|
|
76
76
|
var htx = require('./src/htx.js');
|
|
77
77
|
var huobi = require('./src/huobi.js');
|
|
78
78
|
var huobijp = require('./src/huobijp.js');
|
|
79
|
+
var hyperliquid = require('./src/hyperliquid.js');
|
|
79
80
|
var idex = require('./src/idex.js');
|
|
80
81
|
var independentreserve = require('./src/independentreserve.js');
|
|
81
82
|
var indodax = require('./src/indodax.js');
|
|
@@ -176,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
176
177
|
|
|
177
178
|
//-----------------------------------------------------------------------------
|
|
178
179
|
// this is updated by vss.js when building
|
|
179
|
-
const version = '4.2.
|
|
180
|
+
const version = '4.2.62';
|
|
180
181
|
Exchange["default"].ccxtVersion = version;
|
|
181
182
|
const exchanges = {
|
|
182
183
|
'ace': ace,
|
|
@@ -243,6 +244,7 @@ const exchanges = {
|
|
|
243
244
|
'htx': htx,
|
|
244
245
|
'huobi': huobi,
|
|
245
246
|
'huobijp': huobijp,
|
|
247
|
+
'hyperliquid': hyperliquid,
|
|
246
248
|
'idex': idex,
|
|
247
249
|
'independentreserve': independentreserve,
|
|
248
250
|
'indodax': indodax,
|
|
@@ -448,6 +450,7 @@ exports.hollaex = hollaex;
|
|
|
448
450
|
exports.htx = htx;
|
|
449
451
|
exports.huobi = huobi;
|
|
450
452
|
exports.huobijp = huobijp;
|
|
453
|
+
exports.hyperliquid = hyperliquid;
|
|
451
454
|
exports.idex = idex;
|
|
452
455
|
exports.independentreserve = independentreserve;
|
|
453
456
|
exports.indodax = indodax;
|
|
@@ -10,6 +10,17 @@ var Future = require('./ws/Future.js');
|
|
|
10
10
|
var OrderBook = require('./ws/OrderBook.js');
|
|
11
11
|
var crypto = require('./functions/crypto.js');
|
|
12
12
|
var totp = require('./functions/totp.js');
|
|
13
|
+
var index = require('../static_dependencies/ethers/index.js');
|
|
14
|
+
require('../static_dependencies/ethers/utils/base58.js');
|
|
15
|
+
require('../static_dependencies/ethers/utils/errors.js');
|
|
16
|
+
require('../static_dependencies/ethers/utils/events.js');
|
|
17
|
+
require('../static_dependencies/ethers/utils/fixednumber.js');
|
|
18
|
+
require('../static_dependencies/ethers/utils/maths.js');
|
|
19
|
+
require('../static_dependencies/ethers/utils/utf8.js');
|
|
20
|
+
require('../static_dependencies/noble-hashes/sha3.js');
|
|
21
|
+
require('../static_dependencies/noble-hashes/sha256.js');
|
|
22
|
+
require('../static_dependencies/ethers/address/address.js');
|
|
23
|
+
var typedData = require('../static_dependencies/ethers/hash/typed-data.js');
|
|
13
24
|
var generic = require('./functions/generic.js');
|
|
14
25
|
var misc = require('./functions/misc.js');
|
|
15
26
|
|
|
@@ -32,7 +43,7 @@ function _interopNamespace(e) {
|
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
// ----------------------------------------------------------------------------
|
|
35
|
-
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, parseDate, ymd, base64ToString, crc32, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = functions;
|
|
46
|
+
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, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = functions;
|
|
36
47
|
// ----------------------------------------------------------------------------
|
|
37
48
|
/**
|
|
38
49
|
* @class Exchange
|
|
@@ -219,6 +230,7 @@ class Exchange {
|
|
|
219
230
|
this.ymd = ymd;
|
|
220
231
|
this.base64ToString = base64ToString;
|
|
221
232
|
this.crc32 = crc32;
|
|
233
|
+
this.packb = packb;
|
|
222
234
|
this.httpProxyAgentModule = undefined;
|
|
223
235
|
this.httpsProxyAgentModule = undefined;
|
|
224
236
|
this.socksProxyAgentModule = undefined;
|
|
@@ -1414,6 +1426,15 @@ class Exchange {
|
|
|
1414
1426
|
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
1415
1427
|
return modifiedContent;
|
|
1416
1428
|
}
|
|
1429
|
+
ethAbiEncode(types, args) {
|
|
1430
|
+
return this.base16ToBinary(index["default"].encode(types, args).slice(2));
|
|
1431
|
+
}
|
|
1432
|
+
ethEncodeStructuredData(domain, messageTypes, messageData) {
|
|
1433
|
+
return this.base16ToBinary(typedData.TypedDataEncoder.encode(domain, messageTypes, messageData).slice(-132));
|
|
1434
|
+
}
|
|
1435
|
+
intToBase16(elem) {
|
|
1436
|
+
return elem.toString(16);
|
|
1437
|
+
}
|
|
1417
1438
|
/* eslint-enable */
|
|
1418
1439
|
// ------------------------------------------------------------------------
|
|
1419
1440
|
// ########################################################################
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var index = require('../../static_dependencies/scure-base/index.js');
|
|
6
6
|
var utils = require('../../static_dependencies/noble-curves/abstract/utils.js');
|
|
7
|
+
var msgpack = require('../../static_dependencies/messagepack/msgpack.js');
|
|
7
8
|
var index$1 = require('../../static_dependencies/qs/index.cjs.js');
|
|
8
9
|
|
|
9
10
|
/* eslint-disable */
|
|
@@ -17,6 +18,9 @@ const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedOb
|
|
|
17
18
|
, urlencodeBase64 = base64string => base64string.replace(/[=]+$/, '')
|
|
18
19
|
.replace(/\+/g, '-')
|
|
19
20
|
.replace(/\//g, '_'), numberToLE = (n, padding) => utils.numberToBytesLE(BigInt(n), padding), numberToBE = (n, padding) => utils.numberToBytesBE(BigInt(n), padding);
|
|
21
|
+
function packb(req) {
|
|
22
|
+
return msgpack.serialize(req);
|
|
23
|
+
}
|
|
20
24
|
/* ------------------------------------------------------------------------ */
|
|
21
25
|
|
|
22
26
|
exports.base16ToBinary = base16ToBinary;
|
|
@@ -35,6 +39,7 @@ exports.isJsonEncodedObject = isJsonEncodedObject;
|
|
|
35
39
|
exports.json = json;
|
|
36
40
|
exports.numberToBE = numberToBE;
|
|
37
41
|
exports.numberToLE = numberToLE;
|
|
42
|
+
exports.packb = packb;
|
|
38
43
|
exports.rawencode = rawencode;
|
|
39
44
|
exports.stringToBase64 = stringToBase64;
|
|
40
45
|
exports.stringToBinary = stringToBinary;
|
|
@@ -117,6 +117,7 @@ exports.isJsonEncodedObject = encode.isJsonEncodedObject;
|
|
|
117
117
|
exports.json = encode.json;
|
|
118
118
|
exports.numberToBE = encode.numberToBE;
|
|
119
119
|
exports.numberToLE = encode.numberToLE;
|
|
120
|
+
exports.packb = encode.packb;
|
|
120
121
|
exports.rawencode = encode.rawencode;
|
|
121
122
|
exports.stringToBase64 = encode.stringToBase64;
|
|
122
123
|
exports.stringToBinary = encode.stringToBinary;
|
|
@@ -51,8 +51,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
51
51
|
'fetchBalance': true,
|
|
52
52
|
'fetchBorrowInterest': false,
|
|
53
53
|
'fetchBorrowRate': false,
|
|
54
|
-
'fetchBorrowRateHistory': false,
|
|
55
54
|
'fetchBorrowRateHistories': false,
|
|
55
|
+
'fetchBorrowRateHistory': false,
|
|
56
56
|
'fetchBorrowRates': false,
|
|
57
57
|
'fetchBorrowRatesPerSymbol': false,
|
|
58
58
|
'fetchClosedOrder': true,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1340,6 +1340,23 @@ class bitget extends bitget$1 {
|
|
|
1340
1340
|
'swap': {
|
|
1341
1341
|
'method': 'publicMixGetV2MixMarketCandles', // or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1342
1342
|
},
|
|
1343
|
+
'maxDaysPerTimeframe': {
|
|
1344
|
+
'1m': 30,
|
|
1345
|
+
'3m': 30,
|
|
1346
|
+
'5m': 30,
|
|
1347
|
+
'10m': 52,
|
|
1348
|
+
'15m': 52,
|
|
1349
|
+
'30m': 52,
|
|
1350
|
+
'1h': 83,
|
|
1351
|
+
'2h': 120,
|
|
1352
|
+
'4h': 240,
|
|
1353
|
+
'6h': 360,
|
|
1354
|
+
'12h': 360,
|
|
1355
|
+
'1d': 360,
|
|
1356
|
+
'3d': 1000,
|
|
1357
|
+
'1w': 1000,
|
|
1358
|
+
'1M': 1000,
|
|
1359
|
+
},
|
|
1343
1360
|
},
|
|
1344
1361
|
'fetchTrades': {
|
|
1345
1362
|
'spot': {
|
|
@@ -3291,10 +3308,11 @@ class bitget extends bitget$1 {
|
|
|
3291
3308
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
3292
3309
|
*/
|
|
3293
3310
|
await this.loadMarkets();
|
|
3311
|
+
const maxLimit = 1000; // max 1000
|
|
3294
3312
|
let paginate = false;
|
|
3295
3313
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
3296
3314
|
if (paginate) {
|
|
3297
|
-
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params,
|
|
3315
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimit);
|
|
3298
3316
|
}
|
|
3299
3317
|
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
3300
3318
|
let market = undefined;
|
|
@@ -3308,35 +3326,53 @@ class bitget extends bitget$1 {
|
|
|
3308
3326
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3309
3327
|
const timeframes = this.options['timeframes'][marketType];
|
|
3310
3328
|
const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
3329
|
+
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3311
3330
|
const request = {
|
|
3312
3331
|
'symbol': market['id'],
|
|
3313
3332
|
'granularity': selectedTimeframe,
|
|
3314
3333
|
};
|
|
3315
|
-
const
|
|
3316
|
-
|
|
3334
|
+
const defaultLimit = 100; // by default, exchange returns 100 items
|
|
3335
|
+
const msInDay = 1000 * 60 * 60 * 24;
|
|
3317
3336
|
if (limit !== undefined) {
|
|
3337
|
+
limit = Math.min(limit, maxLimit);
|
|
3318
3338
|
request['limit'] = limit;
|
|
3319
3339
|
}
|
|
3320
|
-
|
|
3321
|
-
|
|
3340
|
+
const until = this.safeInteger2(params, 'until', 'till');
|
|
3341
|
+
params = this.omit(params, ['until', 'till']);
|
|
3342
|
+
if (until !== undefined) {
|
|
3343
|
+
request['endTime'] = until;
|
|
3322
3344
|
}
|
|
3323
3345
|
if (since !== undefined) {
|
|
3324
|
-
|
|
3325
|
-
|
|
3346
|
+
request['startTime'] = since;
|
|
3347
|
+
if (market['spot'] && (until === undefined)) {
|
|
3348
|
+
// for spot we need to send "entTime" too
|
|
3349
|
+
const limitForEnd = (limit !== undefined) ? limit : defaultLimit;
|
|
3350
|
+
const calculatedEnd = this.sum(since, duration * limitForEnd);
|
|
3351
|
+
request['endTime'] = calculatedEnd;
|
|
3326
3352
|
}
|
|
3327
|
-
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3328
|
-
request['endTime'] = this.sum(since, duration * (limit + 1)) - 1; // limit + 1)) - 1 is needed for when since is not the exact timestamp of a candle
|
|
3329
|
-
}
|
|
3330
|
-
else if (until !== undefined) {
|
|
3331
|
-
request['endTime'] = until;
|
|
3332
|
-
}
|
|
3333
|
-
else {
|
|
3334
|
-
request['endTime'] = this.milliseconds();
|
|
3335
3353
|
}
|
|
3336
3354
|
let response = undefined;
|
|
3337
|
-
const
|
|
3355
|
+
const now = this.milliseconds();
|
|
3356
|
+
// retrievable periods listed here:
|
|
3357
|
+
// - https://www.bitget.com/api-doc/spot/market/Get-Candle-Data#request-parameters
|
|
3358
|
+
// - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
|
|
3359
|
+
const ohlcOptions = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
3360
|
+
const retrievableDaysMap = this.safeDict(ohlcOptions, 'maxDaysPerTimeframe', {});
|
|
3361
|
+
const maxRetrievableDaysForNonHistory = this.safeInteger(retrievableDaysMap, timeframe, 30); // default to safe minimum
|
|
3362
|
+
const endpointTsBoundary = now - maxRetrievableDaysForNonHistory * msInDay;
|
|
3363
|
+
// checks if we need history endpoint
|
|
3364
|
+
let needsHistoryEndpoint = false;
|
|
3365
|
+
const displaceByLimit = (limit === undefined) ? 0 : limit * duration;
|
|
3366
|
+
if (since !== undefined && since < endpointTsBoundary) {
|
|
3367
|
+
// if since it earlier than the allowed diapason
|
|
3368
|
+
needsHistoryEndpoint = true;
|
|
3369
|
+
}
|
|
3370
|
+
else if (until !== undefined && until - displaceByLimit < endpointTsBoundary) {
|
|
3371
|
+
// if until is earlier than the allowed diapason
|
|
3372
|
+
needsHistoryEndpoint = true;
|
|
3373
|
+
}
|
|
3338
3374
|
if (market['spot']) {
|
|
3339
|
-
if (
|
|
3375
|
+
if (needsHistoryEndpoint) {
|
|
3340
3376
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
3341
3377
|
}
|
|
3342
3378
|
else {
|
|
@@ -3344,22 +3380,37 @@ class bitget extends bitget$1 {
|
|
|
3344
3380
|
}
|
|
3345
3381
|
}
|
|
3346
3382
|
else {
|
|
3383
|
+
const maxDistanceDaysForContracts = 90; // maximum 90 days allowed between start-end times
|
|
3384
|
+
let distanceError = false;
|
|
3385
|
+
if (limit !== undefined && limit * duration > maxDistanceDaysForContracts * msInDay) {
|
|
3386
|
+
distanceError = true;
|
|
3387
|
+
}
|
|
3388
|
+
else if (since !== undefined && until !== undefined && until - since > maxDistanceDaysForContracts * msInDay) {
|
|
3389
|
+
distanceError = true;
|
|
3390
|
+
}
|
|
3391
|
+
if (distanceError) {
|
|
3392
|
+
throw new errors.BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3393
|
+
}
|
|
3347
3394
|
const priceType = this.safeString(params, 'price');
|
|
3348
3395
|
params = this.omit(params, ['price']);
|
|
3349
3396
|
let productType = undefined;
|
|
3350
3397
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3351
3398
|
request['productType'] = productType;
|
|
3399
|
+
const extended = this.extend(request, params);
|
|
3400
|
+
// todo: mark & index also have their "recent" endpoints, but not priority now.
|
|
3352
3401
|
if (priceType === 'mark') {
|
|
3353
|
-
response = await this.publicMixGetV2MixMarketHistoryMarkCandles(
|
|
3402
|
+
response = await this.publicMixGetV2MixMarketHistoryMarkCandles(extended);
|
|
3354
3403
|
}
|
|
3355
3404
|
else if (priceType === 'index') {
|
|
3356
|
-
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(
|
|
3357
|
-
}
|
|
3358
|
-
else if ((since !== undefined) && (since < thirtyOneDaysAgo)) {
|
|
3359
|
-
response = await this.publicMixGetV2MixMarketHistoryCandles(this.extend(request, params));
|
|
3405
|
+
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(extended);
|
|
3360
3406
|
}
|
|
3361
3407
|
else {
|
|
3362
|
-
|
|
3408
|
+
if (needsHistoryEndpoint) {
|
|
3409
|
+
response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
|
|
3410
|
+
}
|
|
3411
|
+
else {
|
|
3412
|
+
response = await this.publicMixGetV2MixMarketCandles(extended);
|
|
3413
|
+
}
|
|
3363
3414
|
}
|
|
3364
3415
|
}
|
|
3365
3416
|
if (response === '') {
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -19,7 +19,12 @@ class coinbase extends coinbase$1 {
|
|
|
19
19
|
'name': 'Coinbase',
|
|
20
20
|
'countries': ['US'],
|
|
21
21
|
'pro': true,
|
|
22
|
-
|
|
22
|
+
// rate-limits:
|
|
23
|
+
// ADVANCED API: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-rate-limits
|
|
24
|
+
// - max 30 req/second for private data, 10 req/s for public data
|
|
25
|
+
// DATA API : https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/rate-limiting
|
|
26
|
+
// - max 10000 req/hour (to prevent userland mistakes we apply ~3 req/second RL per call
|
|
27
|
+
'rateLimit': 34,
|
|
23
28
|
'version': 'v2',
|
|
24
29
|
'userAgent': this.userAgents['chrome'],
|
|
25
30
|
'headers': {
|
|
@@ -132,116 +137,116 @@ class coinbase extends coinbase$1 {
|
|
|
132
137
|
'api': {
|
|
133
138
|
'v2': {
|
|
134
139
|
'public': {
|
|
135
|
-
'get':
|
|
136
|
-
'currencies',
|
|
137
|
-
'currencies/crypto',
|
|
138
|
-
'time',
|
|
139
|
-
'exchange-rates',
|
|
140
|
-
'users/{user_id}',
|
|
141
|
-
'prices/{symbol}/buy',
|
|
142
|
-
'prices/{symbol}/sell',
|
|
143
|
-
'prices/{symbol}/spot',
|
|
144
|
-
|
|
140
|
+
'get': {
|
|
141
|
+
'currencies': 10.6,
|
|
142
|
+
'currencies/crypto': 10.6,
|
|
143
|
+
'time': 10.6,
|
|
144
|
+
'exchange-rates': 10.6,
|
|
145
|
+
'users/{user_id}': 10.6,
|
|
146
|
+
'prices/{symbol}/buy': 10.6,
|
|
147
|
+
'prices/{symbol}/sell': 10.6,
|
|
148
|
+
'prices/{symbol}/spot': 10.6,
|
|
149
|
+
},
|
|
145
150
|
},
|
|
146
151
|
'private': {
|
|
147
|
-
'get':
|
|
148
|
-
'accounts',
|
|
149
|
-
'accounts/{account_id}',
|
|
150
|
-
'accounts/{account_id}/addresses',
|
|
151
|
-
'accounts/{account_id}/addresses/{address_id}',
|
|
152
|
-
'accounts/{account_id}/addresses/{address_id}/transactions',
|
|
153
|
-
'accounts/{account_id}/transactions',
|
|
154
|
-
'accounts/{account_id}/transactions/{transaction_id}',
|
|
155
|
-
'accounts/{account_id}/buys',
|
|
156
|
-
'accounts/{account_id}/buys/{buy_id}',
|
|
157
|
-
'accounts/{account_id}/sells',
|
|
158
|
-
'accounts/{account_id}/sells/{sell_id}',
|
|
159
|
-
'accounts/{account_id}/deposits',
|
|
160
|
-
'accounts/{account_id}/deposits/{deposit_id}',
|
|
161
|
-
'accounts/{account_id}/withdrawals',
|
|
162
|
-
'accounts/{account_id}/withdrawals/{withdrawal_id}',
|
|
163
|
-
'payment-methods',
|
|
164
|
-
'payment-methods/{payment_method_id}',
|
|
165
|
-
'user',
|
|
166
|
-
'user/auth',
|
|
167
|
-
|
|
168
|
-
'post':
|
|
169
|
-
'accounts',
|
|
170
|
-
'accounts/{account_id}/primary',
|
|
171
|
-
'accounts/{account_id}/addresses',
|
|
172
|
-
'accounts/{account_id}/transactions',
|
|
173
|
-
'accounts/{account_id}/transactions/{transaction_id}/complete',
|
|
174
|
-
'accounts/{account_id}/transactions/{transaction_id}/resend',
|
|
175
|
-
'accounts/{account_id}/buys',
|
|
176
|
-
'accounts/{account_id}/buys/{buy_id}/commit',
|
|
177
|
-
'accounts/{account_id}/sells',
|
|
178
|
-
'accounts/{account_id}/sells/{sell_id}/commit',
|
|
179
|
-
'accounts/{account_id}/deposits',
|
|
180
|
-
'accounts/{account_id}/deposits/{deposit_id}/commit',
|
|
181
|
-
'accounts/{account_id}/withdrawals',
|
|
182
|
-
'accounts/{account_id}/withdrawals/{withdrawal_id}/commit',
|
|
183
|
-
|
|
184
|
-
'put':
|
|
185
|
-
'accounts/{account_id}',
|
|
186
|
-
'user',
|
|
187
|
-
|
|
188
|
-
'delete':
|
|
189
|
-
'accounts/{id}',
|
|
190
|
-
'accounts/{account_id}/transactions/{transaction_id}',
|
|
191
|
-
|
|
152
|
+
'get': {
|
|
153
|
+
'accounts': 10.6,
|
|
154
|
+
'accounts/{account_id}': 10.6,
|
|
155
|
+
'accounts/{account_id}/addresses': 10.6,
|
|
156
|
+
'accounts/{account_id}/addresses/{address_id}': 10.6,
|
|
157
|
+
'accounts/{account_id}/addresses/{address_id}/transactions': 10.6,
|
|
158
|
+
'accounts/{account_id}/transactions': 10.6,
|
|
159
|
+
'accounts/{account_id}/transactions/{transaction_id}': 10.6,
|
|
160
|
+
'accounts/{account_id}/buys': 10.6,
|
|
161
|
+
'accounts/{account_id}/buys/{buy_id}': 10.6,
|
|
162
|
+
'accounts/{account_id}/sells': 10.6,
|
|
163
|
+
'accounts/{account_id}/sells/{sell_id}': 10.6,
|
|
164
|
+
'accounts/{account_id}/deposits': 10.6,
|
|
165
|
+
'accounts/{account_id}/deposits/{deposit_id}': 10.6,
|
|
166
|
+
'accounts/{account_id}/withdrawals': 10.6,
|
|
167
|
+
'accounts/{account_id}/withdrawals/{withdrawal_id}': 10.6,
|
|
168
|
+
'payment-methods': 10.6,
|
|
169
|
+
'payment-methods/{payment_method_id}': 10.6,
|
|
170
|
+
'user': 10.6,
|
|
171
|
+
'user/auth': 10.6,
|
|
172
|
+
},
|
|
173
|
+
'post': {
|
|
174
|
+
'accounts': 10.6,
|
|
175
|
+
'accounts/{account_id}/primary': 10.6,
|
|
176
|
+
'accounts/{account_id}/addresses': 10.6,
|
|
177
|
+
'accounts/{account_id}/transactions': 10.6,
|
|
178
|
+
'accounts/{account_id}/transactions/{transaction_id}/complete': 10.6,
|
|
179
|
+
'accounts/{account_id}/transactions/{transaction_id}/resend': 10.6,
|
|
180
|
+
'accounts/{account_id}/buys': 10.6,
|
|
181
|
+
'accounts/{account_id}/buys/{buy_id}/commit': 10.6,
|
|
182
|
+
'accounts/{account_id}/sells': 10.6,
|
|
183
|
+
'accounts/{account_id}/sells/{sell_id}/commit': 10.6,
|
|
184
|
+
'accounts/{account_id}/deposits': 10.6,
|
|
185
|
+
'accounts/{account_id}/deposits/{deposit_id}/commit': 10.6,
|
|
186
|
+
'accounts/{account_id}/withdrawals': 10.6,
|
|
187
|
+
'accounts/{account_id}/withdrawals/{withdrawal_id}/commit': 10.6,
|
|
188
|
+
},
|
|
189
|
+
'put': {
|
|
190
|
+
'accounts/{account_id}': 10.6,
|
|
191
|
+
'user': 10.6,
|
|
192
|
+
},
|
|
193
|
+
'delete': {
|
|
194
|
+
'accounts/{id}': 10.6,
|
|
195
|
+
'accounts/{account_id}/transactions/{transaction_id}': 10.6,
|
|
196
|
+
},
|
|
192
197
|
},
|
|
193
198
|
},
|
|
194
199
|
'v3': {
|
|
195
200
|
'public': {
|
|
196
|
-
'get':
|
|
197
|
-
'brokerage/time',
|
|
198
|
-
|
|
201
|
+
'get': {
|
|
202
|
+
'brokerage/time': 3,
|
|
203
|
+
},
|
|
199
204
|
},
|
|
200
205
|
'private': {
|
|
201
|
-
'get':
|
|
202
|
-
'brokerage/accounts',
|
|
203
|
-
'brokerage/accounts/{account_uuid}',
|
|
204
|
-
'brokerage/orders/historical/batch',
|
|
205
|
-
'brokerage/orders/historical/fills',
|
|
206
|
-
'brokerage/orders/historical/{order_id}',
|
|
207
|
-
'brokerage/products',
|
|
208
|
-
'brokerage/products/{product_id}',
|
|
209
|
-
'brokerage/products/{product_id}/candles',
|
|
210
|
-
'brokerage/products/{product_id}/ticker',
|
|
211
|
-
'brokerage/
|
|
212
|
-
'brokerage/
|
|
213
|
-
'brokerage/transaction_summary',
|
|
214
|
-
'brokerage/
|
|
215
|
-
'brokerage/
|
|
216
|
-
'brokerage/convert/trade/{trade_id}',
|
|
217
|
-
'brokerage/cfm/balance_summary',
|
|
218
|
-
'brokerage/cfm/positions',
|
|
219
|
-
'brokerage/cfm/positions/{product_id}',
|
|
220
|
-
'brokerage/cfm/sweeps',
|
|
221
|
-
'brokerage/intx/portfolio/{portfolio_uuid}',
|
|
222
|
-
'brokerage/intx/positions/{portfolio_uuid}',
|
|
223
|
-
'brokerage/intx/positions/{portfolio_uuid}/{symbol}',
|
|
224
|
-
|
|
225
|
-
'post':
|
|
226
|
-
'brokerage/orders',
|
|
227
|
-
'brokerage/orders/batch_cancel',
|
|
228
|
-
'brokerage/orders/edit',
|
|
229
|
-
'brokerage/orders/edit_preview',
|
|
230
|
-
'brokerage/orders/preview',
|
|
231
|
-
'brokerage/portfolios',
|
|
232
|
-
'brokerage/portfolios/move_funds',
|
|
233
|
-
'brokerage/convert/quote',
|
|
234
|
-
'brokerage/convert/trade/{trade_id}',
|
|
235
|
-
'brokerage/cfm/sweeps/schedule',
|
|
236
|
-
'brokerage/intx/allocate',
|
|
237
|
-
|
|
238
|
-
'put':
|
|
239
|
-
'brokerage/portfolios/{portfolio_uuid}',
|
|
240
|
-
|
|
241
|
-
'delete':
|
|
242
|
-
'brokerage/portfolios/{portfolio_uuid}',
|
|
243
|
-
'brokerage/cfm/sweeps',
|
|
244
|
-
|
|
206
|
+
'get': {
|
|
207
|
+
'brokerage/accounts': 1,
|
|
208
|
+
'brokerage/accounts/{account_uuid}': 1,
|
|
209
|
+
'brokerage/orders/historical/batch': 1,
|
|
210
|
+
'brokerage/orders/historical/fills': 1,
|
|
211
|
+
'brokerage/orders/historical/{order_id}': 1,
|
|
212
|
+
'brokerage/products': 3,
|
|
213
|
+
'brokerage/products/{product_id}': 3,
|
|
214
|
+
'brokerage/products/{product_id}/candles': 3,
|
|
215
|
+
'brokerage/products/{product_id}/ticker': 3,
|
|
216
|
+
'brokerage/best_bid_ask': 3,
|
|
217
|
+
'brokerage/product_book': 3,
|
|
218
|
+
'brokerage/transaction_summary': 3,
|
|
219
|
+
'brokerage/portfolios': 1,
|
|
220
|
+
'brokerage/portfolios/{portfolio_uuid}': 1,
|
|
221
|
+
'brokerage/convert/trade/{trade_id}': 1,
|
|
222
|
+
'brokerage/cfm/balance_summary': 1,
|
|
223
|
+
'brokerage/cfm/positions': 1,
|
|
224
|
+
'brokerage/cfm/positions/{product_id}': 1,
|
|
225
|
+
'brokerage/cfm/sweeps': 1,
|
|
226
|
+
'brokerage/intx/portfolio/{portfolio_uuid}': 1,
|
|
227
|
+
'brokerage/intx/positions/{portfolio_uuid}': 1,
|
|
228
|
+
'brokerage/intx/positions/{portfolio_uuid}/{symbol}': 1,
|
|
229
|
+
},
|
|
230
|
+
'post': {
|
|
231
|
+
'brokerage/orders': 1,
|
|
232
|
+
'brokerage/orders/batch_cancel': 1,
|
|
233
|
+
'brokerage/orders/edit': 1,
|
|
234
|
+
'brokerage/orders/edit_preview': 1,
|
|
235
|
+
'brokerage/orders/preview': 1,
|
|
236
|
+
'brokerage/portfolios': 1,
|
|
237
|
+
'brokerage/portfolios/move_funds': 1,
|
|
238
|
+
'brokerage/convert/quote': 1,
|
|
239
|
+
'brokerage/convert/trade/{trade_id}': 1,
|
|
240
|
+
'brokerage/cfm/sweeps/schedule': 1,
|
|
241
|
+
'brokerage/intx/allocate': 1,
|
|
242
|
+
},
|
|
243
|
+
'put': {
|
|
244
|
+
'brokerage/portfolios/{portfolio_uuid}': 1,
|
|
245
|
+
},
|
|
246
|
+
'delete': {
|
|
247
|
+
'brokerage/portfolios/{portfolio_uuid}': 1,
|
|
248
|
+
'brokerage/cfm/sweeps': 1,
|
|
249
|
+
},
|
|
245
250
|
},
|
|
246
251
|
},
|
|
247
252
|
},
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -76,7 +76,8 @@ class coinex extends coinex$1 {
|
|
|
76
76
|
'fetchIndexOHLCV': false,
|
|
77
77
|
'fetchIsolatedBorrowRate': true,
|
|
78
78
|
'fetchIsolatedBorrowRates': true,
|
|
79
|
-
'fetchLeverage':
|
|
79
|
+
'fetchLeverage': 'emulated',
|
|
80
|
+
'fetchLeverages': true,
|
|
80
81
|
'fetchLeverageTiers': true,
|
|
81
82
|
'fetchMarketLeverageTiers': 'emulated',
|
|
82
83
|
'fetchMarkets': true,
|
|
@@ -5342,6 +5343,65 @@ class coinex extends coinex$1 {
|
|
|
5342
5343
|
}
|
|
5343
5344
|
return depositWithdrawFees;
|
|
5344
5345
|
}
|
|
5346
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
5347
|
+
/**
|
|
5348
|
+
* @method
|
|
5349
|
+
* @name coinex#fetchLeverages
|
|
5350
|
+
* @description fetch the set leverage for all contract and margin markets
|
|
5351
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
|
5352
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
5353
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5354
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5355
|
+
*/
|
|
5356
|
+
await this.loadMarkets();
|
|
5357
|
+
symbols = this.marketSymbols(symbols);
|
|
5358
|
+
let market = undefined;
|
|
5359
|
+
if (symbols !== undefined) {
|
|
5360
|
+
const symbol = this.safeValue(symbols, 0);
|
|
5361
|
+
market = this.market(symbol);
|
|
5362
|
+
}
|
|
5363
|
+
let marketType = undefined;
|
|
5364
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchLeverages', market, params);
|
|
5365
|
+
if (marketType !== 'spot') {
|
|
5366
|
+
throw new errors.NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
|
|
5367
|
+
}
|
|
5368
|
+
const response = await this.privateGetMarginConfig(params);
|
|
5369
|
+
//
|
|
5370
|
+
// {
|
|
5371
|
+
// "code": 0,
|
|
5372
|
+
// "data": [
|
|
5373
|
+
// {
|
|
5374
|
+
// "market": "BTCUSDT",
|
|
5375
|
+
// "leverage": 10,
|
|
5376
|
+
// "BTC": {
|
|
5377
|
+
// "min_amount": "0.0008",
|
|
5378
|
+
// "max_amount": "200",
|
|
5379
|
+
// "day_rate": "0.0015"
|
|
5380
|
+
// },
|
|
5381
|
+
// "USDT": {
|
|
5382
|
+
// "min_amount": "50",
|
|
5383
|
+
// "max_amount": "500000",
|
|
5384
|
+
// "day_rate": "0.001"
|
|
5385
|
+
// }
|
|
5386
|
+
// },
|
|
5387
|
+
// ],
|
|
5388
|
+
// "message": "Success"
|
|
5389
|
+
// }
|
|
5390
|
+
//
|
|
5391
|
+
const leverages = this.safeList(response, 'data', []);
|
|
5392
|
+
return this.parseLeverages(leverages, symbols, 'market', marketType);
|
|
5393
|
+
}
|
|
5394
|
+
parseLeverage(leverage, market = undefined) {
|
|
5395
|
+
const marketId = this.safeString(leverage, 'market');
|
|
5396
|
+
const leverageValue = this.safeInteger(leverage, 'leverage');
|
|
5397
|
+
return {
|
|
5398
|
+
'info': leverage,
|
|
5399
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'spot'),
|
|
5400
|
+
'marginMode': undefined,
|
|
5401
|
+
'longLeverage': leverageValue,
|
|
5402
|
+
'shortLeverage': leverageValue,
|
|
5403
|
+
};
|
|
5404
|
+
}
|
|
5345
5405
|
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
5346
5406
|
/**
|
|
5347
5407
|
* @ignore
|