ccxt 4.2.10 → 4.2.11
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/build.sh +2 -2
- package/dist/ccxt.browser.js +56 -22
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +11 -0
- package/dist/cjs/src/bingx.js +0 -10
- package/dist/cjs/src/bitget.js +14 -5
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/kucoin.js +29 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +11 -0
- package/js/src/bingx.d.ts +0 -1
- package/js/src/bingx.js +0 -10
- package/js/src/bitget.js +14 -5
- package/js/src/bybit.js +1 -1
- package/js/src/kucoin.js +29 -5
- package/package.json +11 -11
- package/tests-manager.sh +2 -2
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.11';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
|
@@ -1295,6 +1295,17 @@ class Exchange {
|
|
|
1295
1295
|
axolotl(payload, hexKey, ed25519) {
|
|
1296
1296
|
return crypto.axolotl(payload, hexKey, ed25519);
|
|
1297
1297
|
}
|
|
1298
|
+
fixStringifiedJsonMembers(content) {
|
|
1299
|
+
// used for instance in bingx
|
|
1300
|
+
// when stringified json has members with their values also stringified, like:
|
|
1301
|
+
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
1302
|
+
// we can fix with below manipulations
|
|
1303
|
+
// @ts-ignore
|
|
1304
|
+
let modifiedContent = content.replaceAll('\\', '');
|
|
1305
|
+
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
1306
|
+
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
1307
|
+
return modifiedContent;
|
|
1308
|
+
}
|
|
1298
1309
|
/* eslint-enable */
|
|
1299
1310
|
// ------------------------------------------------------------------------
|
|
1300
1311
|
// ########################################################################
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1906,16 +1906,6 @@ class bingx extends bingx$1 {
|
|
|
1906
1906
|
const order = this.safeValue(data, 'order', data);
|
|
1907
1907
|
return this.parseOrder(order, market);
|
|
1908
1908
|
}
|
|
1909
|
-
fixStringifiedJsonMembers(content) {
|
|
1910
|
-
// when stringified json has members with their values also stringified, like:
|
|
1911
|
-
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
1912
|
-
// we can fix with below manipulations
|
|
1913
|
-
// @ts-ignore
|
|
1914
|
-
let modifiedContent = content.replaceAll('\\', '');
|
|
1915
|
-
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
1916
|
-
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
1917
|
-
return modifiedContent;
|
|
1918
|
-
}
|
|
1919
1909
|
async createOrders(orders, params = {}) {
|
|
1920
1910
|
/**
|
|
1921
1911
|
* @method
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -4008,6 +4008,7 @@ class bitget extends bitget$1 {
|
|
|
4008
4008
|
* @param {string} [params.trailingPercent] *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
|
|
4009
4009
|
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4010
4010
|
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
4011
|
+
* @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
|
|
4011
4012
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4012
4013
|
*/
|
|
4013
4014
|
await this.loadMarkets();
|
|
@@ -4201,15 +4202,23 @@ class bitget extends bitget$1 {
|
|
|
4201
4202
|
}
|
|
4202
4203
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4203
4204
|
request['marginMode'] = marginModeRequest;
|
|
4205
|
+
const oneWayMode = this.safeValue(params, 'oneWayMode', false);
|
|
4206
|
+
params = this.omit(params, 'oneWayMode');
|
|
4204
4207
|
let requestSide = side;
|
|
4205
4208
|
if (reduceOnly) {
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4209
|
+
if (oneWayMode) {
|
|
4210
|
+
request['reduceOnly'] = 'YES';
|
|
4211
|
+
}
|
|
4212
|
+
else {
|
|
4213
|
+
// on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
|
4214
|
+
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
4215
|
+
request['tradeSide'] = 'Close';
|
|
4216
|
+
}
|
|
4210
4217
|
}
|
|
4211
4218
|
else {
|
|
4212
|
-
|
|
4219
|
+
if (!oneWayMode) {
|
|
4220
|
+
request['tradeSide'] = 'Open';
|
|
4221
|
+
}
|
|
4213
4222
|
}
|
|
4214
4223
|
request['side'] = requestSide;
|
|
4215
4224
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -316,7 +316,7 @@ class bybit extends bybit$1 {
|
|
|
316
316
|
'v5/asset/deposit/query-internal-record': 5,
|
|
317
317
|
'v5/asset/deposit/query-address': 10,
|
|
318
318
|
'v5/asset/deposit/query-sub-member-address': 10,
|
|
319
|
-
'v5/asset/coin/query-info':
|
|
319
|
+
'v5/asset/coin/query-info': 28,
|
|
320
320
|
'v5/asset/withdraw/query-record': 10,
|
|
321
321
|
'v5/asset/withdraw/withdrawable-amount': 5,
|
|
322
322
|
// user
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -3445,10 +3445,12 @@ class kucoin extends kucoin$1 {
|
|
|
3445
3445
|
* @name kucoin#fetchBalance
|
|
3446
3446
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3447
3447
|
* @see https://docs.kucoin.com/#list-accounts
|
|
3448
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
|
|
3448
3449
|
* @see https://docs.kucoin.com/#query-isolated-margin-account-info
|
|
3449
3450
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3450
3451
|
* @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
|
|
3451
3452
|
* @param {object} [params.type] extra parameters specific to the exchange API endpoint
|
|
3453
|
+
* @param {object} [params.hf] *default if false* if true, the result includes the balance of the high frequency account
|
|
3452
3454
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3453
3455
|
*/
|
|
3454
3456
|
await this.loadMarkets();
|
|
@@ -3460,8 +3462,13 @@ class kucoin extends kucoin$1 {
|
|
|
3460
3462
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
3461
3463
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
3462
3464
|
const accountsByType = this.safeValue(this.options, 'accountsByType');
|
|
3463
|
-
|
|
3465
|
+
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
3464
3466
|
params = this.omit(params, 'type');
|
|
3467
|
+
const isHf = this.safeValue(params, 'hf', false);
|
|
3468
|
+
if (isHf) {
|
|
3469
|
+
type = 'trade_hf';
|
|
3470
|
+
}
|
|
3471
|
+
params = this.omit(params, 'hf');
|
|
3465
3472
|
const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
3466
3473
|
let response = undefined;
|
|
3467
3474
|
const request = {};
|
|
@@ -3543,7 +3550,7 @@ class kucoin extends kucoin$1 {
|
|
|
3543
3550
|
'datetime': undefined,
|
|
3544
3551
|
};
|
|
3545
3552
|
if (isolated) {
|
|
3546
|
-
const assets = this.safeValue(data, 'assets',
|
|
3553
|
+
const assets = this.safeValue(data, 'assets', data);
|
|
3547
3554
|
for (let i = 0; i < assets.length; i++) {
|
|
3548
3555
|
const entry = assets[i];
|
|
3549
3556
|
const marketId = this.safeString(entry, 'symbol');
|
|
@@ -3874,12 +3881,14 @@ class kucoin extends kucoin$1 {
|
|
|
3874
3881
|
* @method
|
|
3875
3882
|
* @name kucoin#fetchLedger
|
|
3876
3883
|
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
3884
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-trade_hf
|
|
3885
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-margin_hf
|
|
3877
3886
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
3878
|
-
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
3879
3887
|
* @param {string} code unified currency code, default is undefined
|
|
3880
3888
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
3881
3889
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
3882
3890
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3891
|
+
* @param {boolean} [params.hf] default false, when true will fetch ledger entries for the high frequency trading account
|
|
3883
3892
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
3884
3893
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3885
3894
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
@@ -3888,6 +3897,8 @@ class kucoin extends kucoin$1 {
|
|
|
3888
3897
|
await this.loadAccounts();
|
|
3889
3898
|
let paginate = false;
|
|
3890
3899
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
3900
|
+
const isHf = this.safeValue(params, 'hf');
|
|
3901
|
+
params = this.omit(params, 'hf');
|
|
3891
3902
|
if (paginate) {
|
|
3892
3903
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
3893
3904
|
}
|
|
@@ -3908,7 +3919,20 @@ class kucoin extends kucoin$1 {
|
|
|
3908
3919
|
request['currency'] = currency['id'];
|
|
3909
3920
|
}
|
|
3910
3921
|
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
3911
|
-
|
|
3922
|
+
let marginMode = undefined;
|
|
3923
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLedger', params);
|
|
3924
|
+
let response = undefined;
|
|
3925
|
+
if (isHf) {
|
|
3926
|
+
if (marginMode !== undefined) {
|
|
3927
|
+
response = await this.privateGetHfMarginAccountLedgers(this.extend(request, params));
|
|
3928
|
+
}
|
|
3929
|
+
else {
|
|
3930
|
+
response = await this.privateGetHfAccountsLedgers(this.extend(request, params));
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
else {
|
|
3934
|
+
response = await this.privateGetAccountsLedgers(this.extend(request, params));
|
|
3935
|
+
}
|
|
3912
3936
|
//
|
|
3913
3937
|
// {
|
|
3914
3938
|
// "code":"200000",
|
|
@@ -3947,7 +3971,7 @@ class kucoin extends kucoin$1 {
|
|
|
3947
3971
|
// }
|
|
3948
3972
|
//
|
|
3949
3973
|
const data = this.safeValue(response, 'data');
|
|
3950
|
-
const items = this.safeValue(data, 'items');
|
|
3974
|
+
const items = this.safeValue(data, 'items', data);
|
|
3951
3975
|
return this.parseLedger(items, currency, since, limit);
|
|
3952
3976
|
}
|
|
3953
3977
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.10";
|
|
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.11';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -555,6 +555,7 @@ export default class Exchange {
|
|
|
555
555
|
getProperty(obj: any, property: any, defaultValue?: any): any;
|
|
556
556
|
setProperty(obj: any, property: any, defaultValue?: any): void;
|
|
557
557
|
axolotl(payload: any, hexKey: any, ed25519: any): string;
|
|
558
|
+
fixStringifiedJsonMembers(content: any): any;
|
|
558
559
|
handleDeltas(orderbook: any, deltas: any): void;
|
|
559
560
|
handleDelta(bookside: any, delta: any): void;
|
|
560
561
|
getCacheIndex(orderbook: any, deltas: any): number;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1291,6 +1291,17 @@ export default class Exchange {
|
|
|
1291
1291
|
axolotl(payload, hexKey, ed25519) {
|
|
1292
1292
|
return axolotl(payload, hexKey, ed25519);
|
|
1293
1293
|
}
|
|
1294
|
+
fixStringifiedJsonMembers(content) {
|
|
1295
|
+
// used for instance in bingx
|
|
1296
|
+
// when stringified json has members with their values also stringified, like:
|
|
1297
|
+
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
1298
|
+
// we can fix with below manipulations
|
|
1299
|
+
// @ts-ignore
|
|
1300
|
+
let modifiedContent = content.replaceAll('\\', '');
|
|
1301
|
+
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
1302
|
+
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
1303
|
+
return modifiedContent;
|
|
1304
|
+
}
|
|
1294
1305
|
/* eslint-enable */
|
|
1295
1306
|
// ------------------------------------------------------------------------
|
|
1296
1307
|
// ########################################################################
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -66,7 +66,6 @@ export default class bingx extends Exchange {
|
|
|
66
66
|
createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
67
67
|
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
|
|
68
68
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
69
|
-
fixStringifiedJsonMembers(content: any): any;
|
|
70
69
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
71
70
|
parseOrderSide(side: any): string;
|
|
72
71
|
parseOrder(order: any, market?: Market): Order;
|
package/js/src/bingx.js
CHANGED
|
@@ -1909,16 +1909,6 @@ export default class bingx extends Exchange {
|
|
|
1909
1909
|
const order = this.safeValue(data, 'order', data);
|
|
1910
1910
|
return this.parseOrder(order, market);
|
|
1911
1911
|
}
|
|
1912
|
-
fixStringifiedJsonMembers(content) {
|
|
1913
|
-
// when stringified json has members with their values also stringified, like:
|
|
1914
|
-
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
1915
|
-
// we can fix with below manipulations
|
|
1916
|
-
// @ts-ignore
|
|
1917
|
-
let modifiedContent = content.replaceAll('\\', '');
|
|
1918
|
-
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
1919
|
-
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
1920
|
-
return modifiedContent;
|
|
1921
|
-
}
|
|
1922
1912
|
async createOrders(orders, params = {}) {
|
|
1923
1913
|
/**
|
|
1924
1914
|
* @method
|
package/js/src/bitget.js
CHANGED
|
@@ -4011,6 +4011,7 @@ export default class bitget extends Exchange {
|
|
|
4011
4011
|
* @param {string} [params.trailingPercent] *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
|
|
4012
4012
|
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4013
4013
|
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
4014
|
+
* @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
|
|
4014
4015
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4015
4016
|
*/
|
|
4016
4017
|
await this.loadMarkets();
|
|
@@ -4204,15 +4205,23 @@ export default class bitget extends Exchange {
|
|
|
4204
4205
|
}
|
|
4205
4206
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4206
4207
|
request['marginMode'] = marginModeRequest;
|
|
4208
|
+
const oneWayMode = this.safeValue(params, 'oneWayMode', false);
|
|
4209
|
+
params = this.omit(params, 'oneWayMode');
|
|
4207
4210
|
let requestSide = side;
|
|
4208
4211
|
if (reduceOnly) {
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4212
|
+
if (oneWayMode) {
|
|
4213
|
+
request['reduceOnly'] = 'YES';
|
|
4214
|
+
}
|
|
4215
|
+
else {
|
|
4216
|
+
// on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
|
4217
|
+
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
4218
|
+
request['tradeSide'] = 'Close';
|
|
4219
|
+
}
|
|
4213
4220
|
}
|
|
4214
4221
|
else {
|
|
4215
|
-
|
|
4222
|
+
if (!oneWayMode) {
|
|
4223
|
+
request['tradeSide'] = 'Open';
|
|
4224
|
+
}
|
|
4216
4225
|
}
|
|
4217
4226
|
request['side'] = requestSide;
|
|
4218
4227
|
}
|
package/js/src/bybit.js
CHANGED
|
@@ -319,7 +319,7 @@ export default class bybit extends Exchange {
|
|
|
319
319
|
'v5/asset/deposit/query-internal-record': 5,
|
|
320
320
|
'v5/asset/deposit/query-address': 10,
|
|
321
321
|
'v5/asset/deposit/query-sub-member-address': 10,
|
|
322
|
-
'v5/asset/coin/query-info':
|
|
322
|
+
'v5/asset/coin/query-info': 28,
|
|
323
323
|
'v5/asset/withdraw/query-record': 10,
|
|
324
324
|
'v5/asset/withdraw/withdrawable-amount': 5,
|
|
325
325
|
// user
|
package/js/src/kucoin.js
CHANGED
|
@@ -3448,10 +3448,12 @@ export default class kucoin extends Exchange {
|
|
|
3448
3448
|
* @name kucoin#fetchBalance
|
|
3449
3449
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3450
3450
|
* @see https://docs.kucoin.com/#list-accounts
|
|
3451
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
|
|
3451
3452
|
* @see https://docs.kucoin.com/#query-isolated-margin-account-info
|
|
3452
3453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3453
3454
|
* @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
|
|
3454
3455
|
* @param {object} [params.type] extra parameters specific to the exchange API endpoint
|
|
3456
|
+
* @param {object} [params.hf] *default if false* if true, the result includes the balance of the high frequency account
|
|
3455
3457
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3456
3458
|
*/
|
|
3457
3459
|
await this.loadMarkets();
|
|
@@ -3463,8 +3465,13 @@ export default class kucoin extends Exchange {
|
|
|
3463
3465
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
3464
3466
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
3465
3467
|
const accountsByType = this.safeValue(this.options, 'accountsByType');
|
|
3466
|
-
|
|
3468
|
+
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
3467
3469
|
params = this.omit(params, 'type');
|
|
3470
|
+
const isHf = this.safeValue(params, 'hf', false);
|
|
3471
|
+
if (isHf) {
|
|
3472
|
+
type = 'trade_hf';
|
|
3473
|
+
}
|
|
3474
|
+
params = this.omit(params, 'hf');
|
|
3468
3475
|
const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
3469
3476
|
let response = undefined;
|
|
3470
3477
|
const request = {};
|
|
@@ -3546,7 +3553,7 @@ export default class kucoin extends Exchange {
|
|
|
3546
3553
|
'datetime': undefined,
|
|
3547
3554
|
};
|
|
3548
3555
|
if (isolated) {
|
|
3549
|
-
const assets = this.safeValue(data, 'assets',
|
|
3556
|
+
const assets = this.safeValue(data, 'assets', data);
|
|
3550
3557
|
for (let i = 0; i < assets.length; i++) {
|
|
3551
3558
|
const entry = assets[i];
|
|
3552
3559
|
const marketId = this.safeString(entry, 'symbol');
|
|
@@ -3877,12 +3884,14 @@ export default class kucoin extends Exchange {
|
|
|
3877
3884
|
* @method
|
|
3878
3885
|
* @name kucoin#fetchLedger
|
|
3879
3886
|
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
3887
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-trade_hf
|
|
3888
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-margin_hf
|
|
3880
3889
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
3881
|
-
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
3882
3890
|
* @param {string} code unified currency code, default is undefined
|
|
3883
3891
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
3884
3892
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
3885
3893
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3894
|
+
* @param {boolean} [params.hf] default false, when true will fetch ledger entries for the high frequency trading account
|
|
3886
3895
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
3887
3896
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3888
3897
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
@@ -3891,6 +3900,8 @@ export default class kucoin extends Exchange {
|
|
|
3891
3900
|
await this.loadAccounts();
|
|
3892
3901
|
let paginate = false;
|
|
3893
3902
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
3903
|
+
const isHf = this.safeValue(params, 'hf');
|
|
3904
|
+
params = this.omit(params, 'hf');
|
|
3894
3905
|
if (paginate) {
|
|
3895
3906
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
3896
3907
|
}
|
|
@@ -3911,7 +3922,20 @@ export default class kucoin extends Exchange {
|
|
|
3911
3922
|
request['currency'] = currency['id'];
|
|
3912
3923
|
}
|
|
3913
3924
|
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
3914
|
-
|
|
3925
|
+
let marginMode = undefined;
|
|
3926
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLedger', params);
|
|
3927
|
+
let response = undefined;
|
|
3928
|
+
if (isHf) {
|
|
3929
|
+
if (marginMode !== undefined) {
|
|
3930
|
+
response = await this.privateGetHfMarginAccountLedgers(this.extend(request, params));
|
|
3931
|
+
}
|
|
3932
|
+
else {
|
|
3933
|
+
response = await this.privateGetHfAccountsLedgers(this.extend(request, params));
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
else {
|
|
3937
|
+
response = await this.privateGetAccountsLedgers(this.extend(request, params));
|
|
3938
|
+
}
|
|
3915
3939
|
//
|
|
3916
3940
|
// {
|
|
3917
3941
|
// "code":"200000",
|
|
@@ -3950,7 +3974,7 @@ export default class kucoin extends Exchange {
|
|
|
3950
3974
|
// }
|
|
3951
3975
|
//
|
|
3952
3976
|
const data = this.safeValue(response, 'data');
|
|
3953
|
-
const items = this.safeValue(data, 'items');
|
|
3977
|
+
const items = this.safeValue(data, 'items', data);
|
|
3954
3978
|
return this.parseLedger(items, currency, since, limit);
|
|
3955
3979
|
}
|
|
3956
3980
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.11",
|
|
4
4
|
"description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"pre-transpile": "npm run export-exchanges && npm run vss && npm run tsBuild && npm run emitAPI && npm run validate-types && npm run tsBuildExamples && npm run copy-python-files && npm run check-js-syntax && npm run bundle",
|
|
36
36
|
"pre-transpile-pr": "npm run export-exchanges && npm run tsBuild && npm run emitAPI && npm run check-js-syntax",
|
|
37
37
|
"post-transpile": "npm run check-python-syntax && npm run check-php-syntax",
|
|
38
|
-
"test-ws": "npm run build && node run-tests --ws",
|
|
39
|
-
"test": "npm run build && npm run commonjs-test && npm run static-tests && node run-tests",
|
|
40
|
-
"fast-test": "npm run commonjs-test && node run-tests --js",
|
|
38
|
+
"test-ws": "npm run build && node run-tests --ws --useProxy",
|
|
39
|
+
"test": "npm run build && npm run commonjs-test && npm run static-tests && node run-tests --useProxy",
|
|
40
|
+
"fast-test": "npm run commonjs-test && node run-tests --js --useProxy",
|
|
41
41
|
"commonjs-test": "node test-commonjs.cjs",
|
|
42
|
-
"fast-test-ws": "node run-tests --ws --js",
|
|
43
|
-
"test-js": "npm run commonjs-test && node run-tests --js",
|
|
44
|
-
"test-js-ws": "node run-tests --ws --js",
|
|
45
|
-
"test-py": "node run-tests --python",
|
|
46
|
-
"test-py-ws": "node run-tests --ws --python",
|
|
47
|
-
"test-php": "node run-tests --php",
|
|
48
|
-
"test-php-ws": "node run-tests --ws --php",
|
|
42
|
+
"fast-test-ws": "node run-tests --ws --js --useProxy",
|
|
43
|
+
"test-js": "npm run commonjs-test && node run-tests --js --useProxy",
|
|
44
|
+
"test-js-ws": "node run-tests --ws --js --useProxy",
|
|
45
|
+
"test-py": "node run-tests --python --useProxy",
|
|
46
|
+
"test-py-ws": "node run-tests --ws --python --useProxy",
|
|
47
|
+
"test-php": "node run-tests --php --useProxy",
|
|
48
|
+
"test-php-ws": "node run-tests --ws --php --useProxy",
|
|
49
49
|
"test-base": "npm run test-js-base && npm run test-python-base && npm run test-php-base && npm run id-tests && npm run static-tests",
|
|
50
50
|
"test-base-ws": "npm run test-js-base-ws && npm run test-python-base-ws && npm run test-php-base-ws",
|
|
51
51
|
"test-js-base": "node ./js/src/test/base/test.base.js",
|
package/tests-manager.sh
CHANGED
|
@@ -78,12 +78,12 @@ function run_tests {
|
|
|
78
78
|
fi
|
|
79
79
|
if [ -z "$rest_pid" ]; then
|
|
80
80
|
# shellcheck disable=SC2086
|
|
81
|
-
node test-commonjs.cjs && node run-tests --js --python-async --php-async $rest_args &
|
|
81
|
+
node test-commonjs.cjs && node run-tests --js --python-async --php-async --useProxy $rest_args &
|
|
82
82
|
local rest_pid=$!
|
|
83
83
|
fi
|
|
84
84
|
if [ -z "$ws_pid" ]; then
|
|
85
85
|
# shellcheck disable=SC2086
|
|
86
|
-
node run-tests-ws --js --python-async --php-async $ws_args &
|
|
86
|
+
node run-tests-ws --js --python-async --php-async --useProxy $ws_args &
|
|
87
87
|
local ws_pid=$!
|
|
88
88
|
fi
|
|
89
89
|
wait $rest_pid && wait $ws_pid && echo "$TRAVIS_BUILD_WEB_URL" > "$cached_url_file"
|