ccxt 4.2.15 → 4.2.17
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/dist/ccxt.browser.js +647 -168
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/js/ccxt.js +3 -1
- package/dist/cjs/js/src/ascendex.js +11 -6
- package/dist/cjs/js/src/base/Exchange.js +12 -12
- package/dist/cjs/js/src/binance.js +1 -0
- package/dist/cjs/js/src/bingx.js +37 -3
- package/dist/cjs/js/src/bitmex.js +3 -6
- package/dist/cjs/js/src/coinlist.js +10 -2
- package/dist/cjs/js/src/coinone.js +1 -1
- package/dist/cjs/js/src/coinsph.js +2 -2
- package/dist/cjs/js/src/phemex.js +28 -25
- package/dist/cjs/js/src/pro/binance.js +2 -2
- package/dist/cjs/js/src/pro/coinone.js +411 -0
- package/dist/cjs/js/src/pro/hitbtc.js +5 -4
- package/dist/cjs/js/src/pro/krakenfutures.js +7 -1
- package/dist/cjs/js/src/pro/kucoin.js +3 -1
- package/dist/cjs/js/src/pro/poloniex.js +2 -2
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/coinlist.d.ts +8 -0
- package/js/src/ascendex.js +11 -6
- package/js/src/base/Exchange.js +12 -12
- package/js/src/binance.js +1 -0
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +38 -4
- package/js/src/bitmex.js +3 -6
- package/js/src/coinlist.js +10 -2
- package/js/src/coinone.js +1 -1
- package/js/src/coinsph.js +2 -2
- package/js/src/phemex.js +28 -25
- package/js/src/pro/binance.js +2 -2
- package/js/src/pro/coinone.d.ts +21 -0
- package/js/src/pro/coinone.js +412 -0
- package/js/src/pro/hitbtc.js +5 -4
- package/js/src/pro/krakenfutures.js +7 -1
- package/js/src/pro/kucoin.js +3 -1
- package/js/src/pro/poloniex.js +2 -2
- package/package.json +1 -1
- package/skip-tests.json +1 -0
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.17';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/js/ccxt.js
CHANGED
|
@@ -135,6 +135,7 @@ var cex$1 = require('./src/pro/cex.js');
|
|
|
135
135
|
var coinbase$1 = require('./src/pro/coinbase.js');
|
|
136
136
|
var coinbasepro$1 = require('./src/pro/coinbasepro.js');
|
|
137
137
|
var coinex$1 = require('./src/pro/coinex.js');
|
|
138
|
+
var coinone$1 = require('./src/pro/coinone.js');
|
|
138
139
|
var cryptocom$1 = require('./src/pro/cryptocom.js');
|
|
139
140
|
var currencycom$1 = require('./src/pro/currencycom.js');
|
|
140
141
|
var deribit$1 = require('./src/pro/deribit.js');
|
|
@@ -169,7 +170,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
170
|
|
|
170
171
|
//-----------------------------------------------------------------------------
|
|
171
172
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
173
|
+
const version = '4.2.16';
|
|
173
174
|
Exchange["default"].ccxtVersion = version;
|
|
174
175
|
const exchanges = {
|
|
175
176
|
'ace': ace,
|
|
@@ -297,6 +298,7 @@ const pro = {
|
|
|
297
298
|
'coinbase': coinbase$1,
|
|
298
299
|
'coinbasepro': coinbasepro$1,
|
|
299
300
|
'coinex': coinex$1,
|
|
301
|
+
'coinone': coinone$1,
|
|
300
302
|
'cryptocom': cryptocom$1,
|
|
301
303
|
'currencycom': currencycom$1,
|
|
302
304
|
'deribit': deribit$1,
|
|
@@ -808,12 +808,14 @@ class ascendex extends ascendex$1 {
|
|
|
808
808
|
*/
|
|
809
809
|
await this.loadMarkets();
|
|
810
810
|
await this.loadAccounts();
|
|
811
|
-
let query = undefined;
|
|
812
811
|
let marketType = undefined;
|
|
813
|
-
|
|
812
|
+
let marginMode = undefined;
|
|
813
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
814
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
814
815
|
const isMargin = this.safeValue(params, 'margin', false);
|
|
815
|
-
|
|
816
|
-
|
|
816
|
+
const isCross = marginMode === 'cross';
|
|
817
|
+
marketType = (isMargin || isCross) ? 'margin' : marketType;
|
|
818
|
+
params = this.omit(params, 'margin');
|
|
817
819
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
818
820
|
const accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
819
821
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -821,15 +823,18 @@ class ascendex extends ascendex$1 {
|
|
|
821
823
|
const request = {
|
|
822
824
|
'account-group': accountGroup,
|
|
823
825
|
};
|
|
826
|
+
if ((marginMode === 'isolated') && (marketType !== 'swap')) {
|
|
827
|
+
throw new errors.BadRequest(this.id + ' does not supported isolated margin trading');
|
|
828
|
+
}
|
|
824
829
|
if ((accountCategory === 'cash') || (accountCategory === 'margin')) {
|
|
825
830
|
request['account-category'] = accountCategory;
|
|
826
831
|
}
|
|
827
832
|
let response = undefined;
|
|
828
833
|
if ((marketType === 'spot') || (marketType === 'margin')) {
|
|
829
|
-
response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request,
|
|
834
|
+
response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request, params));
|
|
830
835
|
}
|
|
831
836
|
else if (marketType === 'swap') {
|
|
832
|
-
response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request,
|
|
837
|
+
response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, params));
|
|
833
838
|
}
|
|
834
839
|
else {
|
|
835
840
|
throw new errors.NotSupported(this.id + ' fetchBalance() is not currently supported for ' + marketType + ' markets');
|
|
@@ -1454,11 +1454,11 @@ class Exchange {
|
|
|
1454
1454
|
let httpsProxy = undefined;
|
|
1455
1455
|
let socksProxy = undefined;
|
|
1456
1456
|
// httpProxy
|
|
1457
|
-
if (this.httpProxy
|
|
1457
|
+
if (this.valueIsDefined(this.httpProxy)) {
|
|
1458
1458
|
usedProxies.push('httpProxy');
|
|
1459
1459
|
httpProxy = this.httpProxy;
|
|
1460
1460
|
}
|
|
1461
|
-
if (this.http_proxy
|
|
1461
|
+
if (this.valueIsDefined(this.http_proxy)) {
|
|
1462
1462
|
usedProxies.push('http_proxy');
|
|
1463
1463
|
httpProxy = this.http_proxy;
|
|
1464
1464
|
}
|
|
@@ -1471,11 +1471,11 @@ class Exchange {
|
|
|
1471
1471
|
httpProxy = this.http_proxy_callback(url, method, headers, body);
|
|
1472
1472
|
}
|
|
1473
1473
|
// httpsProxy
|
|
1474
|
-
if (this.httpsProxy
|
|
1474
|
+
if (this.valueIsDefined(this.httpsProxy)) {
|
|
1475
1475
|
usedProxies.push('httpsProxy');
|
|
1476
1476
|
httpsProxy = this.httpsProxy;
|
|
1477
1477
|
}
|
|
1478
|
-
if (this.https_proxy
|
|
1478
|
+
if (this.valueIsDefined(this.https_proxy)) {
|
|
1479
1479
|
usedProxies.push('https_proxy');
|
|
1480
1480
|
httpsProxy = this.https_proxy;
|
|
1481
1481
|
}
|
|
@@ -1488,11 +1488,11 @@ class Exchange {
|
|
|
1488
1488
|
httpsProxy = this.https_proxy_callback(url, method, headers, body);
|
|
1489
1489
|
}
|
|
1490
1490
|
// socksProxy
|
|
1491
|
-
if (this.socksProxy
|
|
1491
|
+
if (this.valueIsDefined(this.socksProxy)) {
|
|
1492
1492
|
usedProxies.push('socksProxy');
|
|
1493
1493
|
socksProxy = this.socksProxy;
|
|
1494
1494
|
}
|
|
1495
|
-
if (this.socks_proxy
|
|
1495
|
+
if (this.valueIsDefined(this.socks_proxy)) {
|
|
1496
1496
|
usedProxies.push('socks_proxy');
|
|
1497
1497
|
socksProxy = this.socks_proxy;
|
|
1498
1498
|
}
|
|
@@ -1518,29 +1518,29 @@ class Exchange {
|
|
|
1518
1518
|
let wssProxy = undefined;
|
|
1519
1519
|
let wsSocksProxy = undefined;
|
|
1520
1520
|
// ws proxy
|
|
1521
|
-
if (this.wsProxy
|
|
1521
|
+
if (this.valueIsDefined(this.wsProxy)) {
|
|
1522
1522
|
usedProxies.push('wsProxy');
|
|
1523
1523
|
wsProxy = this.wsProxy;
|
|
1524
1524
|
}
|
|
1525
|
-
if (this.ws_proxy
|
|
1525
|
+
if (this.valueIsDefined(this.ws_proxy)) {
|
|
1526
1526
|
usedProxies.push('ws_proxy');
|
|
1527
1527
|
wsProxy = this.ws_proxy;
|
|
1528
1528
|
}
|
|
1529
1529
|
// wss proxy
|
|
1530
|
-
if (this.wssProxy
|
|
1530
|
+
if (this.valueIsDefined(this.wssProxy)) {
|
|
1531
1531
|
usedProxies.push('wssProxy');
|
|
1532
1532
|
wssProxy = this.wssProxy;
|
|
1533
1533
|
}
|
|
1534
|
-
if (this.wss_proxy
|
|
1534
|
+
if (this.valueIsDefined(this.wss_proxy)) {
|
|
1535
1535
|
usedProxies.push('wss_proxy');
|
|
1536
1536
|
wssProxy = this.wss_proxy;
|
|
1537
1537
|
}
|
|
1538
1538
|
// ws socks proxy
|
|
1539
|
-
if (this.wsSocksProxy
|
|
1539
|
+
if (this.valueIsDefined(this.wsSocksProxy)) {
|
|
1540
1540
|
usedProxies.push('wsSocksProxy');
|
|
1541
1541
|
wsSocksProxy = this.wsSocksProxy;
|
|
1542
1542
|
}
|
|
1543
|
-
if (this.ws_socks_proxy
|
|
1543
|
+
if (this.valueIsDefined(this.ws_socks_proxy)) {
|
|
1544
1544
|
usedProxies.push('ws_socks_proxy');
|
|
1545
1545
|
wsSocksProxy = this.ws_socks_proxy;
|
|
1546
1546
|
}
|
|
@@ -222,6 +222,7 @@ class binance extends binance$1 {
|
|
|
222
222
|
'margin/allPairs': 0.1,
|
|
223
223
|
'margin/priceIndex': 1,
|
|
224
224
|
// these endpoints require this.apiKey + this.secret
|
|
225
|
+
'spot/delist-schedule': 0.1,
|
|
225
226
|
'asset/assetDividend': 1,
|
|
226
227
|
'asset/dribblet': 0.1,
|
|
227
228
|
'asset/transfer': 0.1,
|
package/dist/cjs/js/src/bingx.js
CHANGED
|
@@ -22,7 +22,7 @@ class bingx extends bingx$1 {
|
|
|
22
22
|
'has': {
|
|
23
23
|
'CORS': undefined,
|
|
24
24
|
'spot': true,
|
|
25
|
-
'margin':
|
|
25
|
+
'margin': false,
|
|
26
26
|
'swap': true,
|
|
27
27
|
'future': false,
|
|
28
28
|
'option': false,
|
|
@@ -85,6 +85,9 @@ class bingx extends bingx$1 {
|
|
|
85
85
|
'account': 'https://open-api.{hostname}/openApi',
|
|
86
86
|
'copyTrading': 'https://open-api.{hostname}/openApi',
|
|
87
87
|
},
|
|
88
|
+
'test': {
|
|
89
|
+
'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
|
|
90
|
+
},
|
|
88
91
|
'www': 'https://bingx.com/',
|
|
89
92
|
'doc': 'https://bingx-api.github.io/docs/',
|
|
90
93
|
'referral': 'https://bingx.com/invite/OHETOM',
|
|
@@ -418,6 +421,10 @@ class bingx extends bingx$1 {
|
|
|
418
421
|
if (!this.checkRequiredCredentials(false)) {
|
|
419
422
|
return undefined;
|
|
420
423
|
}
|
|
424
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
425
|
+
if (isSandbox) {
|
|
426
|
+
return undefined;
|
|
427
|
+
}
|
|
421
428
|
const response = await this.walletsV1PrivateGetCapitalConfigGetall(params);
|
|
422
429
|
//
|
|
423
430
|
// {
|
|
@@ -657,7 +664,11 @@ class bingx extends bingx$1 {
|
|
|
657
664
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
658
665
|
* @returns {object[]} an array of objects representing market data
|
|
659
666
|
*/
|
|
660
|
-
const requests = [this.
|
|
667
|
+
const requests = [this.fetchSwapMarkets(params)];
|
|
668
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
669
|
+
if (!isSandbox) {
|
|
670
|
+
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
671
|
+
}
|
|
661
672
|
const promises = await Promise.all(requests);
|
|
662
673
|
const spotMarkets = this.safeValue(promises, 0, []);
|
|
663
674
|
const swapMarkets = this.safeValue(promises, 1, []);
|
|
@@ -3088,6 +3099,21 @@ class bingx extends bingx$1 {
|
|
|
3088
3099
|
// "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"
|
|
3089
3100
|
// }
|
|
3090
3101
|
//
|
|
3102
|
+
// withdraw
|
|
3103
|
+
//
|
|
3104
|
+
// {
|
|
3105
|
+
// "code":0,
|
|
3106
|
+
// "timestamp":1705274263621,
|
|
3107
|
+
// "data":{
|
|
3108
|
+
// "id":"1264246141278773252"
|
|
3109
|
+
// }
|
|
3110
|
+
// }
|
|
3111
|
+
//
|
|
3112
|
+
// parse withdraw-type output first...
|
|
3113
|
+
//
|
|
3114
|
+
const data = this.safeValue(transaction, 'data');
|
|
3115
|
+
const dataId = (data === undefined) ? undefined : this.safeString(data, 'id');
|
|
3116
|
+
const id = this.safeString(transaction, 'id', dataId);
|
|
3091
3117
|
const address = this.safeString(transaction, 'address');
|
|
3092
3118
|
const tag = this.safeString(transaction, 'addressTag');
|
|
3093
3119
|
let timestamp = this.safeInteger(transaction, 'insertTime');
|
|
@@ -3108,7 +3134,7 @@ class bingx extends bingx$1 {
|
|
|
3108
3134
|
const type = (rawType === '0') ? 'deposit' : 'withdrawal';
|
|
3109
3135
|
return {
|
|
3110
3136
|
'info': transaction,
|
|
3111
|
-
'id':
|
|
3137
|
+
'id': id,
|
|
3112
3138
|
'txid': this.safeString(transaction, 'txId'),
|
|
3113
3139
|
'type': type,
|
|
3114
3140
|
'currency': code,
|
|
@@ -3742,6 +3768,10 @@ class bingx extends bingx$1 {
|
|
|
3742
3768
|
const type = section[0];
|
|
3743
3769
|
const version = section[1];
|
|
3744
3770
|
const access = section[2];
|
|
3771
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
3772
|
+
if (isSandbox && (type !== 'swap')) {
|
|
3773
|
+
throw new errors.NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
|
|
3774
|
+
}
|
|
3745
3775
|
let url = this.implodeHostname(this.urls['api'][type]);
|
|
3746
3776
|
if (type === 'spot' && version === 'v3') {
|
|
3747
3777
|
url += '/api';
|
|
@@ -3784,6 +3814,10 @@ class bingx extends bingx$1 {
|
|
|
3784
3814
|
nonce() {
|
|
3785
3815
|
return this.milliseconds();
|
|
3786
3816
|
}
|
|
3817
|
+
setSandboxMode(enable) {
|
|
3818
|
+
super.setSandboxMode(enable);
|
|
3819
|
+
this.options['sandboxMode'] = enable;
|
|
3820
|
+
}
|
|
3787
3821
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
3788
3822
|
if (response === undefined) {
|
|
3789
3823
|
return undefined; // fallback to default error handler
|
|
@@ -1500,8 +1500,8 @@ class bitmex extends bitmex$1 {
|
|
|
1500
1500
|
if (fetchOHLCVOpenTimestamp) {
|
|
1501
1501
|
timestamp = this.sum(timestamp, duration);
|
|
1502
1502
|
}
|
|
1503
|
-
const
|
|
1504
|
-
request['startTime'] =
|
|
1503
|
+
const startTime = this.iso8601(timestamp);
|
|
1504
|
+
request['startTime'] = startTime; // starting date filter for results
|
|
1505
1505
|
}
|
|
1506
1506
|
else {
|
|
1507
1507
|
request['reverse'] = true;
|
|
@@ -2611,12 +2611,9 @@ class bitmex extends bitmex$1 {
|
|
|
2611
2611
|
throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress requires params["network"]');
|
|
2612
2612
|
}
|
|
2613
2613
|
const currency = this.currency(code);
|
|
2614
|
-
let currencyId = currency['id'];
|
|
2615
|
-
const idLength = currencyId.length;
|
|
2616
|
-
currencyId = currencyId.slice(0, idLength - 1) + currencyId.slice(idLength - 1, idLength).toLowerCase(); // make the last letter lowercase
|
|
2617
2614
|
params = this.omit(params, 'network');
|
|
2618
2615
|
const request = {
|
|
2619
|
-
'currency':
|
|
2616
|
+
'currency': currency['id'],
|
|
2620
2617
|
'network': this.networkCodeToId(networkCode, currency['code']),
|
|
2621
2618
|
};
|
|
2622
2619
|
const response = await this.privateGetUserDepositAddress(this.extend(request, params));
|
|
@@ -148,6 +148,9 @@ class coinlist extends coinlist$1 {
|
|
|
148
148
|
'v1/symbols/{symbol}/auctions/{auction_code}': 1,
|
|
149
149
|
'v1/time': 1,
|
|
150
150
|
'v1/assets': 1,
|
|
151
|
+
'v1/leaderboard': 1,
|
|
152
|
+
'v1/affiliate/{competition_code}': 1,
|
|
153
|
+
'v1/competition/{competition_id}': 1,
|
|
151
154
|
},
|
|
152
155
|
},
|
|
153
156
|
'private': {
|
|
@@ -155,6 +158,7 @@ class coinlist extends coinlist$1 {
|
|
|
155
158
|
'v1/fees': 1,
|
|
156
159
|
'v1/accounts': 1,
|
|
157
160
|
'v1/accounts/{trader_id}': 1,
|
|
161
|
+
'v1/accounts/{trader_id}/alias': 1,
|
|
158
162
|
'v1/accounts/{trader_id}/ledger': 1,
|
|
159
163
|
'v1/accounts/{trader_id}/wallets': 1,
|
|
160
164
|
'v1/accounts/{trader_id}/wallet-ledger': 1,
|
|
@@ -167,7 +171,9 @@ class coinlist extends coinlist$1 {
|
|
|
167
171
|
'v1/balances': 1,
|
|
168
172
|
'v1/transfers': 1,
|
|
169
173
|
'v1/user': 1,
|
|
170
|
-
'v1/credits': 1,
|
|
174
|
+
'v1/credits': 1,
|
|
175
|
+
'v1/positions': 1,
|
|
176
|
+
'v1/accounts/{trader_id}/competitions': 1,
|
|
171
177
|
},
|
|
172
178
|
'post': {
|
|
173
179
|
'v1/keys': 1,
|
|
@@ -178,7 +184,9 @@ class coinlist extends coinlist$1 {
|
|
|
178
184
|
'v1/transfers/from-wallet': 1,
|
|
179
185
|
'v1/transfers/internal-transfer': 1,
|
|
180
186
|
'v1/transfers/withdrawal-request': 1,
|
|
181
|
-
'v1/orders/bulk': 1,
|
|
187
|
+
'v1/orders/bulk': 1,
|
|
188
|
+
'v1/accounts/{trader_id}/competitions': 1,
|
|
189
|
+
'v1/accounts/{trader_id}/create-competition': 1,
|
|
182
190
|
},
|
|
183
191
|
'patch': {
|
|
184
192
|
'v1/orders/{order_id}': 1,
|
|
@@ -76,7 +76,7 @@ class coinone extends coinone$1 {
|
|
|
76
76
|
'setLeverage': false,
|
|
77
77
|
'setMarginMode': false,
|
|
78
78
|
'setPositionMode': false,
|
|
79
|
-
'ws':
|
|
79
|
+
'ws': true,
|
|
80
80
|
},
|
|
81
81
|
'urls': {
|
|
82
82
|
'logo': 'https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg',
|
|
@@ -996,10 +996,10 @@ class coinsph extends coinsph$1 {
|
|
|
996
996
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
997
997
|
};
|
|
998
998
|
}
|
|
999
|
-
const isBuyer = this.
|
|
999
|
+
const isBuyer = this.safeValue2(trade, 'isBuyer', 'isBuyerMaker', undefined);
|
|
1000
1000
|
let side = undefined;
|
|
1001
1001
|
if (isBuyer !== undefined) {
|
|
1002
|
-
side = (isBuyer ===
|
|
1002
|
+
side = (isBuyer === true) ? 'buy' : 'sell';
|
|
1003
1003
|
}
|
|
1004
1004
|
const isMaker = this.safeString2(trade, 'isMaker', undefined);
|
|
1005
1005
|
let takerOrMaker = undefined;
|
|
@@ -2976,12 +2976,14 @@ class phemex extends phemex$1 {
|
|
|
2976
2976
|
* @description fetch all unfilled currently open orders
|
|
2977
2977
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
|
|
2978
2978
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
|
|
2979
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
|
|
2979
2980
|
* @param {string} symbol unified market symbol
|
|
2980
2981
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
2981
2982
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
2982
2983
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2983
2984
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2984
2985
|
*/
|
|
2986
|
+
await this.loadMarkets();
|
|
2985
2987
|
if (symbol === undefined) {
|
|
2986
2988
|
throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
2987
2989
|
}
|
|
@@ -3023,20 +3025,25 @@ class phemex extends phemex$1 {
|
|
|
3023
3025
|
* @name phemex#fetchClosedOrders
|
|
3024
3026
|
* @description fetches information on multiple closed orders made by the user
|
|
3025
3027
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
|
|
3028
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
|
|
3029
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
|
|
3030
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
|
|
3026
3031
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3027
3032
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3028
3033
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3029
3034
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3035
|
+
* @param {string} [params.settle] the settlement currency to fetch orders for
|
|
3030
3036
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3031
3037
|
*/
|
|
3032
|
-
if (symbol === undefined) {
|
|
3033
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
3034
|
-
}
|
|
3035
3038
|
await this.loadMarkets();
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
}
|
|
3039
|
+
let market = undefined;
|
|
3040
|
+
if (symbol !== undefined) {
|
|
3041
|
+
market = this.market(symbol);
|
|
3042
|
+
}
|
|
3043
|
+
const request = {};
|
|
3044
|
+
if (market !== undefined) {
|
|
3045
|
+
request['symbol'] = market['id'];
|
|
3046
|
+
}
|
|
3040
3047
|
if (since !== undefined) {
|
|
3041
3048
|
request['start'] = since;
|
|
3042
3049
|
}
|
|
@@ -3044,8 +3051,8 @@ class phemex extends phemex$1 {
|
|
|
3044
3051
|
request['limit'] = limit;
|
|
3045
3052
|
}
|
|
3046
3053
|
let response = undefined;
|
|
3047
|
-
if (market
|
|
3048
|
-
request['currency'] =
|
|
3054
|
+
if ((symbol === undefined) || (this.safeString(market, 'settle') === 'USDT')) {
|
|
3055
|
+
request['currency'] = this.safeString(params, 'settle', 'USDT');
|
|
3049
3056
|
response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
|
|
3050
3057
|
}
|
|
3051
3058
|
else if (market['swap']) {
|
|
@@ -3106,23 +3113,25 @@ class phemex extends phemex$1 {
|
|
|
3106
3113
|
* @description fetch all trades made by the user
|
|
3107
3114
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
|
|
3108
3115
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
|
|
3116
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
|
|
3109
3117
|
* @param {string} symbol unified market symbol
|
|
3110
3118
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
3111
3119
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
3112
3120
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3113
3121
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
3114
3122
|
*/
|
|
3115
|
-
if (symbol === undefined) {
|
|
3116
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
3117
|
-
}
|
|
3118
3123
|
await this.loadMarkets();
|
|
3119
|
-
|
|
3124
|
+
let market = undefined;
|
|
3125
|
+
if (symbol !== undefined) {
|
|
3126
|
+
market = this.market(symbol);
|
|
3127
|
+
}
|
|
3120
3128
|
const request = {};
|
|
3121
3129
|
if (limit !== undefined) {
|
|
3122
3130
|
limit = Math.min(200, limit);
|
|
3123
3131
|
request['limit'] = limit;
|
|
3124
3132
|
}
|
|
3125
|
-
|
|
3133
|
+
const isUSDTSettled = (symbol === undefined) || (this.safeString(market, 'settle') === 'USDT');
|
|
3134
|
+
if (isUSDTSettled) {
|
|
3126
3135
|
request['currency'] = 'USDT';
|
|
3127
3136
|
request['offset'] = 0;
|
|
3128
3137
|
if (limit === undefined) {
|
|
@@ -3135,18 +3144,12 @@ class phemex extends phemex$1 {
|
|
|
3135
3144
|
if (since !== undefined) {
|
|
3136
3145
|
request['start'] = since;
|
|
3137
3146
|
}
|
|
3138
|
-
if (market['swap'] && (limit !== undefined)) {
|
|
3139
|
-
request['limit'] = limit;
|
|
3140
|
-
}
|
|
3141
|
-
const isUSDTSettled = market['settle'] === 'USDT';
|
|
3142
3147
|
let response = undefined;
|
|
3143
|
-
if (
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
|
|
3149
|
-
}
|
|
3148
|
+
if (isUSDTSettled) {
|
|
3149
|
+
response = await this.privateGetExchangeOrderV2TradingList(this.extend(request, params));
|
|
3150
|
+
}
|
|
3151
|
+
else if (market['swap']) {
|
|
3152
|
+
response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
|
|
3150
3153
|
}
|
|
3151
3154
|
else {
|
|
3152
3155
|
response = await this.privateGetExchangeSpotOrderTrades(this.extend(request, params));
|
|
@@ -1081,7 +1081,7 @@ class binance extends binance$1 {
|
|
|
1081
1081
|
const isSpot = ((client.url.indexOf('/stream') > -1) || (client.url.indexOf('/testnet.binance') > -1));
|
|
1082
1082
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
1083
1083
|
let rawTickers = [];
|
|
1084
|
-
const newTickers =
|
|
1084
|
+
const newTickers = {};
|
|
1085
1085
|
if (Array.isArray(message)) {
|
|
1086
1086
|
rawTickers = message;
|
|
1087
1087
|
}
|
|
@@ -1093,7 +1093,7 @@ class binance extends binance$1 {
|
|
|
1093
1093
|
const result = this.parseWsTicker(ticker, marketType);
|
|
1094
1094
|
const symbol = result['symbol'];
|
|
1095
1095
|
this.tickers[symbol] = result;
|
|
1096
|
-
newTickers
|
|
1096
|
+
newTickers[symbol] = result;
|
|
1097
1097
|
}
|
|
1098
1098
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
1099
1099
|
for (let i = 0; i < messageHashes.length; i++) {
|