ccxt 4.2.88 → 4.2.90
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 +3 -3
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +1062 -241
- package/dist/ccxt.browser.min.js +6 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +3 -0
- package/dist/cjs/src/base/Exchange.js +53 -7
- package/dist/cjs/src/base/functions/crypto.js +37 -0
- package/dist/cjs/src/base/functions/rsa.js +19 -4
- package/dist/cjs/src/binance.js +92 -9
- package/dist/cjs/src/bingx.js +101 -1
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bitflyer.js +2 -0
- package/dist/cjs/src/bitget.js +9 -1
- package/dist/cjs/src/bitmart.js +2 -0
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitstamp.js +83 -99
- package/dist/cjs/src/blofin.js +2 -0
- package/dist/cjs/src/bybit.js +63 -0
- package/dist/cjs/src/coinbase.js +48 -24
- package/dist/cjs/src/coinbaseinternational.js +1 -0
- package/dist/cjs/src/coinex.js +102 -8
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/digifinex.js +3 -0
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +4 -0
- package/dist/cjs/src/gemini.js +10 -9
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/htx.js +3 -0
- package/dist/cjs/src/hyperliquid.js +1 -0
- package/dist/cjs/src/kucoin.js +40 -15
- package/dist/cjs/src/kucoinfutures.js +34 -3
- package/dist/cjs/src/latoken.js +4 -0
- package/dist/cjs/src/lbank.js +3 -1
- package/dist/cjs/src/luno.js +2 -0
- package/dist/cjs/src/mexc.js +55 -6
- package/dist/cjs/src/okx.js +159 -8
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/pro/bitget.js +2 -0
- package/dist/cjs/src/static_dependencies/noble-curves/p256.js +48 -0
- package/dist/cjs/src/timex.js +2 -0
- package/dist/cjs/src/woo.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/ascendex.js +3 -0
- package/js/src/base/Exchange.d.ts +13 -8
- package/js/src/base/Exchange.js +53 -7
- package/js/src/base/functions/crypto.js +37 -0
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/base/functions/rsa.js +21 -5
- package/js/src/base/types.d.ts +35 -1
- package/js/src/bigone.d.ts +2 -2
- package/js/src/binance.d.ts +6 -15
- package/js/src/binance.js +92 -9
- package/js/src/bingx.d.ts +3 -2
- package/js/src/bingx.js +101 -1
- package/js/src/bit2c.d.ts +2 -2
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitfinex.d.ts +2 -2
- package/js/src/bitfinex2.d.ts +3 -3
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bitflyer.d.ts +2 -7
- package/js/src/bitflyer.js +2 -0
- package/js/src/bitget.d.ts +6 -9
- package/js/src/bitget.js +9 -1
- package/js/src/bitmart.d.ts +4 -14
- package/js/src/bitmart.js +2 -0
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +1 -0
- package/js/src/bitopro.d.ts +3 -3
- package/js/src/bitrue.d.ts +2 -2
- package/js/src/bitrue.js +1 -0
- package/js/src/bitso.d.ts +2 -2
- package/js/src/bitstamp.d.ts +7 -19
- package/js/src/bitstamp.js +83 -99
- package/js/src/bitteam.d.ts +2 -2
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/bl3p.d.ts +2 -2
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +2 -7
- package/js/src/blofin.js +2 -0
- package/js/src/bybit.d.ts +7 -15
- package/js/src/bybit.js +63 -0
- package/js/src/cex.d.ts +3 -3
- package/js/src/coinbase.d.ts +2 -2
- package/js/src/coinbase.js +48 -24
- package/js/src/coinbaseinternational.d.ts +2 -2
- package/js/src/coinbaseinternational.js +1 -0
- package/js/src/coinbasepro.d.ts +3 -3
- package/js/src/coincheck.d.ts +2 -2
- package/js/src/coinex.d.ts +7 -19
- package/js/src/coinex.js +102 -8
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +2 -9
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +4 -14
- package/js/src/coinsph.js +2 -0
- package/js/src/cryptocom.js +1 -0
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/delta.d.ts +2 -2
- package/js/src/delta.js +1 -0
- package/js/src/deribit.d.ts +3 -3
- package/js/src/digifinex.d.ts +4 -14
- package/js/src/digifinex.js +3 -0
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +1 -0
- package/js/src/gate.d.ts +6 -9
- package/js/src/gate.js +4 -0
- package/js/src/gemini.d.ts +3 -3
- package/js/src/gemini.js +10 -9
- package/js/src/hitbtc.d.ts +5 -15
- package/js/src/hitbtc.js +3 -0
- package/js/src/hollaex.d.ts +3 -3
- package/js/src/htx.d.ts +4 -14
- package/js/src/htx.js +3 -0
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.d.ts +2 -2
- package/js/src/hyperliquid.js +1 -0
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/kraken.d.ts +3 -10
- package/js/src/kucoin.d.ts +3 -10
- package/js/src/kucoin.js +40 -15
- package/js/src/kucoinfutures.d.ts +2 -9
- package/js/src/kucoinfutures.js +34 -3
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +7 -8
- package/js/src/latoken.js +4 -0
- package/js/src/lbank.d.ts +4 -9
- package/js/src/lbank.js +3 -1
- package/js/src/luno.d.ts +2 -7
- package/js/src/luno.js +2 -0
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mexc.d.ts +3 -3
- package/js/src/mexc.js +55 -6
- package/js/src/ndax.d.ts +2 -2
- package/js/src/oceanex.d.ts +2 -2
- package/js/src/okcoin.d.ts +2 -2
- package/js/src/okx.d.ts +5 -14
- package/js/src/okx.js +159 -8
- package/js/src/onetrading.d.ts +3 -3
- package/js/src/phemex.d.ts +2 -2
- package/js/src/phemex.js +1 -0
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/pro/bitget.js +2 -0
- package/js/src/pro/bitvavo.d.ts +2 -2
- package/js/src/probit.d.ts +2 -2
- package/js/src/timex.d.ts +4 -14
- package/js/src/timex.js +2 -0
- package/js/src/upbit.d.ts +2 -9
- package/js/src/wazirx.d.ts +2 -2
- package/js/src/whitebit.d.ts +3 -3
- package/js/src/woo.d.ts +3 -3
- package/js/src/woo.js +1 -0
- package/js/src/yobit.d.ts +2 -2
- package/package.json +1 -1
- package/skip-tests.json +6 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.2.
|
|
185
|
+
const version = '4.2.90';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
package/dist/cjs/src/ascendex.js
CHANGED
|
@@ -1483,6 +1483,8 @@ class ascendex extends ascendex$1 {
|
|
|
1483
1483
|
'symbol': symbol,
|
|
1484
1484
|
'maker': this.safeNumber(takerMaker, 'maker'),
|
|
1485
1485
|
'taker': this.safeNumber(takerMaker, 'taker'),
|
|
1486
|
+
'percentage': undefined,
|
|
1487
|
+
'tierBased': undefined,
|
|
1486
1488
|
};
|
|
1487
1489
|
}
|
|
1488
1490
|
return result;
|
|
@@ -2886,6 +2888,7 @@ class ascendex extends ascendex$1 {
|
|
|
2886
2888
|
'info': data,
|
|
2887
2889
|
'symbol': market['symbol'],
|
|
2888
2890
|
'type': undefined,
|
|
2891
|
+
'marginMode': 'isolated',
|
|
2889
2892
|
'amount': undefined,
|
|
2890
2893
|
'total': undefined,
|
|
2891
2894
|
'code': market['quote'],
|
|
@@ -21,6 +21,7 @@ require('../static_dependencies/noble-hashes/sha3.js');
|
|
|
21
21
|
require('../static_dependencies/noble-hashes/sha256.js');
|
|
22
22
|
require('../static_dependencies/ethers/address/address.js');
|
|
23
23
|
var typedData = require('../static_dependencies/ethers/hash/typed-data.js');
|
|
24
|
+
var rng = require('../static_dependencies/jsencrypt/lib/jsbn/rng.js');
|
|
24
25
|
var generic = require('./functions/generic.js');
|
|
25
26
|
var misc = require('./functions/misc.js');
|
|
26
27
|
|
|
@@ -109,7 +110,7 @@ class Exchange {
|
|
|
109
110
|
this.markets_by_id = undefined;
|
|
110
111
|
this.symbols = undefined;
|
|
111
112
|
this.ids = undefined;
|
|
112
|
-
this.currencies =
|
|
113
|
+
this.currencies = {};
|
|
113
114
|
this.baseCurrencies = undefined;
|
|
114
115
|
this.quoteCurrencies = undefined;
|
|
115
116
|
this.currencies_by_id = undefined;
|
|
@@ -441,6 +442,7 @@ class Exchange {
|
|
|
441
442
|
'fetchIndexOHLCV': undefined,
|
|
442
443
|
'fetchIsolatedBorrowRate': undefined,
|
|
443
444
|
'fetchIsolatedBorrowRates': undefined,
|
|
445
|
+
'fetchMarginAdjustmentHistory': undefined,
|
|
444
446
|
'fetchIsolatedPositions': undefined,
|
|
445
447
|
'fetchL2OrderBook': true,
|
|
446
448
|
'fetchL3OrderBook': undefined,
|
|
@@ -1445,6 +1447,13 @@ class Exchange {
|
|
|
1445
1447
|
createSafeDictionary() {
|
|
1446
1448
|
return {};
|
|
1447
1449
|
}
|
|
1450
|
+
randomBytes(length) {
|
|
1451
|
+
const rng$1 = new rng.SecureRandom();
|
|
1452
|
+
const x = [];
|
|
1453
|
+
x.length = length;
|
|
1454
|
+
rng$1.nextBytes(x);
|
|
1455
|
+
return Buffer.from(x).toString('hex');
|
|
1456
|
+
}
|
|
1448
1457
|
/* eslint-enable */
|
|
1449
1458
|
// ------------------------------------------------------------------------
|
|
1450
1459
|
// ########################################################################
|
|
@@ -2051,6 +2060,20 @@ class Exchange {
|
|
|
2051
2060
|
async setMargin(symbol, amount, params = {}) {
|
|
2052
2061
|
throw new errors.NotSupported(this.id + ' setMargin() is not supported yet');
|
|
2053
2062
|
}
|
|
2063
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2064
|
+
/**
|
|
2065
|
+
* @method
|
|
2066
|
+
* @name exchange#fetchMarginAdjustmentHistory
|
|
2067
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
2068
|
+
* @param {string} [symbol] unified market symbol
|
|
2069
|
+
* @param {string} [type] "add" or "reduce"
|
|
2070
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
2071
|
+
* @param {int} [limit] the maximum amount of changes to fetch
|
|
2072
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
2073
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
2074
|
+
*/
|
|
2075
|
+
throw new errors.NotSupported(this.id + ' fetchMarginAdjustmentHistory() is not supported yet');
|
|
2076
|
+
}
|
|
2054
2077
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
2055
2078
|
throw new errors.NotSupported(this.id + ' setMarginMode() is not supported yet');
|
|
2056
2079
|
}
|
|
@@ -3788,11 +3811,11 @@ class Exchange {
|
|
|
3788
3811
|
if (currencyId !== undefined) {
|
|
3789
3812
|
code = this.commonCurrencyCode(currencyId.toUpperCase());
|
|
3790
3813
|
}
|
|
3791
|
-
return {
|
|
3814
|
+
return this.safeCurrencyStructure({
|
|
3792
3815
|
'id': currencyId,
|
|
3793
3816
|
'code': code,
|
|
3794
3817
|
'precision': undefined,
|
|
3795
|
-
};
|
|
3818
|
+
});
|
|
3796
3819
|
}
|
|
3797
3820
|
safeMarket(marketId, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
3798
3821
|
const result = this.safeMarketStructure({
|
|
@@ -4561,11 +4584,18 @@ class Exchange {
|
|
|
4561
4584
|
'total': undefined,
|
|
4562
4585
|
};
|
|
4563
4586
|
}
|
|
4564
|
-
commonCurrencyCode(
|
|
4587
|
+
commonCurrencyCode(code) {
|
|
4565
4588
|
if (!this.substituteCommonCurrencyCodes) {
|
|
4566
|
-
return
|
|
4589
|
+
return code;
|
|
4590
|
+
}
|
|
4591
|
+
// if the provided code already exists as a value in commonCurrencies dict, then we should not again transform it
|
|
4592
|
+
// more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
|
|
4593
|
+
const commonCurrencies = Object.values(this.commonCurrencies);
|
|
4594
|
+
const exists = this.inArray(code, commonCurrencies);
|
|
4595
|
+
if (exists) {
|
|
4596
|
+
return code;
|
|
4567
4597
|
}
|
|
4568
|
-
return this.safeString(this.commonCurrencies,
|
|
4598
|
+
return this.safeString(this.commonCurrencies, code, code);
|
|
4569
4599
|
}
|
|
4570
4600
|
currency(code) {
|
|
4571
4601
|
if (this.currencies === undefined) {
|
|
@@ -5028,7 +5058,8 @@ class Exchange {
|
|
|
5028
5058
|
if (!this.has['fetchTradingFees']) {
|
|
5029
5059
|
throw new errors.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
|
|
5030
5060
|
}
|
|
5031
|
-
|
|
5061
|
+
const fees = await this.fetchTradingFees(params);
|
|
5062
|
+
return this.safeDict(fees, symbol);
|
|
5032
5063
|
}
|
|
5033
5064
|
parseOpenInterest(interest, market = undefined) {
|
|
5034
5065
|
throw new errors.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
|
|
@@ -5806,6 +5837,21 @@ class Exchange {
|
|
|
5806
5837
|
const reconstructedDate = day + month + year;
|
|
5807
5838
|
return reconstructedDate;
|
|
5808
5839
|
}
|
|
5840
|
+
parseMarginModification(data, market = undefined) {
|
|
5841
|
+
throw new errors.NotSupported(this.id + ' parseMarginModification() is not supported yet');
|
|
5842
|
+
}
|
|
5843
|
+
parseMarginModifications(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
5844
|
+
const marginModifications = [];
|
|
5845
|
+
for (let i = 0; i < response.length; i++) {
|
|
5846
|
+
const info = response[i];
|
|
5847
|
+
const marketId = this.safeString(info, symbolKey);
|
|
5848
|
+
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
5849
|
+
if ((symbols === undefined) || this.inArray(market['symbol'], symbols)) {
|
|
5850
|
+
marginModifications.push(this.parseMarginModification(info, market));
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
return marginModifications;
|
|
5854
|
+
}
|
|
5809
5855
|
}
|
|
5810
5856
|
|
|
5811
5857
|
exports.Exchange = Exchange;
|
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var hmac$1 = require('../../static_dependencies/noble-hashes/hmac.js');
|
|
6
6
|
var index = require('../../static_dependencies/scure-base/index.js');
|
|
7
7
|
var base64 = require('../../static_dependencies/jsencrypt/lib/asn1js/base64.js');
|
|
8
|
+
var asn1 = require('../../static_dependencies/jsencrypt/lib/asn1js/asn1.js');
|
|
9
|
+
var secp256k1 = require('../../static_dependencies/noble-curves/secp256k1.js');
|
|
10
|
+
var p256 = require('../../static_dependencies/noble-curves/p256.js');
|
|
8
11
|
|
|
9
12
|
/* ------------------------------------------------------------------------ */
|
|
10
13
|
/* ------------------------------------------------------------------------ */
|
|
@@ -13,6 +16,10 @@ const encoders = {
|
|
|
13
16
|
hex: index.base16.encode,
|
|
14
17
|
base64: index.base64.encode,
|
|
15
18
|
};
|
|
19
|
+
const supportedCurve = {
|
|
20
|
+
'1.3.132.0.10': secp256k1.secp256k1,
|
|
21
|
+
'1.2.840.10045.3.1.7': p256.P256,
|
|
22
|
+
};
|
|
16
23
|
/* ............................................. */
|
|
17
24
|
const hash = (request, hash, digest = 'hex') => {
|
|
18
25
|
const binary = hash(request);
|
|
@@ -28,6 +35,36 @@ function ecdsa(request, secret, curve, prehash = null) {
|
|
|
28
35
|
if (prehash) {
|
|
29
36
|
request = hash(request, prehash, 'hex');
|
|
30
37
|
}
|
|
38
|
+
if (typeof secret === 'string' && secret.length > 64) {
|
|
39
|
+
// decode pem key
|
|
40
|
+
if (secret.startsWith('-----BEGIN EC PRIVATE KEY-----')) {
|
|
41
|
+
const der = base64.Base64.unarmor(secret);
|
|
42
|
+
let asn1$1 = asn1.ASN1.decode(der);
|
|
43
|
+
if (asn1$1.sub.length === 4) {
|
|
44
|
+
// ECPrivateKey ::= SEQUENCE {
|
|
45
|
+
// version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
|
|
46
|
+
// privateKey OCTET STRING,
|
|
47
|
+
// parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
|
|
48
|
+
// publicKey [1] BIT STRING OPTIONAL
|
|
49
|
+
// }
|
|
50
|
+
if (typeof asn1$1.sub[2].sub !== null && asn1$1.sub[2].sub.length > 0) {
|
|
51
|
+
const oid = asn1$1.sub[2].sub[0].content(undefined);
|
|
52
|
+
if (supportedCurve[oid] === undefined)
|
|
53
|
+
throw new Error('Unsupported curve');
|
|
54
|
+
curve = supportedCurve[oid];
|
|
55
|
+
}
|
|
56
|
+
secret = asn1$1.sub[1].getHexStringValue();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// maybe return false
|
|
60
|
+
throw new Error('Unsupported key format');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// maybe return false
|
|
65
|
+
throw new Error('Unsupported key format');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
31
68
|
const signature = curve.sign(request, secret);
|
|
32
69
|
return {
|
|
33
70
|
'r': signature.r.toString(16),
|
|
@@ -6,6 +6,7 @@ var JSEncrypt = require('../../static_dependencies/jsencrypt/JSEncrypt.js');
|
|
|
6
6
|
var index = require('../../static_dependencies/scure-base/index.js');
|
|
7
7
|
var encode = require('./encode.js');
|
|
8
8
|
var crypto = require('./crypto.js');
|
|
9
|
+
var p256 = require('../../static_dependencies/noble-curves/p256.js');
|
|
9
10
|
|
|
10
11
|
function rsa(request, secret, hash) {
|
|
11
12
|
const RSA = new JSEncrypt.JSEncrypt();
|
|
@@ -14,9 +15,17 @@ function rsa(request, secret, hash) {
|
|
|
14
15
|
const name = (hash.create()).constructor.name.toLowerCase();
|
|
15
16
|
return RSA.sign(request, digester, name);
|
|
16
17
|
}
|
|
17
|
-
function jwt(request, secret, hash, isRSA = false) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function jwt(request, secret, hash, isRSA = false, opts = {}) {
|
|
19
|
+
let alg = (isRSA ? 'RS' : 'HS') + (hash.outputLen * 8);
|
|
20
|
+
if (opts['alg']) {
|
|
21
|
+
alg = opts['alg'].toUpperCase();
|
|
22
|
+
}
|
|
23
|
+
const header = Object.assign({ 'alg': alg, 'typ': 'JWT' }, opts);
|
|
24
|
+
if (header['iat'] !== undefined) {
|
|
25
|
+
request['iat'] = header['iat'];
|
|
26
|
+
delete header['iat'];
|
|
27
|
+
}
|
|
28
|
+
const encodedHeader = encode.urlencodeBase64(encode.stringToBase64(JSON.stringify(header)));
|
|
20
29
|
const encodedData = encode.urlencodeBase64(encode.stringToBase64(JSON.stringify(request)));
|
|
21
30
|
const token = [encodedHeader, encodedData].join('.');
|
|
22
31
|
const algoType = alg.slice(0, 2);
|
|
@@ -24,9 +33,15 @@ function jwt(request, secret, hash, isRSA = false) {
|
|
|
24
33
|
if (algoType === 'HS') {
|
|
25
34
|
signature = encode.urlencodeBase64(crypto.hmac(token, secret, hash, 'base64'));
|
|
26
35
|
}
|
|
27
|
-
else if (algoType === 'RS') {
|
|
36
|
+
else if (isRSA || algoType === 'RS') {
|
|
28
37
|
signature = encode.urlencodeBase64(rsa(token, index.utf8.encode(secret), hash));
|
|
29
38
|
}
|
|
39
|
+
else if (algoType === 'ES') {
|
|
40
|
+
const signedHash = crypto.ecdsa(token, index.utf8.encode(secret), p256.P256, hash);
|
|
41
|
+
const r = (signedHash.r.length === 64) ? signedHash.r : '0' + signedHash.r;
|
|
42
|
+
const s = (signedHash.s.length === 64) ? signedHash.s : '0' + signedHash.s;
|
|
43
|
+
signature = encode.urlencodeBase64(encode.binaryToBase64(encode.base16ToBinary(r + s)));
|
|
44
|
+
}
|
|
30
45
|
return [token, signature].join('.');
|
|
31
46
|
}
|
|
32
47
|
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -98,6 +98,7 @@ class binance extends binance$1 {
|
|
|
98
98
|
'fetchLeverages': true,
|
|
99
99
|
'fetchLeverageTiers': true,
|
|
100
100
|
'fetchLiquidations': false,
|
|
101
|
+
'fetchMarginAdjustmentHistory': true,
|
|
101
102
|
'fetchMarginMode': 'emulated',
|
|
102
103
|
'fetchMarginModes': true,
|
|
103
104
|
'fetchMarketLeverageTiers': 'emulated',
|
|
@@ -8653,6 +8654,8 @@ class binance extends binance$1 {
|
|
|
8653
8654
|
'symbol': symbol,
|
|
8654
8655
|
'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
|
|
8655
8656
|
'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
|
|
8657
|
+
'percentage': undefined,
|
|
8658
|
+
'tierBased': undefined,
|
|
8656
8659
|
};
|
|
8657
8660
|
}
|
|
8658
8661
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -11226,21 +11229,37 @@ class binance extends binance$1 {
|
|
|
11226
11229
|
// "type": 1
|
|
11227
11230
|
// }
|
|
11228
11231
|
//
|
|
11232
|
+
// fetchMarginAdjustmentHistory
|
|
11233
|
+
//
|
|
11234
|
+
// {
|
|
11235
|
+
// symbol: "XRPUSDT",
|
|
11236
|
+
// type: "1",
|
|
11237
|
+
// deltaType: "TRADE",
|
|
11238
|
+
// amount: "2.57148240",
|
|
11239
|
+
// asset: "USDT",
|
|
11240
|
+
// time: "1711046271555",
|
|
11241
|
+
// positionSide: "BOTH",
|
|
11242
|
+
// clientTranId: ""
|
|
11243
|
+
// }
|
|
11244
|
+
//
|
|
11229
11245
|
const rawType = this.safeInteger(data, 'type');
|
|
11230
|
-
const resultType = (rawType === 1) ? 'add' : 'reduce';
|
|
11231
|
-
const resultAmount = this.safeNumber(data, 'amount');
|
|
11232
11246
|
const errorCode = this.safeString(data, 'code');
|
|
11233
|
-
const
|
|
11247
|
+
const marketId = this.safeString(data, 'symbol');
|
|
11248
|
+
const timestamp = this.safeInteger(data, 'time');
|
|
11249
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
11250
|
+
const noErrorCode = errorCode === undefined;
|
|
11251
|
+
const success = errorCode === '200';
|
|
11234
11252
|
return {
|
|
11235
11253
|
'info': data,
|
|
11236
11254
|
'symbol': market['symbol'],
|
|
11237
|
-
'type':
|
|
11238
|
-
'
|
|
11255
|
+
'type': (rawType === 1) ? 'add' : 'reduce',
|
|
11256
|
+
'marginMode': 'isolated',
|
|
11257
|
+
'amount': this.safeNumber(data, 'amount'),
|
|
11258
|
+
'code': this.safeString(data, 'asset'),
|
|
11239
11259
|
'total': undefined,
|
|
11240
|
-
'
|
|
11241
|
-
'
|
|
11242
|
-
'
|
|
11243
|
-
'datetime': undefined,
|
|
11260
|
+
'status': (success || noErrorCode) ? 'ok' : 'failed',
|
|
11261
|
+
'timestamp': timestamp,
|
|
11262
|
+
'datetime': this.iso8601(timestamp),
|
|
11244
11263
|
};
|
|
11245
11264
|
}
|
|
11246
11265
|
async reduceMargin(symbol, amount, params = {}) {
|
|
@@ -12503,6 +12522,70 @@ class binance extends binance$1 {
|
|
|
12503
12522
|
'quoteVolume': undefined,
|
|
12504
12523
|
};
|
|
12505
12524
|
}
|
|
12525
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
12526
|
+
/**
|
|
12527
|
+
* @method
|
|
12528
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
12529
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#get-position-margin-change-history-trade
|
|
12530
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#get-position-margin-change-history-trade
|
|
12531
|
+
* @param {string} symbol unified market symbol
|
|
12532
|
+
* @param {string} [type] "add" or "reduce"
|
|
12533
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
12534
|
+
* @param {int} [limit] the maximum amount of changes to fetch
|
|
12535
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
12536
|
+
* @param {int} [params.until] timestamp in ms of the latest change to fetch
|
|
12537
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
12538
|
+
*/
|
|
12539
|
+
await this.loadMarkets();
|
|
12540
|
+
if (symbol === undefined) {
|
|
12541
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory () requires a symbol argument');
|
|
12542
|
+
}
|
|
12543
|
+
const market = this.market(symbol);
|
|
12544
|
+
const until = this.safeInteger(params, 'until');
|
|
12545
|
+
params = this.omit(params, 'until');
|
|
12546
|
+
const request = {
|
|
12547
|
+
'symbol': market['id'],
|
|
12548
|
+
};
|
|
12549
|
+
if (type !== undefined) {
|
|
12550
|
+
request['type'] = (type === 'add') ? 1 : 2;
|
|
12551
|
+
}
|
|
12552
|
+
if (since !== undefined) {
|
|
12553
|
+
request['startTime'] = since;
|
|
12554
|
+
}
|
|
12555
|
+
if (limit !== undefined) {
|
|
12556
|
+
request['limit'] = limit;
|
|
12557
|
+
}
|
|
12558
|
+
if (until !== undefined) {
|
|
12559
|
+
request['endTime'] = until;
|
|
12560
|
+
}
|
|
12561
|
+
let response = undefined;
|
|
12562
|
+
if (market['linear']) {
|
|
12563
|
+
response = await this.fapiPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
12564
|
+
}
|
|
12565
|
+
else if (market['inverse']) {
|
|
12566
|
+
response = await this.dapiPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
12567
|
+
}
|
|
12568
|
+
else {
|
|
12569
|
+
throw new errors.BadRequest(this.id + 'fetchMarginAdjustmentHistory () is not supported for markets of type ' + market['type']);
|
|
12570
|
+
}
|
|
12571
|
+
//
|
|
12572
|
+
// [
|
|
12573
|
+
// {
|
|
12574
|
+
// symbol: "XRPUSDT",
|
|
12575
|
+
// type: "1",
|
|
12576
|
+
// deltaType: "TRADE",
|
|
12577
|
+
// amount: "2.57148240",
|
|
12578
|
+
// asset: "USDT",
|
|
12579
|
+
// time: "1711046271555",
|
|
12580
|
+
// positionSide: "BOTH",
|
|
12581
|
+
// clientTranId: ""
|
|
12582
|
+
// }
|
|
12583
|
+
// ...
|
|
12584
|
+
// ]
|
|
12585
|
+
//
|
|
12586
|
+
const modifications = this.parseMarginModifications(response);
|
|
12587
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
12588
|
+
}
|
|
12506
12589
|
}
|
|
12507
12590
|
|
|
12508
12591
|
module.exports = binance;
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -60,6 +60,7 @@ class bingx extends bingx$1 {
|
|
|
60
60
|
'fetchFundingRates': true,
|
|
61
61
|
'fetchLeverage': true,
|
|
62
62
|
'fetchLiquidations': false,
|
|
63
|
+
'fetchMarginAdjustmentHistory': false,
|
|
63
64
|
'fetchMarginMode': true,
|
|
64
65
|
'fetchMarkets': true,
|
|
65
66
|
'fetchMarkOHLCV': true,
|
|
@@ -69,6 +70,7 @@ class bingx extends bingx$1 {
|
|
|
69
70
|
'fetchOpenOrders': true,
|
|
70
71
|
'fetchOrder': true,
|
|
71
72
|
'fetchOrderBook': true,
|
|
73
|
+
'fetchOrders': true,
|
|
72
74
|
'fetchPositionMode': true,
|
|
73
75
|
'fetchPositions': true,
|
|
74
76
|
'fetchTicker': true,
|
|
@@ -180,6 +182,7 @@ class bingx extends bingx$1 {
|
|
|
180
182
|
'positionSide/dual': 1,
|
|
181
183
|
'market/markPriceKlines': 1,
|
|
182
184
|
'trade/batchCancelReplace': 1,
|
|
185
|
+
'trade/fullOrder': 1,
|
|
183
186
|
},
|
|
184
187
|
'post': {
|
|
185
188
|
'trade/cancelReplace': 1,
|
|
@@ -327,6 +330,7 @@ class bingx extends bingx$1 {
|
|
|
327
330
|
'post': {
|
|
328
331
|
'swap/trace/closeTrackOrder': 1,
|
|
329
332
|
'swap/trace/setTPSL': 1,
|
|
333
|
+
'spot/trader/sellOrder': 1,
|
|
330
334
|
},
|
|
331
335
|
},
|
|
332
336
|
},
|
|
@@ -2757,7 +2761,7 @@ class bingx extends bingx$1 {
|
|
|
2757
2761
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2758
2762
|
*/
|
|
2759
2763
|
if (symbol === undefined) {
|
|
2760
|
-
throw new errors.ArgumentsRequired(this.id + '
|
|
2764
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
2761
2765
|
}
|
|
2762
2766
|
await this.loadMarkets();
|
|
2763
2767
|
const market = this.market(symbol);
|
|
@@ -2828,6 +2832,101 @@ class bingx extends bingx$1 {
|
|
|
2828
2832
|
const first = this.safeDict(data, 'order', data);
|
|
2829
2833
|
return this.parseOrder(first, market);
|
|
2830
2834
|
}
|
|
2835
|
+
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2836
|
+
/**
|
|
2837
|
+
* @method
|
|
2838
|
+
* @name bingx#fetchOrders
|
|
2839
|
+
* @description fetches information on multiple orders made by the user
|
|
2840
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#User's%20All%20Orders
|
|
2841
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
2842
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
2843
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
2844
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2845
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
2846
|
+
* @param {int} [params.orderId] Only return subsequent orders, and return the latest order by default
|
|
2847
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2848
|
+
*/
|
|
2849
|
+
await this.loadMarkets();
|
|
2850
|
+
const request = {};
|
|
2851
|
+
let market = undefined;
|
|
2852
|
+
if (symbol !== undefined) {
|
|
2853
|
+
market = this.market(symbol);
|
|
2854
|
+
request['symbol'] = market['id'];
|
|
2855
|
+
}
|
|
2856
|
+
let type = undefined;
|
|
2857
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrders', market, params);
|
|
2858
|
+
if (type !== 'swap') {
|
|
2859
|
+
throw new errors.NotSupported(this.id + ' fetchOrders() is only supported for swap markets');
|
|
2860
|
+
}
|
|
2861
|
+
if (limit !== undefined) {
|
|
2862
|
+
request['limit'] = limit;
|
|
2863
|
+
}
|
|
2864
|
+
if (since !== undefined) {
|
|
2865
|
+
request['startTime'] = since;
|
|
2866
|
+
}
|
|
2867
|
+
const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
|
|
2868
|
+
const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
|
|
2869
|
+
params = this.omit(params, ['endTime', 'till', 'until']);
|
|
2870
|
+
if (endTime !== undefined) {
|
|
2871
|
+
request['endTime'] = endTime;
|
|
2872
|
+
}
|
|
2873
|
+
const response = await this.swapV1PrivateGetTradeFullOrder(this.extend(request, params));
|
|
2874
|
+
//
|
|
2875
|
+
// {
|
|
2876
|
+
// "code": 0,
|
|
2877
|
+
// "msg": "",
|
|
2878
|
+
// "data": {
|
|
2879
|
+
// "orders": [
|
|
2880
|
+
// {
|
|
2881
|
+
// "symbol": "PYTH-USDT",
|
|
2882
|
+
// "orderId": 1736007506620112100,
|
|
2883
|
+
// "side": "SELL",
|
|
2884
|
+
// "positionSide": "SHORT",
|
|
2885
|
+
// "type": "LIMIT",
|
|
2886
|
+
// "origQty": "33",
|
|
2887
|
+
// "price": "0.3916",
|
|
2888
|
+
// "executedQty": "33",
|
|
2889
|
+
// "avgPrice": "0.3916",
|
|
2890
|
+
// "cumQuote": "13",
|
|
2891
|
+
// "stopPrice": "",
|
|
2892
|
+
// "profit": "0.0000",
|
|
2893
|
+
// "commission": "-0.002585",
|
|
2894
|
+
// "status": "FILLED",
|
|
2895
|
+
// "time": 1702731418000,
|
|
2896
|
+
// "updateTime": 1702731470000,
|
|
2897
|
+
// "clientOrderId": "",
|
|
2898
|
+
// "leverage": "15X",
|
|
2899
|
+
// "takeProfit": {
|
|
2900
|
+
// "type": "TAKE_PROFIT",
|
|
2901
|
+
// "quantity": 0,
|
|
2902
|
+
// "stopPrice": 0,
|
|
2903
|
+
// "price": 0,
|
|
2904
|
+
// "workingType": ""
|
|
2905
|
+
// },
|
|
2906
|
+
// "stopLoss": {
|
|
2907
|
+
// "type": "STOP",
|
|
2908
|
+
// "quantity": 0,
|
|
2909
|
+
// "stopPrice": 0,
|
|
2910
|
+
// "price": 0,
|
|
2911
|
+
// "workingType": ""
|
|
2912
|
+
// },
|
|
2913
|
+
// "advanceAttr": 0,
|
|
2914
|
+
// "positionID": 0,
|
|
2915
|
+
// "takeProfitEntrustPrice": 0,
|
|
2916
|
+
// "stopLossEntrustPrice": 0,
|
|
2917
|
+
// "orderType": "",
|
|
2918
|
+
// "workingType": "MARK_PRICE",
|
|
2919
|
+
// "stopGuaranteed": false,
|
|
2920
|
+
// "triggerOrderId": 1736012449498123500
|
|
2921
|
+
// }
|
|
2922
|
+
// ]
|
|
2923
|
+
// }
|
|
2924
|
+
// }
|
|
2925
|
+
//
|
|
2926
|
+
const data = this.safeDict(response, 'data', {});
|
|
2927
|
+
const orders = this.safeList(data, 'orders', []);
|
|
2928
|
+
return this.parseOrders(orders, market, since, limit);
|
|
2929
|
+
}
|
|
2831
2930
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2832
2931
|
/**
|
|
2833
2932
|
* @method
|
|
@@ -3528,6 +3627,7 @@ class bingx extends bingx$1 {
|
|
|
3528
3627
|
'info': data,
|
|
3529
3628
|
'symbol': this.safeString(market, 'symbol'),
|
|
3530
3629
|
'type': (type === '1') ? 'add' : 'reduce',
|
|
3630
|
+
'marginMode': 'isolated',
|
|
3531
3631
|
'amount': this.safeNumber(data, 'amount'),
|
|
3532
3632
|
'total': this.safeNumber(data, 'margin'),
|
|
3533
3633
|
'code': this.safeString(market, 'settle'),
|
package/dist/cjs/src/bitflyer.js
CHANGED
|
@@ -540,6 +540,8 @@ class bitflyer extends bitflyer$1 {
|
|
|
540
540
|
'symbol': market['symbol'],
|
|
541
541
|
'maker': fee,
|
|
542
542
|
'taker': fee,
|
|
543
|
+
'percentage': undefined,
|
|
544
|
+
'tierBased': undefined,
|
|
543
545
|
};
|
|
544
546
|
}
|
|
545
547
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -84,6 +84,7 @@ class bitget extends bitget$1 {
|
|
|
84
84
|
'fetchLeverage': true,
|
|
85
85
|
'fetchLeverageTiers': false,
|
|
86
86
|
'fetchLiquidations': false,
|
|
87
|
+
'fetchMarginAdjustmentHistory': false,
|
|
87
88
|
'fetchMarginMode': true,
|
|
88
89
|
'fetchMarketLeverageTiers': true,
|
|
89
90
|
'fetchMarkets': true,
|
|
@@ -2624,7 +2625,11 @@ class bitget extends bitget$1 {
|
|
|
2624
2625
|
//
|
|
2625
2626
|
const marketId = this.safeString(ticker, 'symbol');
|
|
2626
2627
|
const close = this.safeString(ticker, 'lastPr');
|
|
2627
|
-
const
|
|
2628
|
+
const timestampString = this.omitZero(this.safeString(ticker, 'ts')); // exchange sometimes provided 0
|
|
2629
|
+
let timestamp = undefined;
|
|
2630
|
+
if (timestampString !== undefined) {
|
|
2631
|
+
timestamp = this.parseToInt(timestampString);
|
|
2632
|
+
}
|
|
2628
2633
|
const change = this.safeString(ticker, 'change24h');
|
|
2629
2634
|
const open24 = this.safeString(ticker, 'open24');
|
|
2630
2635
|
const open = this.safeString(ticker, 'open');
|
|
@@ -3277,6 +3282,8 @@ class bitget extends bitget$1 {
|
|
|
3277
3282
|
'symbol': this.safeSymbol(marketId, market),
|
|
3278
3283
|
'maker': this.safeNumber(data, 'makerFeeRate'),
|
|
3279
3284
|
'taker': this.safeNumber(data, 'takerFeeRate'),
|
|
3285
|
+
'percentage': undefined,
|
|
3286
|
+
'tierBased': undefined,
|
|
3280
3287
|
};
|
|
3281
3288
|
}
|
|
3282
3289
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -6978,6 +6985,7 @@ class bitget extends bitget$1 {
|
|
|
6978
6985
|
'info': data,
|
|
6979
6986
|
'symbol': market['symbol'],
|
|
6980
6987
|
'type': undefined,
|
|
6988
|
+
'marginMode': 'isolated',
|
|
6981
6989
|
'amount': undefined,
|
|
6982
6990
|
'total': undefined,
|
|
6983
6991
|
'code': market['settle'],
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2095,6 +2095,8 @@ class bitmart extends bitmart$1 {
|
|
|
2095
2095
|
'symbol': symbol,
|
|
2096
2096
|
'maker': this.safeNumber(fee, 'maker_fee_rate'),
|
|
2097
2097
|
'taker': this.safeNumber(fee, 'taker_fee_rate'),
|
|
2098
|
+
'percentage': undefined,
|
|
2099
|
+
'tierBased': undefined,
|
|
2098
2100
|
};
|
|
2099
2101
|
}
|
|
2100
2102
|
async fetchTradingFee(symbol, params = {}) {
|
package/dist/cjs/src/bitmex.js
CHANGED
package/dist/cjs/src/bitrue.js
CHANGED