ccxt 4.3.46 → 4.3.48
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/functions/number.js +2 -2
- package/dist/cjs/src/binance.js +6 -3
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/gate.js +103 -54
- package/dist/cjs/src/hyperliquid.js +27 -0
- package/dist/cjs/src/krakenfutures.js +5 -1
- package/dist/cjs/src/pro/bingx.js +5 -5
- package/dist/cjs/src/pro/coinex.js +3 -2
- package/dist/cjs/src/pro/gate.js +365 -34
- package/dist/cjs/src/woo.js +6 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/krakenfutures.d.ts +4 -0
- package/js/src/base/functions/number.js +2 -2
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +6 -3
- package/js/src/bitget.js +1 -1
- package/js/src/bitmart.js +1 -1
- package/js/src/gate.d.ts +4 -0
- package/js/src/gate.js +103 -54
- package/js/src/hyperliquid.d.ts +2 -1
- package/js/src/hyperliquid.js +27 -0
- package/js/src/krakenfutures.js +5 -1
- package/js/src/pro/bingx.js +5 -5
- package/js/src/pro/coinex.js +3 -2
- package/js/src/pro/gate.d.ts +15 -3
- package/js/src/pro/gate.js +366 -35
- package/js/src/woo.js +6 -0
- package/package.json +1 -1
package/js/src/gate.js
CHANGED
|
@@ -782,6 +782,7 @@ export default class gate extends Exchange {
|
|
|
782
782
|
'NOT_ACCEPTABLE': BadRequest,
|
|
783
783
|
'METHOD_NOT_ALLOWED': BadRequest,
|
|
784
784
|
'NOT_FOUND': ExchangeError,
|
|
785
|
+
'AUTHENTICATION_FAILED': AuthenticationError,
|
|
785
786
|
'INVALID_CREDENTIALS': AuthenticationError,
|
|
786
787
|
'INVALID_KEY': AuthenticationError,
|
|
787
788
|
'IP_FORBIDDEN': AuthenticationError,
|
|
@@ -3882,19 +3883,16 @@ export default class gate extends Exchange {
|
|
|
3882
3883
|
//
|
|
3883
3884
|
return this.parseOrder(response, market);
|
|
3884
3885
|
}
|
|
3885
|
-
|
|
3886
|
-
/**
|
|
3887
|
-
* @method
|
|
3888
|
-
* @name gate#createOrders
|
|
3889
|
-
* @description create a list of trade orders
|
|
3890
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
|
3891
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
3892
|
-
* @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
|
|
3893
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3894
|
-
*/
|
|
3895
|
-
await this.loadMarkets();
|
|
3886
|
+
createOrdersRequest(orders, params = {}) {
|
|
3896
3887
|
const ordersRequests = [];
|
|
3897
3888
|
const orderSymbols = [];
|
|
3889
|
+
const ordersLength = orders.length;
|
|
3890
|
+
if (ordersLength === 0) {
|
|
3891
|
+
throw new BadRequest(this.id + ' createOrders() requires at least one order');
|
|
3892
|
+
}
|
|
3893
|
+
if (ordersLength > 10) {
|
|
3894
|
+
throw new BadRequest(this.id + ' createOrders() accepts a maximum of 10 orders at a time');
|
|
3895
|
+
}
|
|
3898
3896
|
for (let i = 0; i < orders.length; i++) {
|
|
3899
3897
|
const rawOrder = orders[i];
|
|
3900
3898
|
const marketId = this.safeString(rawOrder, 'symbol');
|
|
@@ -3918,6 +3916,23 @@ export default class gate extends Exchange {
|
|
|
3918
3916
|
if (market['future'] || market['option']) {
|
|
3919
3917
|
throw new NotSupported(this.id + ' createOrders() does not support futures or options markets');
|
|
3920
3918
|
}
|
|
3919
|
+
return ordersRequests;
|
|
3920
|
+
}
|
|
3921
|
+
async createOrders(orders, params = {}) {
|
|
3922
|
+
/**
|
|
3923
|
+
* @method
|
|
3924
|
+
* @name gate#createOrders
|
|
3925
|
+
* @description create a list of trade orders
|
|
3926
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
|
3927
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
3928
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
|
3929
|
+
* @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
|
|
3930
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3931
|
+
*/
|
|
3932
|
+
await this.loadMarkets();
|
|
3933
|
+
const ordersRequests = this.createOrdersRequest(orders, params);
|
|
3934
|
+
const firstOrder = orders[0];
|
|
3935
|
+
const market = this.market(firstOrder['symbol']);
|
|
3921
3936
|
let response = undefined;
|
|
3922
3937
|
if (market['spot']) {
|
|
3923
3938
|
response = await this.privateSpotPostBatchOrders(ordersRequests);
|
|
@@ -4200,23 +4215,7 @@ export default class gate extends Exchange {
|
|
|
4200
4215
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
4201
4216
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
4202
4217
|
}
|
|
4203
|
-
|
|
4204
|
-
/**
|
|
4205
|
-
* @method
|
|
4206
|
-
* @name gate#editOrder
|
|
4207
|
-
* @description edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4208
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
|
4209
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
|
4210
|
-
* @param {string} id order id
|
|
4211
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
4212
|
-
* @param {string} type 'market' or 'limit'
|
|
4213
|
-
* @param {string} side 'buy' or 'sell'
|
|
4214
|
-
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
4215
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4216
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4217
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4218
|
-
*/
|
|
4219
|
-
await this.loadMarkets();
|
|
4218
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4220
4219
|
const market = this.market(symbol);
|
|
4221
4220
|
const [marketType, query] = this.handleMarketTypeAndParams('editOrder', market, params);
|
|
4222
4221
|
const account = this.convertTypeToAccount(marketType);
|
|
@@ -4228,7 +4227,7 @@ export default class gate extends Exchange {
|
|
|
4228
4227
|
}
|
|
4229
4228
|
}
|
|
4230
4229
|
const request = {
|
|
4231
|
-
'order_id': id,
|
|
4230
|
+
'order_id': id.toString(),
|
|
4232
4231
|
'currency_pair': market['id'],
|
|
4233
4232
|
'account': account,
|
|
4234
4233
|
};
|
|
@@ -4248,13 +4247,36 @@ export default class gate extends Exchange {
|
|
|
4248
4247
|
if (price !== undefined) {
|
|
4249
4248
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4250
4249
|
}
|
|
4250
|
+
if (!market['spot']) {
|
|
4251
|
+
request['settle'] = market['settleId'];
|
|
4252
|
+
}
|
|
4253
|
+
return this.extend(request, query);
|
|
4254
|
+
}
|
|
4255
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4256
|
+
/**
|
|
4257
|
+
* @method
|
|
4258
|
+
* @name gate#editOrder
|
|
4259
|
+
* @description edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4260
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
|
4261
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
|
4262
|
+
* @param {string} id order id
|
|
4263
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4264
|
+
* @param {string} type 'market' or 'limit'
|
|
4265
|
+
* @param {string} side 'buy' or 'sell'
|
|
4266
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
4267
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4268
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4269
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4270
|
+
*/
|
|
4271
|
+
await this.loadMarkets();
|
|
4272
|
+
const market = this.market(symbol);
|
|
4273
|
+
const extendedRequest = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
4251
4274
|
let response = undefined;
|
|
4252
4275
|
if (market['spot']) {
|
|
4253
|
-
response = await this.privateSpotPatchOrdersOrderId(
|
|
4276
|
+
response = await this.privateSpotPatchOrdersOrderId(extendedRequest);
|
|
4254
4277
|
}
|
|
4255
4278
|
else {
|
|
4256
|
-
|
|
4257
|
-
response = await this.privateFuturesPutSettleOrdersOrderId(this.extend(request, query));
|
|
4279
|
+
response = await this.privateFuturesPutSettleOrdersOrderId(extendedRequest);
|
|
4258
4280
|
}
|
|
4259
4281
|
//
|
|
4260
4282
|
// {
|
|
@@ -4568,6 +4590,25 @@ export default class gate extends Exchange {
|
|
|
4568
4590
|
'info': order,
|
|
4569
4591
|
}, market);
|
|
4570
4592
|
}
|
|
4593
|
+
fetchOrderRequest(id, symbol = undefined, params = {}) {
|
|
4594
|
+
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4595
|
+
const stop = this.safeBoolN(params, ['trigger', 'is_stop_order', 'stop'], false);
|
|
4596
|
+
params = this.omit(params, ['is_stop_order', 'stop', 'trigger']);
|
|
4597
|
+
let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
|
|
4598
|
+
let orderId = id;
|
|
4599
|
+
if (clientOrderId !== undefined) {
|
|
4600
|
+
params = this.omit(params, ['text', 'clientOrderId']);
|
|
4601
|
+
if (clientOrderId[0] !== 't') {
|
|
4602
|
+
clientOrderId = 't-' + clientOrderId;
|
|
4603
|
+
}
|
|
4604
|
+
orderId = clientOrderId;
|
|
4605
|
+
}
|
|
4606
|
+
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
4607
|
+
const contract = (type === 'swap') || (type === 'future') || (type === 'option');
|
|
4608
|
+
const [request, requestParams] = contract ? this.prepareRequest(market, type, query) : this.spotOrderPrepareRequest(market, stop, query);
|
|
4609
|
+
request['order_id'] = orderId.toString();
|
|
4610
|
+
return [request, requestParams];
|
|
4611
|
+
}
|
|
4571
4612
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
4572
4613
|
/**
|
|
4573
4614
|
* @method
|
|
@@ -4580,29 +4621,18 @@ export default class gate extends Exchange {
|
|
|
4580
4621
|
* @param {string} id Order id
|
|
4581
4622
|
* @param {string} symbol Unified market symbol, *required for spot and margin*
|
|
4582
4623
|
* @param {object} [params] Parameters specified by the exchange api
|
|
4583
|
-
* @param {bool} [params.
|
|
4624
|
+
* @param {bool} [params.trigger] True if the order being fetched is a trigger order
|
|
4584
4625
|
* @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
|
|
4585
4626
|
* @param {string} [params.type] 'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used
|
|
4586
4627
|
* @param {string} [params.settle] 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol !== undefined, default="usdt" for swap and "btc" for future
|
|
4587
4628
|
* @returns An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4588
4629
|
*/
|
|
4589
4630
|
await this.loadMarkets();
|
|
4590
|
-
const stop = this.safeValue2(params, 'is_stop_order', 'stop', false);
|
|
4591
|
-
params = this.omit(params, ['is_stop_order', 'stop']);
|
|
4592
|
-
let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
|
|
4593
|
-
let orderId = id;
|
|
4594
|
-
if (clientOrderId !== undefined) {
|
|
4595
|
-
params = this.omit(params, ['text', 'clientOrderId']);
|
|
4596
|
-
if (clientOrderId[0] !== 't') {
|
|
4597
|
-
clientOrderId = 't-' + clientOrderId;
|
|
4598
|
-
}
|
|
4599
|
-
orderId = clientOrderId;
|
|
4600
|
-
}
|
|
4601
4631
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4602
|
-
const
|
|
4603
|
-
const
|
|
4604
|
-
const
|
|
4605
|
-
request
|
|
4632
|
+
const result = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
4633
|
+
const type = this.safeString(result, 0);
|
|
4634
|
+
const stop = this.safeBoolN(params, ['trigger', 'is_stop_order', 'stop'], false);
|
|
4635
|
+
const [request, requestParams] = this.fetchOrderRequest(id, symbol, params);
|
|
4606
4636
|
let response = undefined;
|
|
4607
4637
|
if (type === 'spot' || type === 'margin') {
|
|
4608
4638
|
if (stop) {
|
|
@@ -4676,15 +4706,14 @@ export default class gate extends Exchange {
|
|
|
4676
4706
|
*/
|
|
4677
4707
|
return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
|
|
4678
4708
|
}
|
|
4679
|
-
|
|
4680
|
-
await this.loadMarkets();
|
|
4709
|
+
fetchOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4681
4710
|
let market = undefined;
|
|
4682
4711
|
if (symbol !== undefined) {
|
|
4683
4712
|
market = this.market(symbol);
|
|
4684
4713
|
symbol = market['symbol'];
|
|
4685
4714
|
}
|
|
4686
|
-
const stop = this.
|
|
4687
|
-
params = this.omit(params, 'stop');
|
|
4715
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4716
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
4688
4717
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4689
4718
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4690
4719
|
const [request, requestParams] = spot ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
@@ -4698,6 +4727,26 @@ export default class gate extends Exchange {
|
|
|
4698
4727
|
if (since !== undefined && spot) {
|
|
4699
4728
|
request['from'] = this.parseToInt(since / 1000);
|
|
4700
4729
|
}
|
|
4730
|
+
const [lastId, finalParams] = this.handleParamString2(requestParams, 'lastId', 'last_id');
|
|
4731
|
+
if (lastId !== undefined) {
|
|
4732
|
+
request['last_id'] = lastId;
|
|
4733
|
+
}
|
|
4734
|
+
return [request, finalParams];
|
|
4735
|
+
}
|
|
4736
|
+
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4737
|
+
await this.loadMarkets();
|
|
4738
|
+
let market = undefined;
|
|
4739
|
+
if (symbol !== undefined) {
|
|
4740
|
+
market = this.market(symbol);
|
|
4741
|
+
symbol = market['symbol'];
|
|
4742
|
+
}
|
|
4743
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4744
|
+
params = this.omit(params, ['trigger', 'stop']);
|
|
4745
|
+
const res = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4746
|
+
const type = this.safeString(res, 0);
|
|
4747
|
+
params['type'] = type;
|
|
4748
|
+
const [request, requestParams] = this.fetchOrdersByStatusRequest(status, symbol, since, limit, params);
|
|
4749
|
+
const spot = (type === 'spot') || (type === 'margin');
|
|
4701
4750
|
const openSpotOrders = spot && (status === 'open') && !stop;
|
|
4702
4751
|
let response = undefined;
|
|
4703
4752
|
if (type === 'spot' || type === 'margin') {
|
|
@@ -4907,8 +4956,8 @@ export default class gate extends Exchange {
|
|
|
4907
4956
|
*/
|
|
4908
4957
|
await this.loadMarkets();
|
|
4909
4958
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4910
|
-
const stop = this.
|
|
4911
|
-
params = this.omit(params, ['is_stop_order', 'stop']);
|
|
4959
|
+
const stop = this.safeBoolN(params, ['is_stop_order', 'stop', 'trigger'], false);
|
|
4960
|
+
params = this.omit(params, ['is_stop_order', 'stop', 'trigger']);
|
|
4912
4961
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
4913
4962
|
const [request, requestParams] = (type === 'spot' || type === 'margin') ? this.spotOrderPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
4914
4963
|
request['order_id'] = id;
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/hyperliquid.js';
|
|
2
|
-
import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction } from './base/types.js';
|
|
2
|
+
import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class hyperliquid
|
|
5
5
|
* @augments Exchange
|
|
@@ -78,6 +78,7 @@ export default class hyperliquid extends Exchange {
|
|
|
78
78
|
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
79
79
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
80
80
|
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
81
|
+
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
81
82
|
formatVaultAddress(address?: Str): string;
|
|
82
83
|
handlePublicAddress(methodName: string, params: Dict): any[];
|
|
83
84
|
coinToMarketId(coin: Str): string;
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -2479,6 +2479,33 @@ export default class hyperliquid extends Exchange {
|
|
|
2479
2479
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
2480
2480
|
return this.parseTransaction(response);
|
|
2481
2481
|
}
|
|
2482
|
+
parseTransaction(transaction, currency = undefined) {
|
|
2483
|
+
//
|
|
2484
|
+
// { status: 'ok', response: { type: 'default' } }
|
|
2485
|
+
//
|
|
2486
|
+
return {
|
|
2487
|
+
'info': transaction,
|
|
2488
|
+
'id': undefined,
|
|
2489
|
+
'txid': undefined,
|
|
2490
|
+
'timestamp': undefined,
|
|
2491
|
+
'datetime': undefined,
|
|
2492
|
+
'network': undefined,
|
|
2493
|
+
'address': undefined,
|
|
2494
|
+
'addressTo': undefined,
|
|
2495
|
+
'addressFrom': undefined,
|
|
2496
|
+
'tag': undefined,
|
|
2497
|
+
'tagTo': undefined,
|
|
2498
|
+
'tagFrom': undefined,
|
|
2499
|
+
'type': undefined,
|
|
2500
|
+
'amount': undefined,
|
|
2501
|
+
'currency': undefined,
|
|
2502
|
+
'status': this.safeString(transaction, 'status'),
|
|
2503
|
+
'updated': undefined,
|
|
2504
|
+
'comment': undefined,
|
|
2505
|
+
'internal': undefined,
|
|
2506
|
+
'fee': undefined,
|
|
2507
|
+
};
|
|
2508
|
+
}
|
|
2482
2509
|
formatVaultAddress(address = undefined) {
|
|
2483
2510
|
if (address === undefined) {
|
|
2484
2511
|
return undefined;
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -124,6 +124,8 @@ export default class krakenfutures extends Exchange {
|
|
|
124
124
|
'transfers',
|
|
125
125
|
'leveragepreferences',
|
|
126
126
|
'pnlpreferences',
|
|
127
|
+
'assignmentprogram/current',
|
|
128
|
+
'assignmentprogram/history',
|
|
127
129
|
],
|
|
128
130
|
'post': [
|
|
129
131
|
'sendorder',
|
|
@@ -133,7 +135,9 @@ export default class krakenfutures extends Exchange {
|
|
|
133
135
|
'batchorder',
|
|
134
136
|
'cancelallorders',
|
|
135
137
|
'cancelallordersafter',
|
|
136
|
-
'withdrawal',
|
|
138
|
+
'withdrawal',
|
|
139
|
+
'assignmentprogram/add',
|
|
140
|
+
'assignmentprogram/delete',
|
|
137
141
|
],
|
|
138
142
|
'put': [
|
|
139
143
|
'leveragepreferences',
|
package/js/src/pro/bingx.js
CHANGED
|
@@ -742,16 +742,16 @@ export default class bingx extends bingxRest {
|
|
|
742
742
|
// ]
|
|
743
743
|
// }
|
|
744
744
|
//
|
|
745
|
-
const
|
|
745
|
+
const isSwap = client.url.indexOf('swap') >= 0;
|
|
746
746
|
let candles = undefined;
|
|
747
|
-
if (
|
|
748
|
-
candles = data;
|
|
747
|
+
if (isSwap) {
|
|
748
|
+
candles = this.safeList(message, 'data', []);
|
|
749
749
|
}
|
|
750
750
|
else {
|
|
751
|
-
|
|
751
|
+
const data = this.safeDict(message, 'data', {});
|
|
752
|
+
candles = [this.safeDict(data, 'K', {})];
|
|
752
753
|
}
|
|
753
754
|
const dataType = this.safeString(message, 'dataType');
|
|
754
|
-
const isSwap = client.url.indexOf('swap') >= 0;
|
|
755
755
|
const parts = dataType.split('@');
|
|
756
756
|
const firstPart = parts[0];
|
|
757
757
|
const isAllEndpoint = (firstPart === 'all');
|
package/js/src/pro/coinex.js
CHANGED
|
@@ -657,12 +657,13 @@ export default class coinex extends coinexRest {
|
|
|
657
657
|
// "id": null
|
|
658
658
|
// }
|
|
659
659
|
//
|
|
660
|
+
const isSwap = client.url.indexOf('perpetual') >= 0;
|
|
661
|
+
const marketType = isSwap ? 'swap' : 'spot';
|
|
660
662
|
const params = this.safeValue(message, 'params', []);
|
|
661
663
|
const fullOrderBook = this.safeValue(params, 0);
|
|
662
664
|
let orderbook = this.safeValue(params, 1);
|
|
663
665
|
const marketId = this.safeString(params, 2);
|
|
664
|
-
const
|
|
665
|
-
const market = this.safeMarket(marketId, undefined, undefined, defaultType);
|
|
666
|
+
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
666
667
|
const symbol = market['symbol'];
|
|
667
668
|
const name = 'orderbook';
|
|
668
669
|
const messageHash = name + ':' + symbol;
|
package/js/src/pro/gate.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import gateRest from '../gate.js';
|
|
2
|
-
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances, Liquidation } from '../base/types.js';
|
|
2
|
+
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances, Liquidation, OrderType, OrderSide, Num, Market, MarketType, OrderRequest } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class gate extends gateRest {
|
|
5
5
|
describe(): any;
|
|
6
|
+
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
7
|
+
createOrdersWs(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
8
|
+
cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
9
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
10
|
+
editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
11
|
+
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
12
|
+
fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
13
|
+
fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
14
|
+
fetchOrdersByStatusWs(status: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
6
15
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
7
16
|
handleOrderBookSubscription(client: Client, message: any, subscription: any): void;
|
|
8
17
|
handleOrderBook(client: Client, message: any): void;
|
|
@@ -40,11 +49,14 @@ export default class gate extends gateRest {
|
|
|
40
49
|
handleSubscriptionStatus(client: Client, message: any): void;
|
|
41
50
|
handleMessage(client: Client, message: any): void;
|
|
42
51
|
getUrlByMarket(market: any): any;
|
|
43
|
-
getTypeByMarket(market:
|
|
44
|
-
getUrlByMarketType(type:
|
|
52
|
+
getTypeByMarket(market: Market): "spot" | "futures" | "options";
|
|
53
|
+
getUrlByMarketType(type: MarketType, isInverse?: boolean): any;
|
|
45
54
|
getMarketTypeByUrl(url: string): any;
|
|
46
55
|
requestId(): any;
|
|
47
56
|
subscribePublic(url: any, messageHash: any, payload: any, channel: any, params?: {}, subscription?: any): Promise<any>;
|
|
48
57
|
subscribePublicMultiple(url: any, messageHashes: any, payload: any, channel: any, params?: {}): Promise<any>;
|
|
58
|
+
authenticate(url: any, messageType: any): Promise<any>;
|
|
59
|
+
handleAuthenticationMessage(client: Client, message: any): void;
|
|
60
|
+
requestPrivate(url: any, reqParams: any, channel: any, requestId?: Str): Promise<any>;
|
|
49
61
|
subscribePrivate(url: any, messageHash: any, payload: any, channel: any, params: any, requiresUid?: boolean): Promise<any>;
|
|
50
62
|
}
|