ccxt 4.3.56 → 4.3.58
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/alpaca.js +5 -1
- package/dist/cjs/src/base/ws/Client.js +34 -4
- package/dist/cjs/src/bigone.js +21 -1
- package/dist/cjs/src/bingx.js +127 -27
- package/dist/cjs/src/bitget.js +56 -47
- package/dist/cjs/src/coinmate.js +28 -35
- package/dist/cjs/src/coinone.js +13 -19
- package/dist/cjs/src/gate.js +117 -4
- package/dist/cjs/src/htx.js +91 -26
- package/dist/cjs/src/huobijp.js +65 -2
- package/dist/cjs/src/kucoin.js +3 -0
- package/dist/cjs/src/latoken.js +5 -1
- package/dist/cjs/src/okx.js +3 -0
- package/dist/cjs/src/pro/okx.js +3 -3
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/alpaca.d.ts +1 -1
- package/js/src/alpaca.js +5 -1
- package/js/src/base/ws/Client.d.ts +2 -0
- package/js/src/base/ws/Client.js +34 -4
- package/js/src/bigone.d.ts +1 -1
- package/js/src/bigone.js +21 -1
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +127 -27
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +56 -47
- package/js/src/coinmate.js +28 -35
- package/js/src/coinone.js +13 -19
- package/js/src/gate.d.ts +3 -1
- package/js/src/gate.js +117 -4
- package/js/src/htx.d.ts +3 -2
- package/js/src/htx.js +91 -26
- package/js/src/huobijp.d.ts +3 -2
- package/js/src/huobijp.js +65 -2
- package/js/src/kucoin.js +3 -0
- package/js/src/latoken.d.ts +1 -1
- package/js/src/latoken.js +5 -1
- package/js/src/okx.js +3 -0
- package/js/src/pro/okx.js +3 -3
- package/js/src/woo.js +2 -2
- package/package.json +1 -1
package/js/src/coinone.js
CHANGED
|
@@ -21,8 +21,7 @@ export default class coinone extends Exchange {
|
|
|
21
21
|
'id': 'coinone',
|
|
22
22
|
'name': 'CoinOne',
|
|
23
23
|
'countries': ['KR'],
|
|
24
|
-
|
|
25
|
-
'rateLimit': 667,
|
|
24
|
+
'rateLimit': 50,
|
|
26
25
|
'version': 'v2',
|
|
27
26
|
'pro': false,
|
|
28
27
|
'has': {
|
|
@@ -194,10 +193,10 @@ export default class coinone extends Exchange {
|
|
|
194
193
|
},
|
|
195
194
|
'precisionMode': TICK_SIZE,
|
|
196
195
|
'exceptions': {
|
|
197
|
-
'405': OnMaintenance,
|
|
198
196
|
'104': OrderNotFound,
|
|
197
|
+
'107': BadRequest,
|
|
199
198
|
'108': BadSymbol,
|
|
200
|
-
'
|
|
199
|
+
'405': OnMaintenance,
|
|
201
200
|
},
|
|
202
201
|
'commonCurrencies': {
|
|
203
202
|
'SOC': 'Soda Coin',
|
|
@@ -1167,22 +1166,17 @@ export default class coinone extends Exchange {
|
|
|
1167
1166
|
}
|
|
1168
1167
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
1169
1168
|
if (response === undefined) {
|
|
1170
|
-
return undefined;
|
|
1171
|
-
}
|
|
1172
|
-
if ('result' in response) {
|
|
1173
|
-
const result = response['result'];
|
|
1174
|
-
if (result !== 'success') {
|
|
1175
|
-
//
|
|
1176
|
-
// { "errorCode": "405", "status": "maintenance", "result": "error"}
|
|
1177
|
-
//
|
|
1178
|
-
const errorCode = this.safeString(response, 'errorCode');
|
|
1179
|
-
const feedback = this.id + ' ' + body;
|
|
1180
|
-
this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
|
|
1181
|
-
throw new ExchangeError(feedback);
|
|
1182
|
-
}
|
|
1169
|
+
return undefined; // fallback to default error handler
|
|
1183
1170
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1171
|
+
//
|
|
1172
|
+
// {"result":"error","error_code":"107","error_msg":"Parameter value is wrong"}
|
|
1173
|
+
// {"result":"error","error_code":"108","error_msg":"Unknown CryptoCurrency"}
|
|
1174
|
+
//
|
|
1175
|
+
const errorCode = this.safeString(response, 'error_code');
|
|
1176
|
+
if (errorCode !== undefined && errorCode !== '0') {
|
|
1177
|
+
const feedback = this.id + ' ' + body;
|
|
1178
|
+
this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
|
|
1179
|
+
throw new ExchangeError(feedback); // unknown message
|
|
1186
1180
|
}
|
|
1187
1181
|
return undefined;
|
|
1188
1182
|
}
|
package/js/src/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/gate.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class gate
|
|
5
5
|
* @augments Exchange
|
|
@@ -180,6 +180,8 @@ export default class gate extends Exchange {
|
|
|
180
180
|
fetchOrdersByStatusRequest(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): any[];
|
|
181
181
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
182
182
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
183
|
+
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
184
|
+
cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<Order[]>;
|
|
183
185
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
184
186
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
185
187
|
parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
|
package/js/src/gate.js
CHANGED
|
@@ -84,6 +84,8 @@ export default class gate extends Exchange {
|
|
|
84
84
|
'borrowIsolatedMargin': true,
|
|
85
85
|
'cancelAllOrders': true,
|
|
86
86
|
'cancelOrder': true,
|
|
87
|
+
'cancelOrders': true,
|
|
88
|
+
'cancelOrdersForSymbols': true,
|
|
87
89
|
'createMarketBuyOrderWithCost': true,
|
|
88
90
|
'createMarketOrder': true,
|
|
89
91
|
'createMarketOrderWithCost': false,
|
|
@@ -4020,7 +4022,7 @@ export default class gate extends Exchange {
|
|
|
4020
4022
|
request['price'] = price; // set to 0 for market orders
|
|
4021
4023
|
}
|
|
4022
4024
|
else {
|
|
4023
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
4025
|
+
request['price'] = (price === 0) ? '0' : this.priceToPrecision(symbol, price);
|
|
4024
4026
|
}
|
|
4025
4027
|
if (reduceOnly !== undefined) {
|
|
4026
4028
|
request['reduce_only'] = reduceOnly;
|
|
@@ -4111,8 +4113,8 @@ export default class gate extends Exchange {
|
|
|
4111
4113
|
request = {
|
|
4112
4114
|
'initial': {
|
|
4113
4115
|
'contract': market['id'],
|
|
4114
|
-
'size': amount,
|
|
4115
|
-
'price': this.priceToPrecision(symbol, price), // set to 0 to use market price
|
|
4116
|
+
'size': amount, // positive = buy, negative = sell, set to 0 to close the position
|
|
4117
|
+
// 'price': (price === 0) ? '0' : this.priceToPrecision (symbol, price), // set to 0 to use market price
|
|
4116
4118
|
// 'close': false, // set to true if trying to close the position
|
|
4117
4119
|
// 'tif': 'gtc', // gtc, ioc, if using market price, only ioc is supported
|
|
4118
4120
|
// 'text': clientOrderId, // web, api, app
|
|
@@ -4120,6 +4122,12 @@ export default class gate extends Exchange {
|
|
|
4120
4122
|
},
|
|
4121
4123
|
'settle': market['settleId'],
|
|
4122
4124
|
};
|
|
4125
|
+
if (type === 'market') {
|
|
4126
|
+
request['initial']['price'] = '0';
|
|
4127
|
+
}
|
|
4128
|
+
else {
|
|
4129
|
+
request['initial']['price'] = (price === 0) ? '0' : this.priceToPrecision(symbol, price);
|
|
4130
|
+
}
|
|
4123
4131
|
if (trigger === undefined) {
|
|
4124
4132
|
let rule = undefined;
|
|
4125
4133
|
let triggerOrderPrice = undefined;
|
|
@@ -4470,6 +4478,8 @@ export default class gate extends Exchange {
|
|
|
4470
4478
|
// "message": "Not enough balance"
|
|
4471
4479
|
// }
|
|
4472
4480
|
//
|
|
4481
|
+
// {"user_id":10406147,"id":"id","succeeded":false,"message":"INVALID_PROTOCOL","label":"INVALID_PROTOCOL"}
|
|
4482
|
+
//
|
|
4473
4483
|
const succeeded = this.safeBool(order, 'succeeded', true);
|
|
4474
4484
|
if (!succeeded) {
|
|
4475
4485
|
// cancelOrders response
|
|
@@ -4477,6 +4487,7 @@ export default class gate extends Exchange {
|
|
|
4477
4487
|
'clientOrderId': this.safeString(order, 'text'),
|
|
4478
4488
|
'info': order,
|
|
4479
4489
|
'status': 'rejected',
|
|
4490
|
+
'id': this.safeString(order, 'id'),
|
|
4480
4491
|
});
|
|
4481
4492
|
}
|
|
4482
4493
|
const put = this.safeValue2(order, 'put', 'initial', {});
|
|
@@ -5076,6 +5087,92 @@ export default class gate extends Exchange {
|
|
|
5076
5087
|
//
|
|
5077
5088
|
return this.parseOrder(response, market);
|
|
5078
5089
|
}
|
|
5090
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
5091
|
+
/**
|
|
5092
|
+
* @method
|
|
5093
|
+
* @name gate#cancelOrders
|
|
5094
|
+
* @description cancel multiple orders
|
|
5095
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5096
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2
|
|
5097
|
+
* @param {string[]} ids order ids
|
|
5098
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
5099
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5100
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5101
|
+
*/
|
|
5102
|
+
await this.loadMarkets();
|
|
5103
|
+
let market = undefined;
|
|
5104
|
+
if (symbol !== undefined) {
|
|
5105
|
+
market = this.market(symbol);
|
|
5106
|
+
}
|
|
5107
|
+
let type = undefined;
|
|
5108
|
+
const defaultSettle = (market === undefined) ? 'usdt' : market['settle'];
|
|
5109
|
+
const settle = this.safeStringLower(params, 'settle', defaultSettle);
|
|
5110
|
+
[type, params] = this.handleMarketTypeAndParams('cancelOrders', market, params);
|
|
5111
|
+
const isSpot = (type === 'spot');
|
|
5112
|
+
if (isSpot && (symbol === undefined)) {
|
|
5113
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders requires a symbol argument for spot markets');
|
|
5114
|
+
}
|
|
5115
|
+
if (isSpot) {
|
|
5116
|
+
const ordersRequests = [];
|
|
5117
|
+
for (let i = 0; i < ids.length; i++) {
|
|
5118
|
+
const id = ids[i];
|
|
5119
|
+
const orderItem = {
|
|
5120
|
+
'id': id,
|
|
5121
|
+
'symbol': symbol,
|
|
5122
|
+
};
|
|
5123
|
+
ordersRequests.push(orderItem);
|
|
5124
|
+
}
|
|
5125
|
+
return await this.cancelOrdersForSymbols(ordersRequests, params);
|
|
5126
|
+
}
|
|
5127
|
+
const request = {
|
|
5128
|
+
'settle': settle,
|
|
5129
|
+
};
|
|
5130
|
+
const finalList = [request]; // hacky but needs to be done here
|
|
5131
|
+
for (let i = 0; i < ids.length; i++) {
|
|
5132
|
+
finalList.push(ids[i]);
|
|
5133
|
+
}
|
|
5134
|
+
const response = await this.privateFuturesPostSettleBatchCancelOrders(finalList);
|
|
5135
|
+
return this.parseOrders(response);
|
|
5136
|
+
}
|
|
5137
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
5138
|
+
/**
|
|
5139
|
+
* @method
|
|
5140
|
+
* @name gate#cancelOrdersForSymbols
|
|
5141
|
+
* @description cancel multiple orders for multiple symbols
|
|
5142
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5143
|
+
* @param {string[]} ids order ids
|
|
5144
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
5145
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5146
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
5147
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5148
|
+
*/
|
|
5149
|
+
await this.loadMarkets();
|
|
5150
|
+
const ordersRequests = [];
|
|
5151
|
+
for (let i = 0; i < orders.length; i++) {
|
|
5152
|
+
const order = orders[i];
|
|
5153
|
+
const symbol = this.safeString(order, 'symbol');
|
|
5154
|
+
const market = this.market(symbol);
|
|
5155
|
+
if (!market['spot']) {
|
|
5156
|
+
throw new NotSupported(this.id + ' cancelOrdersForSymbols() supports only spot markets');
|
|
5157
|
+
}
|
|
5158
|
+
const id = this.safeString(order, 'id');
|
|
5159
|
+
const orderItem = {
|
|
5160
|
+
'id': id,
|
|
5161
|
+
'currency_pair': market['id'],
|
|
5162
|
+
};
|
|
5163
|
+
ordersRequests.push(orderItem);
|
|
5164
|
+
}
|
|
5165
|
+
const response = await this.privateSpotPostCancelBatchOrders(ordersRequests);
|
|
5166
|
+
//
|
|
5167
|
+
// [
|
|
5168
|
+
// {
|
|
5169
|
+
// "currency_pair": "BTC_USDT",
|
|
5170
|
+
// "id": "123456"
|
|
5171
|
+
// }
|
|
5172
|
+
// ]
|
|
5173
|
+
//
|
|
5174
|
+
return this.parseOrders(response);
|
|
5175
|
+
}
|
|
5079
5176
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
5080
5177
|
/**
|
|
5081
5178
|
* @method
|
|
@@ -6080,7 +6177,22 @@ export default class gate extends Exchange {
|
|
|
6080
6177
|
const authentication = api[0]; // public, private
|
|
6081
6178
|
const type = api[1]; // spot, margin, future, delivery
|
|
6082
6179
|
let query = this.omit(params, this.extractParams(path));
|
|
6083
|
-
|
|
6180
|
+
const containsSettle = path.indexOf('settle') > -1;
|
|
6181
|
+
if (containsSettle && path.endsWith('batch_cancel_orders')) { // weird check to prevent $settle in php and converting {settle} to array(settle)
|
|
6182
|
+
// special case where we need to extract the settle from the path
|
|
6183
|
+
// but the body is an array of strings
|
|
6184
|
+
const settle = this.safeDict(params, 0);
|
|
6185
|
+
path = this.implodeParams(path, settle);
|
|
6186
|
+
// remove the first element from params
|
|
6187
|
+
const newParams = [];
|
|
6188
|
+
const anyParams = params;
|
|
6189
|
+
for (let i = 1; i < anyParams.length; i++) {
|
|
6190
|
+
newParams.push(params[i]);
|
|
6191
|
+
}
|
|
6192
|
+
params = newParams;
|
|
6193
|
+
query = newParams;
|
|
6194
|
+
}
|
|
6195
|
+
else if (Array.isArray(params)) {
|
|
6084
6196
|
// endpoints like createOrders use an array instead of an object
|
|
6085
6197
|
// so we infer the settle from one of the elements
|
|
6086
6198
|
// they have to be all the same so relying on the first one is fine
|
|
@@ -7553,6 +7665,7 @@ export default class gate extends Exchange {
|
|
|
7553
7665
|
// {"label": "INVALID_PARAM_VALUE", "message": "invalid argument: Trigger.rule"}
|
|
7554
7666
|
// {"label": "INVALID_PARAM_VALUE", "message": "invalid argument: trigger.expiration invalid range"}
|
|
7555
7667
|
// {"label": "INVALID_ARGUMENT", "detail": "invalid size"}
|
|
7668
|
+
// {"user_id":10406147,"id":"id","succeeded":false,"message":"INVALID_PROTOCOL","label":"INVALID_PROTOCOL"}
|
|
7556
7669
|
//
|
|
7557
7670
|
const label = this.safeString(response, 'label');
|
|
7558
7671
|
if (label !== undefined) {
|
package/js/src/htx.d.ts
CHANGED
|
@@ -90,8 +90,9 @@ export default class htx extends Exchange {
|
|
|
90
90
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
91
91
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
92
92
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
93
|
-
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
|
|
94
|
-
|
|
93
|
+
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
|
|
94
|
+
parseCancelOrders(orders: any): any[];
|
|
95
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<any[]>;
|
|
95
96
|
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
96
97
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
97
98
|
currency: string;
|
package/js/src/htx.js
CHANGED
|
@@ -3233,6 +3233,7 @@ export default class htx extends Exchange {
|
|
|
3233
3233
|
const instStatus = this.safeString(entry, 'instStatus');
|
|
3234
3234
|
const currencyActive = instStatus === 'normal';
|
|
3235
3235
|
let minPrecision = undefined;
|
|
3236
|
+
let minDeposit = undefined;
|
|
3236
3237
|
let minWithdraw = undefined;
|
|
3237
3238
|
let maxWithdraw = undefined;
|
|
3238
3239
|
let deposit = false;
|
|
@@ -3244,6 +3245,7 @@ export default class htx extends Exchange {
|
|
|
3244
3245
|
this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
|
|
3245
3246
|
this.options['networkNamesByChainIds'][uniqueChainId] = title;
|
|
3246
3247
|
const networkCode = this.networkIdToCode(uniqueChainId);
|
|
3248
|
+
minDeposit = this.safeNumber(chainEntry, 'minDepositAmt');
|
|
3247
3249
|
minWithdraw = this.safeNumber(chainEntry, 'minWithdrawAmt');
|
|
3248
3250
|
maxWithdraw = this.safeNumber(chainEntry, 'maxWithdrawAmt');
|
|
3249
3251
|
const withdrawStatus = this.safeString(chainEntry, 'withdrawStatus');
|
|
@@ -3264,7 +3266,7 @@ export default class htx extends Exchange {
|
|
|
3264
3266
|
'network': networkCode,
|
|
3265
3267
|
'limits': {
|
|
3266
3268
|
'deposit': {
|
|
3267
|
-
'min':
|
|
3269
|
+
'min': minDeposit,
|
|
3268
3270
|
'max': undefined,
|
|
3269
3271
|
},
|
|
3270
3272
|
'withdraw': {
|
|
@@ -6029,7 +6031,66 @@ export default class htx extends Exchange {
|
|
|
6029
6031
|
// "ts": 1604367997451
|
|
6030
6032
|
// }
|
|
6031
6033
|
//
|
|
6032
|
-
|
|
6034
|
+
const data = this.safeDict(response, 'data');
|
|
6035
|
+
return this.parseCancelOrders(data);
|
|
6036
|
+
}
|
|
6037
|
+
parseCancelOrders(orders) {
|
|
6038
|
+
//
|
|
6039
|
+
// {
|
|
6040
|
+
// "success": [
|
|
6041
|
+
// "5983466"
|
|
6042
|
+
// ],
|
|
6043
|
+
// "failed": [
|
|
6044
|
+
// {
|
|
6045
|
+
// "err-msg": "Incorrect order state",
|
|
6046
|
+
// "order-state": 7,
|
|
6047
|
+
// "order-id": "",
|
|
6048
|
+
// "err-code": "order-orderstate-error",
|
|
6049
|
+
// "client-order-id": "first"
|
|
6050
|
+
// },
|
|
6051
|
+
// ...
|
|
6052
|
+
// ]
|
|
6053
|
+
// }
|
|
6054
|
+
//
|
|
6055
|
+
// {
|
|
6056
|
+
// "errors": [
|
|
6057
|
+
// {
|
|
6058
|
+
// "order_id": "769206471845261312",
|
|
6059
|
+
// "err_code": 1061,
|
|
6060
|
+
// "err_msg": "This order doesnt exist."
|
|
6061
|
+
// }
|
|
6062
|
+
// ],
|
|
6063
|
+
// "successes": "1258075374411399168,1258075393254871040"
|
|
6064
|
+
// }
|
|
6065
|
+
//
|
|
6066
|
+
const successes = this.safeString(orders, 'successes');
|
|
6067
|
+
let success = undefined;
|
|
6068
|
+
if (successes !== undefined) {
|
|
6069
|
+
success = successes.split(',');
|
|
6070
|
+
}
|
|
6071
|
+
else {
|
|
6072
|
+
success = this.safeList(orders, 'success', []);
|
|
6073
|
+
}
|
|
6074
|
+
const failed = this.safeList2(orders, 'errors', 'failed', []);
|
|
6075
|
+
const result = [];
|
|
6076
|
+
for (let i = 0; i < success.length; i++) {
|
|
6077
|
+
const order = success[i];
|
|
6078
|
+
result.push(this.safeOrder({
|
|
6079
|
+
'info': order,
|
|
6080
|
+
'id': order,
|
|
6081
|
+
'status': 'canceled',
|
|
6082
|
+
}));
|
|
6083
|
+
}
|
|
6084
|
+
for (let i = 0; i < failed.length; i++) {
|
|
6085
|
+
const order = failed[i];
|
|
6086
|
+
result.push(this.safeOrder({
|
|
6087
|
+
'info': order,
|
|
6088
|
+
'id': this.safeString2(order, 'order-id', 'order_id'),
|
|
6089
|
+
'status': 'failed',
|
|
6090
|
+
'clientOrderId': this.safeString(order, 'client-order-id'),
|
|
6091
|
+
}));
|
|
6092
|
+
}
|
|
6093
|
+
return result;
|
|
6033
6094
|
}
|
|
6034
6095
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
6035
6096
|
/**
|
|
@@ -6070,6 +6131,22 @@ export default class htx extends Exchange {
|
|
|
6070
6131
|
request['symbol'] = market['id'];
|
|
6071
6132
|
}
|
|
6072
6133
|
response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
|
|
6134
|
+
//
|
|
6135
|
+
// {
|
|
6136
|
+
// "code": 200,
|
|
6137
|
+
// "data": {
|
|
6138
|
+
// "success-count": 2,
|
|
6139
|
+
// "failed-count": 0,
|
|
6140
|
+
// "next-id": 5454600
|
|
6141
|
+
// }
|
|
6142
|
+
// }
|
|
6143
|
+
//
|
|
6144
|
+
const data = this.safeDict(response, 'data');
|
|
6145
|
+
return [
|
|
6146
|
+
this.safeOrder({
|
|
6147
|
+
'info': data,
|
|
6148
|
+
}),
|
|
6149
|
+
];
|
|
6073
6150
|
}
|
|
6074
6151
|
else {
|
|
6075
6152
|
if (symbol === undefined) {
|
|
@@ -6149,31 +6226,19 @@ export default class htx extends Exchange {
|
|
|
6149
6226
|
else {
|
|
6150
6227
|
throw new NotSupported(this.id + ' cancelAllOrders() does not support ' + marketType + ' markets');
|
|
6151
6228
|
}
|
|
6229
|
+
//
|
|
6230
|
+
// {
|
|
6231
|
+
// "status": "ok",
|
|
6232
|
+
// "data": {
|
|
6233
|
+
// "errors": [],
|
|
6234
|
+
// "successes": "1104754904426696704"
|
|
6235
|
+
// },
|
|
6236
|
+
// "ts": "1683435723755"
|
|
6237
|
+
// }
|
|
6238
|
+
//
|
|
6239
|
+
const data = this.safeDict(response, 'data');
|
|
6240
|
+
return this.parseCancelOrders(data);
|
|
6152
6241
|
}
|
|
6153
|
-
//
|
|
6154
|
-
// spot
|
|
6155
|
-
//
|
|
6156
|
-
// {
|
|
6157
|
-
// "code": 200,
|
|
6158
|
-
// "data": {
|
|
6159
|
-
// "success-count": 2,
|
|
6160
|
-
// "failed-count": 0,
|
|
6161
|
-
// "next-id": 5454600
|
|
6162
|
-
// }
|
|
6163
|
-
// }
|
|
6164
|
-
//
|
|
6165
|
-
// future and swap
|
|
6166
|
-
//
|
|
6167
|
-
// {
|
|
6168
|
-
// "status": "ok",
|
|
6169
|
-
// "data": {
|
|
6170
|
-
// "errors": [],
|
|
6171
|
-
// "successes": "1104754904426696704"
|
|
6172
|
-
// },
|
|
6173
|
-
// "ts": "1683435723755"
|
|
6174
|
-
// }
|
|
6175
|
-
//
|
|
6176
|
-
return response;
|
|
6177
6242
|
}
|
|
6178
6243
|
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
6179
6244
|
/**
|
package/js/src/huobijp.d.ts
CHANGED
|
@@ -54,8 +54,9 @@ export default class huobijp extends Exchange {
|
|
|
54
54
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
55
55
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
56
56
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
57
|
-
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
|
|
58
|
-
|
|
57
|
+
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
|
|
58
|
+
parseCancelOrders(orders: any): any[];
|
|
59
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
59
60
|
currencyToPrecision(code: any, fee: any, networkCode?: any): string;
|
|
60
61
|
safeNetwork(networkId: any): string;
|
|
61
62
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
package/js/src/huobijp.js
CHANGED
|
@@ -1548,7 +1548,65 @@ export default class huobijp extends Exchange {
|
|
|
1548
1548
|
// }
|
|
1549
1549
|
// }
|
|
1550
1550
|
//
|
|
1551
|
-
return response;
|
|
1551
|
+
return this.parseCancelOrders(response);
|
|
1552
|
+
}
|
|
1553
|
+
parseCancelOrders(orders) {
|
|
1554
|
+
//
|
|
1555
|
+
// {
|
|
1556
|
+
// "success": [
|
|
1557
|
+
// "5983466"
|
|
1558
|
+
// ],
|
|
1559
|
+
// "failed": [
|
|
1560
|
+
// {
|
|
1561
|
+
// "err-msg": "Incorrect order state",
|
|
1562
|
+
// "order-state": 7,
|
|
1563
|
+
// "order-id": "",
|
|
1564
|
+
// "err-code": "order-orderstate-error",
|
|
1565
|
+
// "client-order-id": "first"
|
|
1566
|
+
// },
|
|
1567
|
+
// ...
|
|
1568
|
+
// ]
|
|
1569
|
+
// }
|
|
1570
|
+
//
|
|
1571
|
+
// {
|
|
1572
|
+
// "errors": [
|
|
1573
|
+
// {
|
|
1574
|
+
// "order_id": "769206471845261312",
|
|
1575
|
+
// "err_code": 1061,
|
|
1576
|
+
// "err_msg": "This order doesnt exist."
|
|
1577
|
+
// }
|
|
1578
|
+
// ],
|
|
1579
|
+
// "successes": "1258075374411399168,1258075393254871040"
|
|
1580
|
+
// }
|
|
1581
|
+
//
|
|
1582
|
+
const successes = this.safeString(orders, 'successes');
|
|
1583
|
+
let success = undefined;
|
|
1584
|
+
if (successes !== undefined) {
|
|
1585
|
+
success = successes.split(',');
|
|
1586
|
+
}
|
|
1587
|
+
else {
|
|
1588
|
+
success = this.safeList(orders, 'success', []);
|
|
1589
|
+
}
|
|
1590
|
+
const failed = this.safeList2(orders, 'errors', 'failed', []);
|
|
1591
|
+
const result = [];
|
|
1592
|
+
for (let i = 0; i < success.length; i++) {
|
|
1593
|
+
const order = success[i];
|
|
1594
|
+
result.push(this.safeOrder({
|
|
1595
|
+
'info': order,
|
|
1596
|
+
'id': order,
|
|
1597
|
+
'status': 'canceled',
|
|
1598
|
+
}));
|
|
1599
|
+
}
|
|
1600
|
+
for (let i = 0; i < failed.length; i++) {
|
|
1601
|
+
const order = failed[i];
|
|
1602
|
+
result.push(this.safeOrder({
|
|
1603
|
+
'info': order,
|
|
1604
|
+
'id': this.safeString2(order, 'order-id', 'order_id'),
|
|
1605
|
+
'status': 'failed',
|
|
1606
|
+
'clientOrderId': this.safeString(order, 'client-order-id'),
|
|
1607
|
+
}));
|
|
1608
|
+
}
|
|
1609
|
+
return result;
|
|
1552
1610
|
}
|
|
1553
1611
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
1554
1612
|
/**
|
|
@@ -1583,7 +1641,12 @@ export default class huobijp extends Exchange {
|
|
|
1583
1641
|
// }
|
|
1584
1642
|
// }
|
|
1585
1643
|
//
|
|
1586
|
-
|
|
1644
|
+
const data = this.safeDict(response, 'data', {});
|
|
1645
|
+
return [
|
|
1646
|
+
this.safeOrder({
|
|
1647
|
+
'info': data,
|
|
1648
|
+
}),
|
|
1649
|
+
];
|
|
1587
1650
|
}
|
|
1588
1651
|
currencyToPrecision(code, fee, networkCode = undefined) {
|
|
1589
1652
|
return this.decimalToPrecision(fee, 0, this.currencies[code]['precision'], this.precisionMode);
|
package/js/src/kucoin.js
CHANGED
|
@@ -243,6 +243,8 @@ export default class kucoin extends Exchange {
|
|
|
243
243
|
'purchase/orders': 10,
|
|
244
244
|
// broker
|
|
245
245
|
'broker/api/rebase/download': 3,
|
|
246
|
+
// affiliate
|
|
247
|
+
'affiliate/inviter/statistics': 30,
|
|
246
248
|
},
|
|
247
249
|
'post': {
|
|
248
250
|
// account
|
|
@@ -684,6 +686,7 @@ export default class kucoin extends Exchange {
|
|
|
684
686
|
'redeem/orders': 'v3',
|
|
685
687
|
'purchase/orders': 'v3',
|
|
686
688
|
'margin/symbols': 'v3',
|
|
689
|
+
'affiliate/inviter/statistics': 'v2',
|
|
687
690
|
},
|
|
688
691
|
'POST': {
|
|
689
692
|
// account
|
package/js/src/latoken.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export default class latoken extends Exchange {
|
|
|
45
45
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
46
46
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
47
47
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
48
|
-
cancelAllOrders(symbol?: Str, params?: {}): Promise<
|
|
48
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
49
49
|
fetchTransactions(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
50
50
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
51
51
|
parseTransactionStatus(status: Str): string;
|
package/js/src/latoken.js
CHANGED
|
@@ -1419,7 +1419,11 @@ export default class latoken extends Exchange {
|
|
|
1419
1419
|
// "status":"SUCCESS"
|
|
1420
1420
|
// }
|
|
1421
1421
|
//
|
|
1422
|
-
return
|
|
1422
|
+
return [
|
|
1423
|
+
this.safeOrder({
|
|
1424
|
+
'info': response,
|
|
1425
|
+
}),
|
|
1426
|
+
];
|
|
1423
1427
|
}
|
|
1424
1428
|
async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1425
1429
|
/**
|
package/js/src/okx.js
CHANGED
|
@@ -7356,6 +7356,9 @@ export default class okx extends Exchange {
|
|
|
7356
7356
|
}
|
|
7357
7357
|
depositWithdrawFees[code]['info'][currencyId] = feeInfo;
|
|
7358
7358
|
const chain = this.safeString(feeInfo, 'chain');
|
|
7359
|
+
if (chain === undefined) {
|
|
7360
|
+
continue;
|
|
7361
|
+
}
|
|
7359
7362
|
const chainSplit = chain.split('-');
|
|
7360
7363
|
const networkId = this.safeValue(chainSplit, 1);
|
|
7361
7364
|
const withdrawFee = this.safeNumber(feeInfo, 'minFee');
|
package/js/src/pro/okx.js
CHANGED
|
@@ -1685,7 +1685,7 @@ export default class okx extends okxRest {
|
|
|
1685
1685
|
if (this.isEmpty(args)) {
|
|
1686
1686
|
const method = this.safeString(message, 'op');
|
|
1687
1687
|
const stringMsg = this.json(message);
|
|
1688
|
-
this.handleErrors(undefined, undefined, client.url, method, undefined, stringMsg,
|
|
1688
|
+
this.handleErrors(undefined, undefined, client.url, method, undefined, stringMsg, message, undefined, undefined);
|
|
1689
1689
|
}
|
|
1690
1690
|
const orders = this.parseOrders(args, undefined, undefined, undefined);
|
|
1691
1691
|
const first = this.safeDict(orders, 0, {});
|
|
@@ -1860,8 +1860,8 @@ export default class okx extends okxRest {
|
|
|
1860
1860
|
future.resolve(true);
|
|
1861
1861
|
}
|
|
1862
1862
|
ping(client) {
|
|
1863
|
-
//
|
|
1864
|
-
//
|
|
1863
|
+
// OKX does not support the built-in WebSocket protocol-level ping-pong.
|
|
1864
|
+
// Instead, it requires a custom text-based ping-pong mechanism.
|
|
1865
1865
|
return 'ping';
|
|
1866
1866
|
}
|
|
1867
1867
|
handlePong(client, message) {
|
package/js/src/woo.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/woo.js';
|
|
9
|
-
import { AuthenticationError, RateLimitExceeded, BadRequest, ExchangeError, InvalidOrder, ArgumentsRequired, NotSupported, OnMaintenance } from './base/errors.js';
|
|
9
|
+
import { AuthenticationError, RateLimitExceeded, BadRequest, OperationFailed, ExchangeError, InvalidOrder, ArgumentsRequired, NotSupported, OnMaintenance } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
@@ -309,7 +309,7 @@ export default class woo extends Exchange {
|
|
|
309
309
|
'commonCurrencies': {},
|
|
310
310
|
'exceptions': {
|
|
311
311
|
'exact': {
|
|
312
|
-
'-1000':
|
|
312
|
+
'-1000': OperationFailed,
|
|
313
313
|
'-1001': AuthenticationError,
|
|
314
314
|
'-1002': AuthenticationError,
|
|
315
315
|
'-1003': RateLimitExceeded,
|
package/package.json
CHANGED