ccxt 4.2.91 → 4.2.92
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 +1 -1
- package/dist/ccxt.browser.js +177 -110
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +5 -1
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/deribit.js +114 -101
- package/dist/cjs/src/kraken.js +56 -7
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/base/Exchange.js +5 -1
- package/js/src/bybit.js +1 -0
- package/js/src/deribit.js +114 -101
- package/js/src/kraken.d.ts +2 -1
- package/js/src/kraken.js +56 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,13 +212,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
212
212
|
|
|
213
213
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
214
214
|
|
|
215
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
216
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
215
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.92/dist/ccxt.browser.js
|
|
216
|
+
* unpkg: https://unpkg.com/ccxt@4.2.92/dist/ccxt.browser.js
|
|
217
217
|
|
|
218
218
|
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.
|
|
219
219
|
|
|
220
220
|
```HTML
|
|
221
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
221
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.92/dist/ccxt.browser.js"></script>
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Creates a global `ccxt` object:
|
package/build.sh
CHANGED
package/dist/ccxt.browser.js
CHANGED
|
@@ -13027,7 +13027,7 @@ class Exchange {
|
|
|
13027
13027
|
return reconstructedDate;
|
|
13028
13028
|
}
|
|
13029
13029
|
convertMarketIdExpireDate(date) {
|
|
13030
|
-
// parse
|
|
13030
|
+
// parse 03JAN24 to 240103
|
|
13031
13031
|
const monthMappping = {
|
|
13032
13032
|
'JAN': '01',
|
|
13033
13033
|
'FEB': '02',
|
|
@@ -13042,6 +13042,10 @@ class Exchange {
|
|
|
13042
13042
|
'NOV': '11',
|
|
13043
13043
|
'DEC': '12',
|
|
13044
13044
|
};
|
|
13045
|
+
// if exchange omits first zero and provides i.e. '3JAN24' instead of '03JAN24'
|
|
13046
|
+
if (date.length === 6) {
|
|
13047
|
+
date = '0' + date;
|
|
13048
|
+
}
|
|
13045
13049
|
const year = date.slice(0, 2);
|
|
13046
13050
|
const monthName = date.slice(2, 5);
|
|
13047
13051
|
const month = this.safeString(monthMappping, monthName);
|
|
@@ -84538,6 +84542,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84538
84542
|
'v5/broker/earning-record': 5,
|
|
84539
84543
|
'v5/broker/earnings-info': 5,
|
|
84540
84544
|
'v5/broker/account-info': 5,
|
|
84545
|
+
'v5/broker/asset/query-sub-member-deposit-record': 10,
|
|
84541
84546
|
},
|
|
84542
84547
|
'post': {
|
|
84543
84548
|
// Legacy option USDC
|
|
@@ -127444,117 +127449,130 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
127444
127449
|
* @name deribit#fetchMarkets
|
|
127445
127450
|
* @description retrieves data on all markets for deribit
|
|
127446
127451
|
* @see https://docs.deribit.com/#public-get_currencies
|
|
127452
|
+
* @see https://docs.deribit.com/#public-get_instruments
|
|
127447
127453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
127448
127454
|
* @returns {object[]} an array of objects representing market data
|
|
127449
127455
|
*/
|
|
127450
|
-
const
|
|
127451
|
-
//
|
|
127452
|
-
// {
|
|
127453
|
-
// "jsonrpc": "2.0",
|
|
127454
|
-
// "result": [
|
|
127455
|
-
// {
|
|
127456
|
-
// "withdrawal_priorities": [
|
|
127457
|
-
// { value: 0.15, name: "very_low" },
|
|
127458
|
-
// { value: 1.5, name: "very_high" },
|
|
127459
|
-
// ],
|
|
127460
|
-
// "withdrawal_fee": 0.0005,
|
|
127461
|
-
// "min_withdrawal_fee": 0.0005,
|
|
127462
|
-
// "min_confirmations": 1,
|
|
127463
|
-
// "fee_precision": 4,
|
|
127464
|
-
// "currency_long": "Bitcoin",
|
|
127465
|
-
// "currency": "BTC",
|
|
127466
|
-
// "coin_type": "BITCOIN"
|
|
127467
|
-
// }
|
|
127468
|
-
// ],
|
|
127469
|
-
// "usIn": 1583761588590479,
|
|
127470
|
-
// "usOut": 1583761588590544,
|
|
127471
|
-
// "usDiff": 65,
|
|
127472
|
-
// "testnet": false
|
|
127473
|
-
// }
|
|
127474
|
-
//
|
|
127475
|
-
const parsedMarkets = {};
|
|
127476
|
-
const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
|
|
127456
|
+
const instrumentsResponses = [];
|
|
127477
127457
|
const result = [];
|
|
127478
|
-
|
|
127479
|
-
|
|
127480
|
-
|
|
127481
|
-
|
|
127482
|
-
|
|
127483
|
-
|
|
127458
|
+
const parsedMarkets = {};
|
|
127459
|
+
let fetchAllMarkets = undefined;
|
|
127460
|
+
[fetchAllMarkets, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'fetchAllMarkets', true);
|
|
127461
|
+
if (fetchAllMarkets) {
|
|
127462
|
+
const instrumentsResponse = await this.publicGetGetInstruments(params);
|
|
127463
|
+
instrumentsResponses.push(instrumentsResponse);
|
|
127464
|
+
}
|
|
127465
|
+
else {
|
|
127466
|
+
const currenciesResponse = await this.publicGetGetCurrencies(params);
|
|
127484
127467
|
//
|
|
127485
127468
|
// {
|
|
127486
|
-
// "jsonrpc":"2.0",
|
|
127487
|
-
// "result":[
|
|
127488
|
-
// {
|
|
127489
|
-
// "tick_size":0.0005,
|
|
127490
|
-
// "taker_commission":0.0003,
|
|
127491
|
-
// "strike":52000.0,
|
|
127492
|
-
// "settlement_period":"month",
|
|
127493
|
-
// "settlement_currency":"BTC",
|
|
127494
|
-
// "quote_currency":"BTC",
|
|
127495
|
-
// "option_type":"put", // put, call
|
|
127496
|
-
// "min_trade_amount":0.1,
|
|
127497
|
-
// "maker_commission":0.0003,
|
|
127498
|
-
// "kind":"option",
|
|
127499
|
-
// "is_active":true,
|
|
127500
|
-
// "instrument_name":"BTC-24JUN22-52000-P",
|
|
127501
|
-
// "expiration_timestamp":1656057600000,
|
|
127502
|
-
// "creation_timestamp":1648199543000,
|
|
127503
|
-
// "counter_currency":"USD",
|
|
127504
|
-
// "contract_size":1.0,
|
|
127505
|
-
// "block_trade_commission":0.0003,
|
|
127506
|
-
// "base_currency":"BTC"
|
|
127507
|
-
// },
|
|
127508
|
-
// {
|
|
127509
|
-
// "tick_size":0.5,
|
|
127510
|
-
// "taker_commission":0.0005,
|
|
127511
|
-
// "settlement_period":"month", // month, week
|
|
127512
|
-
// "settlement_currency":"BTC",
|
|
127513
|
-
// "quote_currency":"USD",
|
|
127514
|
-
// "min_trade_amount":10.0,
|
|
127515
|
-
// "max_liquidation_commission":0.0075,
|
|
127516
|
-
// "max_leverage":50,
|
|
127517
|
-
// "maker_commission":0.0,
|
|
127518
|
-
// "kind":"future",
|
|
127519
|
-
// "is_active":true,
|
|
127520
|
-
// "instrument_name":"BTC-27MAY22",
|
|
127521
|
-
// "future_type":"reversed",
|
|
127522
|
-
// "expiration_timestamp":1653638400000,
|
|
127523
|
-
// "creation_timestamp":1648195209000,
|
|
127524
|
-
// "counter_currency":"USD",
|
|
127525
|
-
// "contract_size":10.0,
|
|
127526
|
-
// "block_trade_commission":0.0001,
|
|
127527
|
-
// "base_currency":"BTC"
|
|
127528
|
-
// },
|
|
127469
|
+
// "jsonrpc": "2.0",
|
|
127470
|
+
// "result": [
|
|
127529
127471
|
// {
|
|
127530
|
-
// "
|
|
127531
|
-
//
|
|
127532
|
-
//
|
|
127533
|
-
//
|
|
127534
|
-
// "
|
|
127535
|
-
// "
|
|
127536
|
-
// "
|
|
127537
|
-
// "
|
|
127538
|
-
// "
|
|
127539
|
-
// "
|
|
127540
|
-
// "
|
|
127541
|
-
//
|
|
127542
|
-
// "future_type":"reversed",
|
|
127543
|
-
// "expiration_timestamp":32503708800000,
|
|
127544
|
-
// "creation_timestamp":1534242287000,
|
|
127545
|
-
// "counter_currency":"USD",
|
|
127546
|
-
// "contract_size":10.0,
|
|
127547
|
-
// "block_trade_commission":0.0001,
|
|
127548
|
-
// "base_currency":"BTC"
|
|
127549
|
-
// },
|
|
127472
|
+
// "withdrawal_priorities": [
|
|
127473
|
+
// { value: 0.15, name: "very_low" },
|
|
127474
|
+
// { value: 1.5, name: "very_high" },
|
|
127475
|
+
// ],
|
|
127476
|
+
// "withdrawal_fee": 0.0005,
|
|
127477
|
+
// "min_withdrawal_fee": 0.0005,
|
|
127478
|
+
// "min_confirmations": 1,
|
|
127479
|
+
// "fee_precision": 4,
|
|
127480
|
+
// "currency_long": "Bitcoin",
|
|
127481
|
+
// "currency": "BTC",
|
|
127482
|
+
// "coin_type": "BITCOIN"
|
|
127483
|
+
// }
|
|
127550
127484
|
// ],
|
|
127551
|
-
// "usIn":
|
|
127552
|
-
// "usOut":
|
|
127553
|
-
// "usDiff":
|
|
127554
|
-
// "testnet":false
|
|
127485
|
+
// "usIn": 1583761588590479,
|
|
127486
|
+
// "usOut": 1583761588590544,
|
|
127487
|
+
// "usDiff": 65,
|
|
127488
|
+
// "testnet": false
|
|
127555
127489
|
// }
|
|
127556
127490
|
//
|
|
127557
|
-
const
|
|
127491
|
+
const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
|
|
127492
|
+
for (let i = 0; i < currenciesResult.length; i++) {
|
|
127493
|
+
const currencyId = this.safeString(currenciesResult[i], 'currency');
|
|
127494
|
+
const request = {
|
|
127495
|
+
'currency': currencyId,
|
|
127496
|
+
};
|
|
127497
|
+
const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
|
|
127498
|
+
//
|
|
127499
|
+
// {
|
|
127500
|
+
// "jsonrpc":"2.0",
|
|
127501
|
+
// "result":[
|
|
127502
|
+
// {
|
|
127503
|
+
// "tick_size":0.0005,
|
|
127504
|
+
// "taker_commission":0.0003,
|
|
127505
|
+
// "strike":52000.0,
|
|
127506
|
+
// "settlement_period":"month",
|
|
127507
|
+
// "settlement_currency":"BTC",
|
|
127508
|
+
// "quote_currency":"BTC",
|
|
127509
|
+
// "option_type":"put", // put, call
|
|
127510
|
+
// "min_trade_amount":0.1,
|
|
127511
|
+
// "maker_commission":0.0003,
|
|
127512
|
+
// "kind":"option",
|
|
127513
|
+
// "is_active":true,
|
|
127514
|
+
// "instrument_name":"BTC-24JUN22-52000-P",
|
|
127515
|
+
// "expiration_timestamp":1656057600000,
|
|
127516
|
+
// "creation_timestamp":1648199543000,
|
|
127517
|
+
// "counter_currency":"USD",
|
|
127518
|
+
// "contract_size":1.0,
|
|
127519
|
+
// "block_trade_commission":0.0003,
|
|
127520
|
+
// "base_currency":"BTC"
|
|
127521
|
+
// },
|
|
127522
|
+
// {
|
|
127523
|
+
// "tick_size":0.5,
|
|
127524
|
+
// "taker_commission":0.0005,
|
|
127525
|
+
// "settlement_period":"month", // month, week
|
|
127526
|
+
// "settlement_currency":"BTC",
|
|
127527
|
+
// "quote_currency":"USD",
|
|
127528
|
+
// "min_trade_amount":10.0,
|
|
127529
|
+
// "max_liquidation_commission":0.0075,
|
|
127530
|
+
// "max_leverage":50,
|
|
127531
|
+
// "maker_commission":0.0,
|
|
127532
|
+
// "kind":"future",
|
|
127533
|
+
// "is_active":true,
|
|
127534
|
+
// "instrument_name":"BTC-27MAY22",
|
|
127535
|
+
// "future_type":"reversed",
|
|
127536
|
+
// "expiration_timestamp":1653638400000,
|
|
127537
|
+
// "creation_timestamp":1648195209000,
|
|
127538
|
+
// "counter_currency":"USD",
|
|
127539
|
+
// "contract_size":10.0,
|
|
127540
|
+
// "block_trade_commission":0.0001,
|
|
127541
|
+
// "base_currency":"BTC"
|
|
127542
|
+
// },
|
|
127543
|
+
// {
|
|
127544
|
+
// "tick_size":0.5,
|
|
127545
|
+
// "taker_commission":0.0005,
|
|
127546
|
+
// "settlement_period":"perpetual",
|
|
127547
|
+
// "settlement_currency":"BTC",
|
|
127548
|
+
// "quote_currency":"USD",
|
|
127549
|
+
// "min_trade_amount":10.0,
|
|
127550
|
+
// "max_liquidation_commission":0.0075,
|
|
127551
|
+
// "max_leverage":50,
|
|
127552
|
+
// "maker_commission":0.0,
|
|
127553
|
+
// "kind":"future",
|
|
127554
|
+
// "is_active":true,
|
|
127555
|
+
// "instrument_name":"BTC-PERPETUAL",
|
|
127556
|
+
// "future_type":"reversed",
|
|
127557
|
+
// "expiration_timestamp":32503708800000,
|
|
127558
|
+
// "creation_timestamp":1534242287000,
|
|
127559
|
+
// "counter_currency":"USD",
|
|
127560
|
+
// "contract_size":10.0,
|
|
127561
|
+
// "block_trade_commission":0.0001,
|
|
127562
|
+
// "base_currency":"BTC"
|
|
127563
|
+
// },
|
|
127564
|
+
// ],
|
|
127565
|
+
// "usIn":1648691472831791,
|
|
127566
|
+
// "usOut":1648691472831896,
|
|
127567
|
+
// "usDiff":105,
|
|
127568
|
+
// "testnet":false
|
|
127569
|
+
// }
|
|
127570
|
+
//
|
|
127571
|
+
instrumentsResponses.push(instrumentsResponse);
|
|
127572
|
+
}
|
|
127573
|
+
}
|
|
127574
|
+
for (let i = 0; i < instrumentsResponses.length; i++) {
|
|
127575
|
+
const instrumentsResult = this.safeValue(instrumentsResponses[i], 'result', []);
|
|
127558
127576
|
for (let k = 0; k < instrumentsResult.length; k++) {
|
|
127559
127577
|
const market = instrumentsResult[k];
|
|
127560
127578
|
const kind = this.safeString(market, 'kind');
|
|
@@ -172649,15 +172667,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172649
172667
|
* @name kraken#fetchPositions
|
|
172650
172668
|
* @description fetch all open positions
|
|
172651
172669
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
|
|
172652
|
-
* @param {string[]
|
|
172670
|
+
* @param {string[]} [symbols] not used by kraken fetchPositions ()
|
|
172653
172671
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
172654
172672
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
172655
172673
|
*/
|
|
172656
172674
|
await this.loadMarkets();
|
|
172657
172675
|
const request = {
|
|
172658
|
-
|
|
172659
|
-
|
|
172660
|
-
|
|
172676
|
+
// 'txid': 'comma delimited list of transaction ids to restrict output to',
|
|
172677
|
+
'docalcs': 'true',
|
|
172678
|
+
'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
|
|
172661
172679
|
};
|
|
172662
172680
|
const response = await this.privatePostOpenPositions(this.extend(request, params));
|
|
172663
172681
|
//
|
|
@@ -172705,9 +172723,58 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172705
172723
|
// ]
|
|
172706
172724
|
// }
|
|
172707
172725
|
//
|
|
172708
|
-
|
|
172709
|
-
|
|
172710
|
-
|
|
172726
|
+
symbols = this.marketSymbols(symbols);
|
|
172727
|
+
const result = this.safeList(response, 'result');
|
|
172728
|
+
const results = this.parsePositions(result, symbols);
|
|
172729
|
+
return this.filterByArrayPositions(results, 'symbol', symbols, false);
|
|
172730
|
+
}
|
|
172731
|
+
parsePosition(position, market = undefined) {
|
|
172732
|
+
//
|
|
172733
|
+
// {
|
|
172734
|
+
// "pair": "ETHUSDT",
|
|
172735
|
+
// "positions": "1",
|
|
172736
|
+
// "type": "buy",
|
|
172737
|
+
// "leverage": "2.00000",
|
|
172738
|
+
// "cost": "28.49800",
|
|
172739
|
+
// "fee": "0.07979",
|
|
172740
|
+
// "vol": "0.02000000",
|
|
172741
|
+
// "vol_closed": "0.00000000",
|
|
172742
|
+
// "margin": "14.24900"
|
|
172743
|
+
// }
|
|
172744
|
+
//
|
|
172745
|
+
const marketId = this.safeString(position, 'pair');
|
|
172746
|
+
const rawSide = this.safeString(position, 'type');
|
|
172747
|
+
const side = (rawSide === 'buy') ? 'long' : 'short';
|
|
172748
|
+
return this.safePosition({
|
|
172749
|
+
'info': position,
|
|
172750
|
+
'id': undefined,
|
|
172751
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
172752
|
+
'notional': undefined,
|
|
172753
|
+
'marginMode': undefined,
|
|
172754
|
+
'liquidationPrice': undefined,
|
|
172755
|
+
'entryPrice': undefined,
|
|
172756
|
+
'unrealizedPnl': this.safeNumber(position, 'net'),
|
|
172757
|
+
'realizedPnl': undefined,
|
|
172758
|
+
'percentage': undefined,
|
|
172759
|
+
'contracts': this.safeNumber(position, 'vol'),
|
|
172760
|
+
'contractSize': undefined,
|
|
172761
|
+
'markPrice': undefined,
|
|
172762
|
+
'lastPrice': undefined,
|
|
172763
|
+
'side': side,
|
|
172764
|
+
'hedged': undefined,
|
|
172765
|
+
'timestamp': undefined,
|
|
172766
|
+
'datetime': undefined,
|
|
172767
|
+
'lastUpdateTimestamp': undefined,
|
|
172768
|
+
'maintenanceMargin': undefined,
|
|
172769
|
+
'maintenanceMarginPercentage': undefined,
|
|
172770
|
+
'collateral': undefined,
|
|
172771
|
+
'initialMargin': this.safeNumber(position, 'margin'),
|
|
172772
|
+
'initialMarginPercentage': undefined,
|
|
172773
|
+
'leverage': this.safeNumber(position, 'leverage'),
|
|
172774
|
+
'marginRatio': undefined,
|
|
172775
|
+
'stopLossPrice': undefined,
|
|
172776
|
+
'takeProfitPrice': undefined,
|
|
172777
|
+
});
|
|
172711
172778
|
}
|
|
172712
172779
|
parseAccountType(account) {
|
|
172713
172780
|
const accountByType = {
|
|
@@ -325545,7 +325612,7 @@ SOFTWARE.
|
|
|
325545
325612
|
|
|
325546
325613
|
//-----------------------------------------------------------------------------
|
|
325547
325614
|
// this is updated by vss.js when building
|
|
325548
|
-
const version = '4.2.
|
|
325615
|
+
const version = '4.2.92';
|
|
325549
325616
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
325550
325617
|
//-----------------------------------------------------------------------------
|
|
325551
325618
|
|