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/dist/cjs/ccxt.js
CHANGED
|
@@ -188,7 +188,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
188
188
|
|
|
189
189
|
//-----------------------------------------------------------------------------
|
|
190
190
|
// this is updated by vss.js when building
|
|
191
|
-
const version = '4.3.
|
|
191
|
+
const version = '4.3.49';
|
|
192
192
|
Exchange["default"].ccxtVersion = version;
|
|
193
193
|
const exchanges = {
|
|
194
194
|
'ace': ace,
|
package/dist/cjs/src/ace.js
CHANGED
|
@@ -1017,14 +1017,11 @@ class ace extends ace$1 {
|
|
|
1017
1017
|
let auth = 'ACE_SIGN' + this.secret;
|
|
1018
1018
|
const data = this.extend({
|
|
1019
1019
|
'apiKey': this.apiKey,
|
|
1020
|
-
'timeStamp': nonce,
|
|
1020
|
+
'timeStamp': this.numberToString(nonce),
|
|
1021
1021
|
}, params);
|
|
1022
|
-
const
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
const key = sortedDataKeys[i];
|
|
1026
|
-
auth += this.safeString(data, key);
|
|
1027
|
-
}
|
|
1022
|
+
const sortedData = this.keysort(data);
|
|
1023
|
+
const values = Object.values(sortedData);
|
|
1024
|
+
auth += values.join('');
|
|
1028
1025
|
const signature = this.hash(this.encode(auth), sha256.sha256, 'hex');
|
|
1029
1026
|
data['signKey'] = signature;
|
|
1030
1027
|
headers = {
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -1180,7 +1180,7 @@ class binance extends binance$1 {
|
|
|
1180
1180
|
'BCC': 'BCC',
|
|
1181
1181
|
'YOYO': 'YOYOW',
|
|
1182
1182
|
},
|
|
1183
|
-
'precisionMode': number.
|
|
1183
|
+
'precisionMode': number.TICK_SIZE,
|
|
1184
1184
|
// exchange-specific options
|
|
1185
1185
|
'options': {
|
|
1186
1186
|
'sandboxMode': false,
|
|
@@ -2783,7 +2783,7 @@ class binance extends binance$1 {
|
|
|
2783
2783
|
'deposit': depositEnable,
|
|
2784
2784
|
'withdraw': withdrawEnable,
|
|
2785
2785
|
'fee': this.parseNumber(fee),
|
|
2786
|
-
'precision':
|
|
2786
|
+
'precision': this.parseNumber(precisionTick),
|
|
2787
2787
|
'limits': {
|
|
2788
2788
|
'withdraw': {
|
|
2789
2789
|
'min': this.safeNumber(networkItem, 'withdrawMin'),
|
|
@@ -2798,15 +2798,11 @@ class binance extends binance$1 {
|
|
|
2798
2798
|
}
|
|
2799
2799
|
const trading = this.safeBool(entry, 'trading');
|
|
2800
2800
|
const active = (isWithdrawEnabled && isDepositEnabled && trading);
|
|
2801
|
-
let maxDecimalPlaces = undefined;
|
|
2802
|
-
if (minPrecision !== undefined) {
|
|
2803
|
-
maxDecimalPlaces = parseInt(this.numberToString(this.precisionFromString(minPrecision)));
|
|
2804
|
-
}
|
|
2805
2801
|
result[code] = {
|
|
2806
2802
|
'id': id,
|
|
2807
2803
|
'name': name,
|
|
2808
2804
|
'code': code,
|
|
2809
|
-
'precision':
|
|
2805
|
+
'precision': this.parseNumber(minPrecision),
|
|
2810
2806
|
'info': entry,
|
|
2811
2807
|
'active': active,
|
|
2812
2808
|
'deposit': isDepositEnabled,
|
|
@@ -3191,10 +3187,10 @@ class binance extends binance$1 {
|
|
|
3191
3187
|
'strike': parsedStrike,
|
|
3192
3188
|
'optionType': this.safeStringLower(market, 'side'),
|
|
3193
3189
|
'precision': {
|
|
3194
|
-
'amount': this.
|
|
3195
|
-
'price': this.
|
|
3196
|
-
'base': this.
|
|
3197
|
-
'quote': this.
|
|
3190
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString2(market, 'quantityPrecision', 'quantityScale'))),
|
|
3191
|
+
'price': this.parseNumber(this.parsePrecision(this.safeString2(market, 'pricePrecision', 'priceScale'))),
|
|
3192
|
+
'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
|
|
3193
|
+
'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
|
|
3198
3194
|
},
|
|
3199
3195
|
'limits': {
|
|
3200
3196
|
'leverage': {
|
|
@@ -3227,12 +3223,11 @@ class binance extends binance$1 {
|
|
|
3227
3223
|
'min': this.safeNumber(filter, 'minPrice'),
|
|
3228
3224
|
'max': this.safeNumber(filter, 'maxPrice'),
|
|
3229
3225
|
};
|
|
3230
|
-
entry['precision']['price'] = this.
|
|
3226
|
+
entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
|
|
3231
3227
|
}
|
|
3232
3228
|
if ('LOT_SIZE' in filtersByType) {
|
|
3233
3229
|
const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
|
|
3234
|
-
|
|
3235
|
-
entry['precision']['amount'] = this.precisionFromString(stepSize);
|
|
3230
|
+
entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
|
|
3236
3231
|
entry['limits']['amount'] = {
|
|
3237
3232
|
'min': this.safeNumber(filter, 'minQty'),
|
|
3238
3233
|
'max': this.safeNumber(filter, 'maxQty'),
|
|
@@ -6166,7 +6161,7 @@ class binance extends binance$1 {
|
|
|
6166
6161
|
if (!market['spot']) {
|
|
6167
6162
|
throw new errors.NotSupported(this.id + ' createMarketOrderWithCost() supports spot orders only');
|
|
6168
6163
|
}
|
|
6169
|
-
params['
|
|
6164
|
+
params['cost'] = cost;
|
|
6170
6165
|
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
6171
6166
|
}
|
|
6172
6167
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
@@ -6185,7 +6180,7 @@ class binance extends binance$1 {
|
|
|
6185
6180
|
if (!market['spot']) {
|
|
6186
6181
|
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
6187
6182
|
}
|
|
6188
|
-
params['
|
|
6183
|
+
params['cost'] = cost;
|
|
6189
6184
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
6190
6185
|
}
|
|
6191
6186
|
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
@@ -7920,6 +7915,9 @@ class binance extends binance$1 {
|
|
|
7920
7915
|
return this.parseTransactions(response, currency, since, limit);
|
|
7921
7916
|
}
|
|
7922
7917
|
parseTransactionStatusByType(status, type = undefined) {
|
|
7918
|
+
if (type === undefined) {
|
|
7919
|
+
return status;
|
|
7920
|
+
}
|
|
7923
7921
|
const statusesByType = {
|
|
7924
7922
|
'deposit': {
|
|
7925
7923
|
'0': 'pending',
|
|
@@ -8806,7 +8804,7 @@ class binance extends binance$1 {
|
|
|
8806
8804
|
const request = {
|
|
8807
8805
|
'coin': currency['id'],
|
|
8808
8806
|
'address': address,
|
|
8809
|
-
'amount': amount,
|
|
8807
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8810
8808
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
8811
8809
|
// issue sapiGetCapitalConfigGetall () to get networks for withdrawing USDT ERC20 vs USDT Omni
|
|
8812
8810
|
// 'network': 'ETH', // 'BTC', 'TRX', etc, optional
|
|
@@ -9575,7 +9573,7 @@ class binance extends binance$1 {
|
|
|
9575
9573
|
const rightSide = Precise["default"].stringSub(Precise["default"].stringMul(Precise["default"].stringDiv('1', entryPriceSignString), size), walletBalance);
|
|
9576
9574
|
liquidationPriceStringRaw = Precise["default"].stringDiv(leftSide, rightSide);
|
|
9577
9575
|
}
|
|
9578
|
-
const pricePrecision = market['precision']
|
|
9576
|
+
const pricePrecision = this.precisionFromString(this.safeString(market['precision'], 'price'));
|
|
9579
9577
|
const pricePrecisionPlusOne = pricePrecision + 1;
|
|
9580
9578
|
const pricePrecisionPlusOneString = pricePrecisionPlusOne.toString();
|
|
9581
9579
|
// round half up
|
|
@@ -9748,8 +9746,7 @@ class binance extends binance$1 {
|
|
|
9748
9746
|
}
|
|
9749
9747
|
const inner = Precise["default"].stringMul(liquidationPriceString, onePlusMaintenanceMarginPercentageString);
|
|
9750
9748
|
const leftSide = Precise["default"].stringAdd(inner, entryPriceSignString);
|
|
9751
|
-
const
|
|
9752
|
-
const quotePrecision = this.safeInteger(precision, 'quote', pricePrecision);
|
|
9749
|
+
const quotePrecision = this.precisionFromString(this.safeString2(precision, 'quote', 'price'));
|
|
9753
9750
|
if (quotePrecision !== undefined) {
|
|
9754
9751
|
collateralString = Precise["default"].stringDiv(Precise["default"].stringMul(leftSide, contractsAbs), '1', quotePrecision);
|
|
9755
9752
|
}
|
|
@@ -9767,7 +9764,7 @@ class binance extends binance$1 {
|
|
|
9767
9764
|
}
|
|
9768
9765
|
const leftSide = Precise["default"].stringMul(contractsAbs, contractSizeString);
|
|
9769
9766
|
const rightSide = Precise["default"].stringSub(Precise["default"].stringDiv('1', entryPriceSignString), Precise["default"].stringDiv(onePlusMaintenanceMarginPercentageString, liquidationPriceString));
|
|
9770
|
-
const basePrecision = this.
|
|
9767
|
+
const basePrecision = this.precisionFromString(this.safeString(precision, 'base'));
|
|
9771
9768
|
if (basePrecision !== undefined) {
|
|
9772
9769
|
collateralString = Precise["default"].stringDiv(Precise["default"].stringMul(leftSide, rightSide), '1', basePrecision);
|
|
9773
9770
|
}
|
|
@@ -12918,7 +12915,7 @@ class binance extends binance$1 {
|
|
|
12918
12915
|
'deposit': undefined,
|
|
12919
12916
|
'withdraw': undefined,
|
|
12920
12917
|
'fee': undefined,
|
|
12921
|
-
'precision': this.
|
|
12918
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'fraction'))),
|
|
12922
12919
|
'limits': {
|
|
12923
12920
|
'amount': {
|
|
12924
12921
|
'min': undefined,
|
package/dist/cjs/src/bitso.js
CHANGED
|
@@ -1002,7 +1002,19 @@ class bitso extends bitso$1 {
|
|
|
1002
1002
|
const request = {
|
|
1003
1003
|
'oid': id,
|
|
1004
1004
|
};
|
|
1005
|
-
|
|
1005
|
+
const response = await this.privateDeleteOrdersOid(this.extend(request, params));
|
|
1006
|
+
//
|
|
1007
|
+
// {
|
|
1008
|
+
// "success": true,
|
|
1009
|
+
// "payload": ["yWTQGxDMZ0VimZgZ"]
|
|
1010
|
+
// }
|
|
1011
|
+
//
|
|
1012
|
+
const payload = this.safeList(response, 'payload', []);
|
|
1013
|
+
const orderId = this.safeString(payload, 0);
|
|
1014
|
+
return this.safeOrder({
|
|
1015
|
+
'info': response,
|
|
1016
|
+
'id': orderId,
|
|
1017
|
+
});
|
|
1006
1018
|
}
|
|
1007
1019
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1008
1020
|
/**
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -779,6 +779,7 @@ class gate extends gate$1 {
|
|
|
779
779
|
'NOT_ACCEPTABLE': errors.BadRequest,
|
|
780
780
|
'METHOD_NOT_ALLOWED': errors.BadRequest,
|
|
781
781
|
'NOT_FOUND': errors.ExchangeError,
|
|
782
|
+
'AUTHENTICATION_FAILED': errors.AuthenticationError,
|
|
782
783
|
'INVALID_CREDENTIALS': errors.AuthenticationError,
|
|
783
784
|
'INVALID_KEY': errors.AuthenticationError,
|
|
784
785
|
'IP_FORBIDDEN': errors.AuthenticationError,
|
|
@@ -3879,19 +3880,16 @@ class gate extends gate$1 {
|
|
|
3879
3880
|
//
|
|
3880
3881
|
return this.parseOrder(response, market);
|
|
3881
3882
|
}
|
|
3882
|
-
|
|
3883
|
-
/**
|
|
3884
|
-
* @method
|
|
3885
|
-
* @name gate#createOrders
|
|
3886
|
-
* @description create a list of trade orders
|
|
3887
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
|
3888
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
3889
|
-
* @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
|
|
3890
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3891
|
-
*/
|
|
3892
|
-
await this.loadMarkets();
|
|
3883
|
+
createOrdersRequest(orders, params = {}) {
|
|
3893
3884
|
const ordersRequests = [];
|
|
3894
3885
|
const orderSymbols = [];
|
|
3886
|
+
const ordersLength = orders.length;
|
|
3887
|
+
if (ordersLength === 0) {
|
|
3888
|
+
throw new errors.BadRequest(this.id + ' createOrders() requires at least one order');
|
|
3889
|
+
}
|
|
3890
|
+
if (ordersLength > 10) {
|
|
3891
|
+
throw new errors.BadRequest(this.id + ' createOrders() accepts a maximum of 10 orders at a time');
|
|
3892
|
+
}
|
|
3895
3893
|
for (let i = 0; i < orders.length; i++) {
|
|
3896
3894
|
const rawOrder = orders[i];
|
|
3897
3895
|
const marketId = this.safeString(rawOrder, 'symbol');
|
|
@@ -3915,6 +3913,23 @@ class gate extends gate$1 {
|
|
|
3915
3913
|
if (market['future'] || market['option']) {
|
|
3916
3914
|
throw new errors.NotSupported(this.id + ' createOrders() does not support futures or options markets');
|
|
3917
3915
|
}
|
|
3916
|
+
return ordersRequests;
|
|
3917
|
+
}
|
|
3918
|
+
async createOrders(orders, params = {}) {
|
|
3919
|
+
/**
|
|
3920
|
+
* @method
|
|
3921
|
+
* @name gate#createOrders
|
|
3922
|
+
* @description create a list of trade orders
|
|
3923
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
|
3924
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
3925
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
|
3926
|
+
* @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
|
|
3927
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3928
|
+
*/
|
|
3929
|
+
await this.loadMarkets();
|
|
3930
|
+
const ordersRequests = this.createOrdersRequest(orders, params);
|
|
3931
|
+
const firstOrder = orders[0];
|
|
3932
|
+
const market = this.market(firstOrder['symbol']);
|
|
3918
3933
|
let response = undefined;
|
|
3919
3934
|
if (market['spot']) {
|
|
3920
3935
|
response = await this.privateSpotPostBatchOrders(ordersRequests);
|
|
@@ -4197,23 +4212,7 @@ class gate extends gate$1 {
|
|
|
4197
4212
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
4198
4213
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
4199
4214
|
}
|
|
4200
|
-
|
|
4201
|
-
/**
|
|
4202
|
-
* @method
|
|
4203
|
-
* @name gate#editOrder
|
|
4204
|
-
* @description edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4205
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
|
4206
|
-
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
|
4207
|
-
* @param {string} id order id
|
|
4208
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
4209
|
-
* @param {string} type 'market' or 'limit'
|
|
4210
|
-
* @param {string} side 'buy' or 'sell'
|
|
4211
|
-
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
4212
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4213
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4214
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4215
|
-
*/
|
|
4216
|
-
await this.loadMarkets();
|
|
4215
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4217
4216
|
const market = this.market(symbol);
|
|
4218
4217
|
const [marketType, query] = this.handleMarketTypeAndParams('editOrder', market, params);
|
|
4219
4218
|
const account = this.convertTypeToAccount(marketType);
|
|
@@ -4225,7 +4224,7 @@ class gate extends gate$1 {
|
|
|
4225
4224
|
}
|
|
4226
4225
|
}
|
|
4227
4226
|
const request = {
|
|
4228
|
-
'order_id': id,
|
|
4227
|
+
'order_id': id.toString(),
|
|
4229
4228
|
'currency_pair': market['id'],
|
|
4230
4229
|
'account': account,
|
|
4231
4230
|
};
|
|
@@ -4245,13 +4244,36 @@ class gate extends gate$1 {
|
|
|
4245
4244
|
if (price !== undefined) {
|
|
4246
4245
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4247
4246
|
}
|
|
4247
|
+
if (!market['spot']) {
|
|
4248
|
+
request['settle'] = market['settleId'];
|
|
4249
|
+
}
|
|
4250
|
+
return this.extend(request, query);
|
|
4251
|
+
}
|
|
4252
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4253
|
+
/**
|
|
4254
|
+
* @method
|
|
4255
|
+
* @name gate#editOrder
|
|
4256
|
+
* @description edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4257
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
|
4258
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
|
4259
|
+
* @param {string} id order id
|
|
4260
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4261
|
+
* @param {string} type 'market' or 'limit'
|
|
4262
|
+
* @param {string} side 'buy' or 'sell'
|
|
4263
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
4264
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4265
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4266
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4267
|
+
*/
|
|
4268
|
+
await this.loadMarkets();
|
|
4269
|
+
const market = this.market(symbol);
|
|
4270
|
+
const extendedRequest = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
4248
4271
|
let response = undefined;
|
|
4249
4272
|
if (market['spot']) {
|
|
4250
|
-
response = await this.privateSpotPatchOrdersOrderId(
|
|
4273
|
+
response = await this.privateSpotPatchOrdersOrderId(extendedRequest);
|
|
4251
4274
|
}
|
|
4252
4275
|
else {
|
|
4253
|
-
|
|
4254
|
-
response = await this.privateFuturesPutSettleOrdersOrderId(this.extend(request, query));
|
|
4276
|
+
response = await this.privateFuturesPutSettleOrdersOrderId(extendedRequest);
|
|
4255
4277
|
}
|
|
4256
4278
|
//
|
|
4257
4279
|
// {
|
|
@@ -4565,6 +4587,25 @@ class gate extends gate$1 {
|
|
|
4565
4587
|
'info': order,
|
|
4566
4588
|
}, market);
|
|
4567
4589
|
}
|
|
4590
|
+
fetchOrderRequest(id, symbol = undefined, params = {}) {
|
|
4591
|
+
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4592
|
+
const stop = this.safeBoolN(params, ['trigger', 'is_stop_order', 'stop'], false);
|
|
4593
|
+
params = this.omit(params, ['is_stop_order', 'stop', 'trigger']);
|
|
4594
|
+
let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
|
|
4595
|
+
let orderId = id;
|
|
4596
|
+
if (clientOrderId !== undefined) {
|
|
4597
|
+
params = this.omit(params, ['text', 'clientOrderId']);
|
|
4598
|
+
if (clientOrderId[0] !== 't') {
|
|
4599
|
+
clientOrderId = 't-' + clientOrderId;
|
|
4600
|
+
}
|
|
4601
|
+
orderId = clientOrderId;
|
|
4602
|
+
}
|
|
4603
|
+
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
4604
|
+
const contract = (type === 'swap') || (type === 'future') || (type === 'option');
|
|
4605
|
+
const [request, requestParams] = contract ? this.prepareRequest(market, type, query) : this.spotOrderPrepareRequest(market, stop, query);
|
|
4606
|
+
request['order_id'] = orderId.toString();
|
|
4607
|
+
return [request, requestParams];
|
|
4608
|
+
}
|
|
4568
4609
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
4569
4610
|
/**
|
|
4570
4611
|
* @method
|
|
@@ -4577,29 +4618,18 @@ class gate extends gate$1 {
|
|
|
4577
4618
|
* @param {string} id Order id
|
|
4578
4619
|
* @param {string} symbol Unified market symbol, *required for spot and margin*
|
|
4579
4620
|
* @param {object} [params] Parameters specified by the exchange api
|
|
4580
|
-
* @param {bool} [params.
|
|
4621
|
+
* @param {bool} [params.trigger] True if the order being fetched is a trigger order
|
|
4581
4622
|
* @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
|
|
4582
4623
|
* @param {string} [params.type] 'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used
|
|
4583
4624
|
* @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
|
|
4584
4625
|
* @returns An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4585
4626
|
*/
|
|
4586
4627
|
await this.loadMarkets();
|
|
4587
|
-
const stop = this.safeValue2(params, 'is_stop_order', 'stop', false);
|
|
4588
|
-
params = this.omit(params, ['is_stop_order', 'stop']);
|
|
4589
|
-
let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
|
|
4590
|
-
let orderId = id;
|
|
4591
|
-
if (clientOrderId !== undefined) {
|
|
4592
|
-
params = this.omit(params, ['text', 'clientOrderId']);
|
|
4593
|
-
if (clientOrderId[0] !== 't') {
|
|
4594
|
-
clientOrderId = 't-' + clientOrderId;
|
|
4595
|
-
}
|
|
4596
|
-
orderId = clientOrderId;
|
|
4597
|
-
}
|
|
4598
4628
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4599
|
-
const
|
|
4600
|
-
const
|
|
4601
|
-
const
|
|
4602
|
-
request
|
|
4629
|
+
const result = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
4630
|
+
const type = this.safeString(result, 0);
|
|
4631
|
+
const stop = this.safeBoolN(params, ['trigger', 'is_stop_order', 'stop'], false);
|
|
4632
|
+
const [request, requestParams] = this.fetchOrderRequest(id, symbol, params);
|
|
4603
4633
|
let response = undefined;
|
|
4604
4634
|
if (type === 'spot' || type === 'margin') {
|
|
4605
4635
|
if (stop) {
|
|
@@ -4673,15 +4703,14 @@ class gate extends gate$1 {
|
|
|
4673
4703
|
*/
|
|
4674
4704
|
return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
|
|
4675
4705
|
}
|
|
4676
|
-
|
|
4677
|
-
await this.loadMarkets();
|
|
4706
|
+
fetchOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4678
4707
|
let market = undefined;
|
|
4679
4708
|
if (symbol !== undefined) {
|
|
4680
4709
|
market = this.market(symbol);
|
|
4681
4710
|
symbol = market['symbol'];
|
|
4682
4711
|
}
|
|
4683
|
-
const stop = this.
|
|
4684
|
-
params = this.omit(params, 'stop');
|
|
4712
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4713
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
4685
4714
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4686
4715
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4687
4716
|
const [request, requestParams] = spot ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
@@ -4695,6 +4724,26 @@ class gate extends gate$1 {
|
|
|
4695
4724
|
if (since !== undefined && spot) {
|
|
4696
4725
|
request['from'] = this.parseToInt(since / 1000);
|
|
4697
4726
|
}
|
|
4727
|
+
const [lastId, finalParams] = this.handleParamString2(requestParams, 'lastId', 'last_id');
|
|
4728
|
+
if (lastId !== undefined) {
|
|
4729
|
+
request['last_id'] = lastId;
|
|
4730
|
+
}
|
|
4731
|
+
return [request, finalParams];
|
|
4732
|
+
}
|
|
4733
|
+
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4734
|
+
await this.loadMarkets();
|
|
4735
|
+
let market = undefined;
|
|
4736
|
+
if (symbol !== undefined) {
|
|
4737
|
+
market = this.market(symbol);
|
|
4738
|
+
symbol = market['symbol'];
|
|
4739
|
+
}
|
|
4740
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4741
|
+
params = this.omit(params, ['trigger', 'stop']);
|
|
4742
|
+
const res = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4743
|
+
const type = this.safeString(res, 0);
|
|
4744
|
+
params['type'] = type;
|
|
4745
|
+
const [request, requestParams] = this.fetchOrdersByStatusRequest(status, symbol, since, limit, params);
|
|
4746
|
+
const spot = (type === 'spot') || (type === 'margin');
|
|
4698
4747
|
const openSpotOrders = spot && (status === 'open') && !stop;
|
|
4699
4748
|
let response = undefined;
|
|
4700
4749
|
if (type === 'spot' || type === 'margin') {
|
|
@@ -4904,8 +4953,8 @@ class gate extends gate$1 {
|
|
|
4904
4953
|
*/
|
|
4905
4954
|
await this.loadMarkets();
|
|
4906
4955
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
4907
|
-
const stop = this.
|
|
4908
|
-
params = this.omit(params, ['is_stop_order', 'stop']);
|
|
4956
|
+
const stop = this.safeBoolN(params, ['is_stop_order', 'stop', 'trigger'], false);
|
|
4957
|
+
params = this.omit(params, ['is_stop_order', 'stop', 'trigger']);
|
|
4909
4958
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
4910
4959
|
const [request, requestParams] = (type === 'spot' || type === 'margin') ? this.spotOrderPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
4911
4960
|
request['order_id'] = id;
|
|
@@ -1213,7 +1213,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1213
1213
|
* @param {string} [params.vaultAddress] the vault address for order
|
|
1214
1214
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1215
1215
|
*/
|
|
1216
|
-
|
|
1216
|
+
const orders = await this.cancelOrders([id], symbol, params);
|
|
1217
|
+
return this.safeDict(orders, 0);
|
|
1217
1218
|
}
|
|
1218
1219
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1219
1220
|
/**
|
|
@@ -1292,7 +1293,18 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1292
1293
|
// }
|
|
1293
1294
|
// }
|
|
1294
1295
|
//
|
|
1295
|
-
|
|
1296
|
+
const innerResponse = this.safeDict(response, 'response');
|
|
1297
|
+
const data = this.safeDict(innerResponse, 'data');
|
|
1298
|
+
const statuses = this.safeList(data, 'statuses');
|
|
1299
|
+
const orders = [];
|
|
1300
|
+
for (let i = 0; i < statuses.length; i++) {
|
|
1301
|
+
const status = statuses[i];
|
|
1302
|
+
orders.push(this.safeOrder({
|
|
1303
|
+
'info': status,
|
|
1304
|
+
'status': status,
|
|
1305
|
+
}));
|
|
1306
|
+
}
|
|
1307
|
+
return orders;
|
|
1296
1308
|
}
|
|
1297
1309
|
async cancelOrdersForSymbols(orders, params = {}) {
|
|
1298
1310
|
/**
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1713,6 +1713,7 @@ class kraken extends kraken$1 {
|
|
|
1713
1713
|
'filled': filled,
|
|
1714
1714
|
'average': average,
|
|
1715
1715
|
'remaining': undefined,
|
|
1716
|
+
'reduceOnly': this.safeBool2(order, 'reduceOnly', 'reduce_only'),
|
|
1716
1717
|
'fee': fee,
|
|
1717
1718
|
'trades': trades,
|
|
1718
1719
|
}, market);
|
|
@@ -2122,7 +2123,7 @@ class kraken extends kraken$1 {
|
|
|
2122
2123
|
* @method
|
|
2123
2124
|
* @name kraken#cancelOrder
|
|
2124
2125
|
* @description cancels an open order
|
|
2125
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
|
|
2126
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrder
|
|
2126
2127
|
* @param {string} id order id
|
|
2127
2128
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2128
2129
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2163,7 +2164,7 @@ class kraken extends kraken$1 {
|
|
|
2163
2164
|
* @method
|
|
2164
2165
|
* @name kraken#cancelOrders
|
|
2165
2166
|
* @description cancel multiple orders
|
|
2166
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
|
|
2167
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrderBatch
|
|
2167
2168
|
* @param {string[]} ids open orders transaction ID (txid) or user reference (userref)
|
|
2168
2169
|
* @param {string} symbol unified market symbol
|
|
2169
2170
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2192,7 +2193,7 @@ class kraken extends kraken$1 {
|
|
|
2192
2193
|
* @method
|
|
2193
2194
|
* @name kraken#cancelAllOrders
|
|
2194
2195
|
* @description cancel all open orders
|
|
2195
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
|
|
2196
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
|
|
2196
2197
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
2197
2198
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2198
2199
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -121,6 +121,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
121
121
|
'transfers',
|
|
122
122
|
'leveragepreferences',
|
|
123
123
|
'pnlpreferences',
|
|
124
|
+
'assignmentprogram/current',
|
|
125
|
+
'assignmentprogram/history',
|
|
124
126
|
],
|
|
125
127
|
'post': [
|
|
126
128
|
'sendorder',
|
|
@@ -130,7 +132,9 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
130
132
|
'batchorder',
|
|
131
133
|
'cancelallorders',
|
|
132
134
|
'cancelallordersafter',
|
|
133
|
-
'withdrawal',
|
|
135
|
+
'withdrawal',
|
|
136
|
+
'assignmentprogram/add',
|
|
137
|
+
'assignmentprogram/delete',
|
|
134
138
|
],
|
|
135
139
|
'put': [
|
|
136
140
|
'leveragepreferences',
|
|
@@ -1871,7 +1875,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1871
1875
|
'type': this.parseOrderType(type),
|
|
1872
1876
|
'timeInForce': timeInForce,
|
|
1873
1877
|
'postOnly': type === 'post',
|
|
1874
|
-
'reduceOnly': this.
|
|
1878
|
+
'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
|
|
1875
1879
|
'side': this.safeString(details, 'side'),
|
|
1876
1880
|
'price': price,
|
|
1877
1881
|
'stopPrice': this.safeString(details, 'triggerPrice'),
|
|
@@ -739,16 +739,16 @@ class bingx extends bingx$1 {
|
|
|
739
739
|
// ]
|
|
740
740
|
// }
|
|
741
741
|
//
|
|
742
|
-
const
|
|
742
|
+
const isSwap = client.url.indexOf('swap') >= 0;
|
|
743
743
|
let candles = undefined;
|
|
744
|
-
if (
|
|
745
|
-
candles = data;
|
|
744
|
+
if (isSwap) {
|
|
745
|
+
candles = this.safeList(message, 'data', []);
|
|
746
746
|
}
|
|
747
747
|
else {
|
|
748
|
-
|
|
748
|
+
const data = this.safeDict(message, 'data', {});
|
|
749
|
+
candles = [this.safeDict(data, 'K', {})];
|
|
749
750
|
}
|
|
750
751
|
const dataType = this.safeString(message, 'dataType');
|
|
751
|
-
const isSwap = client.url.indexOf('swap') >= 0;
|
|
752
752
|
const parts = dataType.split('@');
|
|
753
753
|
const firstPart = parts[0];
|
|
754
754
|
const isAllEndpoint = (firstPart === 'all');
|
|
@@ -69,6 +69,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
69
69
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70
70
|
* @returns {object} subscription to a websocket channel
|
|
71
71
|
*/
|
|
72
|
+
await this.loadMarkets();
|
|
72
73
|
this.checkRequiredCredentials();
|
|
73
74
|
let market = undefined;
|
|
74
75
|
let messageHash = name;
|
|
@@ -117,6 +118,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
117
118
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
118
119
|
* @returns {object} subscription to a websocket channel
|
|
119
120
|
*/
|
|
121
|
+
await this.loadMarkets();
|
|
120
122
|
this.checkRequiredCredentials();
|
|
121
123
|
if (this.isEmpty(symbols)) {
|
|
122
124
|
symbols = this.symbols;
|
|
@@ -160,6 +162,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
160
162
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161
163
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
162
164
|
*/
|
|
165
|
+
await this.loadMarkets();
|
|
163
166
|
return await this.subscribe('RISK', [symbol], params);
|
|
164
167
|
}
|
|
165
168
|
async watchFundingRates(symbols, params = {}) {
|
|
@@ -172,6 +175,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
172
175
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
173
176
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
174
177
|
*/
|
|
178
|
+
await this.loadMarkets();
|
|
175
179
|
const fundingRate = await this.subscribeMultiple('RISK', symbols, params);
|
|
176
180
|
const symbol = this.safeString(fundingRate, 'symbol');
|
|
177
181
|
if (this.newUpdates) {
|
|
@@ -191,6 +195,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
191
195
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
192
196
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
193
197
|
*/
|
|
198
|
+
await this.loadMarkets();
|
|
194
199
|
let channel = undefined;
|
|
195
200
|
[channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'LEVEL1');
|
|
196
201
|
return await this.subscribe(channel, [symbol], params);
|