ccxt 4.2.69 → 4.2.70
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.js +207 -32
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +32 -30
- package/dist/cjs/src/gate.js +174 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +32 -30
- package/js/src/gate.d.ts +4 -1
- package/js/src/gate.js +174 -1
- package/package.json +1 -1
- package/skip-tests.json +16 -0
package/README.md
CHANGED
|
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
210
210
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
214
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
213
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.70/dist/ccxt.browser.js
|
|
214
|
+
* unpkg: https://unpkg.com/ccxt@4.2.70/dist/ccxt.browser.js
|
|
215
215
|
|
|
216
216
|
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.
|
|
217
217
|
|
|
218
218
|
```HTML
|
|
219
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
219
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.70/dist/ccxt.browser.js"></script>
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -7254,7 +7254,7 @@ class Exchange {
|
|
|
7254
7254
|
this.socksProxyAgentModule = undefined;
|
|
7255
7255
|
this.socksProxyAgentModuleChecked = false;
|
|
7256
7256
|
this.proxyDictionaries = {};
|
|
7257
|
-
this.
|
|
7257
|
+
this.proxiesModulesLoading = undefined;
|
|
7258
7258
|
Object.assign(this, _functions_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
7259
7259
|
//
|
|
7260
7260
|
// if (isNode) {
|
|
@@ -7755,36 +7755,38 @@ class Exchange {
|
|
|
7755
7755
|
console.log(...args);
|
|
7756
7756
|
}
|
|
7757
7757
|
async loadProxyModules() {
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7758
|
+
// when loading markets, multiple parallel calls are made, so need one promise
|
|
7759
|
+
if (this.proxiesModulesLoading === undefined) {
|
|
7760
|
+
this.proxiesModulesLoading = (async () => {
|
|
7761
|
+
// we have to handle it with below nested way, because of dynamic
|
|
7762
|
+
// import issues (https://github.com/ccxt/ccxt/pull/20687)
|
|
7763
|
+
try {
|
|
7764
|
+
// todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
|
|
7765
|
+
this.httpProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js');
|
|
7766
|
+
this.httpsProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js');
|
|
7767
|
+
}
|
|
7768
|
+
catch (e) {
|
|
7769
|
+
// if several users are using those frameworks which cause exceptions,
|
|
7770
|
+
// let them to be able to load modules still, by installing them
|
|
7771
|
+
try {
|
|
7772
|
+
// @ts-ignore
|
|
7773
|
+
this.httpProxyAgentModule = await import(/* webpackIgnore: true */ 'http-proxy-agent');
|
|
7774
|
+
// @ts-ignore
|
|
7775
|
+
this.httpProxyAgentModule = await import(/* webpackIgnore: true */ 'https-proxy-agent');
|
|
7776
|
+
}
|
|
7777
|
+
catch (e) { }
|
|
7778
|
+
}
|
|
7779
|
+
if (this.socksProxyAgentModuleChecked === false) {
|
|
7780
|
+
try {
|
|
7781
|
+
// @ts-ignore
|
|
7782
|
+
this.socksProxyAgentModule = await import(/* webpackIgnore: true */ 'socks-proxy-agent');
|
|
7783
|
+
}
|
|
7784
|
+
catch (e) { }
|
|
7785
|
+
this.socksProxyAgentModuleChecked = true;
|
|
7786
|
+
}
|
|
7787
|
+
})();
|
|
7787
7788
|
}
|
|
7789
|
+
return await this.proxiesModulesLoading;
|
|
7788
7790
|
}
|
|
7789
7791
|
setProxyAgents(httpProxy, httpsProxy, socksProxy) {
|
|
7790
7792
|
let chosenAgent = undefined;
|
|
@@ -133439,7 +133441,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
133439
133441
|
'fetchIsolatedBorrowRate': false,
|
|
133440
133442
|
'fetchIsolatedBorrowRates': false,
|
|
133441
133443
|
'fetchLedger': true,
|
|
133442
|
-
'fetchLeverage':
|
|
133444
|
+
'fetchLeverage': true,
|
|
133445
|
+
'fetchLeverages': true,
|
|
133443
133446
|
'fetchLeverageTiers': true,
|
|
133444
133447
|
'fetchLiquidations': true,
|
|
133445
133448
|
'fetchMarginMode': false,
|
|
@@ -140339,6 +140342,178 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
140339
140342
|
}
|
|
140340
140343
|
return await this.createOrder(symbol, 'market', side, 0, undefined, params);
|
|
140341
140344
|
}
|
|
140345
|
+
async fetchLeverage(symbol, params = {}) {
|
|
140346
|
+
/**
|
|
140347
|
+
* @method
|
|
140348
|
+
* @name gate#fetchLeverage
|
|
140349
|
+
* @description fetch the set leverage for a market
|
|
140350
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information
|
|
140351
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market
|
|
140352
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
|
|
140353
|
+
* @param {string} symbol unified market symbol
|
|
140354
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
140355
|
+
* @param {boolean} [params.unified] default false, set to true for fetching the unified accounts leverage
|
|
140356
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
140357
|
+
*/
|
|
140358
|
+
await this.loadMarkets();
|
|
140359
|
+
let market = undefined;
|
|
140360
|
+
if (symbol !== undefined) {
|
|
140361
|
+
// unified account does not require a symbol
|
|
140362
|
+
market = this.market(symbol);
|
|
140363
|
+
}
|
|
140364
|
+
const request = {};
|
|
140365
|
+
let response = undefined;
|
|
140366
|
+
const isUnified = this.safeBool(params, 'unified');
|
|
140367
|
+
params = this.omit(params, 'unified');
|
|
140368
|
+
if (market['spot']) {
|
|
140369
|
+
request['currency_pair'] = market['id'];
|
|
140370
|
+
if (isUnified) {
|
|
140371
|
+
response = await this.publicMarginGetUniCurrencyPairsCurrencyPair(this.extend(request, params));
|
|
140372
|
+
//
|
|
140373
|
+
// {
|
|
140374
|
+
// "currency_pair": "BTC_USDT",
|
|
140375
|
+
// "base_min_borrow_amount": "0.0001",
|
|
140376
|
+
// "quote_min_borrow_amount": "1",
|
|
140377
|
+
// "leverage": "10"
|
|
140378
|
+
// }
|
|
140379
|
+
//
|
|
140380
|
+
}
|
|
140381
|
+
else {
|
|
140382
|
+
response = await this.publicMarginGetCurrencyPairsCurrencyPair(this.extend(request, params));
|
|
140383
|
+
//
|
|
140384
|
+
// {
|
|
140385
|
+
// "id": "BTC_USDT",
|
|
140386
|
+
// "base": "BTC",
|
|
140387
|
+
// "quote": "USDT",
|
|
140388
|
+
// "leverage": 10,
|
|
140389
|
+
// "min_base_amount": "0.0001",
|
|
140390
|
+
// "min_quote_amount": "1",
|
|
140391
|
+
// "max_quote_amount": "40000000",
|
|
140392
|
+
// "status": 1
|
|
140393
|
+
// }
|
|
140394
|
+
//
|
|
140395
|
+
}
|
|
140396
|
+
}
|
|
140397
|
+
else if (isUnified) {
|
|
140398
|
+
response = await this.privateUnifiedGetAccounts(this.extend(request, params));
|
|
140399
|
+
//
|
|
140400
|
+
// {
|
|
140401
|
+
// "user_id": 10001,
|
|
140402
|
+
// "locked": false,
|
|
140403
|
+
// "balances": {
|
|
140404
|
+
// "ETH": {
|
|
140405
|
+
// "available": "0",
|
|
140406
|
+
// "freeze": "0",
|
|
140407
|
+
// "borrowed": "0.075393666654",
|
|
140408
|
+
// "negative_liab": "0",
|
|
140409
|
+
// "futures_pos_liab": "0",
|
|
140410
|
+
// "equity": "1016.1",
|
|
140411
|
+
// "total_freeze": "0",
|
|
140412
|
+
// "total_liab": "0"
|
|
140413
|
+
// },
|
|
140414
|
+
// "POINT": {
|
|
140415
|
+
// "available": "9999999999.017023138734",
|
|
140416
|
+
// "freeze": "0",
|
|
140417
|
+
// "borrowed": "0",
|
|
140418
|
+
// "negative_liab": "0",
|
|
140419
|
+
// "futures_pos_liab": "0",
|
|
140420
|
+
// "equity": "12016.1",
|
|
140421
|
+
// "total_freeze": "0",
|
|
140422
|
+
// "total_liab": "0"
|
|
140423
|
+
// },
|
|
140424
|
+
// "USDT": {
|
|
140425
|
+
// "available": "0.00000062023",
|
|
140426
|
+
// "freeze": "0",
|
|
140427
|
+
// "borrowed": "0",
|
|
140428
|
+
// "negative_liab": "0",
|
|
140429
|
+
// "futures_pos_liab": "0",
|
|
140430
|
+
// "equity": "16.1",
|
|
140431
|
+
// "total_freeze": "0",
|
|
140432
|
+
// "total_liab": "0"
|
|
140433
|
+
// }
|
|
140434
|
+
// },
|
|
140435
|
+
// "total": "230.94621713",
|
|
140436
|
+
// "borrowed": "161.66395521",
|
|
140437
|
+
// "total_initial_margin": "1025.0524665088",
|
|
140438
|
+
// "total_margin_balance": "3382495.944473949183",
|
|
140439
|
+
// "total_maintenance_margin": "205.01049330176",
|
|
140440
|
+
// "total_initial_margin_rate": "3299.827135672679",
|
|
140441
|
+
// "total_maintenance_margin_rate": "16499.135678363399",
|
|
140442
|
+
// "total_available_margin": "3381470.892007440383",
|
|
140443
|
+
// "unified_account_total": "3381470.892007440383",
|
|
140444
|
+
// "unified_account_total_liab": "0",
|
|
140445
|
+
// "unified_account_total_equity": "100016.1",
|
|
140446
|
+
// "leverage": "2"
|
|
140447
|
+
// }
|
|
140448
|
+
//
|
|
140449
|
+
}
|
|
140450
|
+
else {
|
|
140451
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverage() does not support ' + market['type'] + ' markets');
|
|
140452
|
+
}
|
|
140453
|
+
return this.parseLeverage(response, market);
|
|
140454
|
+
}
|
|
140455
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
140456
|
+
/**
|
|
140457
|
+
* @method
|
|
140458
|
+
* @name gate#fetchLeverages
|
|
140459
|
+
* @description fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
|
140460
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets
|
|
140461
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
|
|
140462
|
+
* @param {string[]} symbols a list of unified market symbols
|
|
140463
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
140464
|
+
* @param {boolean} [params.unified] default false, set to true for fetching unified account leverages
|
|
140465
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
140466
|
+
*/
|
|
140467
|
+
await this.loadMarkets();
|
|
140468
|
+
symbols = this.marketSymbols(symbols);
|
|
140469
|
+
let response = undefined;
|
|
140470
|
+
const isUnified = this.safeBool(params, 'unified');
|
|
140471
|
+
params = this.omit(params, 'unified');
|
|
140472
|
+
let marketIdRequest = 'id';
|
|
140473
|
+
if (isUnified) {
|
|
140474
|
+
marketIdRequest = 'currency_pair';
|
|
140475
|
+
response = await this.publicMarginGetUniCurrencyPairs(params);
|
|
140476
|
+
//
|
|
140477
|
+
// [
|
|
140478
|
+
// {
|
|
140479
|
+
// "currency_pair": "1INCH_USDT",
|
|
140480
|
+
// "base_min_borrow_amount": "8",
|
|
140481
|
+
// "quote_min_borrow_amount": "1",
|
|
140482
|
+
// "leverage": "3"
|
|
140483
|
+
// },
|
|
140484
|
+
// ]
|
|
140485
|
+
//
|
|
140486
|
+
}
|
|
140487
|
+
else {
|
|
140488
|
+
response = await this.publicMarginGetCurrencyPairs(params);
|
|
140489
|
+
//
|
|
140490
|
+
// [
|
|
140491
|
+
// {
|
|
140492
|
+
// "id": "1CAT_USDT",
|
|
140493
|
+
// "base": "1CAT",
|
|
140494
|
+
// "quote": "USDT",
|
|
140495
|
+
// "leverage": 3,
|
|
140496
|
+
// "min_base_amount": "71",
|
|
140497
|
+
// "min_quote_amount": "1",
|
|
140498
|
+
// "max_quote_amount": "10000",
|
|
140499
|
+
// "status": 1
|
|
140500
|
+
// },
|
|
140501
|
+
// ]
|
|
140502
|
+
//
|
|
140503
|
+
}
|
|
140504
|
+
return this.parseLeverages(response, symbols, marketIdRequest, 'spot');
|
|
140505
|
+
}
|
|
140506
|
+
parseLeverage(leverage, market = undefined) {
|
|
140507
|
+
const marketId = this.safeString2(leverage, 'currency_pair', 'id');
|
|
140508
|
+
const leverageValue = this.safeInteger(leverage, 'leverage');
|
|
140509
|
+
return {
|
|
140510
|
+
'info': leverage,
|
|
140511
|
+
'symbol': this.safeSymbol(marketId, market, '_', 'spot'),
|
|
140512
|
+
'marginMode': undefined,
|
|
140513
|
+
'longLeverage': leverageValue,
|
|
140514
|
+
'shortLeverage': leverageValue,
|
|
140515
|
+
};
|
|
140516
|
+
}
|
|
140342
140517
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
140343
140518
|
if (response === undefined) {
|
|
140344
140519
|
return undefined;
|
|
@@ -317101,7 +317276,7 @@ SOFTWARE.
|
|
|
317101
317276
|
|
|
317102
317277
|
//-----------------------------------------------------------------------------
|
|
317103
317278
|
// this is updated by vss.js when building
|
|
317104
|
-
const version = '4.2.
|
|
317279
|
+
const version = '4.2.70';
|
|
317105
317280
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
317106
317281
|
//-----------------------------------------------------------------------------
|
|
317107
317282
|
|