ccxt 4.3.47 → 4.3.49
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/ace.js +4 -7
- package/dist/cjs/src/binance.js +19 -22
- package/dist/cjs/src/bitso.js +13 -1
- package/dist/cjs/src/gate.js +103 -54
- package/dist/cjs/src/hyperliquid.js +14 -2
- package/dist/cjs/src/kraken.js +4 -3
- package/dist/cjs/src/krakenfutures.js +6 -2
- package/dist/cjs/src/pro/bingx.js +5 -5
- package/dist/cjs/src/pro/coinbaseinternational.js +5 -0
- 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/ace.js +4 -7
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +20 -23
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +13 -1
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/gate.d.ts +4 -0
- package/js/src/gate.js +103 -54
- package/js/src/hyperliquid.d.ts +2 -2
- package/js/src/hyperliquid.js +14 -2
- package/js/src/kraken.js +4 -3
- package/js/src/krakenfutures.js +6 -2
- package/js/src/pro/bingx.js +5 -5
- package/js/src/pro/coinbaseinternational.js +5 -0
- 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/binance.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Exchange from './abstract/binance.js';
|
|
9
9
|
import { ExchangeError, ArgumentsRequired, OperationFailed, OperationRejected, InsufficientFunds, OrderNotFound, InvalidOrder, DDoSProtection, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, NotSupported, BadRequest, BadSymbol, AccountSuspended, OrderImmediatelyFillable, OnMaintenance, BadResponse, RequestTimeout, OrderNotFillable, MarginModeAlreadySet, MarketClosed } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
|
-
import { TRUNCATE,
|
|
11
|
+
import { TRUNCATE, TICK_SIZE } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
import { rsa } from './base/functions/rsa.js';
|
|
14
14
|
import { eddsa } from './base/functions/crypto.js';
|
|
@@ -1183,7 +1183,7 @@ export default class binance extends Exchange {
|
|
|
1183
1183
|
'BCC': 'BCC',
|
|
1184
1184
|
'YOYO': 'YOYOW',
|
|
1185
1185
|
},
|
|
1186
|
-
'precisionMode':
|
|
1186
|
+
'precisionMode': TICK_SIZE,
|
|
1187
1187
|
// exchange-specific options
|
|
1188
1188
|
'options': {
|
|
1189
1189
|
'sandboxMode': false,
|
|
@@ -2786,7 +2786,7 @@ export default class binance extends Exchange {
|
|
|
2786
2786
|
'deposit': depositEnable,
|
|
2787
2787
|
'withdraw': withdrawEnable,
|
|
2788
2788
|
'fee': this.parseNumber(fee),
|
|
2789
|
-
'precision':
|
|
2789
|
+
'precision': this.parseNumber(precisionTick),
|
|
2790
2790
|
'limits': {
|
|
2791
2791
|
'withdraw': {
|
|
2792
2792
|
'min': this.safeNumber(networkItem, 'withdrawMin'),
|
|
@@ -2801,15 +2801,11 @@ export default class binance extends Exchange {
|
|
|
2801
2801
|
}
|
|
2802
2802
|
const trading = this.safeBool(entry, 'trading');
|
|
2803
2803
|
const active = (isWithdrawEnabled && isDepositEnabled && trading);
|
|
2804
|
-
let maxDecimalPlaces = undefined;
|
|
2805
|
-
if (minPrecision !== undefined) {
|
|
2806
|
-
maxDecimalPlaces = parseInt(this.numberToString(this.precisionFromString(minPrecision)));
|
|
2807
|
-
}
|
|
2808
2804
|
result[code] = {
|
|
2809
2805
|
'id': id,
|
|
2810
2806
|
'name': name,
|
|
2811
2807
|
'code': code,
|
|
2812
|
-
'precision':
|
|
2808
|
+
'precision': this.parseNumber(minPrecision),
|
|
2813
2809
|
'info': entry,
|
|
2814
2810
|
'active': active,
|
|
2815
2811
|
'deposit': isDepositEnabled,
|
|
@@ -3194,10 +3190,10 @@ export default class binance extends Exchange {
|
|
|
3194
3190
|
'strike': parsedStrike,
|
|
3195
3191
|
'optionType': this.safeStringLower(market, 'side'),
|
|
3196
3192
|
'precision': {
|
|
3197
|
-
'amount': this.
|
|
3198
|
-
'price': this.
|
|
3199
|
-
'base': this.
|
|
3200
|
-
'quote': this.
|
|
3193
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString2(market, 'quantityPrecision', 'quantityScale'))),
|
|
3194
|
+
'price': this.parseNumber(this.parsePrecision(this.safeString2(market, 'pricePrecision', 'priceScale'))),
|
|
3195
|
+
'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
|
|
3196
|
+
'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
|
|
3201
3197
|
},
|
|
3202
3198
|
'limits': {
|
|
3203
3199
|
'leverage': {
|
|
@@ -3230,12 +3226,11 @@ export default class binance extends Exchange {
|
|
|
3230
3226
|
'min': this.safeNumber(filter, 'minPrice'),
|
|
3231
3227
|
'max': this.safeNumber(filter, 'maxPrice'),
|
|
3232
3228
|
};
|
|
3233
|
-
entry['precision']['price'] = this.
|
|
3229
|
+
entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
|
|
3234
3230
|
}
|
|
3235
3231
|
if ('LOT_SIZE' in filtersByType) {
|
|
3236
3232
|
const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
|
|
3237
|
-
|
|
3238
|
-
entry['precision']['amount'] = this.precisionFromString(stepSize);
|
|
3233
|
+
entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
|
|
3239
3234
|
entry['limits']['amount'] = {
|
|
3240
3235
|
'min': this.safeNumber(filter, 'minQty'),
|
|
3241
3236
|
'max': this.safeNumber(filter, 'maxQty'),
|
|
@@ -6169,7 +6164,7 @@ export default class binance extends Exchange {
|
|
|
6169
6164
|
if (!market['spot']) {
|
|
6170
6165
|
throw new NotSupported(this.id + ' createMarketOrderWithCost() supports spot orders only');
|
|
6171
6166
|
}
|
|
6172
|
-
params['
|
|
6167
|
+
params['cost'] = cost;
|
|
6173
6168
|
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
6174
6169
|
}
|
|
6175
6170
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
@@ -6188,7 +6183,7 @@ export default class binance extends Exchange {
|
|
|
6188
6183
|
if (!market['spot']) {
|
|
6189
6184
|
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
6190
6185
|
}
|
|
6191
|
-
params['
|
|
6186
|
+
params['cost'] = cost;
|
|
6192
6187
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
6193
6188
|
}
|
|
6194
6189
|
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
@@ -7923,6 +7918,9 @@ export default class binance extends Exchange {
|
|
|
7923
7918
|
return this.parseTransactions(response, currency, since, limit);
|
|
7924
7919
|
}
|
|
7925
7920
|
parseTransactionStatusByType(status, type = undefined) {
|
|
7921
|
+
if (type === undefined) {
|
|
7922
|
+
return status;
|
|
7923
|
+
}
|
|
7926
7924
|
const statusesByType = {
|
|
7927
7925
|
'deposit': {
|
|
7928
7926
|
'0': 'pending',
|
|
@@ -8809,7 +8807,7 @@ export default class binance extends Exchange {
|
|
|
8809
8807
|
const request = {
|
|
8810
8808
|
'coin': currency['id'],
|
|
8811
8809
|
'address': address,
|
|
8812
|
-
'amount': amount,
|
|
8810
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8813
8811
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
8814
8812
|
// issue sapiGetCapitalConfigGetall () to get networks for withdrawing USDT ERC20 vs USDT Omni
|
|
8815
8813
|
// 'network': 'ETH', // 'BTC', 'TRX', etc, optional
|
|
@@ -9578,7 +9576,7 @@ export default class binance extends Exchange {
|
|
|
9578
9576
|
const rightSide = Precise.stringSub(Precise.stringMul(Precise.stringDiv('1', entryPriceSignString), size), walletBalance);
|
|
9579
9577
|
liquidationPriceStringRaw = Precise.stringDiv(leftSide, rightSide);
|
|
9580
9578
|
}
|
|
9581
|
-
const pricePrecision = market['precision']
|
|
9579
|
+
const pricePrecision = this.precisionFromString(this.safeString(market['precision'], 'price'));
|
|
9582
9580
|
const pricePrecisionPlusOne = pricePrecision + 1;
|
|
9583
9581
|
const pricePrecisionPlusOneString = pricePrecisionPlusOne.toString();
|
|
9584
9582
|
// round half up
|
|
@@ -9751,8 +9749,7 @@ export default class binance extends Exchange {
|
|
|
9751
9749
|
}
|
|
9752
9750
|
const inner = Precise.stringMul(liquidationPriceString, onePlusMaintenanceMarginPercentageString);
|
|
9753
9751
|
const leftSide = Precise.stringAdd(inner, entryPriceSignString);
|
|
9754
|
-
const
|
|
9755
|
-
const quotePrecision = this.safeInteger(precision, 'quote', pricePrecision);
|
|
9752
|
+
const quotePrecision = this.precisionFromString(this.safeString2(precision, 'quote', 'price'));
|
|
9756
9753
|
if (quotePrecision !== undefined) {
|
|
9757
9754
|
collateralString = Precise.stringDiv(Precise.stringMul(leftSide, contractsAbs), '1', quotePrecision);
|
|
9758
9755
|
}
|
|
@@ -9770,7 +9767,7 @@ export default class binance extends Exchange {
|
|
|
9770
9767
|
}
|
|
9771
9768
|
const leftSide = Precise.stringMul(contractsAbs, contractSizeString);
|
|
9772
9769
|
const rightSide = Precise.stringSub(Precise.stringDiv('1', entryPriceSignString), Precise.stringDiv(onePlusMaintenanceMarginPercentageString, liquidationPriceString));
|
|
9773
|
-
const basePrecision = this.
|
|
9770
|
+
const basePrecision = this.precisionFromString(this.safeString(precision, 'base'));
|
|
9774
9771
|
if (basePrecision !== undefined) {
|
|
9775
9772
|
collateralString = Precise.stringDiv(Precise.stringMul(leftSide, rightSide), '1', basePrecision);
|
|
9776
9773
|
}
|
|
@@ -12921,7 +12918,7 @@ export default class binance extends Exchange {
|
|
|
12921
12918
|
'deposit': undefined,
|
|
12922
12919
|
'withdraw': undefined,
|
|
12923
12920
|
'fee': undefined,
|
|
12924
|
-
'precision': this.
|
|
12921
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'fraction'))),
|
|
12925
12922
|
'limits': {
|
|
12926
12923
|
'amount': {
|
|
12927
12924
|
'min': undefined,
|
package/js/src/bitso.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export default class bitso extends Exchange {
|
|
|
38
38
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
39
39
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
40
40
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
41
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<
|
|
41
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
42
42
|
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
|
|
43
43
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any[]>;
|
|
44
44
|
parseOrderStatus(status: Str): string;
|
package/js/src/bitso.js
CHANGED
|
@@ -1005,7 +1005,19 @@ export default class bitso extends Exchange {
|
|
|
1005
1005
|
const request = {
|
|
1006
1006
|
'oid': id,
|
|
1007
1007
|
};
|
|
1008
|
-
|
|
1008
|
+
const response = await this.privateDeleteOrdersOid(this.extend(request, params));
|
|
1009
|
+
//
|
|
1010
|
+
// {
|
|
1011
|
+
// "success": true,
|
|
1012
|
+
// "payload": ["yWTQGxDMZ0VimZgZ"]
|
|
1013
|
+
// }
|
|
1014
|
+
//
|
|
1015
|
+
const payload = this.safeList(response, 'payload', []);
|
|
1016
|
+
const orderId = this.safeString(payload, 0);
|
|
1017
|
+
return this.safeOrder({
|
|
1018
|
+
'info': response,
|
|
1019
|
+
'id': orderId,
|
|
1020
|
+
});
|
|
1009
1021
|
}
|
|
1010
1022
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1011
1023
|
/**
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export default class coinbase extends Exchange {
|
|
|
76
76
|
parseOrderStatus(status: Str): string;
|
|
77
77
|
parseOrderType(type: Str): string;
|
|
78
78
|
parseTimeInForce(timeInForce: Str): string;
|
|
79
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<
|
|
79
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
80
80
|
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
|
|
81
81
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
82
82
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
package/js/src/gate.d.ts
CHANGED
|
@@ -165,15 +165,19 @@ export default class gate extends Exchange {
|
|
|
165
165
|
parseTransactionType(type: any): string;
|
|
166
166
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
167
167
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
168
|
+
createOrdersRequest(orders: OrderRequest[], params?: {}): any[];
|
|
168
169
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
169
170
|
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any;
|
|
170
171
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
172
|
+
editOrderRequest(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): any;
|
|
171
173
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
172
174
|
parseOrderStatus(status: Str): string;
|
|
173
175
|
parseOrder(order: Dict, market?: Market): Order;
|
|
176
|
+
fetchOrderRequest(id: string, symbol?: Str, params?: {}): any[];
|
|
174
177
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
175
178
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
176
179
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
180
|
+
fetchOrdersByStatusRequest(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): any[];
|
|
177
181
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
178
182
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
179
183
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
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
|
@@ -53,8 +53,8 @@ export default class hyperliquid extends Exchange {
|
|
|
53
53
|
};
|
|
54
54
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
55
55
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
56
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any
|
|
57
|
-
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any>;
|
|
56
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
|
|
57
|
+
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any[]>;
|
|
58
58
|
cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<any>;
|
|
59
59
|
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
60
60
|
editOrder(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -1216,7 +1216,8 @@ export default class hyperliquid extends Exchange {
|
|
|
1216
1216
|
* @param {string} [params.vaultAddress] the vault address for order
|
|
1217
1217
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1218
1218
|
*/
|
|
1219
|
-
|
|
1219
|
+
const orders = await this.cancelOrders([id], symbol, params);
|
|
1220
|
+
return this.safeDict(orders, 0);
|
|
1220
1221
|
}
|
|
1221
1222
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1222
1223
|
/**
|
|
@@ -1295,7 +1296,18 @@ export default class hyperliquid extends Exchange {
|
|
|
1295
1296
|
// }
|
|
1296
1297
|
// }
|
|
1297
1298
|
//
|
|
1298
|
-
|
|
1299
|
+
const innerResponse = this.safeDict(response, 'response');
|
|
1300
|
+
const data = this.safeDict(innerResponse, 'data');
|
|
1301
|
+
const statuses = this.safeList(data, 'statuses');
|
|
1302
|
+
const orders = [];
|
|
1303
|
+
for (let i = 0; i < statuses.length; i++) {
|
|
1304
|
+
const status = statuses[i];
|
|
1305
|
+
orders.push(this.safeOrder({
|
|
1306
|
+
'info': status,
|
|
1307
|
+
'status': status,
|
|
1308
|
+
}));
|
|
1309
|
+
}
|
|
1310
|
+
return orders;
|
|
1299
1311
|
}
|
|
1300
1312
|
async cancelOrdersForSymbols(orders, params = {}) {
|
|
1301
1313
|
/**
|
package/js/src/kraken.js
CHANGED
|
@@ -1716,6 +1716,7 @@ export default class kraken extends Exchange {
|
|
|
1716
1716
|
'filled': filled,
|
|
1717
1717
|
'average': average,
|
|
1718
1718
|
'remaining': undefined,
|
|
1719
|
+
'reduceOnly': this.safeBool2(order, 'reduceOnly', 'reduce_only'),
|
|
1719
1720
|
'fee': fee,
|
|
1720
1721
|
'trades': trades,
|
|
1721
1722
|
}, market);
|
|
@@ -2125,7 +2126,7 @@ export default class kraken extends Exchange {
|
|
|
2125
2126
|
* @method
|
|
2126
2127
|
* @name kraken#cancelOrder
|
|
2127
2128
|
* @description cancels an open order
|
|
2128
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
|
|
2129
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrder
|
|
2129
2130
|
* @param {string} id order id
|
|
2130
2131
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2131
2132
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2166,7 +2167,7 @@ export default class kraken extends Exchange {
|
|
|
2166
2167
|
* @method
|
|
2167
2168
|
* @name kraken#cancelOrders
|
|
2168
2169
|
* @description cancel multiple orders
|
|
2169
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
|
|
2170
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrderBatch
|
|
2170
2171
|
* @param {string[]} ids open orders transaction ID (txid) or user reference (userref)
|
|
2171
2172
|
* @param {string} symbol unified market symbol
|
|
2172
2173
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2195,7 +2196,7 @@ export default class kraken extends Exchange {
|
|
|
2195
2196
|
* @method
|
|
2196
2197
|
* @name kraken#cancelAllOrders
|
|
2197
2198
|
* @description cancel all open orders
|
|
2198
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
|
|
2199
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
|
|
2199
2200
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
2200
2201
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2201
2202
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
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',
|
|
@@ -1874,7 +1878,7 @@ export default class krakenfutures extends Exchange {
|
|
|
1874
1878
|
'type': this.parseOrderType(type),
|
|
1875
1879
|
'timeInForce': timeInForce,
|
|
1876
1880
|
'postOnly': type === 'post',
|
|
1877
|
-
'reduceOnly': this.
|
|
1881
|
+
'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
|
|
1878
1882
|
'side': this.safeString(details, 'side'),
|
|
1879
1883
|
'price': price,
|
|
1880
1884
|
'stopPrice': this.safeString(details, 'triggerPrice'),
|
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');
|
|
@@ -72,6 +72,7 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
|
|
|
72
72
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
73
73
|
* @returns {object} subscription to a websocket channel
|
|
74
74
|
*/
|
|
75
|
+
await this.loadMarkets();
|
|
75
76
|
this.checkRequiredCredentials();
|
|
76
77
|
let market = undefined;
|
|
77
78
|
let messageHash = name;
|
|
@@ -120,6 +121,7 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
|
|
|
120
121
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
121
122
|
* @returns {object} subscription to a websocket channel
|
|
122
123
|
*/
|
|
124
|
+
await this.loadMarkets();
|
|
123
125
|
this.checkRequiredCredentials();
|
|
124
126
|
if (this.isEmpty(symbols)) {
|
|
125
127
|
symbols = this.symbols;
|
|
@@ -163,6 +165,7 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
|
|
|
163
165
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
164
166
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
165
167
|
*/
|
|
168
|
+
await this.loadMarkets();
|
|
166
169
|
return await this.subscribe('RISK', [symbol], params);
|
|
167
170
|
}
|
|
168
171
|
async watchFundingRates(symbols, params = {}) {
|
|
@@ -175,6 +178,7 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
|
|
|
175
178
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
176
179
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
177
180
|
*/
|
|
181
|
+
await this.loadMarkets();
|
|
178
182
|
const fundingRate = await this.subscribeMultiple('RISK', symbols, params);
|
|
179
183
|
const symbol = this.safeString(fundingRate, 'symbol');
|
|
180
184
|
if (this.newUpdates) {
|
|
@@ -194,6 +198,7 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
|
|
|
194
198
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
195
199
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
196
200
|
*/
|
|
201
|
+
await this.loadMarkets();
|
|
197
202
|
let channel = undefined;
|
|
198
203
|
[channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'LEVEL1');
|
|
199
204
|
return await this.subscribe(channel, [symbol], params);
|