ccxt 4.3.91 → 4.3.93
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 +16 -16
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/hyperliquid.js +4 -3
- package/dist/cjs/src/kucoin.js +38 -10
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/hyperliquid.js +4 -3
- package/js/src/kucoin.js +38 -10
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -196,7 +196,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
196
196
|
|
|
197
197
|
//-----------------------------------------------------------------------------
|
|
198
198
|
// this is updated by vss.js when building
|
|
199
|
-
const version = '4.3.
|
|
199
|
+
const version = '4.3.93';
|
|
200
200
|
Exchange["default"].ccxtVersion = version;
|
|
201
201
|
const exchanges = {
|
|
202
202
|
'ace': ace,
|
|
@@ -326,7 +326,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
326
326
|
//
|
|
327
327
|
const meta = this.safeDict(response, 0, {});
|
|
328
328
|
const universe = this.safeList(meta, 'universe', []);
|
|
329
|
-
const assetCtxs = this.
|
|
329
|
+
const assetCtxs = this.safeList(response, 1, []);
|
|
330
330
|
const result = [];
|
|
331
331
|
for (let i = 0; i < universe.length; i++) {
|
|
332
332
|
const data = this.extend(this.safeDict(universe, i, {}), this.safeDict(assetCtxs, i, {}));
|
|
@@ -689,7 +689,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
689
689
|
const total = this.safeString(balance, 'total');
|
|
690
690
|
const free = this.safeString(balance, 'hold');
|
|
691
691
|
account['total'] = total;
|
|
692
|
-
account['
|
|
692
|
+
account['used'] = free;
|
|
693
693
|
spotBalances[code] = account;
|
|
694
694
|
}
|
|
695
695
|
return this.safeBalance(spotBalances);
|
|
@@ -1784,9 +1784,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1784
1784
|
[userAddress, params] = this.handlePublicAddress('fetchOrder', params);
|
|
1785
1785
|
await this.loadMarkets();
|
|
1786
1786
|
const market = this.safeMarket(symbol);
|
|
1787
|
+
const isClientOrderId = id.length >= 34;
|
|
1787
1788
|
const request = {
|
|
1788
1789
|
'type': 'orderStatus',
|
|
1789
|
-
'oid': this.parseToNumeric(id),
|
|
1790
|
+
'oid': isClientOrderId ? id : this.parseToNumeric(id),
|
|
1790
1791
|
'user': userAddress,
|
|
1791
1792
|
};
|
|
1792
1793
|
const response = await this.publicPostInfo(this.extend(request, params));
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -1211,7 +1211,7 @@ class kucoin extends kucoin$1 {
|
|
|
1211
1211
|
return result;
|
|
1212
1212
|
}
|
|
1213
1213
|
async loadMigrationStatus(force = false) {
|
|
1214
|
-
if (!('hfMigrated' in this.options) || force) {
|
|
1214
|
+
if (!('hfMigrated' in this.options) || (this.options['hfMigrated'] === undefined) || force) {
|
|
1215
1215
|
const result = await this.privateGetMigrateUserAccountStatus();
|
|
1216
1216
|
const data = this.safeDict(result, 'data', {});
|
|
1217
1217
|
const status = this.safeInteger(data, 'status');
|
|
@@ -1777,7 +1777,8 @@ class kucoin extends kucoin$1 {
|
|
|
1777
1777
|
// }
|
|
1778
1778
|
// }
|
|
1779
1779
|
//
|
|
1780
|
-
|
|
1780
|
+
const data = this.safeDict(response, 'data', {});
|
|
1781
|
+
return this.parseTicker(data, market);
|
|
1781
1782
|
}
|
|
1782
1783
|
parseOHLCV(ohlcv, market = undefined) {
|
|
1783
1784
|
//
|
|
@@ -2079,6 +2080,7 @@ class kucoin extends kucoin$1 {
|
|
|
2079
2080
|
* @see https://docs.kucoin.com/spot-hf/#place-hf-order
|
|
2080
2081
|
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order-test
|
|
2081
2082
|
* @see https://www.kucoin.com/docs/rest/margin-trading/orders/place-margin-order-test
|
|
2083
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-hf-order
|
|
2082
2084
|
* @param {string} symbol Unified CCXT market symbol
|
|
2083
2085
|
* @param {string} type 'limit' or 'market'
|
|
2084
2086
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2109,6 +2111,7 @@ class kucoin extends kucoin$1 {
|
|
|
2109
2111
|
* @param {bool} [params.autoBorrow] false, // The system will first borrow you funds at the optimal interest rate and then place an order for you
|
|
2110
2112
|
* @param {bool} [params.hf] false, // true for hf order
|
|
2111
2113
|
* @param {bool} [params.test] set to true to test an order, no order will be created but the request will be validated
|
|
2114
|
+
* @param {bool} [params.sync] set to true to use the hf sync call
|
|
2112
2115
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2113
2116
|
*/
|
|
2114
2117
|
await this.loadMarkets();
|
|
@@ -2117,6 +2120,8 @@ class kucoin extends kucoin$1 {
|
|
|
2117
2120
|
params = this.omit(params, 'test');
|
|
2118
2121
|
let hf = undefined;
|
|
2119
2122
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2123
|
+
let useSync = false;
|
|
2124
|
+
[useSync, params] = this.handleOptionAndParams(params, 'createOrder', 'sync', false);
|
|
2120
2125
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
2121
2126
|
const tradeType = this.safeString(params, 'tradeType'); // keep it for backward compatibility
|
|
2122
2127
|
const isTriggerOrder = (triggerPrice || stopLossPrice || takeProfitPrice);
|
|
@@ -2143,6 +2148,9 @@ class kucoin extends kucoin$1 {
|
|
|
2143
2148
|
else if (isMarginOrder) {
|
|
2144
2149
|
response = await this.privatePostMarginOrder(orderRequest);
|
|
2145
2150
|
}
|
|
2151
|
+
else if (useSync) {
|
|
2152
|
+
response = await this.privatePostHfOrdersSync(orderRequest);
|
|
2153
|
+
}
|
|
2146
2154
|
else if (hf) {
|
|
2147
2155
|
response = await this.privatePostHfOrders(orderRequest);
|
|
2148
2156
|
}
|
|
@@ -2211,9 +2219,11 @@ class kucoin extends kucoin$1 {
|
|
|
2211
2219
|
* @description create a list of trade orders
|
|
2212
2220
|
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-multiple-orders
|
|
2213
2221
|
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/place-multiple-hf-orders
|
|
2222
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-multiple-hf-orders
|
|
2214
2223
|
* @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
|
|
2215
2224
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2216
2225
|
* @param {bool} [params.hf] false, // true for hf orders
|
|
2226
|
+
* @param {bool} [params.sync] false, // true to use the hf sync call
|
|
2217
2227
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2218
2228
|
*/
|
|
2219
2229
|
await this.loadMarkets();
|
|
@@ -2248,8 +2258,13 @@ class kucoin extends kucoin$1 {
|
|
|
2248
2258
|
};
|
|
2249
2259
|
let hf = undefined;
|
|
2250
2260
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2261
|
+
let useSync = false;
|
|
2262
|
+
[useSync, params] = this.handleOptionAndParams(params, 'createOrders', 'sync', false);
|
|
2251
2263
|
let response = undefined;
|
|
2252
|
-
if (
|
|
2264
|
+
if (useSync) {
|
|
2265
|
+
response = await this.privatePostHfOrdersMultiSync(this.extend(request, params));
|
|
2266
|
+
}
|
|
2267
|
+
else if (hf) {
|
|
2253
2268
|
response = await this.privatePostHfOrdersMulti(this.extend(request, params));
|
|
2254
2269
|
}
|
|
2255
2270
|
else {
|
|
@@ -2425,11 +2440,14 @@ class kucoin extends kucoin$1 {
|
|
|
2425
2440
|
* @see https://docs.kucoin.com/spot#cancel-single-order-by-clientoid-2
|
|
2426
2441
|
* @see https://docs.kucoin.com/spot-hf/#cancel-orders-by-orderid
|
|
2427
2442
|
* @see https://docs.kucoin.com/spot-hf/#cancel-order-by-clientoid
|
|
2443
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-orderid
|
|
2444
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-clientoid
|
|
2428
2445
|
* @param {string} id order id
|
|
2429
2446
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2430
2447
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2431
2448
|
* @param {bool} [params.stop] True if cancelling a stop order
|
|
2432
2449
|
* @param {bool} [params.hf] false, // true for hf order
|
|
2450
|
+
* @param {bool} [params.sync] false, // true to use the hf sync call
|
|
2433
2451
|
* @returns Response from the exchange
|
|
2434
2452
|
*/
|
|
2435
2453
|
await this.loadMarkets();
|
|
@@ -2438,7 +2456,9 @@ class kucoin extends kucoin$1 {
|
|
|
2438
2456
|
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2439
2457
|
let hf = undefined;
|
|
2440
2458
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2441
|
-
|
|
2459
|
+
let useSync = false;
|
|
2460
|
+
[useSync, params] = this.handleOptionAndParams(params, 'cancelOrder', 'sync', false);
|
|
2461
|
+
if (hf || useSync) {
|
|
2442
2462
|
if (symbol === undefined) {
|
|
2443
2463
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol parameter for hf orders');
|
|
2444
2464
|
}
|
|
@@ -2461,6 +2481,9 @@ class kucoin extends kucoin$1 {
|
|
|
2461
2481
|
// }
|
|
2462
2482
|
//
|
|
2463
2483
|
}
|
|
2484
|
+
else if (useSync) {
|
|
2485
|
+
response = await this.privateDeleteHfOrdersSyncClientOrderClientOid(this.extend(request, params));
|
|
2486
|
+
}
|
|
2464
2487
|
else if (hf) {
|
|
2465
2488
|
response = await this.privateDeleteHfOrdersClientOrderClientOid(this.extend(request, params));
|
|
2466
2489
|
//
|
|
@@ -2499,6 +2522,9 @@ class kucoin extends kucoin$1 {
|
|
|
2499
2522
|
// }
|
|
2500
2523
|
//
|
|
2501
2524
|
}
|
|
2525
|
+
else if (useSync) {
|
|
2526
|
+
response = await this.privateDeleteHfOrdersSyncOrderId(this.extend(request, params));
|
|
2527
|
+
}
|
|
2502
2528
|
else if (hf) {
|
|
2503
2529
|
response = await this.privateDeleteHfOrdersOrderId(this.extend(request, params));
|
|
2504
2530
|
//
|
|
@@ -3675,8 +3701,9 @@ class kucoin extends kucoin$1 {
|
|
|
3675
3701
|
// }
|
|
3676
3702
|
// }
|
|
3677
3703
|
//
|
|
3678
|
-
const
|
|
3679
|
-
|
|
3704
|
+
const data = this.safeDict(response, 'data', {});
|
|
3705
|
+
const items = this.safeList(data, 'items', []);
|
|
3706
|
+
return this.parseTransactions(items, currency, since, limit, { 'type': 'deposit' });
|
|
3680
3707
|
}
|
|
3681
3708
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3682
3709
|
/**
|
|
@@ -3760,8 +3787,9 @@ class kucoin extends kucoin$1 {
|
|
|
3760
3787
|
// }
|
|
3761
3788
|
// }
|
|
3762
3789
|
//
|
|
3763
|
-
const
|
|
3764
|
-
|
|
3790
|
+
const data = this.safeDict(response, 'data', {});
|
|
3791
|
+
const items = this.safeList(data, 'items', []);
|
|
3792
|
+
return this.parseTransactions(items, currency, since, limit, { 'type': 'withdrawal' });
|
|
3765
3793
|
}
|
|
3766
3794
|
parseBalanceHelper(entry) {
|
|
3767
3795
|
const account = this.account();
|
|
@@ -4623,7 +4651,7 @@ class kucoin extends kucoin$1 {
|
|
|
4623
4651
|
// }
|
|
4624
4652
|
//
|
|
4625
4653
|
const data = this.safeDict(response, 'data');
|
|
4626
|
-
const rows = this.safeList(data, 'items');
|
|
4654
|
+
const rows = this.safeList(data, 'items', []);
|
|
4627
4655
|
return this.parseBorrowRateHistories(rows, codes, since, limit);
|
|
4628
4656
|
}
|
|
4629
4657
|
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
@@ -4678,7 +4706,7 @@ class kucoin extends kucoin$1 {
|
|
|
4678
4706
|
// }
|
|
4679
4707
|
//
|
|
4680
4708
|
const data = this.safeDict(response, 'data');
|
|
4681
|
-
const rows = this.safeList(data, 'items');
|
|
4709
|
+
const rows = this.safeList(data, 'items', []);
|
|
4682
4710
|
return this.parseBorrowRateHistory(rows, code, since, limit);
|
|
4683
4711
|
}
|
|
4684
4712
|
parseBorrowRateHistories(response, codes, since, limit) {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.92";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.93';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -329,7 +329,7 @@ export default class hyperliquid extends Exchange {
|
|
|
329
329
|
//
|
|
330
330
|
const meta = this.safeDict(response, 0, {});
|
|
331
331
|
const universe = this.safeList(meta, 'universe', []);
|
|
332
|
-
const assetCtxs = this.
|
|
332
|
+
const assetCtxs = this.safeList(response, 1, []);
|
|
333
333
|
const result = [];
|
|
334
334
|
for (let i = 0; i < universe.length; i++) {
|
|
335
335
|
const data = this.extend(this.safeDict(universe, i, {}), this.safeDict(assetCtxs, i, {}));
|
|
@@ -692,7 +692,7 @@ export default class hyperliquid extends Exchange {
|
|
|
692
692
|
const total = this.safeString(balance, 'total');
|
|
693
693
|
const free = this.safeString(balance, 'hold');
|
|
694
694
|
account['total'] = total;
|
|
695
|
-
account['
|
|
695
|
+
account['used'] = free;
|
|
696
696
|
spotBalances[code] = account;
|
|
697
697
|
}
|
|
698
698
|
return this.safeBalance(spotBalances);
|
|
@@ -1787,9 +1787,10 @@ export default class hyperliquid extends Exchange {
|
|
|
1787
1787
|
[userAddress, params] = this.handlePublicAddress('fetchOrder', params);
|
|
1788
1788
|
await this.loadMarkets();
|
|
1789
1789
|
const market = this.safeMarket(symbol);
|
|
1790
|
+
const isClientOrderId = id.length >= 34;
|
|
1790
1791
|
const request = {
|
|
1791
1792
|
'type': 'orderStatus',
|
|
1792
|
-
'oid': this.parseToNumeric(id),
|
|
1793
|
+
'oid': isClientOrderId ? id : this.parseToNumeric(id),
|
|
1793
1794
|
'user': userAddress,
|
|
1794
1795
|
};
|
|
1795
1796
|
const response = await this.publicPostInfo(this.extend(request, params));
|
package/js/src/kucoin.js
CHANGED
|
@@ -1214,7 +1214,7 @@ export default class kucoin extends Exchange {
|
|
|
1214
1214
|
return result;
|
|
1215
1215
|
}
|
|
1216
1216
|
async loadMigrationStatus(force = false) {
|
|
1217
|
-
if (!('hfMigrated' in this.options) || force) {
|
|
1217
|
+
if (!('hfMigrated' in this.options) || (this.options['hfMigrated'] === undefined) || force) {
|
|
1218
1218
|
const result = await this.privateGetMigrateUserAccountStatus();
|
|
1219
1219
|
const data = this.safeDict(result, 'data', {});
|
|
1220
1220
|
const status = this.safeInteger(data, 'status');
|
|
@@ -1780,7 +1780,8 @@ export default class kucoin extends Exchange {
|
|
|
1780
1780
|
// }
|
|
1781
1781
|
// }
|
|
1782
1782
|
//
|
|
1783
|
-
|
|
1783
|
+
const data = this.safeDict(response, 'data', {});
|
|
1784
|
+
return this.parseTicker(data, market);
|
|
1784
1785
|
}
|
|
1785
1786
|
parseOHLCV(ohlcv, market = undefined) {
|
|
1786
1787
|
//
|
|
@@ -2082,6 +2083,7 @@ export default class kucoin extends Exchange {
|
|
|
2082
2083
|
* @see https://docs.kucoin.com/spot-hf/#place-hf-order
|
|
2083
2084
|
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order-test
|
|
2084
2085
|
* @see https://www.kucoin.com/docs/rest/margin-trading/orders/place-margin-order-test
|
|
2086
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-hf-order
|
|
2085
2087
|
* @param {string} symbol Unified CCXT market symbol
|
|
2086
2088
|
* @param {string} type 'limit' or 'market'
|
|
2087
2089
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2112,6 +2114,7 @@ export default class kucoin extends Exchange {
|
|
|
2112
2114
|
* @param {bool} [params.autoBorrow] false, // The system will first borrow you funds at the optimal interest rate and then place an order for you
|
|
2113
2115
|
* @param {bool} [params.hf] false, // true for hf order
|
|
2114
2116
|
* @param {bool} [params.test] set to true to test an order, no order will be created but the request will be validated
|
|
2117
|
+
* @param {bool} [params.sync] set to true to use the hf sync call
|
|
2115
2118
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2116
2119
|
*/
|
|
2117
2120
|
await this.loadMarkets();
|
|
@@ -2120,6 +2123,8 @@ export default class kucoin extends Exchange {
|
|
|
2120
2123
|
params = this.omit(params, 'test');
|
|
2121
2124
|
let hf = undefined;
|
|
2122
2125
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2126
|
+
let useSync = false;
|
|
2127
|
+
[useSync, params] = this.handleOptionAndParams(params, 'createOrder', 'sync', false);
|
|
2123
2128
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
2124
2129
|
const tradeType = this.safeString(params, 'tradeType'); // keep it for backward compatibility
|
|
2125
2130
|
const isTriggerOrder = (triggerPrice || stopLossPrice || takeProfitPrice);
|
|
@@ -2146,6 +2151,9 @@ export default class kucoin extends Exchange {
|
|
|
2146
2151
|
else if (isMarginOrder) {
|
|
2147
2152
|
response = await this.privatePostMarginOrder(orderRequest);
|
|
2148
2153
|
}
|
|
2154
|
+
else if (useSync) {
|
|
2155
|
+
response = await this.privatePostHfOrdersSync(orderRequest);
|
|
2156
|
+
}
|
|
2149
2157
|
else if (hf) {
|
|
2150
2158
|
response = await this.privatePostHfOrders(orderRequest);
|
|
2151
2159
|
}
|
|
@@ -2214,9 +2222,11 @@ export default class kucoin extends Exchange {
|
|
|
2214
2222
|
* @description create a list of trade orders
|
|
2215
2223
|
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-multiple-orders
|
|
2216
2224
|
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/place-multiple-hf-orders
|
|
2225
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-multiple-hf-orders
|
|
2217
2226
|
* @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
|
|
2218
2227
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2219
2228
|
* @param {bool} [params.hf] false, // true for hf orders
|
|
2229
|
+
* @param {bool} [params.sync] false, // true to use the hf sync call
|
|
2220
2230
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2221
2231
|
*/
|
|
2222
2232
|
await this.loadMarkets();
|
|
@@ -2251,8 +2261,13 @@ export default class kucoin extends Exchange {
|
|
|
2251
2261
|
};
|
|
2252
2262
|
let hf = undefined;
|
|
2253
2263
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2264
|
+
let useSync = false;
|
|
2265
|
+
[useSync, params] = this.handleOptionAndParams(params, 'createOrders', 'sync', false);
|
|
2254
2266
|
let response = undefined;
|
|
2255
|
-
if (
|
|
2267
|
+
if (useSync) {
|
|
2268
|
+
response = await this.privatePostHfOrdersMultiSync(this.extend(request, params));
|
|
2269
|
+
}
|
|
2270
|
+
else if (hf) {
|
|
2256
2271
|
response = await this.privatePostHfOrdersMulti(this.extend(request, params));
|
|
2257
2272
|
}
|
|
2258
2273
|
else {
|
|
@@ -2428,11 +2443,14 @@ export default class kucoin extends Exchange {
|
|
|
2428
2443
|
* @see https://docs.kucoin.com/spot#cancel-single-order-by-clientoid-2
|
|
2429
2444
|
* @see https://docs.kucoin.com/spot-hf/#cancel-orders-by-orderid
|
|
2430
2445
|
* @see https://docs.kucoin.com/spot-hf/#cancel-order-by-clientoid
|
|
2446
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-orderid
|
|
2447
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-clientoid
|
|
2431
2448
|
* @param {string} id order id
|
|
2432
2449
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2433
2450
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2434
2451
|
* @param {bool} [params.stop] True if cancelling a stop order
|
|
2435
2452
|
* @param {bool} [params.hf] false, // true for hf order
|
|
2453
|
+
* @param {bool} [params.sync] false, // true to use the hf sync call
|
|
2436
2454
|
* @returns Response from the exchange
|
|
2437
2455
|
*/
|
|
2438
2456
|
await this.loadMarkets();
|
|
@@ -2441,7 +2459,9 @@ export default class kucoin extends Exchange {
|
|
|
2441
2459
|
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2442
2460
|
let hf = undefined;
|
|
2443
2461
|
[hf, params] = await this.handleHfAndParams(params);
|
|
2444
|
-
|
|
2462
|
+
let useSync = false;
|
|
2463
|
+
[useSync, params] = this.handleOptionAndParams(params, 'cancelOrder', 'sync', false);
|
|
2464
|
+
if (hf || useSync) {
|
|
2445
2465
|
if (symbol === undefined) {
|
|
2446
2466
|
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol parameter for hf orders');
|
|
2447
2467
|
}
|
|
@@ -2464,6 +2484,9 @@ export default class kucoin extends Exchange {
|
|
|
2464
2484
|
// }
|
|
2465
2485
|
//
|
|
2466
2486
|
}
|
|
2487
|
+
else if (useSync) {
|
|
2488
|
+
response = await this.privateDeleteHfOrdersSyncClientOrderClientOid(this.extend(request, params));
|
|
2489
|
+
}
|
|
2467
2490
|
else if (hf) {
|
|
2468
2491
|
response = await this.privateDeleteHfOrdersClientOrderClientOid(this.extend(request, params));
|
|
2469
2492
|
//
|
|
@@ -2502,6 +2525,9 @@ export default class kucoin extends Exchange {
|
|
|
2502
2525
|
// }
|
|
2503
2526
|
//
|
|
2504
2527
|
}
|
|
2528
|
+
else if (useSync) {
|
|
2529
|
+
response = await this.privateDeleteHfOrdersSyncOrderId(this.extend(request, params));
|
|
2530
|
+
}
|
|
2505
2531
|
else if (hf) {
|
|
2506
2532
|
response = await this.privateDeleteHfOrdersOrderId(this.extend(request, params));
|
|
2507
2533
|
//
|
|
@@ -3678,8 +3704,9 @@ export default class kucoin extends Exchange {
|
|
|
3678
3704
|
// }
|
|
3679
3705
|
// }
|
|
3680
3706
|
//
|
|
3681
|
-
const
|
|
3682
|
-
|
|
3707
|
+
const data = this.safeDict(response, 'data', {});
|
|
3708
|
+
const items = this.safeList(data, 'items', []);
|
|
3709
|
+
return this.parseTransactions(items, currency, since, limit, { 'type': 'deposit' });
|
|
3683
3710
|
}
|
|
3684
3711
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3685
3712
|
/**
|
|
@@ -3763,8 +3790,9 @@ export default class kucoin extends Exchange {
|
|
|
3763
3790
|
// }
|
|
3764
3791
|
// }
|
|
3765
3792
|
//
|
|
3766
|
-
const
|
|
3767
|
-
|
|
3793
|
+
const data = this.safeDict(response, 'data', {});
|
|
3794
|
+
const items = this.safeList(data, 'items', []);
|
|
3795
|
+
return this.parseTransactions(items, currency, since, limit, { 'type': 'withdrawal' });
|
|
3768
3796
|
}
|
|
3769
3797
|
parseBalanceHelper(entry) {
|
|
3770
3798
|
const account = this.account();
|
|
@@ -4626,7 +4654,7 @@ export default class kucoin extends Exchange {
|
|
|
4626
4654
|
// }
|
|
4627
4655
|
//
|
|
4628
4656
|
const data = this.safeDict(response, 'data');
|
|
4629
|
-
const rows = this.safeList(data, 'items');
|
|
4657
|
+
const rows = this.safeList(data, 'items', []);
|
|
4630
4658
|
return this.parseBorrowRateHistories(rows, codes, since, limit);
|
|
4631
4659
|
}
|
|
4632
4660
|
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
@@ -4681,7 +4709,7 @@ export default class kucoin extends Exchange {
|
|
|
4681
4709
|
// }
|
|
4682
4710
|
//
|
|
4683
4711
|
const data = this.safeDict(response, 'data');
|
|
4684
|
-
const rows = this.safeList(data, 'items');
|
|
4712
|
+
const rows = this.safeList(data, 'items', []);
|
|
4685
4713
|
return this.parseBorrowRateHistory(rows, code, since, limit);
|
|
4686
4714
|
}
|
|
4687
4715
|
parseBorrowRateHistories(response, codes, since, limit) {
|
package/package.json
CHANGED