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/js/src/base/Exchange.js
CHANGED
|
@@ -1448,11 +1448,11 @@ export default class Exchange {
|
|
|
1448
1448
|
let httpsProxy = undefined;
|
|
1449
1449
|
let socksProxy = undefined;
|
|
1450
1450
|
// httpProxy
|
|
1451
|
-
if (this.httpProxy
|
|
1451
|
+
if (this.valueIsDefined(this.httpProxy)) {
|
|
1452
1452
|
usedProxies.push('httpProxy');
|
|
1453
1453
|
httpProxy = this.httpProxy;
|
|
1454
1454
|
}
|
|
1455
|
-
if (this.http_proxy
|
|
1455
|
+
if (this.valueIsDefined(this.http_proxy)) {
|
|
1456
1456
|
usedProxies.push('http_proxy');
|
|
1457
1457
|
httpProxy = this.http_proxy;
|
|
1458
1458
|
}
|
|
@@ -1465,11 +1465,11 @@ export default class Exchange {
|
|
|
1465
1465
|
httpProxy = this.http_proxy_callback(url, method, headers, body);
|
|
1466
1466
|
}
|
|
1467
1467
|
// httpsProxy
|
|
1468
|
-
if (this.httpsProxy
|
|
1468
|
+
if (this.valueIsDefined(this.httpsProxy)) {
|
|
1469
1469
|
usedProxies.push('httpsProxy');
|
|
1470
1470
|
httpsProxy = this.httpsProxy;
|
|
1471
1471
|
}
|
|
1472
|
-
if (this.https_proxy
|
|
1472
|
+
if (this.valueIsDefined(this.https_proxy)) {
|
|
1473
1473
|
usedProxies.push('https_proxy');
|
|
1474
1474
|
httpsProxy = this.https_proxy;
|
|
1475
1475
|
}
|
|
@@ -1482,11 +1482,11 @@ export default class Exchange {
|
|
|
1482
1482
|
httpsProxy = this.https_proxy_callback(url, method, headers, body);
|
|
1483
1483
|
}
|
|
1484
1484
|
// socksProxy
|
|
1485
|
-
if (this.socksProxy
|
|
1485
|
+
if (this.valueIsDefined(this.socksProxy)) {
|
|
1486
1486
|
usedProxies.push('socksProxy');
|
|
1487
1487
|
socksProxy = this.socksProxy;
|
|
1488
1488
|
}
|
|
1489
|
-
if (this.socks_proxy
|
|
1489
|
+
if (this.valueIsDefined(this.socks_proxy)) {
|
|
1490
1490
|
usedProxies.push('socks_proxy');
|
|
1491
1491
|
socksProxy = this.socks_proxy;
|
|
1492
1492
|
}
|
|
@@ -1512,29 +1512,29 @@ export default class Exchange {
|
|
|
1512
1512
|
let wssProxy = undefined;
|
|
1513
1513
|
let wsSocksProxy = undefined;
|
|
1514
1514
|
// ws proxy
|
|
1515
|
-
if (this.wsProxy
|
|
1515
|
+
if (this.valueIsDefined(this.wsProxy)) {
|
|
1516
1516
|
usedProxies.push('wsProxy');
|
|
1517
1517
|
wsProxy = this.wsProxy;
|
|
1518
1518
|
}
|
|
1519
|
-
if (this.ws_proxy
|
|
1519
|
+
if (this.valueIsDefined(this.ws_proxy)) {
|
|
1520
1520
|
usedProxies.push('ws_proxy');
|
|
1521
1521
|
wsProxy = this.ws_proxy;
|
|
1522
1522
|
}
|
|
1523
1523
|
// wss proxy
|
|
1524
|
-
if (this.wssProxy
|
|
1524
|
+
if (this.valueIsDefined(this.wssProxy)) {
|
|
1525
1525
|
usedProxies.push('wssProxy');
|
|
1526
1526
|
wssProxy = this.wssProxy;
|
|
1527
1527
|
}
|
|
1528
|
-
if (this.wss_proxy
|
|
1528
|
+
if (this.valueIsDefined(this.wss_proxy)) {
|
|
1529
1529
|
usedProxies.push('wss_proxy');
|
|
1530
1530
|
wssProxy = this.wss_proxy;
|
|
1531
1531
|
}
|
|
1532
1532
|
// ws socks proxy
|
|
1533
|
-
if (this.wsSocksProxy
|
|
1533
|
+
if (this.valueIsDefined(this.wsSocksProxy)) {
|
|
1534
1534
|
usedProxies.push('wsSocksProxy');
|
|
1535
1535
|
wsSocksProxy = this.wsSocksProxy;
|
|
1536
1536
|
}
|
|
1537
|
-
if (this.ws_socks_proxy
|
|
1537
|
+
if (this.valueIsDefined(this.ws_socks_proxy)) {
|
|
1538
1538
|
usedProxies.push('ws_socks_proxy');
|
|
1539
1539
|
wsSocksProxy = this.ws_socks_proxy;
|
|
1540
1540
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -225,6 +225,7 @@ export default class binance extends Exchange {
|
|
|
225
225
|
'margin/allPairs': 0.1,
|
|
226
226
|
'margin/priceIndex': 1,
|
|
227
227
|
// these endpoints require this.apiKey + this.secret
|
|
228
|
+
'spot/delist-schedule': 0.1,
|
|
228
229
|
'asset/assetDividend': 1,
|
|
229
230
|
'asset/dribblet': 0.1,
|
|
230
231
|
'asset/transfer': 0.1,
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -143,5 +143,6 @@ export default class bingx extends Exchange {
|
|
|
143
143
|
headers: any;
|
|
144
144
|
};
|
|
145
145
|
nonce(): number;
|
|
146
|
+
setSandboxMode(enable: any): void;
|
|
146
147
|
handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
147
148
|
}
|
package/js/src/bingx.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/bingx.js';
|
|
9
|
-
import { AuthenticationError, ExchangeNotAvailable, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired } from './base/errors.js';
|
|
9
|
+
import { AuthenticationError, ExchangeNotAvailable, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired, NotSupported } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
import { DECIMAL_PLACES } from './base/functions/number.js';
|
|
@@ -25,7 +25,7 @@ export default class bingx extends Exchange {
|
|
|
25
25
|
'has': {
|
|
26
26
|
'CORS': undefined,
|
|
27
27
|
'spot': true,
|
|
28
|
-
'margin':
|
|
28
|
+
'margin': false,
|
|
29
29
|
'swap': true,
|
|
30
30
|
'future': false,
|
|
31
31
|
'option': false,
|
|
@@ -88,6 +88,9 @@ export default class bingx extends Exchange {
|
|
|
88
88
|
'account': 'https://open-api.{hostname}/openApi',
|
|
89
89
|
'copyTrading': 'https://open-api.{hostname}/openApi',
|
|
90
90
|
},
|
|
91
|
+
'test': {
|
|
92
|
+
'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
|
|
93
|
+
},
|
|
91
94
|
'www': 'https://bingx.com/',
|
|
92
95
|
'doc': 'https://bingx-api.github.io/docs/',
|
|
93
96
|
'referral': 'https://bingx.com/invite/OHETOM',
|
|
@@ -421,6 +424,10 @@ export default class bingx extends Exchange {
|
|
|
421
424
|
if (!this.checkRequiredCredentials(false)) {
|
|
422
425
|
return undefined;
|
|
423
426
|
}
|
|
427
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
428
|
+
if (isSandbox) {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
424
431
|
const response = await this.walletsV1PrivateGetCapitalConfigGetall(params);
|
|
425
432
|
//
|
|
426
433
|
// {
|
|
@@ -660,7 +667,11 @@ export default class bingx extends Exchange {
|
|
|
660
667
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
661
668
|
* @returns {object[]} an array of objects representing market data
|
|
662
669
|
*/
|
|
663
|
-
const requests = [this.
|
|
670
|
+
const requests = [this.fetchSwapMarkets(params)];
|
|
671
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
672
|
+
if (!isSandbox) {
|
|
673
|
+
requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
|
|
674
|
+
}
|
|
664
675
|
const promises = await Promise.all(requests);
|
|
665
676
|
const spotMarkets = this.safeValue(promises, 0, []);
|
|
666
677
|
const swapMarkets = this.safeValue(promises, 1, []);
|
|
@@ -3091,6 +3102,21 @@ export default class bingx extends Exchange {
|
|
|
3091
3102
|
// "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"
|
|
3092
3103
|
// }
|
|
3093
3104
|
//
|
|
3105
|
+
// withdraw
|
|
3106
|
+
//
|
|
3107
|
+
// {
|
|
3108
|
+
// "code":0,
|
|
3109
|
+
// "timestamp":1705274263621,
|
|
3110
|
+
// "data":{
|
|
3111
|
+
// "id":"1264246141278773252"
|
|
3112
|
+
// }
|
|
3113
|
+
// }
|
|
3114
|
+
//
|
|
3115
|
+
// parse withdraw-type output first...
|
|
3116
|
+
//
|
|
3117
|
+
const data = this.safeValue(transaction, 'data');
|
|
3118
|
+
const dataId = (data === undefined) ? undefined : this.safeString(data, 'id');
|
|
3119
|
+
const id = this.safeString(transaction, 'id', dataId);
|
|
3094
3120
|
const address = this.safeString(transaction, 'address');
|
|
3095
3121
|
const tag = this.safeString(transaction, 'addressTag');
|
|
3096
3122
|
let timestamp = this.safeInteger(transaction, 'insertTime');
|
|
@@ -3111,7 +3137,7 @@ export default class bingx extends Exchange {
|
|
|
3111
3137
|
const type = (rawType === '0') ? 'deposit' : 'withdrawal';
|
|
3112
3138
|
return {
|
|
3113
3139
|
'info': transaction,
|
|
3114
|
-
'id':
|
|
3140
|
+
'id': id,
|
|
3115
3141
|
'txid': this.safeString(transaction, 'txId'),
|
|
3116
3142
|
'type': type,
|
|
3117
3143
|
'currency': code,
|
|
@@ -3745,6 +3771,10 @@ export default class bingx extends Exchange {
|
|
|
3745
3771
|
const type = section[0];
|
|
3746
3772
|
const version = section[1];
|
|
3747
3773
|
const access = section[2];
|
|
3774
|
+
const isSandbox = this.safeValue(this.options, 'sandboxMode', false);
|
|
3775
|
+
if (isSandbox && (type !== 'swap')) {
|
|
3776
|
+
throw new NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
|
|
3777
|
+
}
|
|
3748
3778
|
let url = this.implodeHostname(this.urls['api'][type]);
|
|
3749
3779
|
if (type === 'spot' && version === 'v3') {
|
|
3750
3780
|
url += '/api';
|
|
@@ -3787,6 +3817,10 @@ export default class bingx extends Exchange {
|
|
|
3787
3817
|
nonce() {
|
|
3788
3818
|
return this.milliseconds();
|
|
3789
3819
|
}
|
|
3820
|
+
setSandboxMode(enable) {
|
|
3821
|
+
super.setSandboxMode(enable);
|
|
3822
|
+
this.options['sandboxMode'] = enable;
|
|
3823
|
+
}
|
|
3790
3824
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
3791
3825
|
if (response === undefined) {
|
|
3792
3826
|
return undefined; // fallback to default error handler
|
package/js/src/bitmex.js
CHANGED
|
@@ -1503,8 +1503,8 @@ export default class bitmex extends Exchange {
|
|
|
1503
1503
|
if (fetchOHLCVOpenTimestamp) {
|
|
1504
1504
|
timestamp = this.sum(timestamp, duration);
|
|
1505
1505
|
}
|
|
1506
|
-
const
|
|
1507
|
-
request['startTime'] =
|
|
1506
|
+
const startTime = this.iso8601(timestamp);
|
|
1507
|
+
request['startTime'] = startTime; // starting date filter for results
|
|
1508
1508
|
}
|
|
1509
1509
|
else {
|
|
1510
1510
|
request['reverse'] = true;
|
|
@@ -2614,12 +2614,9 @@ export default class bitmex extends Exchange {
|
|
|
2614
2614
|
throw new ArgumentsRequired(this.id + ' fetchDepositAddress requires params["network"]');
|
|
2615
2615
|
}
|
|
2616
2616
|
const currency = this.currency(code);
|
|
2617
|
-
let currencyId = currency['id'];
|
|
2618
|
-
const idLength = currencyId.length;
|
|
2619
|
-
currencyId = currencyId.slice(0, idLength - 1) + currencyId.slice(idLength - 1, idLength).toLowerCase(); // make the last letter lowercase
|
|
2620
2617
|
params = this.omit(params, 'network');
|
|
2621
2618
|
const request = {
|
|
2622
|
-
'currency':
|
|
2619
|
+
'currency': currency['id'],
|
|
2623
2620
|
'network': this.networkCodeToId(networkCode, currency['code']),
|
|
2624
2621
|
};
|
|
2625
2622
|
const response = await this.privateGetUserDepositAddress(this.extend(request, params));
|
package/js/src/coinlist.js
CHANGED
|
@@ -151,6 +151,9 @@ export default class coinlist extends Exchange {
|
|
|
151
151
|
'v1/symbols/{symbol}/auctions/{auction_code}': 1,
|
|
152
152
|
'v1/time': 1,
|
|
153
153
|
'v1/assets': 1,
|
|
154
|
+
'v1/leaderboard': 1,
|
|
155
|
+
'v1/affiliate/{competition_code}': 1,
|
|
156
|
+
'v1/competition/{competition_id}': 1,
|
|
154
157
|
},
|
|
155
158
|
},
|
|
156
159
|
'private': {
|
|
@@ -158,6 +161,7 @@ export default class coinlist extends Exchange {
|
|
|
158
161
|
'v1/fees': 1,
|
|
159
162
|
'v1/accounts': 1,
|
|
160
163
|
'v1/accounts/{trader_id}': 1,
|
|
164
|
+
'v1/accounts/{trader_id}/alias': 1,
|
|
161
165
|
'v1/accounts/{trader_id}/ledger': 1,
|
|
162
166
|
'v1/accounts/{trader_id}/wallets': 1,
|
|
163
167
|
'v1/accounts/{trader_id}/wallet-ledger': 1,
|
|
@@ -170,7 +174,9 @@ export default class coinlist extends Exchange {
|
|
|
170
174
|
'v1/balances': 1,
|
|
171
175
|
'v1/transfers': 1,
|
|
172
176
|
'v1/user': 1,
|
|
173
|
-
'v1/credits': 1,
|
|
177
|
+
'v1/credits': 1,
|
|
178
|
+
'v1/positions': 1,
|
|
179
|
+
'v1/accounts/{trader_id}/competitions': 1,
|
|
174
180
|
},
|
|
175
181
|
'post': {
|
|
176
182
|
'v1/keys': 1,
|
|
@@ -181,7 +187,9 @@ export default class coinlist extends Exchange {
|
|
|
181
187
|
'v1/transfers/from-wallet': 1,
|
|
182
188
|
'v1/transfers/internal-transfer': 1,
|
|
183
189
|
'v1/transfers/withdrawal-request': 1,
|
|
184
|
-
'v1/orders/bulk': 1,
|
|
190
|
+
'v1/orders/bulk': 1,
|
|
191
|
+
'v1/accounts/{trader_id}/competitions': 1,
|
|
192
|
+
'v1/accounts/{trader_id}/create-competition': 1,
|
|
185
193
|
},
|
|
186
194
|
'patch': {
|
|
187
195
|
'v1/orders/{order_id}': 1,
|
package/js/src/coinone.js
CHANGED
|
@@ -79,7 +79,7 @@ export default class coinone extends Exchange {
|
|
|
79
79
|
'setLeverage': false,
|
|
80
80
|
'setMarginMode': false,
|
|
81
81
|
'setPositionMode': false,
|
|
82
|
-
'ws':
|
|
82
|
+
'ws': true,
|
|
83
83
|
},
|
|
84
84
|
'urls': {
|
|
85
85
|
'logo': 'https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg',
|
package/js/src/coinsph.js
CHANGED
|
@@ -999,10 +999,10 @@ export default class coinsph extends Exchange {
|
|
|
999
999
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
const isBuyer = this.
|
|
1002
|
+
const isBuyer = this.safeValue2(trade, 'isBuyer', 'isBuyerMaker', undefined);
|
|
1003
1003
|
let side = undefined;
|
|
1004
1004
|
if (isBuyer !== undefined) {
|
|
1005
|
-
side = (isBuyer ===
|
|
1005
|
+
side = (isBuyer === true) ? 'buy' : 'sell';
|
|
1006
1006
|
}
|
|
1007
1007
|
const isMaker = this.safeString2(trade, 'isMaker', undefined);
|
|
1008
1008
|
let takerOrMaker = undefined;
|
package/js/src/phemex.js
CHANGED
|
@@ -2979,12 +2979,14 @@ export default class phemex extends Exchange {
|
|
|
2979
2979
|
* @description fetch all unfilled currently open orders
|
|
2980
2980
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
|
|
2981
2981
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
|
|
2982
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
|
|
2982
2983
|
* @param {string} symbol unified market symbol
|
|
2983
2984
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
2984
2985
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
2985
2986
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2986
2987
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2987
2988
|
*/
|
|
2989
|
+
await this.loadMarkets();
|
|
2988
2990
|
if (symbol === undefined) {
|
|
2989
2991
|
throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
2990
2992
|
}
|
|
@@ -3026,20 +3028,25 @@ export default class phemex extends Exchange {
|
|
|
3026
3028
|
* @name phemex#fetchClosedOrders
|
|
3027
3029
|
* @description fetches information on multiple closed orders made by the user
|
|
3028
3030
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
|
|
3031
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
|
|
3032
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
|
|
3033
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
|
|
3029
3034
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3030
3035
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3031
3036
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3032
3037
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3038
|
+
* @param {string} [params.settle] the settlement currency to fetch orders for
|
|
3033
3039
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3034
3040
|
*/
|
|
3035
|
-
if (symbol === undefined) {
|
|
3036
|
-
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
3037
|
-
}
|
|
3038
3041
|
await this.loadMarkets();
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
}
|
|
3042
|
+
let market = undefined;
|
|
3043
|
+
if (symbol !== undefined) {
|
|
3044
|
+
market = this.market(symbol);
|
|
3045
|
+
}
|
|
3046
|
+
const request = {};
|
|
3047
|
+
if (market !== undefined) {
|
|
3048
|
+
request['symbol'] = market['id'];
|
|
3049
|
+
}
|
|
3043
3050
|
if (since !== undefined) {
|
|
3044
3051
|
request['start'] = since;
|
|
3045
3052
|
}
|
|
@@ -3047,8 +3054,8 @@ export default class phemex extends Exchange {
|
|
|
3047
3054
|
request['limit'] = limit;
|
|
3048
3055
|
}
|
|
3049
3056
|
let response = undefined;
|
|
3050
|
-
if (market
|
|
3051
|
-
request['currency'] =
|
|
3057
|
+
if ((symbol === undefined) || (this.safeString(market, 'settle') === 'USDT')) {
|
|
3058
|
+
request['currency'] = this.safeString(params, 'settle', 'USDT');
|
|
3052
3059
|
response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
|
|
3053
3060
|
}
|
|
3054
3061
|
else if (market['swap']) {
|
|
@@ -3109,23 +3116,25 @@ export default class phemex extends Exchange {
|
|
|
3109
3116
|
* @description fetch all trades made by the user
|
|
3110
3117
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
|
|
3111
3118
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
|
|
3119
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
|
|
3112
3120
|
* @param {string} symbol unified market symbol
|
|
3113
3121
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
3114
3122
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
3115
3123
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3116
3124
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
3117
3125
|
*/
|
|
3118
|
-
if (symbol === undefined) {
|
|
3119
|
-
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
3120
|
-
}
|
|
3121
3126
|
await this.loadMarkets();
|
|
3122
|
-
|
|
3127
|
+
let market = undefined;
|
|
3128
|
+
if (symbol !== undefined) {
|
|
3129
|
+
market = this.market(symbol);
|
|
3130
|
+
}
|
|
3123
3131
|
const request = {};
|
|
3124
3132
|
if (limit !== undefined) {
|
|
3125
3133
|
limit = Math.min(200, limit);
|
|
3126
3134
|
request['limit'] = limit;
|
|
3127
3135
|
}
|
|
3128
|
-
|
|
3136
|
+
const isUSDTSettled = (symbol === undefined) || (this.safeString(market, 'settle') === 'USDT');
|
|
3137
|
+
if (isUSDTSettled) {
|
|
3129
3138
|
request['currency'] = 'USDT';
|
|
3130
3139
|
request['offset'] = 0;
|
|
3131
3140
|
if (limit === undefined) {
|
|
@@ -3138,18 +3147,12 @@ export default class phemex extends Exchange {
|
|
|
3138
3147
|
if (since !== undefined) {
|
|
3139
3148
|
request['start'] = since;
|
|
3140
3149
|
}
|
|
3141
|
-
if (market['swap'] && (limit !== undefined)) {
|
|
3142
|
-
request['limit'] = limit;
|
|
3143
|
-
}
|
|
3144
|
-
const isUSDTSettled = market['settle'] === 'USDT';
|
|
3145
3150
|
let response = undefined;
|
|
3146
|
-
if (
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
|
|
3152
|
-
}
|
|
3151
|
+
if (isUSDTSettled) {
|
|
3152
|
+
response = await this.privateGetExchangeOrderV2TradingList(this.extend(request, params));
|
|
3153
|
+
}
|
|
3154
|
+
else if (market['swap']) {
|
|
3155
|
+
response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
|
|
3153
3156
|
}
|
|
3154
3157
|
else {
|
|
3155
3158
|
response = await this.privateGetExchangeSpotOrderTrades(this.extend(request, params));
|
package/js/src/pro/binance.js
CHANGED
|
@@ -1084,7 +1084,7 @@ export default class binance extends binanceRest {
|
|
|
1084
1084
|
const isSpot = ((client.url.indexOf('/stream') > -1) || (client.url.indexOf('/testnet.binance') > -1));
|
|
1085
1085
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
1086
1086
|
let rawTickers = [];
|
|
1087
|
-
const newTickers =
|
|
1087
|
+
const newTickers = {};
|
|
1088
1088
|
if (Array.isArray(message)) {
|
|
1089
1089
|
rawTickers = message;
|
|
1090
1090
|
}
|
|
@@ -1096,7 +1096,7 @@ export default class binance extends binanceRest {
|
|
|
1096
1096
|
const result = this.parseWsTicker(ticker, marketType);
|
|
1097
1097
|
const symbol = result['symbol'];
|
|
1098
1098
|
this.tickers[symbol] = result;
|
|
1099
|
-
newTickers
|
|
1099
|
+
newTickers[symbol] = result;
|
|
1100
1100
|
}
|
|
1101
1101
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
1102
1102
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import coinoneRest from '../coinone.js';
|
|
2
|
+
import type { Int, Market, OrderBook, Ticker, Trade } from '../base/types.js';
|
|
3
|
+
import Client from '../base/ws/Client.js';
|
|
4
|
+
export default class coinone extends coinoneRest {
|
|
5
|
+
describe(): any;
|
|
6
|
+
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
7
|
+
handleOrderBook(client: any, message: any): void;
|
|
8
|
+
handleDelta(bookside: any, delta: any): void;
|
|
9
|
+
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
10
|
+
handleTicker(client: Client, message: any): void;
|
|
11
|
+
parseWsTicker(ticker: any, market?: Market): Ticker;
|
|
12
|
+
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
13
|
+
handleTrades(client: Client, message: any): void;
|
|
14
|
+
parseWsTrade(trade: any, market?: Market): Trade;
|
|
15
|
+
handleErrorMessage(client: Client, message: any): boolean;
|
|
16
|
+
handleMessage(client: Client, message: any): void;
|
|
17
|
+
ping(client: any): {
|
|
18
|
+
request_type: string;
|
|
19
|
+
};
|
|
20
|
+
handlePong(client: Client, message: any): any;
|
|
21
|
+
}
|