ccxt 4.3.55 → 4.3.57
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 -5
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +26 -2
- package/dist/cjs/src/base/ws/Client.js +34 -4
- package/dist/cjs/src/binance.js +7 -7
- package/dist/cjs/src/bingx.js +83 -9
- package/dist/cjs/src/bitflyer.js +7 -1
- package/dist/cjs/src/bitget.js +56 -47
- package/dist/cjs/src/bitopro.js +20 -3
- package/dist/cjs/src/btcmarkets.js +26 -27
- package/dist/cjs/src/bybit.js +9 -5
- package/dist/cjs/src/coinone.js +13 -19
- package/dist/cjs/src/delta.js +5 -1
- package/dist/cjs/src/gate.js +109 -1
- package/dist/cjs/src/htx.js +88 -25
- package/dist/cjs/src/huobijp.js +65 -2
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/lbank.js +27 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +16 -0
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +26 -2
- package/js/src/base/ws/Client.d.ts +2 -0
- package/js/src/base/ws/Client.js +34 -4
- package/js/src/binance.js +7 -7
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +83 -9
- package/js/src/bitflyer.d.ts +1 -1
- package/js/src/bitflyer.js +7 -1
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +56 -47
- package/js/src/bitopro.d.ts +3 -2
- package/js/src/bitopro.js +20 -3
- package/js/src/btcmarkets.js +27 -28
- package/js/src/bybit.js +9 -5
- package/js/src/coinone.js +13 -19
- package/js/src/delta.d.ts +1 -1
- package/js/src/delta.js +5 -1
- package/js/src/gate.d.ts +3 -1
- package/js/src/gate.js +109 -1
- package/js/src/htx.d.ts +3 -2
- package/js/src/htx.js +88 -25
- package/js/src/huobijp.d.ts +3 -2
- package/js/src/huobijp.js +65 -2
- package/js/src/hyperliquid.js +1 -1
- package/js/src/lbank.d.ts +2 -2
- package/js/src/lbank.js +27 -6
- package/package.json +7 -3
package/dist/cjs/ccxt.js
CHANGED
|
@@ -190,7 +190,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
190
190
|
|
|
191
191
|
//-----------------------------------------------------------------------------
|
|
192
192
|
// this is updated by vss.js when building
|
|
193
|
-
const version = '4.3.
|
|
193
|
+
const version = '4.3.57';
|
|
194
194
|
Exchange["default"].ccxtVersion = version;
|
|
195
195
|
const exchanges = {
|
|
196
196
|
'ace': ace,
|
|
@@ -44,7 +44,7 @@ function _interopNamespace(e) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// ----------------------------------------------------------------------------
|
|
47
|
-
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 } = functions;
|
|
47
|
+
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;
|
|
48
48
|
// ----------------------------------------------------------------------------
|
|
49
49
|
/**
|
|
50
50
|
* @class Exchange
|
|
@@ -52,6 +52,7 @@ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sor
|
|
|
52
52
|
class Exchange {
|
|
53
53
|
constructor(userConfig = {}) {
|
|
54
54
|
this.throttleProp = undefined;
|
|
55
|
+
this.sleep = sleep;
|
|
55
56
|
this.api = undefined;
|
|
56
57
|
this.userAgent = undefined;
|
|
57
58
|
this.user_agent = undefined;
|
|
@@ -3805,7 +3806,30 @@ class Exchange {
|
|
|
3805
3806
|
this.last_request_headers = request['headers'];
|
|
3806
3807
|
this.last_request_body = request['body'];
|
|
3807
3808
|
this.last_request_url = request['url'];
|
|
3808
|
-
|
|
3809
|
+
let retries = undefined;
|
|
3810
|
+
[retries, params] = this.handleOptionAndParams(params, path, 'maxRetriesOnFailure', 0);
|
|
3811
|
+
let retryDelay = undefined;
|
|
3812
|
+
[retryDelay, params] = this.handleOptionAndParams(params, path, 'maxRetriesOnFailureDelay', 0);
|
|
3813
|
+
for (let i = 0; i < retries + 1; i++) {
|
|
3814
|
+
try {
|
|
3815
|
+
return await this.fetch(request['url'], request['method'], request['headers'], request['body']);
|
|
3816
|
+
}
|
|
3817
|
+
catch (e) {
|
|
3818
|
+
if (e instanceof errors.NetworkError) {
|
|
3819
|
+
if (i < retries) {
|
|
3820
|
+
if (this.verbose) {
|
|
3821
|
+
this.log('Request failed with the error: ' + e.toString() + ', retrying ' + (i + 1).toString() + ' of ' + retries.toString() + '...');
|
|
3822
|
+
}
|
|
3823
|
+
if ((retryDelay !== undefined) && (retryDelay !== 0)) {
|
|
3824
|
+
await this.sleep(retryDelay);
|
|
3825
|
+
}
|
|
3826
|
+
continue;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
throw e;
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
return undefined; // this line is never reached, but exists for c# value return requirement
|
|
3809
3833
|
}
|
|
3810
3834
|
async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
|
|
3811
3835
|
return await this.fetch2(path, api, method, params, headers, body, config);
|
|
@@ -12,6 +12,7 @@ var index = require('../../static_dependencies/scure-base/index.js');
|
|
|
12
12
|
|
|
13
13
|
class Client {
|
|
14
14
|
constructor(url, onMessageCallback, onErrorCallback, onCloseCallback, onConnectedCallback, config = {}) {
|
|
15
|
+
this.useMessageQueue = true;
|
|
15
16
|
this.verbose = false;
|
|
16
17
|
const defaults = {
|
|
17
18
|
url,
|
|
@@ -25,6 +26,8 @@ class Client {
|
|
|
25
26
|
futures: {},
|
|
26
27
|
subscriptions: {},
|
|
27
28
|
rejections: {},
|
|
29
|
+
messageQueue: {},
|
|
30
|
+
useMessageQueue: true,
|
|
28
31
|
connected: undefined,
|
|
29
32
|
error: undefined,
|
|
30
33
|
connectionStarted: undefined,
|
|
@@ -55,6 +58,15 @@ class Client {
|
|
|
55
58
|
if (messageHash in this.rejections) {
|
|
56
59
|
future.reject(this.rejections[messageHash]);
|
|
57
60
|
delete this.rejections[messageHash];
|
|
61
|
+
delete this.messageQueue[messageHash];
|
|
62
|
+
return future;
|
|
63
|
+
}
|
|
64
|
+
if (this.useMessageQueue) {
|
|
65
|
+
const queue = this.messageQueue[messageHash];
|
|
66
|
+
if (queue && queue.length) {
|
|
67
|
+
future.resolve(queue.shift());
|
|
68
|
+
delete this.futures[messageHash];
|
|
69
|
+
}
|
|
58
70
|
}
|
|
59
71
|
return future;
|
|
60
72
|
}
|
|
@@ -62,10 +74,27 @@ class Client {
|
|
|
62
74
|
if (this.verbose && (messageHash === undefined)) {
|
|
63
75
|
this.log(new Date(), 'resolve received undefined messageHash');
|
|
64
76
|
}
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
if (this.useMessageQueue === true) {
|
|
78
|
+
if (!(messageHash in this.messageQueue)) {
|
|
79
|
+
this.messageQueue[messageHash] = [];
|
|
80
|
+
}
|
|
81
|
+
const queue = this.messageQueue[messageHash];
|
|
82
|
+
queue.push(result);
|
|
83
|
+
while (queue.length > 10) { // limit size to 10 messages in the queue
|
|
84
|
+
queue.shift();
|
|
85
|
+
}
|
|
86
|
+
if ((messageHash !== undefined) && (messageHash in this.futures)) {
|
|
87
|
+
const promise = this.futures[messageHash];
|
|
88
|
+
promise.resolve(queue.shift());
|
|
89
|
+
delete this.futures[messageHash];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (messageHash in this.futures) {
|
|
94
|
+
const promise = this.futures[messageHash];
|
|
95
|
+
promise.resolve(result);
|
|
96
|
+
delete this.futures[messageHash];
|
|
97
|
+
}
|
|
69
98
|
}
|
|
70
99
|
return result;
|
|
71
100
|
}
|
|
@@ -106,6 +135,7 @@ class Client {
|
|
|
106
135
|
reset(error) {
|
|
107
136
|
this.clearConnectionTimeout();
|
|
108
137
|
this.clearPingInterval();
|
|
138
|
+
this.messageQueue = {};
|
|
109
139
|
this.reject(error);
|
|
110
140
|
}
|
|
111
141
|
onConnectionTimeout() {
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -1543,7 +1543,7 @@ class binance extends binance$1 {
|
|
|
1543
1543
|
'-3042': errors.BadRequest,
|
|
1544
1544
|
'-3043': errors.PermissionDenied,
|
|
1545
1545
|
'-3044': errors.OperationFailed,
|
|
1546
|
-
'-3045': errors.
|
|
1546
|
+
'-3045': errors.OperationRejected,
|
|
1547
1547
|
'-3999': errors.PermissionDenied,
|
|
1548
1548
|
//
|
|
1549
1549
|
// 4xxx (different from contract markets)
|
|
@@ -1562,7 +1562,7 @@ class binance extends binance$1 {
|
|
|
1562
1562
|
'-4011': errors.BadRequest,
|
|
1563
1563
|
'-4012': errors.PermissionDenied,
|
|
1564
1564
|
'-4013': errors.AuthenticationError,
|
|
1565
|
-
'-4014': errors.
|
|
1565
|
+
'-4014': errors.OperationRejected,
|
|
1566
1566
|
'-4015': errors.PermissionDenied,
|
|
1567
1567
|
'-4016': errors.PermissionDenied,
|
|
1568
1568
|
'-4017': errors.PermissionDenied,
|
|
@@ -1571,7 +1571,7 @@ class binance extends binance$1 {
|
|
|
1571
1571
|
'-4020': errors.ExchangeError,
|
|
1572
1572
|
'-4021': errors.BadRequest,
|
|
1573
1573
|
'-4022': errors.BadRequest,
|
|
1574
|
-
'-4023': errors.
|
|
1574
|
+
'-4023': errors.OperationRejected,
|
|
1575
1575
|
'-4024': errors.InsufficientFunds,
|
|
1576
1576
|
'-4025': errors.InsufficientFunds,
|
|
1577
1577
|
'-4026': errors.InsufficientFunds,
|
|
@@ -1580,7 +1580,7 @@ class binance extends binance$1 {
|
|
|
1580
1580
|
'-4029': errors.BadRequest,
|
|
1581
1581
|
'-4030': errors.BadResponse,
|
|
1582
1582
|
'-4031': errors.OperationFailed,
|
|
1583
|
-
'-4032': errors.
|
|
1583
|
+
'-4032': errors.OperationRejected,
|
|
1584
1584
|
'-4033': errors.BadRequest,
|
|
1585
1585
|
'-4034': errors.OperationRejected,
|
|
1586
1586
|
'-4035': errors.PermissionDenied,
|
|
@@ -1703,7 +1703,7 @@ class binance extends binance$1 {
|
|
|
1703
1703
|
'-5003': errors.InsufficientFunds,
|
|
1704
1704
|
'-5004': errors.OperationRejected,
|
|
1705
1705
|
'-5005': errors.OperationRejected,
|
|
1706
|
-
'-5006': errors.
|
|
1706
|
+
'-5006': errors.OperationRejected,
|
|
1707
1707
|
'-5007': errors.BadRequest,
|
|
1708
1708
|
'-5008': errors.OperationRejected,
|
|
1709
1709
|
'-5009': errors.BadSymbol,
|
|
@@ -1721,8 +1721,8 @@ class binance extends binance$1 {
|
|
|
1721
1721
|
'-6004': errors.BadRequest,
|
|
1722
1722
|
'-6005': errors.BadRequest,
|
|
1723
1723
|
'-6006': errors.BadRequest,
|
|
1724
|
-
'-6007': errors.
|
|
1725
|
-
'-6008': errors.
|
|
1724
|
+
'-6007': errors.OperationRejected,
|
|
1725
|
+
'-6008': errors.OperationRejected,
|
|
1726
1726
|
'-6009': errors.RateLimitExceeded,
|
|
1727
1727
|
'-6011': errors.OperationRejected,
|
|
1728
1728
|
'-6012': errors.InsufficientFunds,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -101,6 +101,7 @@ class bingx extends bingx$1 {
|
|
|
101
101
|
'subAccount': 'https://open-api.{hostname}/openApi',
|
|
102
102
|
'account': 'https://open-api.{hostname}/openApi',
|
|
103
103
|
'copyTrading': 'https://open-api.{hostname}/openApi',
|
|
104
|
+
'cswap': 'https://open-api.{hostname}/openApi',
|
|
104
105
|
},
|
|
105
106
|
'test': {
|
|
106
107
|
'swap': 'https://open-api-vst.{hostname}/openApi', // only swap is really "test" but since the API keys are the same, we want to keep all the functionalities when the user enables the sandboxmode
|
|
@@ -263,6 +264,36 @@ class bingx extends bingx$1 {
|
|
|
263
264
|
},
|
|
264
265
|
},
|
|
265
266
|
},
|
|
267
|
+
'cswap': {
|
|
268
|
+
'v1': {
|
|
269
|
+
'public': {
|
|
270
|
+
'get': {
|
|
271
|
+
'market/contracts': 1,
|
|
272
|
+
'market/premiumIndex': 1,
|
|
273
|
+
'market/openInterest': 1,
|
|
274
|
+
'market/klines': 1,
|
|
275
|
+
'market/depth': 1,
|
|
276
|
+
'market/ticker': 1,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
'private': {
|
|
280
|
+
'get': {
|
|
281
|
+
'trade/leverage': 2,
|
|
282
|
+
'trade/forceOrders': 2,
|
|
283
|
+
'trade/allFillOrders': 2,
|
|
284
|
+
'user/commissionRate': 2,
|
|
285
|
+
'user/positions': 2,
|
|
286
|
+
'user/balance': 2,
|
|
287
|
+
},
|
|
288
|
+
'post': {
|
|
289
|
+
'trade/order': 2,
|
|
290
|
+
'trade/leverage': 2,
|
|
291
|
+
'trade/allOpenOrders': 2,
|
|
292
|
+
'trade/closeAllPositions': 2,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
266
297
|
'contract': {
|
|
267
298
|
'v1': {
|
|
268
299
|
'private': {
|
|
@@ -638,6 +669,29 @@ class bingx extends bingx$1 {
|
|
|
638
669
|
const markets = this.safeList(response, 'data', []);
|
|
639
670
|
return this.parseMarkets(markets);
|
|
640
671
|
}
|
|
672
|
+
async fetchInverseSwapMarkets(params) {
|
|
673
|
+
const response = await this.cswapV1PublicGetMarketContracts(params);
|
|
674
|
+
//
|
|
675
|
+
// {
|
|
676
|
+
// "code": 0,
|
|
677
|
+
// "msg": "",
|
|
678
|
+
// "timestamp": 1720074487610,
|
|
679
|
+
// "data": [
|
|
680
|
+
// {
|
|
681
|
+
// "symbol": "BNB-USD",
|
|
682
|
+
// "pricePrecision": 2,
|
|
683
|
+
// "minTickSize": "10",
|
|
684
|
+
// "minTradeValue": "10",
|
|
685
|
+
// "minQty": "1.00000000",
|
|
686
|
+
// "status": 1,
|
|
687
|
+
// "timeOnline": 1713175200000
|
|
688
|
+
// },
|
|
689
|
+
// ]
|
|
690
|
+
// }
|
|
691
|
+
//
|
|
692
|
+
const markets = this.safeList(response, 'data', []);
|
|
693
|
+
return this.parseMarkets(markets);
|
|
694
|
+
}
|
|
641
695
|
parseMarket(market) {
|
|
642
696
|
const id = this.safeString(market, 'symbol');
|
|
643
697
|
const symbolParts = id.split('-');
|
|
@@ -645,7 +699,16 @@ class bingx extends bingx$1 {
|
|
|
645
699
|
const quoteId = symbolParts[1];
|
|
646
700
|
const base = this.safeCurrencyCode(baseId);
|
|
647
701
|
const quote = this.safeCurrencyCode(quoteId);
|
|
648
|
-
|
|
702
|
+
let currency = this.safeString(market, 'currency');
|
|
703
|
+
let checkIsInverse = false;
|
|
704
|
+
let checkIsLinear = true;
|
|
705
|
+
const minTickSize = this.safeNumber(market, 'minTickSize');
|
|
706
|
+
if (minTickSize !== undefined) {
|
|
707
|
+
// inverse swap market
|
|
708
|
+
currency = baseId;
|
|
709
|
+
checkIsInverse = true;
|
|
710
|
+
checkIsLinear = false;
|
|
711
|
+
}
|
|
649
712
|
const settle = this.safeCurrencyCode(currency);
|
|
650
713
|
let pricePrecision = this.safeNumber(market, 'tickSize');
|
|
651
714
|
if (pricePrecision === undefined) {
|
|
@@ -665,8 +728,12 @@ class bingx extends bingx$1 {
|
|
|
665
728
|
const fees = this.safeDict(this.fees, type, {});
|
|
666
729
|
const contractSize = (swap) ? this.parseNumber('1') : undefined;
|
|
667
730
|
const isActive = this.safeString(market, 'status') === '1';
|
|
668
|
-
const isInverse = (spot) ? undefined :
|
|
669
|
-
const isLinear = (spot) ? undefined :
|
|
731
|
+
const isInverse = (spot) ? undefined : checkIsInverse;
|
|
732
|
+
const isLinear = (spot) ? undefined : checkIsLinear;
|
|
733
|
+
let timeOnline = this.safeInteger(market, 'timeOnline');
|
|
734
|
+
if (timeOnline === 0) {
|
|
735
|
+
timeOnline = undefined;
|
|
736
|
+
}
|
|
670
737
|
return this.safeMarketStructure({
|
|
671
738
|
'id': id,
|
|
672
739
|
'symbol': symbol,
|
|
@@ -708,15 +775,15 @@ class bingx extends bingx$1 {
|
|
|
708
775
|
'max': this.safeNumber(market, 'maxQty'),
|
|
709
776
|
},
|
|
710
777
|
'price': {
|
|
711
|
-
'min':
|
|
778
|
+
'min': minTickSize,
|
|
712
779
|
'max': undefined,
|
|
713
780
|
},
|
|
714
781
|
'cost': {
|
|
715
|
-
'min': this.
|
|
782
|
+
'min': this.safeNumberN(market, ['minNotional', 'tradeMinUSDT', 'minTradeValue']),
|
|
716
783
|
'max': this.safeNumber(market, 'maxNotional'),
|
|
717
784
|
},
|
|
718
785
|
},
|
|
719
|
-
'created':
|
|
786
|
+
'created': timeOnline,
|
|
720
787
|
'info': market,
|
|
721
788
|
});
|
|
722
789
|
}
|
|
@@ -727,17 +794,21 @@ class bingx extends bingx$1 {
|
|
|
727
794
|
* @description retrieves data on all markets for bingx
|
|
728
795
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
|
|
729
796
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
|
|
797
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information
|
|
730
798
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
731
799
|
* @returns {object[]} an array of objects representing market data
|
|
732
800
|
*/
|
|
733
801
|
const requests = [this.fetchSwapMarkets(params)];
|
|
734
802
|
const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
|
|
735
803
|
if (!isSandbox) {
|
|
804
|
+
requests.push(this.fetchInverseSwapMarkets(params));
|
|
736
805
|
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
737
806
|
}
|
|
738
807
|
const promises = await Promise.all(requests);
|
|
739
|
-
const
|
|
740
|
-
const
|
|
808
|
+
const linearSwapMarkets = this.safeList(promises, 0, []);
|
|
809
|
+
const inverseSwapMarkets = this.safeList(promises, 1, []);
|
|
810
|
+
const spotMarkets = this.safeList(promises, 2, []);
|
|
811
|
+
const swapMarkets = this.arrayConcat(linearSwapMarkets, inverseSwapMarkets);
|
|
741
812
|
return this.arrayConcat(spotMarkets, swapMarkets);
|
|
742
813
|
}
|
|
743
814
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -1523,7 +1594,10 @@ class bingx extends bingx$1 {
|
|
|
1523
1594
|
percentage = percentage.replace('%', '');
|
|
1524
1595
|
}
|
|
1525
1596
|
const change = this.safeString(ticker, 'priceChange');
|
|
1526
|
-
|
|
1597
|
+
let ts = this.safeInteger(ticker, 'closeTime');
|
|
1598
|
+
if (ts === 0) {
|
|
1599
|
+
ts = undefined;
|
|
1600
|
+
}
|
|
1527
1601
|
const datetime = this.iso8601(ts);
|
|
1528
1602
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
1529
1603
|
const bidVolume = this.safeString(ticker, 'bidQty');
|
package/dist/cjs/src/bitflyer.js
CHANGED
|
@@ -593,7 +593,13 @@ class bitflyer extends bitflyer$1 {
|
|
|
593
593
|
'product_code': this.marketId(symbol),
|
|
594
594
|
'child_order_acceptance_id': id,
|
|
595
595
|
};
|
|
596
|
-
|
|
596
|
+
const response = await this.privatePostCancelchildorder(this.extend(request, params));
|
|
597
|
+
//
|
|
598
|
+
// 200 OK.
|
|
599
|
+
//
|
|
600
|
+
return this.safeOrder({
|
|
601
|
+
'info': response,
|
|
602
|
+
});
|
|
597
603
|
}
|
|
598
604
|
parseOrderStatus(status) {
|
|
599
605
|
const statuses = {
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -5012,6 +5012,22 @@ class bitget extends bitget$1 {
|
|
|
5012
5012
|
else {
|
|
5013
5013
|
response = await this.privateMarginPostMarginV1IsolatedOrderBatchCancelOrder(this.extend(request, params));
|
|
5014
5014
|
}
|
|
5015
|
+
//
|
|
5016
|
+
// {
|
|
5017
|
+
// "code": "00000",
|
|
5018
|
+
// "msg": "success",
|
|
5019
|
+
// "requestTime": 1700717155622,
|
|
5020
|
+
// "data": {
|
|
5021
|
+
// "resultList": [
|
|
5022
|
+
// {
|
|
5023
|
+
// "orderId": "1111453253721796609",
|
|
5024
|
+
// "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
|
|
5025
|
+
// },
|
|
5026
|
+
// ],
|
|
5027
|
+
// "failure": []
|
|
5028
|
+
// }
|
|
5029
|
+
// }
|
|
5030
|
+
//
|
|
5015
5031
|
}
|
|
5016
5032
|
else {
|
|
5017
5033
|
if (stop) {
|
|
@@ -5023,6 +5039,27 @@ class bitget extends bitget$1 {
|
|
|
5023
5039
|
else {
|
|
5024
5040
|
response = await this.privateSpotPostV2SpotTradeCancelSymbolOrder(this.extend(request, params));
|
|
5025
5041
|
}
|
|
5042
|
+
//
|
|
5043
|
+
// {
|
|
5044
|
+
// "code": "00000",
|
|
5045
|
+
// "msg": "success",
|
|
5046
|
+
// "requestTime": 1700716953996,
|
|
5047
|
+
// "data": {
|
|
5048
|
+
// "symbol": "BTCUSDT"
|
|
5049
|
+
// }
|
|
5050
|
+
// }
|
|
5051
|
+
//
|
|
5052
|
+
const timestamp = this.safeInteger(response, 'requestTime');
|
|
5053
|
+
const responseData = this.safeDict(response, 'data');
|
|
5054
|
+
const marketId = this.safeString(responseData, 'symbol');
|
|
5055
|
+
return [
|
|
5056
|
+
this.safeOrder({
|
|
5057
|
+
'info': response,
|
|
5058
|
+
'symbol': this.safeSymbol(marketId, undefined, undefined, 'spot'),
|
|
5059
|
+
'timestamp': timestamp,
|
|
5060
|
+
'datetime': this.iso8601(timestamp),
|
|
5061
|
+
}),
|
|
5062
|
+
];
|
|
5026
5063
|
}
|
|
5027
5064
|
}
|
|
5028
5065
|
else {
|
|
@@ -5035,54 +5072,26 @@ class bitget extends bitget$1 {
|
|
|
5035
5072
|
else {
|
|
5036
5073
|
response = await this.privateMixPostV2MixOrderBatchCancelOrders(this.extend(request, params));
|
|
5037
5074
|
}
|
|
5075
|
+
// {
|
|
5076
|
+
// "code": "00000",
|
|
5077
|
+
// "msg": "success",
|
|
5078
|
+
// "requestTime": "1680008815965",
|
|
5079
|
+
// "data": {
|
|
5080
|
+
// "successList": [
|
|
5081
|
+
// {
|
|
5082
|
+
// "orderId": "1024598257429823488",
|
|
5083
|
+
// "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
|
|
5084
|
+
// },
|
|
5085
|
+
// ],
|
|
5086
|
+
// "failureList": []
|
|
5087
|
+
// }
|
|
5088
|
+
// }
|
|
5038
5089
|
}
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
// "msg": "success",
|
|
5045
|
-
// "requestTime": 1700716953996,
|
|
5046
|
-
// "data": {
|
|
5047
|
-
// "symbol": "BTCUSDT"
|
|
5048
|
-
// }
|
|
5049
|
-
// }
|
|
5050
|
-
//
|
|
5051
|
-
// swap
|
|
5052
|
-
//
|
|
5053
|
-
// {
|
|
5054
|
-
// "code": "00000",
|
|
5055
|
-
// "msg": "success",
|
|
5056
|
-
// "requestTime": "1680008815965",
|
|
5057
|
-
// "data": {
|
|
5058
|
-
// "successList": [
|
|
5059
|
-
// {
|
|
5060
|
-
// "orderId": "1024598257429823488",
|
|
5061
|
-
// "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
|
|
5062
|
-
// },
|
|
5063
|
-
// ],
|
|
5064
|
-
// "failureList": []
|
|
5065
|
-
// }
|
|
5066
|
-
// }
|
|
5067
|
-
//
|
|
5068
|
-
// spot margin
|
|
5069
|
-
//
|
|
5070
|
-
// {
|
|
5071
|
-
// "code": "00000",
|
|
5072
|
-
// "msg": "success",
|
|
5073
|
-
// "requestTime": 1700717155622,
|
|
5074
|
-
// "data": {
|
|
5075
|
-
// "resultList": [
|
|
5076
|
-
// {
|
|
5077
|
-
// "orderId": "1111453253721796609",
|
|
5078
|
-
// "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
|
|
5079
|
-
// },
|
|
5080
|
-
// ],
|
|
5081
|
-
// "failure": []
|
|
5082
|
-
// }
|
|
5083
|
-
// }
|
|
5084
|
-
//
|
|
5085
|
-
return response;
|
|
5090
|
+
const data = this.safeDict(response, 'data');
|
|
5091
|
+
const resultList = this.safeList2(data, 'resultList', 'successList');
|
|
5092
|
+
const failureList = this.safeList2(data, 'failure', 'failureList');
|
|
5093
|
+
const responseList = this.arrayConcat(resultList, failureList);
|
|
5094
|
+
return this.parseOrders(responseList);
|
|
5086
5095
|
}
|
|
5087
5096
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
5088
5097
|
/**
|
package/dist/cjs/src/bitopro.js
CHANGED
|
@@ -1085,6 +1085,22 @@ class bitopro extends bitopro$1 {
|
|
|
1085
1085
|
//
|
|
1086
1086
|
return this.parseOrder(response, market);
|
|
1087
1087
|
}
|
|
1088
|
+
parseCancelOrders(data) {
|
|
1089
|
+
const dataKeys = Object.keys(data);
|
|
1090
|
+
const orders = [];
|
|
1091
|
+
for (let i = 0; i < dataKeys.length; i++) {
|
|
1092
|
+
const marketId = dataKeys[i];
|
|
1093
|
+
const orderIds = data[marketId];
|
|
1094
|
+
for (let j = 0; j < orderIds.length; j++) {
|
|
1095
|
+
orders.push(this.safeOrder({
|
|
1096
|
+
'info': orderIds[j],
|
|
1097
|
+
'id': orderIds[j],
|
|
1098
|
+
'symbol': this.safeSymbol(marketId),
|
|
1099
|
+
}));
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return orders;
|
|
1103
|
+
}
|
|
1088
1104
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1089
1105
|
/**
|
|
1090
1106
|
* @method
|
|
@@ -1115,7 +1131,8 @@ class bitopro extends bitopro$1 {
|
|
|
1115
1131
|
// }
|
|
1116
1132
|
// }
|
|
1117
1133
|
//
|
|
1118
|
-
|
|
1134
|
+
const data = this.safeDict(response, 'data');
|
|
1135
|
+
return this.parseCancelOrders(data);
|
|
1119
1136
|
}
|
|
1120
1137
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
1121
1138
|
/**
|
|
@@ -1140,7 +1157,7 @@ class bitopro extends bitopro$1 {
|
|
|
1140
1157
|
else {
|
|
1141
1158
|
response = await this.privateDeleteOrdersAll(this.extend(request, params));
|
|
1142
1159
|
}
|
|
1143
|
-
const
|
|
1160
|
+
const data = this.safeValue(response, 'data', {});
|
|
1144
1161
|
//
|
|
1145
1162
|
// {
|
|
1146
1163
|
// "data":{
|
|
@@ -1151,7 +1168,7 @@ class bitopro extends bitopro$1 {
|
|
|
1151
1168
|
// }
|
|
1152
1169
|
// }
|
|
1153
1170
|
//
|
|
1154
|
-
return
|
|
1171
|
+
return this.parseCancelOrders(data);
|
|
1155
1172
|
}
|
|
1156
1173
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
1157
1174
|
/**
|
|
@@ -153,16 +153,17 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
153
153
|
},
|
|
154
154
|
'precisionMode': number.TICK_SIZE,
|
|
155
155
|
'exceptions': {
|
|
156
|
-
'
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
'exact': {
|
|
157
|
+
'InsufficientFund': errors.InsufficientFunds,
|
|
158
|
+
'InvalidPrice': errors.InvalidOrder,
|
|
159
|
+
'InvalidAmount': errors.InvalidOrder,
|
|
160
|
+
'MissingArgument': errors.BadRequest,
|
|
161
|
+
'OrderAlreadyCancelled': errors.InvalidOrder,
|
|
162
|
+
'OrderNotFound': errors.OrderNotFound,
|
|
163
|
+
'OrderStatusIsFinal': errors.InvalidOrder,
|
|
164
|
+
'InvalidPaginationParameter': errors.BadRequest,
|
|
165
|
+
},
|
|
166
|
+
'broad': {},
|
|
166
167
|
},
|
|
167
168
|
'fees': {
|
|
168
169
|
'percentage': true,
|
|
@@ -377,7 +378,8 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
377
378
|
// "minOrderAmount":"0.00007",
|
|
378
379
|
// "maxOrderAmount":"1000000",
|
|
379
380
|
// "amountDecimals":"8",
|
|
380
|
-
// "priceDecimals":"2"
|
|
381
|
+
// "priceDecimals":"2",
|
|
382
|
+
// "status": "Online"
|
|
381
383
|
// }
|
|
382
384
|
// ]
|
|
383
385
|
//
|
|
@@ -394,6 +396,7 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
394
396
|
const pricePrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'priceDecimals')));
|
|
395
397
|
const minAmount = this.safeNumber(market, 'minOrderAmount');
|
|
396
398
|
const maxAmount = this.safeNumber(market, 'maxOrderAmount');
|
|
399
|
+
const status = this.safeString(market, 'status');
|
|
397
400
|
let minPrice = undefined;
|
|
398
401
|
if (quote === 'AUD') {
|
|
399
402
|
minPrice = pricePrecision;
|
|
@@ -413,7 +416,7 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
413
416
|
'swap': false,
|
|
414
417
|
'future': false,
|
|
415
418
|
'option': false,
|
|
416
|
-
'active':
|
|
419
|
+
'active': (status === 'Online'),
|
|
417
420
|
'contract': false,
|
|
418
421
|
'linear': undefined,
|
|
419
422
|
'inverse': undefined,
|
|
@@ -1280,22 +1283,18 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
1280
1283
|
if (response === undefined) {
|
|
1281
1284
|
return undefined; // fallback to default error handler
|
|
1282
1285
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
}
|
|
1291
|
-
// v3 api errors
|
|
1292
|
-
if (code >= 400) {
|
|
1293
|
-
const errorCode = this.safeString(response, 'code');
|
|
1294
|
-
const message = this.safeString(response, 'message');
|
|
1286
|
+
//
|
|
1287
|
+
// {"code":"UnAuthorized","message":"invalid access token"}
|
|
1288
|
+
// {"code":"MarketNotFound","message":"invalid marketId"}
|
|
1289
|
+
//
|
|
1290
|
+
const errorCode = this.safeString(response, 'code');
|
|
1291
|
+
const message = this.safeString(response, 'message');
|
|
1292
|
+
if (errorCode !== undefined) {
|
|
1295
1293
|
const feedback = this.id + ' ' + body;
|
|
1296
|
-
this.throwExactlyMatchedException(this.exceptions,
|
|
1297
|
-
this.throwExactlyMatchedException(this.exceptions,
|
|
1298
|
-
|
|
1294
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
|
|
1295
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
1296
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
|
|
1297
|
+
throw new errors.ExchangeError(feedback); // unknown message
|
|
1299
1298
|
}
|
|
1300
1299
|
return undefined;
|
|
1301
1300
|
}
|