ccxt 4.0.87 → 4.0.88
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 +166 -31
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/exmo.js +82 -30
- package/dist/cjs/src/gate.js +39 -0
- package/dist/cjs/src/okx.js +39 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.js +1 -0
- package/js/src/bybit.js +1 -0
- package/js/src/cryptocom.js +1 -0
- package/js/src/delta.js +1 -0
- package/js/src/deribit.js +1 -0
- package/js/src/exmo.js +83 -31
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +39 -0
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +39 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
215
215
|
|
|
216
216
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
217
217
|
|
|
218
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
219
|
-
* unpkg: https://unpkg.com/ccxt@4.0.
|
|
218
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.88/dist/ccxt.browser.js
|
|
219
|
+
* unpkg: https://unpkg.com/ccxt@4.0.88/dist/ccxt.browser.js
|
|
220
220
|
|
|
221
221
|
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.
|
|
222
222
|
|
|
223
223
|
```HTML
|
|
224
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
224
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.88/dist/ccxt.browser.js"></script>
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -15648,6 +15648,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
15648
15648
|
'fetchTransactionFees': true,
|
|
15649
15649
|
'fetchTransactions': false,
|
|
15650
15650
|
'fetchTransfers': true,
|
|
15651
|
+
'fetchUnderlyingAssets': false,
|
|
15651
15652
|
'fetchVolatilityHistory': false,
|
|
15652
15653
|
'fetchWithdrawal': false,
|
|
15653
15654
|
'fetchWithdrawals': true,
|
|
@@ -71433,6 +71434,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
71433
71434
|
'fetchTradingFees': true,
|
|
71434
71435
|
'fetchTransactions': false,
|
|
71435
71436
|
'fetchTransfers': true,
|
|
71437
|
+
'fetchUnderlyingAssets': false,
|
|
71436
71438
|
'fetchVolatilityHistory': true,
|
|
71437
71439
|
'fetchWithdrawals': true,
|
|
71438
71440
|
'setLeverage': true,
|
|
@@ -98276,6 +98278,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
98276
98278
|
'fetchTransactionFees': false,
|
|
98277
98279
|
'fetchTransactions': false,
|
|
98278
98280
|
'fetchTransfers': true,
|
|
98281
|
+
'fetchUnderlyingAssets': false,
|
|
98279
98282
|
'fetchVolatilityHistory': false,
|
|
98280
98283
|
'fetchWithdrawals': true,
|
|
98281
98284
|
'reduceMargin': false,
|
|
@@ -103316,6 +103319,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
103316
103319
|
'fetchTrades': true,
|
|
103317
103320
|
'fetchTransfer': undefined,
|
|
103318
103321
|
'fetchTransfers': undefined,
|
|
103322
|
+
'fetchUnderlyingAssets': false,
|
|
103319
103323
|
'fetchVolatilityHistory': false,
|
|
103320
103324
|
'fetchWithdrawal': undefined,
|
|
103321
103325
|
'fetchWithdrawals': undefined,
|
|
@@ -106414,6 +106418,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
106414
106418
|
'fetchTransactions': false,
|
|
106415
106419
|
'fetchTransfer': false,
|
|
106416
106420
|
'fetchTransfers': true,
|
|
106421
|
+
'fetchUnderlyingAssets': false,
|
|
106417
106422
|
'fetchVolatilityHistory': true,
|
|
106418
106423
|
'fetchWithdrawal': false,
|
|
106419
106424
|
'fetchWithdrawals': true,
|
|
@@ -114378,17 +114383,16 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
114378
114383
|
// "commission_percent": "0.2"
|
|
114379
114384
|
// }
|
|
114380
114385
|
//
|
|
114381
|
-
// margin
|
|
114386
|
+
// fetchMyTrades (margin)
|
|
114382
114387
|
//
|
|
114383
114388
|
// {
|
|
114384
|
-
// "
|
|
114385
|
-
// "
|
|
114386
|
-
// "
|
|
114387
|
-
// "
|
|
114388
|
-
// "quantity": "
|
|
114389
|
-
// "
|
|
114390
|
-
// "
|
|
114391
|
-
// "type": "sell"
|
|
114389
|
+
// "trade_id": "692861757015952517",
|
|
114390
|
+
// "trade_dt": "1693951853197811824",
|
|
114391
|
+
// "trade_type": "buy",
|
|
114392
|
+
// "pair": "ADA_USDT",
|
|
114393
|
+
// "quantity": "1.96607879",
|
|
114394
|
+
// "price": "0.2568",
|
|
114395
|
+
// "amount": "0.50488903"
|
|
114392
114396
|
// }
|
|
114393
114397
|
//
|
|
114394
114398
|
const timestamp = this.safeTimestamp(trade, 'date');
|
|
@@ -114397,7 +114401,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
114397
114401
|
const priceString = this.safeString(trade, 'price');
|
|
114398
114402
|
const amountString = this.safeString(trade, 'quantity');
|
|
114399
114403
|
const costString = this.safeString(trade, 'amount');
|
|
114400
|
-
const side = this.
|
|
114404
|
+
const side = this.safeString2(trade, 'type', 'trade_type');
|
|
114401
114405
|
const type = undefined;
|
|
114402
114406
|
const marketId = this.safeString(trade, 'pair');
|
|
114403
114407
|
market = this.safeMarket(marketId, market, '_');
|
|
@@ -114486,38 +114490,91 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
114486
114490
|
* @method
|
|
114487
114491
|
* @name exmo#fetchMyTrades
|
|
114488
114492
|
* @description fetch all trades made by the user
|
|
114489
|
-
* @
|
|
114493
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#b8d8d9af-4f46-46a1-939b-ad261d79f452 // spot
|
|
114494
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#f4b1aaf8-399f-403b-ab5e-4926d967a106 // margin
|
|
114495
|
+
* @param {string} symbol a symbol is required but it can be a single string, or a non-empty array
|
|
114490
114496
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
114491
|
-
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
114497
|
+
* @param {int} [limit] *required for margin orders* the maximum number of trades structures to retrieve
|
|
114492
114498
|
* @param {object} [params] extra parameters specific to the exmo api endpoint
|
|
114499
|
+
*
|
|
114500
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
114501
|
+
* @param {int} [params.offset] last deal offset, default = 0
|
|
114493
114502
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
114494
114503
|
*/
|
|
114495
|
-
|
|
114496
|
-
|
|
114497
|
-
|
|
114504
|
+
this.checkRequiredSymbol('fetchMyTrades', symbol);
|
|
114505
|
+
let marginMode = undefined;
|
|
114506
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
114507
|
+
if (marginMode === 'cross') {
|
|
114508
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + 'only isolated margin is supported');
|
|
114498
114509
|
}
|
|
114499
114510
|
await this.loadMarkets();
|
|
114500
|
-
|
|
114501
|
-
|
|
114502
|
-
|
|
114503
|
-
|
|
114504
|
-
|
|
114505
|
-
|
|
114506
|
-
|
|
114507
|
-
|
|
114508
|
-
pair =
|
|
114511
|
+
const market = this.market(symbol);
|
|
114512
|
+
const pair = market['id'];
|
|
114513
|
+
const isSpot = marginMode !== 'isolated';
|
|
114514
|
+
if (limit === undefined) {
|
|
114515
|
+
limit = 100;
|
|
114516
|
+
}
|
|
114517
|
+
const request = {};
|
|
114518
|
+
if (isSpot) {
|
|
114519
|
+
request['pair'] = pair;
|
|
114509
114520
|
}
|
|
114510
114521
|
else {
|
|
114511
|
-
|
|
114512
|
-
pair = market['id'];
|
|
114522
|
+
request['pair_name'] = pair;
|
|
114513
114523
|
}
|
|
114514
|
-
const request = {
|
|
114515
|
-
'pair': pair,
|
|
114516
|
-
};
|
|
114517
114524
|
if (limit !== undefined) {
|
|
114518
114525
|
request['limit'] = limit;
|
|
114519
114526
|
}
|
|
114520
|
-
const
|
|
114527
|
+
const offset = this.safeInteger(params, 'offset', 0);
|
|
114528
|
+
request['offset'] = offset;
|
|
114529
|
+
let response = undefined;
|
|
114530
|
+
if (isSpot) {
|
|
114531
|
+
response = await this.privatePostUserTrades(this.extend(request, params));
|
|
114532
|
+
//
|
|
114533
|
+
// {
|
|
114534
|
+
// "BTC_USD": [
|
|
114535
|
+
// {
|
|
114536
|
+
// "trade_id": 20056872,
|
|
114537
|
+
// "client_id": 100500,
|
|
114538
|
+
// "date": 1435488248,
|
|
114539
|
+
// "type": "buy",
|
|
114540
|
+
// "pair": "BTC_USD",
|
|
114541
|
+
// "quantity": "1",
|
|
114542
|
+
// "price": "100",
|
|
114543
|
+
// "amount": "100",
|
|
114544
|
+
// "order_id": 7,
|
|
114545
|
+
// "parent_order_id": 117684023830293,
|
|
114546
|
+
// "exec_type": "taker",
|
|
114547
|
+
// "commission_amount": "0.02",
|
|
114548
|
+
// "commission_currency": "BTC",
|
|
114549
|
+
// "commission_percent": "0.2"
|
|
114550
|
+
// }
|
|
114551
|
+
// ],
|
|
114552
|
+
// ...
|
|
114553
|
+
// }
|
|
114554
|
+
//
|
|
114555
|
+
}
|
|
114556
|
+
else {
|
|
114557
|
+
const responseFromExchange = await this.privatePostMarginTrades(this.extend(request, params));
|
|
114558
|
+
//
|
|
114559
|
+
// {
|
|
114560
|
+
// "trades": {
|
|
114561
|
+
// "ADA_USDT": [
|
|
114562
|
+
// {
|
|
114563
|
+
// "trade_id": "692861757015952517",
|
|
114564
|
+
// "trade_dt": "1693951853197811824",
|
|
114565
|
+
// "trade_type": "buy",
|
|
114566
|
+
// "pair": "ADA_USDT",
|
|
114567
|
+
// "quantity": "1.96607879",
|
|
114568
|
+
// "price": "0.2568",
|
|
114569
|
+
// "amount": "0.50488903"
|
|
114570
|
+
// },
|
|
114571
|
+
// ]
|
|
114572
|
+
// ...
|
|
114573
|
+
// }
|
|
114574
|
+
// }
|
|
114575
|
+
//
|
|
114576
|
+
response = this.safeValue(responseFromExchange, 'trades');
|
|
114577
|
+
}
|
|
114521
114578
|
let result = [];
|
|
114522
114579
|
const marketIdsInner = Object.keys(response);
|
|
114523
114580
|
for (let i = 0; i < marketIdsInner.length; i++) {
|
|
@@ -115610,6 +115667,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
115610
115667
|
'fetchTradingFee': true,
|
|
115611
115668
|
'fetchTradingFees': true,
|
|
115612
115669
|
'fetchTransactionFees': true,
|
|
115670
|
+
'fetchUnderlyingAssets': true,
|
|
115613
115671
|
'fetchVolatilityHistory': false,
|
|
115614
115672
|
'fetchWithdrawals': true,
|
|
115615
115673
|
'reduceMargin': true,
|
|
@@ -121702,6 +121760,44 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121702
121760
|
request['dual_mode'] = hedged;
|
|
121703
121761
|
return await this.privateFuturesPostSettleDualMode(this.extend(request, query));
|
|
121704
121762
|
}
|
|
121763
|
+
async fetchUnderlyingAssets(params = {}) {
|
|
121764
|
+
/**
|
|
121765
|
+
* @method
|
|
121766
|
+
* @name gate#fetchUnderlyingAssets
|
|
121767
|
+
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
121768
|
+
* @param {object} [params] exchange specific params
|
|
121769
|
+
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
121770
|
+
* @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
|
|
121771
|
+
*/
|
|
121772
|
+
await this.loadMarkets();
|
|
121773
|
+
let marketType = undefined;
|
|
121774
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchUnderlyingAssets', undefined, params);
|
|
121775
|
+
if ((marketType === undefined) || (marketType === 'spot')) {
|
|
121776
|
+
marketType = 'option';
|
|
121777
|
+
}
|
|
121778
|
+
if (marketType !== 'option') {
|
|
121779
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchUnderlyingAssets() supports option markets only');
|
|
121780
|
+
}
|
|
121781
|
+
const response = await this.publicOptionsGetUnderlyings(params);
|
|
121782
|
+
//
|
|
121783
|
+
// [
|
|
121784
|
+
// {
|
|
121785
|
+
// "index_time": "1646915796",
|
|
121786
|
+
// "name": "BTC_USDT",
|
|
121787
|
+
// "index_price": "39142.73"
|
|
121788
|
+
// }
|
|
121789
|
+
// ]
|
|
121790
|
+
//
|
|
121791
|
+
const underlyings = [];
|
|
121792
|
+
for (let i = 0; i < response.length; i++) {
|
|
121793
|
+
const underlying = response[i];
|
|
121794
|
+
const name = this.safeString(underlying, 'name');
|
|
121795
|
+
if (name !== undefined) {
|
|
121796
|
+
underlyings.push(name);
|
|
121797
|
+
}
|
|
121798
|
+
}
|
|
121799
|
+
return underlyings;
|
|
121800
|
+
}
|
|
121705
121801
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
121706
121802
|
if (response === undefined) {
|
|
121707
121803
|
return undefined;
|
|
@@ -177440,6 +177536,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177440
177536
|
'fetchTransactions': false,
|
|
177441
177537
|
'fetchTransfer': true,
|
|
177442
177538
|
'fetchTransfers': true,
|
|
177539
|
+
'fetchUnderlyingAssets': true,
|
|
177443
177540
|
'fetchVolatilityHistory': false,
|
|
177444
177541
|
'fetchWithdrawal': true,
|
|
177445
177542
|
'fetchWithdrawals': true,
|
|
@@ -184033,6 +184130,44 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
184033
184130
|
}
|
|
184034
184131
|
return result;
|
|
184035
184132
|
}
|
|
184133
|
+
async fetchUnderlyingAssets(params = {}) {
|
|
184134
|
+
/**
|
|
184135
|
+
* @method
|
|
184136
|
+
* @name okx#fetchUnderlyingAssets
|
|
184137
|
+
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
184138
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
184139
|
+
* @param {object} [params] exchange specific params
|
|
184140
|
+
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
184141
|
+
* @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
|
|
184142
|
+
*/
|
|
184143
|
+
await this.loadMarkets();
|
|
184144
|
+
let marketType = undefined;
|
|
184145
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchUnderlyingAssets', undefined, params);
|
|
184146
|
+
if ((marketType === undefined) || (marketType === 'spot')) {
|
|
184147
|
+
marketType = 'option';
|
|
184148
|
+
}
|
|
184149
|
+
if ((marketType !== 'option') && (marketType !== 'swap') && (marketType !== 'future')) {
|
|
184150
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchUnderlyingAssets() supports contract markets only');
|
|
184151
|
+
}
|
|
184152
|
+
const request = {
|
|
184153
|
+
'instType': this.convertToInstrumentType(marketType),
|
|
184154
|
+
};
|
|
184155
|
+
const response = await this.publicGetPublicUnderlying(this.extend(request, params));
|
|
184156
|
+
//
|
|
184157
|
+
// {
|
|
184158
|
+
// "code": "0",
|
|
184159
|
+
// "data": [
|
|
184160
|
+
// [
|
|
184161
|
+
// "BTC-USD",
|
|
184162
|
+
// "ETH-USD"
|
|
184163
|
+
// ]
|
|
184164
|
+
// ],
|
|
184165
|
+
// "msg": ""
|
|
184166
|
+
// }
|
|
184167
|
+
//
|
|
184168
|
+
const underlyings = this.safeValue(response, 'data', []);
|
|
184169
|
+
return underlyings[0];
|
|
184170
|
+
}
|
|
184036
184171
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
184037
184172
|
if (!response) {
|
|
184038
184173
|
return undefined; // fallback to default error handler
|
|
@@ -273757,7 +273892,7 @@ SOFTWARE.
|
|
|
273757
273892
|
|
|
273758
273893
|
//-----------------------------------------------------------------------------
|
|
273759
273894
|
// this is updated by vss.js when building
|
|
273760
|
-
const version = '4.0.
|
|
273895
|
+
const version = '4.0.88';
|
|
273761
273896
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
273762
273897
|
//-----------------------------------------------------------------------------
|
|
273763
273898
|
|