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/README.md
CHANGED
|
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
209
209
|
|
|
210
210
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
211
211
|
|
|
212
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.11/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.11/dist/ccxt.browser.js
|
|
214
214
|
|
|
215
215
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
216
216
|
|
|
217
217
|
```HTML
|
|
218
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.11/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/build.sh
CHANGED
|
@@ -34,14 +34,14 @@ function run_tests {
|
|
|
34
34
|
if [ -z "$rest_pid" ]; then
|
|
35
35
|
if [ -z "$rest_args" ] || { [ -n "$rest_args" ] && [ "$rest_args" != "skip" ]; }; then
|
|
36
36
|
# shellcheck disable=SC2086
|
|
37
|
-
node test-commonjs.cjs && node run-tests --js --python-async --php-async $rest_args &
|
|
37
|
+
node test-commonjs.cjs && node run-tests --js --python-async --php-async --useProxy $rest_args &
|
|
38
38
|
local rest_pid=$!
|
|
39
39
|
fi
|
|
40
40
|
fi
|
|
41
41
|
if [ -z "$ws_pid" ]; then
|
|
42
42
|
if [ -z "$ws_args" ] || { [ -n "$ws_args" ] && [ "$ws_args" != "skip" ]; }; then
|
|
43
43
|
# shellcheck disable=SC2086
|
|
44
|
-
node run-tests --ws --js --python-async --php-async $ws_args &
|
|
44
|
+
node run-tests --ws --js --python-async --php-async --useProxy $ws_args &
|
|
45
45
|
local ws_pid=$!
|
|
46
46
|
fi
|
|
47
47
|
fi
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -8284,6 +8284,17 @@ class Exchange {
|
|
|
8284
8284
|
axolotl(payload, hexKey, ed25519) {
|
|
8285
8285
|
return (0,_functions_crypto_js__WEBPACK_IMPORTED_MODULE_7__/* .axolotl */ .gC)(payload, hexKey, ed25519);
|
|
8286
8286
|
}
|
|
8287
|
+
fixStringifiedJsonMembers(content) {
|
|
8288
|
+
// used for instance in bingx
|
|
8289
|
+
// when stringified json has members with their values also stringified, like:
|
|
8290
|
+
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
8291
|
+
// we can fix with below manipulations
|
|
8292
|
+
// @ts-ignore
|
|
8293
|
+
let modifiedContent = content.replaceAll('\\', '');
|
|
8294
|
+
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
8295
|
+
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
8296
|
+
return modifiedContent;
|
|
8297
|
+
}
|
|
8287
8298
|
/* eslint-enable */
|
|
8288
8299
|
// ------------------------------------------------------------------------
|
|
8289
8300
|
// ########################################################################
|
|
@@ -29033,16 +29044,6 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29033
29044
|
const order = this.safeValue(data, 'order', data);
|
|
29034
29045
|
return this.parseOrder(order, market);
|
|
29035
29046
|
}
|
|
29036
|
-
fixStringifiedJsonMembers(content) {
|
|
29037
|
-
// when stringified json has members with their values also stringified, like:
|
|
29038
|
-
// '{"code":0, "data":{"order":{"orderId":1742968678528512345,"symbol":"BTC-USDT", "takeProfit":"{\"type\":\"TAKE_PROFIT\",\"stopPrice\":43320.1}","reduceOnly":false}}}'
|
|
29039
|
-
// we can fix with below manipulations
|
|
29040
|
-
// @ts-ignore
|
|
29041
|
-
let modifiedContent = content.replaceAll('\\', '');
|
|
29042
|
-
modifiedContent = modifiedContent.replaceAll('"{', '{');
|
|
29043
|
-
modifiedContent = modifiedContent.replaceAll('}"', '}');
|
|
29044
|
-
return modifiedContent;
|
|
29045
|
-
}
|
|
29046
29047
|
async createOrders(orders, params = {}) {
|
|
29047
29048
|
/**
|
|
29048
29049
|
* @method
|
|
@@ -44693,6 +44694,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44693
44694
|
* @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
|
|
44694
44695
|
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
44695
44696
|
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
44697
|
+
* @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
|
|
44696
44698
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
44697
44699
|
*/
|
|
44698
44700
|
await this.loadMarkets();
|
|
@@ -44886,15 +44888,23 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44886
44888
|
}
|
|
44887
44889
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
44888
44890
|
request['marginMode'] = marginModeRequest;
|
|
44891
|
+
const oneWayMode = this.safeValue(params, 'oneWayMode', false);
|
|
44892
|
+
params = this.omit(params, 'oneWayMode');
|
|
44889
44893
|
let requestSide = side;
|
|
44890
44894
|
if (reduceOnly) {
|
|
44891
|
-
|
|
44892
|
-
|
|
44893
|
-
|
|
44894
|
-
|
|
44895
|
+
if (oneWayMode) {
|
|
44896
|
+
request['reduceOnly'] = 'YES';
|
|
44897
|
+
}
|
|
44898
|
+
else {
|
|
44899
|
+
// 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
|
|
44900
|
+
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
44901
|
+
request['tradeSide'] = 'Close';
|
|
44902
|
+
}
|
|
44895
44903
|
}
|
|
44896
44904
|
else {
|
|
44897
|
-
|
|
44905
|
+
if (!oneWayMode) {
|
|
44906
|
+
request['tradeSide'] = 'Open';
|
|
44907
|
+
}
|
|
44898
44908
|
}
|
|
44899
44909
|
request['side'] = requestSide;
|
|
44900
44910
|
}
|
|
@@ -78321,7 +78331,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
78321
78331
|
'v5/asset/deposit/query-internal-record': 5,
|
|
78322
78332
|
'v5/asset/deposit/query-address': 10,
|
|
78323
78333
|
'v5/asset/deposit/query-sub-member-address': 10,
|
|
78324
|
-
'v5/asset/coin/query-info':
|
|
78334
|
+
'v5/asset/coin/query-info': 28,
|
|
78325
78335
|
'v5/asset/withdraw/query-record': 10,
|
|
78326
78336
|
'v5/asset/withdraw/withdrawable-amount': 5,
|
|
78327
78337
|
// user
|
|
@@ -162319,10 +162329,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162319
162329
|
* @name kucoin#fetchBalance
|
|
162320
162330
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
162321
162331
|
* @see https://docs.kucoin.com/#list-accounts
|
|
162332
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
|
|
162322
162333
|
* @see https://docs.kucoin.com/#query-isolated-margin-account-info
|
|
162323
162334
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
162324
162335
|
* @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
|
|
162325
162336
|
* @param {object} [params.type] extra parameters specific to the exchange API endpoint
|
|
162337
|
+
* @param {object} [params.hf] *default if false* if true, the result includes the balance of the high frequency account
|
|
162326
162338
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
162327
162339
|
*/
|
|
162328
162340
|
await this.loadMarkets();
|
|
@@ -162334,8 +162346,13 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162334
162346
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
162335
162347
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
162336
162348
|
const accountsByType = this.safeValue(this.options, 'accountsByType');
|
|
162337
|
-
|
|
162349
|
+
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
162338
162350
|
params = this.omit(params, 'type');
|
|
162351
|
+
const isHf = this.safeValue(params, 'hf', false);
|
|
162352
|
+
if (isHf) {
|
|
162353
|
+
type = 'trade_hf';
|
|
162354
|
+
}
|
|
162355
|
+
params = this.omit(params, 'hf');
|
|
162339
162356
|
const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
162340
162357
|
let response = undefined;
|
|
162341
162358
|
const request = {};
|
|
@@ -162417,7 +162434,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162417
162434
|
'datetime': undefined,
|
|
162418
162435
|
};
|
|
162419
162436
|
if (isolated) {
|
|
162420
|
-
const assets = this.safeValue(data, 'assets',
|
|
162437
|
+
const assets = this.safeValue(data, 'assets', data);
|
|
162421
162438
|
for (let i = 0; i < assets.length; i++) {
|
|
162422
162439
|
const entry = assets[i];
|
|
162423
162440
|
const marketId = this.safeString(entry, 'symbol');
|
|
@@ -162748,12 +162765,14 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162748
162765
|
* @method
|
|
162749
162766
|
* @name kucoin#fetchLedger
|
|
162750
162767
|
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
162768
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-trade_hf
|
|
162769
|
+
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-margin_hf
|
|
162751
162770
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
162752
|
-
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
162753
162771
|
* @param {string} code unified currency code, default is undefined
|
|
162754
162772
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
162755
162773
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
162756
162774
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
162775
|
+
* @param {boolean} [params.hf] default false, when true will fetch ledger entries for the high frequency trading account
|
|
162757
162776
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
162758
162777
|
* @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)
|
|
162759
162778
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
@@ -162762,6 +162781,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162762
162781
|
await this.loadAccounts();
|
|
162763
162782
|
let paginate = false;
|
|
162764
162783
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
162784
|
+
const isHf = this.safeValue(params, 'hf');
|
|
162785
|
+
params = this.omit(params, 'hf');
|
|
162765
162786
|
if (paginate) {
|
|
162766
162787
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
162767
162788
|
}
|
|
@@ -162782,7 +162803,20 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162782
162803
|
request['currency'] = currency['id'];
|
|
162783
162804
|
}
|
|
162784
162805
|
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
162785
|
-
|
|
162806
|
+
let marginMode = undefined;
|
|
162807
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLedger', params);
|
|
162808
|
+
let response = undefined;
|
|
162809
|
+
if (isHf) {
|
|
162810
|
+
if (marginMode !== undefined) {
|
|
162811
|
+
response = await this.privateGetHfMarginAccountLedgers(this.extend(request, params));
|
|
162812
|
+
}
|
|
162813
|
+
else {
|
|
162814
|
+
response = await this.privateGetHfAccountsLedgers(this.extend(request, params));
|
|
162815
|
+
}
|
|
162816
|
+
}
|
|
162817
|
+
else {
|
|
162818
|
+
response = await this.privateGetAccountsLedgers(this.extend(request, params));
|
|
162819
|
+
}
|
|
162786
162820
|
//
|
|
162787
162821
|
// {
|
|
162788
162822
|
// "code":"200000",
|
|
@@ -162821,7 +162855,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
162821
162855
|
// }
|
|
162822
162856
|
//
|
|
162823
162857
|
const data = this.safeValue(response, 'data');
|
|
162824
|
-
const items = this.safeValue(data, 'items');
|
|
162858
|
+
const items = this.safeValue(data, 'items', data);
|
|
162825
162859
|
return this.parseLedger(items, currency, since, limit);
|
|
162826
162860
|
}
|
|
162827
162861
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
@@ -292241,7 +292275,7 @@ SOFTWARE.
|
|
|
292241
292275
|
|
|
292242
292276
|
//-----------------------------------------------------------------------------
|
|
292243
292277
|
// this is updated by vss.js when building
|
|
292244
|
-
const version = '4.2.
|
|
292278
|
+
const version = '4.2.11';
|
|
292245
292279
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
292246
292280
|
//-----------------------------------------------------------------------------
|
|
292247
292281
|
|