ccxt 4.4.60 → 4.4.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +56 -34
- package/dist/cjs/src/bingx.js +6 -7
- package/dist/cjs/src/bybit.js +113 -2
- package/dist/cjs/src/gate.js +77 -12
- package/dist/cjs/src/kraken.js +2 -2
- package/dist/cjs/src/phemex.js +226 -4
- package/dist/cjs/src/pro/binance.js +26 -11
- package/dist/cjs/src/pro/gate.js +35 -0
- package/dist/cjs/src/pro/lbank.js +11 -4
- package/dist/cjs/src/pro/myokx.js +10 -1
- package/dist/cjs/src/whitebit.js +3 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +56 -34
- package/js/src/bingx.js +6 -7
- package/js/src/bybit.d.ts +22 -0
- package/js/src/bybit.js +113 -2
- package/js/src/gate.js +77 -12
- package/js/src/kraken.js +2 -2
- package/js/src/phemex.d.ts +42 -1
- package/js/src/phemex.js +226 -4
- package/js/src/pro/binance.d.ts +8 -0
- package/js/src/pro/binance.js +26 -11
- package/js/src/pro/gate.js +35 -0
- package/js/src/pro/lbank.js +11 -4
- package/js/src/pro/myokx.js +10 -1
- package/js/src/whitebit.js +3 -1
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -49,6 +49,7 @@ export default class Exchange {
|
|
|
49
49
|
};
|
|
50
50
|
this.headers = {};
|
|
51
51
|
this.origin = '*'; // CORS origin
|
|
52
|
+
this.MAX_VALUE = Number.MAX_VALUE;
|
|
52
53
|
//
|
|
53
54
|
this.agent = undefined; // maintained for backwards compatibility
|
|
54
55
|
this.nodeHttpModuleLoaded = false;
|
|
@@ -341,18 +342,8 @@ export default class Exchange {
|
|
|
341
342
|
if (this.api) {
|
|
342
343
|
this.defineRestApi(this.api, 'request');
|
|
343
344
|
}
|
|
344
|
-
// init the request rate limiter
|
|
345
|
-
this.initRestRateLimiter();
|
|
346
|
-
// init predefined markets if any
|
|
347
|
-
if (this.markets) {
|
|
348
|
-
this.setMarkets(this.markets);
|
|
349
|
-
}
|
|
350
345
|
this.newUpdates = (this.options.newUpdates !== undefined) ? this.options.newUpdates : true;
|
|
351
346
|
this.afterConstruct();
|
|
352
|
-
const isSandbox = this.safeBool2(this.options, 'sandbox', 'testnet', false);
|
|
353
|
-
if (isSandbox) {
|
|
354
|
-
this.setSandboxMode(isSandbox);
|
|
355
|
-
}
|
|
356
347
|
}
|
|
357
348
|
encodeURIComponent(...args) {
|
|
358
349
|
// @ts-expect-error
|
|
@@ -382,22 +373,12 @@ export default class Exchange {
|
|
|
382
373
|
}
|
|
383
374
|
return result;
|
|
384
375
|
}
|
|
385
|
-
initRestRateLimiter() {
|
|
386
|
-
if (this.rateLimit === undefined) {
|
|
387
|
-
throw new Error(this.id + '.rateLimit property is not configured');
|
|
388
|
-
}
|
|
389
|
-
this.tokenBucket = this.extend({
|
|
390
|
-
delay: 0.001,
|
|
391
|
-
capacity: 1,
|
|
392
|
-
cost: 1,
|
|
393
|
-
maxCapacity: 1000,
|
|
394
|
-
refillRate: (this.rateLimit > 0) ? 1 / this.rateLimit : Number.MAX_VALUE,
|
|
395
|
-
}, this.tokenBucket);
|
|
396
|
-
this.throttler = new Throttler(this.tokenBucket);
|
|
397
|
-
}
|
|
398
376
|
throttle(cost = undefined) {
|
|
399
377
|
return this.throttler.throttle(cost);
|
|
400
378
|
}
|
|
379
|
+
initThrottler() {
|
|
380
|
+
this.throttler = new Throttler(this.tokenBucket);
|
|
381
|
+
}
|
|
401
382
|
defineRestApiEndpoint(methodName, uppercaseMethod, lowercaseMethod, camelcaseMethod, path, paths, config = {}) {
|
|
402
383
|
const splitPath = path.split(/[^a-zA-Z0-9]/);
|
|
403
384
|
const camelcaseSuffix = splitPath.map(this.capitalize).join('');
|
|
@@ -2322,8 +2303,39 @@ export default class Exchange {
|
|
|
2322
2303
|
return timestamp;
|
|
2323
2304
|
}
|
|
2324
2305
|
afterConstruct() {
|
|
2306
|
+
// networks
|
|
2325
2307
|
this.createNetworksByIdObject();
|
|
2326
2308
|
this.featuresGenerator();
|
|
2309
|
+
// init predefined markets if any
|
|
2310
|
+
if (this.markets) {
|
|
2311
|
+
this.setMarkets(this.markets);
|
|
2312
|
+
}
|
|
2313
|
+
// init the request rate limiter
|
|
2314
|
+
this.initRestRateLimiter();
|
|
2315
|
+
// sanbox mode
|
|
2316
|
+
const isSandbox = this.safeBool2(this.options, 'sandbox', 'testnet', false);
|
|
2317
|
+
if (isSandbox) {
|
|
2318
|
+
this.setSandboxMode(isSandbox);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
initRestRateLimiter() {
|
|
2322
|
+
if (this.rateLimit === undefined || (this.id !== undefined && this.rateLimit === -1)) {
|
|
2323
|
+
throw new ExchangeError(this.id + '.rateLimit property is not configured');
|
|
2324
|
+
}
|
|
2325
|
+
let refillRate = this.MAX_VALUE;
|
|
2326
|
+
if (this.rateLimit > 0) {
|
|
2327
|
+
refillRate = 1 / this.rateLimit;
|
|
2328
|
+
}
|
|
2329
|
+
const defaultBucket = {
|
|
2330
|
+
'delay': 0.001,
|
|
2331
|
+
'capacity': 1,
|
|
2332
|
+
'cost': 1,
|
|
2333
|
+
'maxCapacity': 1000,
|
|
2334
|
+
'refillRate': refillRate,
|
|
2335
|
+
};
|
|
2336
|
+
const existingBucket = (this.tokenBucket === undefined) ? {} : this.tokenBucket;
|
|
2337
|
+
this.tokenBucket = this.extend(defaultBucket, existingBucket);
|
|
2338
|
+
this.initThrottler();
|
|
2327
2339
|
}
|
|
2328
2340
|
featuresGenerator() {
|
|
2329
2341
|
//
|
|
@@ -4594,24 +4606,34 @@ export default class Exchange {
|
|
|
4594
4606
|
* @param {string} [defaultValue] assigned programatically in the method calling handleMarketTypeAndParams
|
|
4595
4607
|
* @returns {[string, object]} the market type and params with type and defaultType omitted
|
|
4596
4608
|
*/
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4609
|
+
// type from param
|
|
4610
|
+
const type = this.safeString2(params, 'defaultType', 'type');
|
|
4611
|
+
if (type !== undefined) {
|
|
4612
|
+
params = this.omit(params, ['defaultType', 'type']);
|
|
4613
|
+
return [type, params];
|
|
4614
|
+
}
|
|
4615
|
+
// type from market
|
|
4616
|
+
if (market !== undefined) {
|
|
4617
|
+
return [market['type'], params];
|
|
4618
|
+
}
|
|
4619
|
+
// type from default-argument
|
|
4620
|
+
if (defaultValue !== undefined) {
|
|
4621
|
+
return [defaultValue, params];
|
|
4600
4622
|
}
|
|
4601
4623
|
const methodOptions = this.safeDict(this.options, methodName);
|
|
4602
|
-
|
|
4603
|
-
if (methodOptions !== undefined) { // user defined methodType takes precedence over defaultValue
|
|
4624
|
+
if (methodOptions !== undefined) {
|
|
4604
4625
|
if (typeof methodOptions === 'string') {
|
|
4605
|
-
|
|
4626
|
+
return [methodOptions, params];
|
|
4606
4627
|
}
|
|
4607
4628
|
else {
|
|
4608
|
-
|
|
4629
|
+
const typeFromMethod = this.safeString2(methodOptions, 'defaultType', 'type');
|
|
4630
|
+
if (typeFromMethod !== undefined) {
|
|
4631
|
+
return [typeFromMethod, params];
|
|
4632
|
+
}
|
|
4609
4633
|
}
|
|
4610
4634
|
}
|
|
4611
|
-
const
|
|
4612
|
-
|
|
4613
|
-
params = this.omit(params, ['defaultType', 'type']);
|
|
4614
|
-
return [type, params];
|
|
4635
|
+
const defaultType = this.safeString2(this.options, 'defaultType', 'type', 'spot');
|
|
4636
|
+
return [defaultType, params];
|
|
4615
4637
|
}
|
|
4616
4638
|
handleSubTypeAndParams(methodName, market = undefined, params = {}, defaultValue = undefined) {
|
|
4617
4639
|
let subType = undefined;
|
package/js/src/bingx.js
CHANGED
|
@@ -4670,14 +4670,13 @@ export default class bingx extends Exchange {
|
|
|
4670
4670
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4671
4671
|
*/
|
|
4672
4672
|
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4673
|
-
if (symbol === undefined) {
|
|
4674
|
-
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
4675
|
-
}
|
|
4676
4673
|
await this.loadMarkets();
|
|
4677
|
-
|
|
4678
|
-
const request = {
|
|
4679
|
-
|
|
4680
|
-
|
|
4674
|
+
let market = undefined;
|
|
4675
|
+
const request = {};
|
|
4676
|
+
if (symbol !== undefined) {
|
|
4677
|
+
market = this.market(symbol);
|
|
4678
|
+
request['symbol'] = market['id'];
|
|
4679
|
+
}
|
|
4681
4680
|
let type = undefined;
|
|
4682
4681
|
let subType = undefined;
|
|
4683
4682
|
let standard = undefined;
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -87,6 +87,18 @@ export default class bybit extends Exchange {
|
|
|
87
87
|
* @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
88
88
|
*/
|
|
89
89
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
90
|
+
/**
|
|
91
|
+
* @method
|
|
92
|
+
* @name bybit#fetchBidsAsks
|
|
93
|
+
* @description fetches the bid and ask price and volume for multiple markets
|
|
94
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/tickers
|
|
95
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
96
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
97
|
+
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
98
|
+
* @param {string} [params.baseCoin] *option only* base coin, default is 'BTC'
|
|
99
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
100
|
+
*/
|
|
101
|
+
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
90
102
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
91
103
|
/**
|
|
92
104
|
* @method
|
|
@@ -267,6 +279,16 @@ export default class bybit extends Exchange {
|
|
|
267
279
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
268
280
|
*/
|
|
269
281
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
282
|
+
/**
|
|
283
|
+
* @method
|
|
284
|
+
* @name bybit#editOrders
|
|
285
|
+
* @description edit a list of trade orders
|
|
286
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/batch-amend
|
|
287
|
+
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
288
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
289
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
290
|
+
*/
|
|
291
|
+
editOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
270
292
|
cancelOrderRequest(id: string, symbol?: Str, params?: {}): any;
|
|
271
293
|
/**
|
|
272
294
|
* @method
|
package/js/src/bybit.js
CHANGED
|
@@ -59,7 +59,9 @@ export default class bybit extends Exchange {
|
|
|
59
59
|
'createTrailingAmountOrder': true,
|
|
60
60
|
'createTriggerOrder': true,
|
|
61
61
|
'editOrder': true,
|
|
62
|
+
'editOrders': true,
|
|
62
63
|
'fetchBalance': true,
|
|
64
|
+
'fetchBidsAsks': 'emulated',
|
|
63
65
|
'fetchBorrowInterest': false,
|
|
64
66
|
'fetchBorrowRateHistories': false,
|
|
65
67
|
'fetchBorrowRateHistory': false,
|
|
@@ -240,6 +242,7 @@ export default class bybit extends Exchange {
|
|
|
240
242
|
'v5/spot-lever-token/reference': 5,
|
|
241
243
|
// spot margin trade
|
|
242
244
|
'v5/spot-margin-trade/data': 5,
|
|
245
|
+
'v5/spot-margin-trade/collateral': 5,
|
|
243
246
|
'v5/spot-cross-margin-trade/data': 5,
|
|
244
247
|
'v5/spot-cross-margin-trade/pledge-token': 5,
|
|
245
248
|
'v5/spot-cross-margin-trade/borrow-token': 5,
|
|
@@ -1225,6 +1228,9 @@ export default class bybit extends Exchange {
|
|
|
1225
1228
|
'fetchOHLCV': {
|
|
1226
1229
|
'limit': 1000,
|
|
1227
1230
|
},
|
|
1231
|
+
'editOrders': {
|
|
1232
|
+
'max': 10,
|
|
1233
|
+
},
|
|
1228
1234
|
},
|
|
1229
1235
|
'spot': {
|
|
1230
1236
|
'extends': 'default',
|
|
@@ -2527,6 +2533,20 @@ export default class bybit extends Exchange {
|
|
|
2527
2533
|
const tickerList = this.safeList(result, 'list', []);
|
|
2528
2534
|
return this.parseTickers(tickerList, parsedSymbols);
|
|
2529
2535
|
}
|
|
2536
|
+
/**
|
|
2537
|
+
* @method
|
|
2538
|
+
* @name bybit#fetchBidsAsks
|
|
2539
|
+
* @description fetches the bid and ask price and volume for multiple markets
|
|
2540
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/tickers
|
|
2541
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
2542
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2543
|
+
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
2544
|
+
* @param {string} [params.baseCoin] *option only* base coin, default is 'BTC'
|
|
2545
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2546
|
+
*/
|
|
2547
|
+
async fetchBidsAsks(symbols = undefined, params = {}) {
|
|
2548
|
+
return await this.fetchTickers(symbols, params);
|
|
2549
|
+
}
|
|
2530
2550
|
parseOHLCV(ohlcv, market = undefined) {
|
|
2531
2551
|
//
|
|
2532
2552
|
// [
|
|
@@ -4210,14 +4230,16 @@ export default class bybit extends Exchange {
|
|
|
4210
4230
|
const price = this.safeValue(rawOrder, 'price');
|
|
4211
4231
|
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
4212
4232
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams, isUta);
|
|
4233
|
+
delete orderRequest['category'];
|
|
4213
4234
|
ordersRequests.push(orderRequest);
|
|
4214
4235
|
}
|
|
4215
4236
|
const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
|
4216
4237
|
const market = this.market(symbols[0]);
|
|
4238
|
+
const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 3);
|
|
4217
4239
|
let category = undefined;
|
|
4218
4240
|
[category, params] = this.getBybitType('createOrders', market, params);
|
|
4219
|
-
if (category === 'inverse') {
|
|
4220
|
-
throw new NotSupported(this.id + ' createOrders does not allow inverse orders');
|
|
4241
|
+
if ((category === 'inverse') && (unifiedMarginStatus < 5)) {
|
|
4242
|
+
throw new NotSupported(this.id + ' createOrders does not allow inverse orders for non UTA2.0 account');
|
|
4221
4243
|
}
|
|
4222
4244
|
const request = {
|
|
4223
4245
|
'category': category,
|
|
@@ -4400,6 +4422,95 @@ export default class bybit extends Exchange {
|
|
|
4400
4422
|
'id': this.safeString(result, 'orderId'),
|
|
4401
4423
|
});
|
|
4402
4424
|
}
|
|
4425
|
+
/**
|
|
4426
|
+
* @method
|
|
4427
|
+
* @name bybit#editOrders
|
|
4428
|
+
* @description edit a list of trade orders
|
|
4429
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/batch-amend
|
|
4430
|
+
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
4431
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4432
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4433
|
+
*/
|
|
4434
|
+
async editOrders(orders, params = {}) {
|
|
4435
|
+
await this.loadMarkets();
|
|
4436
|
+
const ordersRequests = [];
|
|
4437
|
+
let orderSymbols = [];
|
|
4438
|
+
for (let i = 0; i < orders.length; i++) {
|
|
4439
|
+
const rawOrder = orders[i];
|
|
4440
|
+
const symbol = this.safeString(rawOrder, 'symbol');
|
|
4441
|
+
orderSymbols.push(symbol);
|
|
4442
|
+
const id = this.safeString(rawOrder, 'id');
|
|
4443
|
+
const type = this.safeString(rawOrder, 'type');
|
|
4444
|
+
const side = this.safeString(rawOrder, 'side');
|
|
4445
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
4446
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
4447
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
4448
|
+
const orderRequest = this.editOrderRequest(id, symbol, type, side, amount, price, orderParams);
|
|
4449
|
+
delete orderRequest['category'];
|
|
4450
|
+
ordersRequests.push(orderRequest);
|
|
4451
|
+
}
|
|
4452
|
+
orderSymbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
|
4453
|
+
const market = this.market(orderSymbols[0]);
|
|
4454
|
+
const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 3);
|
|
4455
|
+
let category = undefined;
|
|
4456
|
+
[category, params] = this.getBybitType('editOrders', market, params);
|
|
4457
|
+
if ((category === 'inverse') && (unifiedMarginStatus < 5)) {
|
|
4458
|
+
throw new NotSupported(this.id + ' editOrders does not allow inverse orders for non UTA2.0 account');
|
|
4459
|
+
}
|
|
4460
|
+
const request = {
|
|
4461
|
+
'category': category,
|
|
4462
|
+
'request': ordersRequests,
|
|
4463
|
+
};
|
|
4464
|
+
const response = await this.privatePostV5OrderAmendBatch(this.extend(request, params));
|
|
4465
|
+
const result = this.safeDict(response, 'result', {});
|
|
4466
|
+
const data = this.safeList(result, 'list', []);
|
|
4467
|
+
const retInfo = this.safeDict(response, 'retExtInfo', {});
|
|
4468
|
+
const codes = this.safeList(retInfo, 'list', []);
|
|
4469
|
+
// extend the error with the unsuccessful orders
|
|
4470
|
+
for (let i = 0; i < codes.length; i++) {
|
|
4471
|
+
const code = codes[i];
|
|
4472
|
+
const retCode = this.safeInteger(code, 'code');
|
|
4473
|
+
if (retCode !== 0) {
|
|
4474
|
+
data[i] = this.extend(data[i], code);
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
//
|
|
4478
|
+
// {
|
|
4479
|
+
// "retCode": 0,
|
|
4480
|
+
// "retMsg": "OK",
|
|
4481
|
+
// "result": {
|
|
4482
|
+
// "list": [
|
|
4483
|
+
// {
|
|
4484
|
+
// "category": "option",
|
|
4485
|
+
// "symbol": "ETH-30DEC22-500-C",
|
|
4486
|
+
// "orderId": "b551f227-7059-4fb5-a6a6-699c04dbd2f2",
|
|
4487
|
+
// "orderLinkId": ""
|
|
4488
|
+
// },
|
|
4489
|
+
// {
|
|
4490
|
+
// "category": "option",
|
|
4491
|
+
// "symbol": "ETH-30DEC22-700-C",
|
|
4492
|
+
// "orderId": "fa6a595f-1a57-483f-b9d3-30e9c8235a52",
|
|
4493
|
+
// "orderLinkId": ""
|
|
4494
|
+
// }
|
|
4495
|
+
// ]
|
|
4496
|
+
// },
|
|
4497
|
+
// "retExtInfo": {
|
|
4498
|
+
// "list": [
|
|
4499
|
+
// {
|
|
4500
|
+
// "code": 0,
|
|
4501
|
+
// "msg": "OK"
|
|
4502
|
+
// },
|
|
4503
|
+
// {
|
|
4504
|
+
// "code": 0,
|
|
4505
|
+
// "msg": "OK"
|
|
4506
|
+
// }
|
|
4507
|
+
// ]
|
|
4508
|
+
// },
|
|
4509
|
+
// "time": 1672222808060
|
|
4510
|
+
// }
|
|
4511
|
+
//
|
|
4512
|
+
return this.parseOrders(data);
|
|
4513
|
+
}
|
|
4403
4514
|
cancelOrderRequest(id, symbol = undefined, params = {}) {
|
|
4404
4515
|
const market = this.market(symbol);
|
|
4405
4516
|
const request = {
|
package/js/src/gate.js
CHANGED
|
@@ -659,23 +659,67 @@ export default class gate extends Exchange {
|
|
|
659
659
|
},
|
|
660
660
|
'createMarketBuyOrderRequiresPrice': true,
|
|
661
661
|
'networks': {
|
|
662
|
-
'
|
|
663
|
-
'
|
|
664
|
-
'
|
|
662
|
+
'BTC': 'BTC',
|
|
663
|
+
'BRC20': 'BTCBRC',
|
|
664
|
+
'ETH': 'ETH',
|
|
665
|
+
'ERC20': 'ETH',
|
|
666
|
+
'TRX': 'TRX',
|
|
667
|
+
'TRC20': 'TRX',
|
|
668
|
+
'HECO': 'HT',
|
|
669
|
+
'HRC20': 'HT',
|
|
670
|
+
'BSC': 'BSC',
|
|
665
671
|
'BEP20': 'BSC',
|
|
672
|
+
'SOL': 'SOL',
|
|
673
|
+
'POLYGON': 'POL',
|
|
674
|
+
'MATIC': 'POL',
|
|
675
|
+
'OP': 'OPETH',
|
|
676
|
+
'OPTIMISM': 'OPETH',
|
|
677
|
+
'ADA': 'ADA',
|
|
678
|
+
'AVAXC': 'AVAX_C',
|
|
679
|
+
'NEAR': 'NEAR',
|
|
680
|
+
'ARBONE': 'ARBEVM',
|
|
681
|
+
'BASE': 'BASEEVM',
|
|
682
|
+
'SUI': 'SUI',
|
|
683
|
+
'CRONOS': 'CRO',
|
|
684
|
+
'CRO': 'CRO',
|
|
685
|
+
'APT': 'APT',
|
|
686
|
+
'SCROLL': 'SCROLLETH',
|
|
687
|
+
'TAIKO': 'TAIKOETH',
|
|
688
|
+
'HYPE': 'HYPE',
|
|
689
|
+
'ALGO': 'ALGO',
|
|
690
|
+
// KAVA: ['KAVA', 'KAVAEVM']
|
|
691
|
+
// SEI: ['SEI', 'SEIEVM']
|
|
692
|
+
'LINEA': 'LINEAETH',
|
|
693
|
+
'BLAST': 'BLASTETH',
|
|
694
|
+
'XLM': 'XLM',
|
|
695
|
+
'RSK': 'RBTC',
|
|
696
|
+
'TON': 'TON',
|
|
697
|
+
'MNT': 'MNT',
|
|
698
|
+
// 'RUNE': 'BTCRUNES', probably, cant verify atm
|
|
699
|
+
'CELO': 'CELO',
|
|
700
|
+
'HBAR': 'HBAR',
|
|
701
|
+
// 'FTM': SONIC REBRAND, todo
|
|
702
|
+
'ZKSERA': 'ZKSERA',
|
|
703
|
+
'KLAY': 'KLAY',
|
|
666
704
|
'EOS': 'EOS',
|
|
667
|
-
'
|
|
705
|
+
'ACA': 'ACA',
|
|
706
|
+
// TLOS: ['TLOS', 'TLOSEVM']
|
|
707
|
+
// ASTR: ['ASTR', 'ASTREVM']
|
|
708
|
+
// CFX: ['CFX', 'CFXEVM']
|
|
709
|
+
'XTZ': 'XTZ',
|
|
710
|
+
'EGLD': 'EGLD',
|
|
711
|
+
'GLMR': 'GLMR',
|
|
712
|
+
'AURORA': 'AURORAEVM',
|
|
713
|
+
// others
|
|
714
|
+
'KON': 'KONET',
|
|
668
715
|
'GATECHAIN': 'GTEVM',
|
|
669
|
-
'HRC20': 'HT',
|
|
670
716
|
'KUSAMA': 'KSMSM',
|
|
671
|
-
'NEAR': 'NEAR',
|
|
672
717
|
'OKC': 'OKT',
|
|
673
|
-
'OPTIMISM': 'OPETH',
|
|
674
718
|
'POLKADOT': 'DOTSM',
|
|
675
|
-
'TRC20': 'TRX',
|
|
676
719
|
'LUNA': 'LUNC',
|
|
677
|
-
|
|
678
|
-
|
|
720
|
+
},
|
|
721
|
+
'networksById': {
|
|
722
|
+
'OPETH': 'OP',
|
|
679
723
|
},
|
|
680
724
|
'timeInForce': {
|
|
681
725
|
'GTC': 'gtc',
|
|
@@ -3678,6 +3722,7 @@ export default class gate extends Exchange {
|
|
|
3678
3722
|
//
|
|
3679
3723
|
// public
|
|
3680
3724
|
//
|
|
3725
|
+
// spot:
|
|
3681
3726
|
// {
|
|
3682
3727
|
// "id": "1334253759",
|
|
3683
3728
|
// "create_time": "1626342738",
|
|
@@ -3688,6 +3733,18 @@ export default class gate extends Exchange {
|
|
|
3688
3733
|
// "price": "32452.16"
|
|
3689
3734
|
// }
|
|
3690
3735
|
//
|
|
3736
|
+
// swap:
|
|
3737
|
+
//
|
|
3738
|
+
// {
|
|
3739
|
+
// "id": "442288327",
|
|
3740
|
+
// "contract": "BTC_USDT",
|
|
3741
|
+
// "create_time": "1739814676.707",
|
|
3742
|
+
// "create_time_ms": "1739814676.707",
|
|
3743
|
+
// "size": "-105",
|
|
3744
|
+
// "price": "95594.8"
|
|
3745
|
+
// }
|
|
3746
|
+
//
|
|
3747
|
+
//
|
|
3691
3748
|
// public ws
|
|
3692
3749
|
//
|
|
3693
3750
|
// {
|
|
@@ -3764,8 +3821,16 @@ export default class gate extends Exchange {
|
|
|
3764
3821
|
// }
|
|
3765
3822
|
//
|
|
3766
3823
|
const id = this.safeString2(trade, 'id', 'trade_id');
|
|
3767
|
-
let timestamp =
|
|
3768
|
-
|
|
3824
|
+
let timestamp = undefined;
|
|
3825
|
+
let msString = this.safeString(trade, 'create_time_ms');
|
|
3826
|
+
if (msString !== undefined) {
|
|
3827
|
+
msString = Precise.stringMul(msString, '1000');
|
|
3828
|
+
msString = msString.slice(0, 13);
|
|
3829
|
+
timestamp = this.parseToInt(msString);
|
|
3830
|
+
}
|
|
3831
|
+
else {
|
|
3832
|
+
timestamp = this.safeTimestamp2(trade, 'time', 'create_time');
|
|
3833
|
+
}
|
|
3769
3834
|
const marketId = this.safeString2(trade, 'currency_pair', 'contract');
|
|
3770
3835
|
const marketType = ('contract' in trade) ? 'contract' : 'spot';
|
|
3771
3836
|
market = this.safeMarket(marketId, market, '_', marketType);
|
package/js/src/kraken.js
CHANGED
|
@@ -979,9 +979,9 @@ export default class kraken extends Exchange {
|
|
|
979
979
|
'high': this.safeString(high, 1),
|
|
980
980
|
'low': this.safeString(low, 1),
|
|
981
981
|
'bid': this.safeString(bid, 0),
|
|
982
|
-
'bidVolume':
|
|
982
|
+
'bidVolume': this.safeString(bid, 2),
|
|
983
983
|
'ask': this.safeString(ask, 0),
|
|
984
|
-
'askVolume':
|
|
984
|
+
'askVolume': this.safeString(ask, 2),
|
|
985
985
|
'vwap': vwap,
|
|
986
986
|
'open': this.safeString(ticker, 'o'),
|
|
987
987
|
'close': last,
|
package/js/src/phemex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/phemex.js';
|
|
2
|
-
import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, MarginModification, Currencies, Dict, LeverageTier, LeverageTiers, int, FundingRate, DepositAddress } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, MarginModification, Currencies, Dict, LeverageTier, LeverageTiers, int, FundingRate, DepositAddress, Conversion } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class phemex
|
|
5
5
|
* @augments Exchange
|
|
@@ -451,5 +451,46 @@ export default class phemex extends Exchange {
|
|
|
451
451
|
*/
|
|
452
452
|
fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
|
|
453
453
|
parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
|
|
454
|
+
/**
|
|
455
|
+
* @method
|
|
456
|
+
* @name phemex#fetchConvertQuote
|
|
457
|
+
* @description fetch a quote for converting from one currency to another
|
|
458
|
+
* @see https://phemex-docs.github.io/#rfq-quote
|
|
459
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
460
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
461
|
+
* @param {float} amount how much you want to trade in units of the from currency
|
|
462
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
463
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
464
|
+
*/
|
|
465
|
+
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
466
|
+
/**
|
|
467
|
+
* @method
|
|
468
|
+
* @name phemex#createConvertTrade
|
|
469
|
+
* @description convert from one currency to another
|
|
470
|
+
* @see https://phemex-docs.github.io/#convert
|
|
471
|
+
* @param {string} id the id of the trade that you want to make
|
|
472
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
473
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
474
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
475
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
476
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
477
|
+
*/
|
|
478
|
+
createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
479
|
+
/**
|
|
480
|
+
* @method
|
|
481
|
+
* @name phemex#fetchConvertTradeHistory
|
|
482
|
+
* @description fetch the users history of conversion trades
|
|
483
|
+
* @see https://phemex-docs.github.io/#query-convert-history
|
|
484
|
+
* @param {string} [code] the unified currency code
|
|
485
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
486
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve, default 20, max 200
|
|
487
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
488
|
+
* @param {string} [params.until] the end time in ms
|
|
489
|
+
* @param {string} [params.fromCurrency] the currency that you sold and converted from
|
|
490
|
+
* @param {string} [params.toCurrency] the currency that you bought and converted into
|
|
491
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
492
|
+
*/
|
|
493
|
+
fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
|
|
494
|
+
parseConversion(conversion: Dict, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
454
495
|
handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
455
496
|
}
|