ccxt 4.4.91 → 4.4.93
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +9 -8
- package/dist/cjs/src/base/Exchange.js +81 -33
- package/dist/cjs/src/binance.js +44 -1
- package/dist/cjs/src/bitmart.js +7 -0
- package/dist/cjs/src/bitmex.js +4 -4
- package/dist/cjs/src/bitvavo.js +10 -1
- package/dist/cjs/src/bybit.js +83 -8
- package/dist/cjs/src/coinbaseexchange.js +53 -0
- package/dist/cjs/src/coincheck.js +47 -4
- package/dist/cjs/src/coinex.js +19 -14
- package/dist/cjs/src/cryptomus.js +30 -53
- package/dist/cjs/src/deribit.js +6 -6
- package/dist/cjs/src/exmo.js +72 -59
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/hyperliquid.js +3 -2
- package/dist/cjs/src/krakenfutures.js +1 -1
- package/dist/cjs/src/kucoin.js +13 -15
- package/dist/cjs/src/latoken.js +19 -74
- package/dist/cjs/src/lbank.js +118 -34
- package/dist/cjs/src/okx.js +158 -2
- package/dist/cjs/src/paradex.js +54 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/pro/bitstamp.js +55 -16
- package/dist/cjs/src/pro/bybit.js +6 -7
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/lbank.d.ts +1 -0
- package/js/src/ascendex.js +9 -8
- package/js/src/base/Exchange.d.ts +5 -1
- package/js/src/base/Exchange.js +81 -33
- package/js/src/binance.d.ts +10 -0
- package/js/src/binance.js +44 -1
- package/js/src/bitmart.d.ts +7 -0
- package/js/src/bitmart.js +7 -0
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +4 -4
- package/js/src/bitvavo.js +10 -1
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +83 -8
- package/js/src/coinbaseexchange.js +53 -0
- package/js/src/coincheck.js +48 -5
- package/js/src/coinex.js +16 -13
- package/js/src/cryptomus.js +30 -53
- package/js/src/deribit.js +6 -6
- package/js/src/exmo.js +72 -59
- package/js/src/htx.js +1 -1
- package/js/src/hyperliquid.js +3 -2
- package/js/src/krakenfutures.js +1 -1
- package/js/src/kucoin.js +13 -15
- package/js/src/latoken.d.ts +0 -1
- package/js/src/latoken.js +19 -74
- package/js/src/lbank.d.ts +9 -1
- package/js/src/lbank.js +118 -34
- package/js/src/okx.d.ts +13 -1
- package/js/src/okx.js +158 -2
- package/js/src/paradex.d.ts +10 -0
- package/js/src/paradex.js +54 -0
- package/js/src/phemex.js +3 -3
- package/js/src/pro/bitstamp.js +55 -16
- package/js/src/pro/bybit.js +7 -8
- package/package.json +1 -1
package/js/src/lbank.js
CHANGED
|
@@ -52,6 +52,7 @@ export default class lbank extends Exchange {
|
|
|
52
52
|
'fetchClosedOrders': false,
|
|
53
53
|
'fetchCrossBorrowRate': false,
|
|
54
54
|
'fetchCrossBorrowRates': false,
|
|
55
|
+
'fetchCurrencies': true,
|
|
55
56
|
'fetchDepositAddress': true,
|
|
56
57
|
'fetchDepositAddresses': false,
|
|
57
58
|
'fetchDepositAddressesByNetwork': false,
|
|
@@ -126,7 +127,8 @@ export default class lbank extends Exchange {
|
|
|
126
127
|
'currencyPairs': 2.5,
|
|
127
128
|
'accuracy': 2.5,
|
|
128
129
|
'usdToCny': 2.5,
|
|
129
|
-
'
|
|
130
|
+
'assetConfigs': 2.5,
|
|
131
|
+
'withdrawConfigs': 2.5 * 1.5,
|
|
130
132
|
'timestamp': 2.5,
|
|
131
133
|
'ticker/24hr': 2.5,
|
|
132
134
|
'ticker': 2.5,
|
|
@@ -212,6 +214,7 @@ export default class lbank extends Exchange {
|
|
|
212
214
|
},
|
|
213
215
|
},
|
|
214
216
|
'commonCurrencies': {
|
|
217
|
+
'XBT': 'XBT',
|
|
215
218
|
'HIT': 'Hiver',
|
|
216
219
|
'VET_ERC20': 'VEN',
|
|
217
220
|
'PNT': 'Penta',
|
|
@@ -279,21 +282,12 @@ export default class lbank extends Exchange {
|
|
|
279
282
|
// ptx: 1
|
|
280
283
|
// }
|
|
281
284
|
},
|
|
282
|
-
'
|
|
285
|
+
'networksById': {
|
|
283
286
|
'erc20': 'ERC20',
|
|
284
287
|
'trc20': 'TRC20',
|
|
285
|
-
'
|
|
286
|
-
'
|
|
287
|
-
'bep20
|
|
288
|
-
'bep20': 'BSC',
|
|
289
|
-
'heco': 'HT',
|
|
290
|
-
'bep2': 'BNB',
|
|
291
|
-
'btc': 'BTC',
|
|
292
|
-
'dogecoin': 'DOGE',
|
|
293
|
-
'matic': 'MATIC',
|
|
294
|
-
'oec': 'OEC',
|
|
295
|
-
'btctron': 'BTCTRON',
|
|
296
|
-
'xrp': 'XRP',
|
|
288
|
+
'TRX': 'TRC20',
|
|
289
|
+
'bep20(bsc)': 'BEP20',
|
|
290
|
+
'bep20': 'BEP20',
|
|
297
291
|
},
|
|
298
292
|
'defaultNetworks': {
|
|
299
293
|
'USDT': 'TRC20',
|
|
@@ -416,6 +410,108 @@ export default class lbank extends Exchange {
|
|
|
416
410
|
//
|
|
417
411
|
return this.safeInteger(response, 'data');
|
|
418
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* @method
|
|
415
|
+
* @name lbank#fetchCurrencies
|
|
416
|
+
* @description fetches all available currencies on an exchange
|
|
417
|
+
* @param {dict} [params] extra parameters specific to the exchange API endpoint
|
|
418
|
+
* @returns {dict} an associative dictionary of currencies
|
|
419
|
+
*/
|
|
420
|
+
async fetchCurrencies(params = {}) {
|
|
421
|
+
const response = await this.spotPublicGetWithdrawConfigs(params);
|
|
422
|
+
//
|
|
423
|
+
// {
|
|
424
|
+
// "msg": "Success",
|
|
425
|
+
// "result": "true",
|
|
426
|
+
// "data": [
|
|
427
|
+
// {
|
|
428
|
+
// "amountScale": "4",
|
|
429
|
+
// "chain": "bep20(bsc)",
|
|
430
|
+
// "assetCode": "usdt",
|
|
431
|
+
// "min": "10",
|
|
432
|
+
// "transferAmtScale": "4",
|
|
433
|
+
// "canWithDraw": true,
|
|
434
|
+
// "fee": "0.0000",
|
|
435
|
+
// "minTransfer": "0.0001",
|
|
436
|
+
// "type": "1"
|
|
437
|
+
// },
|
|
438
|
+
// {
|
|
439
|
+
// "amountScale": "4",
|
|
440
|
+
// "chain": "trc20",
|
|
441
|
+
// "assetCode": "usdt",
|
|
442
|
+
// "min": "1",
|
|
443
|
+
// "transferAmtScale": "4",
|
|
444
|
+
// "canWithDraw": true,
|
|
445
|
+
// "fee": "1.0000",
|
|
446
|
+
// "minTransfer": "0.0001",
|
|
447
|
+
// "type": "1"
|
|
448
|
+
// },
|
|
449
|
+
// ...
|
|
450
|
+
// ],
|
|
451
|
+
// "error_code": "0",
|
|
452
|
+
// "ts": "1747973911431"
|
|
453
|
+
// }
|
|
454
|
+
//
|
|
455
|
+
const currenciesData = this.safeList(response, 'data', []);
|
|
456
|
+
const grouped = this.groupBy(currenciesData, 'assetCode');
|
|
457
|
+
const groupedKeys = Object.keys(grouped);
|
|
458
|
+
const result = {};
|
|
459
|
+
for (let i = 0; i < groupedKeys.length; i++) {
|
|
460
|
+
const id = (groupedKeys[i]).toString(); // some currencies are numeric
|
|
461
|
+
const code = this.safeCurrencyCode(id);
|
|
462
|
+
const networksRaw = grouped[id];
|
|
463
|
+
const networks = {};
|
|
464
|
+
for (let j = 0; j < networksRaw.length; j++) {
|
|
465
|
+
const networkEntry = networksRaw[j];
|
|
466
|
+
const networkId = this.safeString(networkEntry, 'chain');
|
|
467
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
468
|
+
networks[networkCode] = {
|
|
469
|
+
'id': networkId,
|
|
470
|
+
'network': networkCode,
|
|
471
|
+
'limits': {
|
|
472
|
+
'withdraw': {
|
|
473
|
+
'min': this.safeNumber(networkEntry, 'min'),
|
|
474
|
+
'max': undefined,
|
|
475
|
+
},
|
|
476
|
+
'deposit': {
|
|
477
|
+
'min': this.safeNumber(networkEntry, 'minTransfer'),
|
|
478
|
+
'max': undefined,
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
'active': undefined,
|
|
482
|
+
'deposit': undefined,
|
|
483
|
+
'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
|
|
484
|
+
'fee': this.safeNumber(networkEntry, 'fee'),
|
|
485
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
|
|
486
|
+
'info': networkEntry,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
result[code] = this.safeCurrencyStructure({
|
|
490
|
+
'id': id,
|
|
491
|
+
'code': code,
|
|
492
|
+
'precision': undefined,
|
|
493
|
+
'type': undefined,
|
|
494
|
+
'name': undefined,
|
|
495
|
+
'active': undefined,
|
|
496
|
+
'deposit': undefined,
|
|
497
|
+
'withdraw': undefined,
|
|
498
|
+
'fee': undefined,
|
|
499
|
+
'limits': {
|
|
500
|
+
'withdraw': {
|
|
501
|
+
'min': undefined,
|
|
502
|
+
'max': undefined,
|
|
503
|
+
},
|
|
504
|
+
'deposit': {
|
|
505
|
+
'min': undefined,
|
|
506
|
+
'max': undefined,
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
'networks': networks,
|
|
510
|
+
'info': networksRaw,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
419
515
|
/**
|
|
420
516
|
* @method
|
|
421
517
|
* @name lbank#fetchMarkets
|
|
@@ -576,7 +672,7 @@ export default class lbank extends Exchange {
|
|
|
576
672
|
'active': true,
|
|
577
673
|
'contract': true,
|
|
578
674
|
'linear': true,
|
|
579
|
-
'inverse':
|
|
675
|
+
'inverse': false,
|
|
580
676
|
'contractSize': this.safeNumber(market, 'volumeMultiple'),
|
|
581
677
|
'expiry': undefined,
|
|
582
678
|
'expiryDatetime': undefined,
|
|
@@ -2171,13 +2267,10 @@ export default class lbank extends Exchange {
|
|
|
2171
2267
|
const result = this.safeValue(response, 'data');
|
|
2172
2268
|
const address = this.safeString(result, 'address');
|
|
2173
2269
|
const tag = this.safeString(result, 'memo');
|
|
2174
|
-
const networkId = this.safeString(result, 'netWork');
|
|
2175
|
-
const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2176
|
-
const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId);
|
|
2177
2270
|
return {
|
|
2178
2271
|
'info': response,
|
|
2179
2272
|
'currency': code,
|
|
2180
|
-
'network':
|
|
2273
|
+
'network': this.networkIdToCode(this.safeString(result, 'netWork')),
|
|
2181
2274
|
'address': address,
|
|
2182
2275
|
'tag': tag,
|
|
2183
2276
|
};
|
|
@@ -2212,12 +2305,10 @@ export default class lbank extends Exchange {
|
|
|
2212
2305
|
const result = this.safeValue(response, 'data');
|
|
2213
2306
|
const address = this.safeString(result, 'address');
|
|
2214
2307
|
const tag = this.safeString(result, 'memo');
|
|
2215
|
-
const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2216
|
-
const networkCode = this.safeStringUpper(inverseNetworks, network, network);
|
|
2217
2308
|
return {
|
|
2218
2309
|
'info': response,
|
|
2219
2310
|
'currency': code,
|
|
2220
|
-
'network':
|
|
2311
|
+
'network': undefined,
|
|
2221
2312
|
'address': address,
|
|
2222
2313
|
'tag': tag,
|
|
2223
2314
|
};
|
|
@@ -2341,9 +2432,6 @@ export default class lbank extends Exchange {
|
|
|
2341
2432
|
}
|
|
2342
2433
|
const txid = this.safeString(transaction, 'txId');
|
|
2343
2434
|
const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
|
|
2344
|
-
const networks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2345
|
-
const networkId = this.safeString(transaction, 'networkName');
|
|
2346
|
-
const network = this.safeString(networks, networkId, networkId);
|
|
2347
2435
|
const address = this.safeString(transaction, 'address');
|
|
2348
2436
|
let addressFrom = undefined;
|
|
2349
2437
|
let addressTo = undefined;
|
|
@@ -2371,7 +2459,7 @@ export default class lbank extends Exchange {
|
|
|
2371
2459
|
'txid': txid,
|
|
2372
2460
|
'timestamp': timestamp,
|
|
2373
2461
|
'datetime': this.iso8601(timestamp),
|
|
2374
|
-
'network':
|
|
2462
|
+
'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
|
|
2375
2463
|
'address': address,
|
|
2376
2464
|
'addressTo': addressTo,
|
|
2377
2465
|
'addressFrom': addressFrom,
|
|
@@ -2574,10 +2662,9 @@ export default class lbank extends Exchange {
|
|
|
2574
2662
|
withdrawFees[code] = {};
|
|
2575
2663
|
for (let j = 0; j < networkList.length; j++) {
|
|
2576
2664
|
const networkEntry = networkList[j];
|
|
2577
|
-
const networkId = this.safeString(networkEntry, 'name');
|
|
2578
|
-
const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId);
|
|
2579
2665
|
const fee = this.safeNumber(networkEntry, 'withdrawFee');
|
|
2580
2666
|
if (fee !== undefined) {
|
|
2667
|
+
const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
|
|
2581
2668
|
withdrawFees[code][networkCode] = fee;
|
|
2582
2669
|
}
|
|
2583
2670
|
}
|
|
@@ -2629,8 +2716,7 @@ export default class lbank extends Exchange {
|
|
|
2629
2716
|
if (canWithdraw === 'true') {
|
|
2630
2717
|
const currencyId = this.safeString(item, 'assetCode');
|
|
2631
2718
|
const codeInner = this.safeCurrencyCode(currencyId);
|
|
2632
|
-
|
|
2633
|
-
let network = this.safeString(this.options['inverse-networks'], chain, chain);
|
|
2719
|
+
let network = this.networkIdToCode(this.safeString(item, 'chain'));
|
|
2634
2720
|
if (network === undefined) {
|
|
2635
2721
|
network = codeInner;
|
|
2636
2722
|
}
|
|
@@ -2781,8 +2867,7 @@ export default class lbank extends Exchange {
|
|
|
2781
2867
|
const resultCodeInfo = result[code]['info'];
|
|
2782
2868
|
resultCodeInfo.push(fee);
|
|
2783
2869
|
}
|
|
2784
|
-
const
|
|
2785
|
-
const networkCode = this.safeString(this.options['inverse-networks'], chain, chain);
|
|
2870
|
+
const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
|
|
2786
2871
|
if (networkCode !== undefined) {
|
|
2787
2872
|
result[code]['networks'][networkCode] = {
|
|
2788
2873
|
'withdraw': {
|
|
@@ -2838,8 +2923,7 @@ export default class lbank extends Exchange {
|
|
|
2838
2923
|
const networkList = this.safeValue(fee, 'networkList', []);
|
|
2839
2924
|
for (let j = 0; j < networkList.length; j++) {
|
|
2840
2925
|
const networkEntry = networkList[j];
|
|
2841
|
-
const
|
|
2842
|
-
const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId);
|
|
2926
|
+
const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
|
|
2843
2927
|
const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
|
|
2844
2928
|
const isDefault = this.safeValue(networkEntry, 'isDefault');
|
|
2845
2929
|
if (withdrawFee !== undefined) {
|
package/js/src/okx.d.ts
CHANGED
|
@@ -807,7 +807,7 @@ export default class okx extends Exchange {
|
|
|
807
807
|
/**
|
|
808
808
|
* @method
|
|
809
809
|
* @name okx#fetchBorrowInterest
|
|
810
|
-
* @description fetch the interest owed
|
|
810
|
+
* @description fetch the interest owed b the user for borrowing currency for margin trading
|
|
811
811
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
812
812
|
* @param {string} code the unified currency code for the currency of the interest
|
|
813
813
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
@@ -959,6 +959,18 @@ export default class okx extends Exchange {
|
|
|
959
959
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
960
960
|
*/
|
|
961
961
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
962
|
+
/**
|
|
963
|
+
* @method
|
|
964
|
+
* @name okx#fetchAllGreeks
|
|
965
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
966
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
967
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
968
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
969
|
+
* @param {string} params.uly Underlying, either uly or instFamily is required
|
|
970
|
+
* @param {string} params.instFamily Instrument family, either uly or instFamily is required
|
|
971
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
972
|
+
*/
|
|
973
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
962
974
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
963
975
|
/**
|
|
964
976
|
* @method
|
package/js/src/okx.js
CHANGED
|
@@ -58,6 +58,7 @@ export default class okx extends Exchange {
|
|
|
58
58
|
'createTriggerOrder': true,
|
|
59
59
|
'editOrder': true,
|
|
60
60
|
'fetchAccounts': true,
|
|
61
|
+
'fetchAllGreeks': true,
|
|
61
62
|
'fetchBalance': true,
|
|
62
63
|
'fetchBidsAsks': undefined,
|
|
63
64
|
'fetchBorrowInterest': true,
|
|
@@ -3792,6 +3793,84 @@ export default class okx extends Exchange {
|
|
|
3792
3793
|
// "uTime": "1621910749815"
|
|
3793
3794
|
// }
|
|
3794
3795
|
//
|
|
3796
|
+
// watchOrders & fetchClosedOrders
|
|
3797
|
+
//
|
|
3798
|
+
// {
|
|
3799
|
+
// "algoClOrdId": "",
|
|
3800
|
+
// "algoId": "",
|
|
3801
|
+
// "attachAlgoClOrdId": "",
|
|
3802
|
+
// "attachAlgoOrds": [],
|
|
3803
|
+
// "cancelSource": "",
|
|
3804
|
+
// "cancelSourceReason": "", // not present in WS, but present in fetchClosedOrders
|
|
3805
|
+
// "category": "normal",
|
|
3806
|
+
// "ccy": "", // empty in WS, but eg. `USDT` in fetchClosedOrders
|
|
3807
|
+
// "clOrdId": "",
|
|
3808
|
+
// "cTime": "1751705801423",
|
|
3809
|
+
// "feeCcy": "USDT",
|
|
3810
|
+
// "instId": "LINK-USDT-SWAP",
|
|
3811
|
+
// "instType": "SWAP",
|
|
3812
|
+
// "isTpLimit": "false",
|
|
3813
|
+
// "lever": "3",
|
|
3814
|
+
// "linkedAlgoOrd": { "algoId": "" },
|
|
3815
|
+
// "ordId": "2657625147249614848",
|
|
3816
|
+
// "ordType": "limit",
|
|
3817
|
+
// "posSide": "net",
|
|
3818
|
+
// "px": "13.142",
|
|
3819
|
+
// "pxType": "",
|
|
3820
|
+
// "pxUsd": "",
|
|
3821
|
+
// "pxVol": "",
|
|
3822
|
+
// "quickMgnType": "",
|
|
3823
|
+
// "rebate": "0",
|
|
3824
|
+
// "rebateCcy": "USDT",
|
|
3825
|
+
// "reduceOnly": "true",
|
|
3826
|
+
// "side": "sell",
|
|
3827
|
+
// "slOrdPx": "",
|
|
3828
|
+
// "slTriggerPx": "",
|
|
3829
|
+
// "slTriggerPxType": "",
|
|
3830
|
+
// "source": "",
|
|
3831
|
+
// "stpId": "",
|
|
3832
|
+
// "stpMode": "cancel_maker",
|
|
3833
|
+
// "sz": "0.1",
|
|
3834
|
+
// "tag": "",
|
|
3835
|
+
// "tdMode": "isolated",
|
|
3836
|
+
// "tgtCcy": "",
|
|
3837
|
+
// "tpOrdPx": "",
|
|
3838
|
+
// "tpTriggerPx": "",
|
|
3839
|
+
// "tpTriggerPxType": "",
|
|
3840
|
+
// "uTime": "1751705807467",
|
|
3841
|
+
// "reqId": "", // field present only in WS
|
|
3842
|
+
// "msg": "", // field present only in WS
|
|
3843
|
+
// "amendResult": "", // field present only in WS
|
|
3844
|
+
// "amendSource": "", // field present only in WS
|
|
3845
|
+
// "code": "0", // field present only in WS
|
|
3846
|
+
// "fillFwdPx": "", // field present only in WS
|
|
3847
|
+
// "fillMarkVol": "", // field present only in WS
|
|
3848
|
+
// "fillPxUsd": "", // field present only in WS
|
|
3849
|
+
// "fillPxVol": "", // field present only in WS
|
|
3850
|
+
// "lastPx": "13.142", // field present only in WS
|
|
3851
|
+
// "notionalUsd": "1.314515408", // field present only in WS
|
|
3852
|
+
//
|
|
3853
|
+
// #### these below fields are empty on first omit from websocket, because of "creation" event. however, if order is executed, it also immediately sends another update with these fields filled ###
|
|
3854
|
+
//
|
|
3855
|
+
// "pnl": "-0.0001",
|
|
3856
|
+
// "accFillSz": "0.1",
|
|
3857
|
+
// "avgPx": "13.142",
|
|
3858
|
+
// "state": "filled",
|
|
3859
|
+
// "fee": "-0.00026284",
|
|
3860
|
+
// "fillPx": "13.142",
|
|
3861
|
+
// "tradeId": "293429690",
|
|
3862
|
+
// "fillSz": "0.1",
|
|
3863
|
+
// "fillTime": "1751705807467",
|
|
3864
|
+
// "fillNotionalUsd": "1.314515408", // field present only in WS
|
|
3865
|
+
// "fillPnl": "-0.0001", // field present only in WS
|
|
3866
|
+
// "fillFee": "-0.00026284", // field present only in WS
|
|
3867
|
+
// "fillFeeCcy": "USDT", // field present only in WS
|
|
3868
|
+
// "execType": "M", // field present only in WS
|
|
3869
|
+
// "fillMarkPx": "13.141", // field present only in WS
|
|
3870
|
+
// "fillIdxPx": "13.147" // field present only in WS
|
|
3871
|
+
// }
|
|
3872
|
+
//
|
|
3873
|
+
//
|
|
3795
3874
|
// Algo Order fetchOpenOrders, fetchCanceledOrders, fetchClosedOrders
|
|
3796
3875
|
//
|
|
3797
3876
|
// {
|
|
@@ -5145,7 +5224,7 @@ export default class okx extends Exchange {
|
|
|
5145
5224
|
let fee = this.safeString(params, 'fee');
|
|
5146
5225
|
if (fee === undefined) {
|
|
5147
5226
|
const currencies = await this.fetchCurrencies();
|
|
5148
|
-
this.currencies = this.deepExtend(this.currencies, currencies);
|
|
5227
|
+
this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
|
|
5149
5228
|
const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
|
|
5150
5229
|
fee = this.safeString(targetNetwork, 'fee');
|
|
5151
5230
|
if (fee === undefined) {
|
|
@@ -7200,7 +7279,7 @@ export default class okx extends Exchange {
|
|
|
7200
7279
|
/**
|
|
7201
7280
|
* @method
|
|
7202
7281
|
* @name okx#fetchBorrowInterest
|
|
7203
|
-
* @description fetch the interest owed
|
|
7282
|
+
* @description fetch the interest owed b the user for borrowing currency for margin trading
|
|
7204
7283
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7205
7284
|
* @param {string} code the unified currency code for the currency of the interest
|
|
7206
7285
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
@@ -7946,6 +8025,83 @@ export default class okx extends Exchange {
|
|
|
7946
8025
|
}
|
|
7947
8026
|
return undefined;
|
|
7948
8027
|
}
|
|
8028
|
+
/**
|
|
8029
|
+
* @method
|
|
8030
|
+
* @name okx#fetchAllGreeks
|
|
8031
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
8032
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
8033
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
8034
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8035
|
+
* @param {string} params.uly Underlying, either uly or instFamily is required
|
|
8036
|
+
* @param {string} params.instFamily Instrument family, either uly or instFamily is required
|
|
8037
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
8038
|
+
*/
|
|
8039
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
8040
|
+
await this.loadMarkets();
|
|
8041
|
+
const request = {};
|
|
8042
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
8043
|
+
let symbolsLength = undefined;
|
|
8044
|
+
if (symbols !== undefined) {
|
|
8045
|
+
symbolsLength = symbols.length;
|
|
8046
|
+
}
|
|
8047
|
+
if ((symbols === undefined) || (symbolsLength !== 1)) {
|
|
8048
|
+
const uly = this.safeString(params, 'uly');
|
|
8049
|
+
if (uly !== undefined) {
|
|
8050
|
+
request['uly'] = uly;
|
|
8051
|
+
}
|
|
8052
|
+
const instFamily = this.safeString(params, 'instFamily');
|
|
8053
|
+
if (instFamily !== undefined) {
|
|
8054
|
+
request['instFamily'] = instFamily;
|
|
8055
|
+
}
|
|
8056
|
+
if ((uly === undefined) && (instFamily === undefined)) {
|
|
8057
|
+
throw new BadRequest(this.id + ' fetchAllGreeks() requires either a uly or instFamily parameter');
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
let market = undefined;
|
|
8061
|
+
if (symbols !== undefined) {
|
|
8062
|
+
if (symbolsLength === 1) {
|
|
8063
|
+
market = this.market(symbols[0]);
|
|
8064
|
+
const marketId = market['id'];
|
|
8065
|
+
const optionParts = marketId.split('-');
|
|
8066
|
+
request['uly'] = market['info']['uly'];
|
|
8067
|
+
request['instFamily'] = market['info']['instFamily'];
|
|
8068
|
+
request['expTime'] = this.safeString(optionParts, 2);
|
|
8069
|
+
}
|
|
8070
|
+
}
|
|
8071
|
+
params = this.omit(params, ['uly', 'instFamily']);
|
|
8072
|
+
const response = await this.publicGetPublicOptSummary(this.extend(request, params));
|
|
8073
|
+
//
|
|
8074
|
+
// {
|
|
8075
|
+
// "code": "0",
|
|
8076
|
+
// "data": [
|
|
8077
|
+
// {
|
|
8078
|
+
// "askVol": "0",
|
|
8079
|
+
// "bidVol": "0",
|
|
8080
|
+
// "delta": "0.5105464486882039",
|
|
8081
|
+
// "deltaBS": "0.7325502184143025",
|
|
8082
|
+
// "fwdPx": "37675.80158694987186",
|
|
8083
|
+
// "gamma": "-0.13183515090501083",
|
|
8084
|
+
// "gammaBS": "0.000024139685826358558",
|
|
8085
|
+
// "instId": "BTC-USD-240329-32000-C",
|
|
8086
|
+
// "instType": "OPTION",
|
|
8087
|
+
// "lever": "4.504428015946619",
|
|
8088
|
+
// "markVol": "0.5916253554539876",
|
|
8089
|
+
// "realVol": "0",
|
|
8090
|
+
// "theta": "-0.0004202992014012855",
|
|
8091
|
+
// "thetaBS": "-18.52354631567909",
|
|
8092
|
+
// "ts": "1699586421976",
|
|
8093
|
+
// "uly": "BTC-USD",
|
|
8094
|
+
// "vega": "0.0020207455080045846",
|
|
8095
|
+
// "vegaBS": "74.44022302387287",
|
|
8096
|
+
// "volLv": "0.5948549730405797"
|
|
8097
|
+
// },
|
|
8098
|
+
// ],
|
|
8099
|
+
// "msg": ""
|
|
8100
|
+
// }
|
|
8101
|
+
//
|
|
8102
|
+
const data = this.safeList(response, 'data', []);
|
|
8103
|
+
return this.parseAllGreeks(data, symbols);
|
|
8104
|
+
}
|
|
7949
8105
|
parseGreeks(greeks, market = undefined) {
|
|
7950
8106
|
//
|
|
7951
8107
|
// {
|
package/js/src/paradex.d.ts
CHANGED
|
@@ -368,6 +368,16 @@ export default class paradex extends Exchange {
|
|
|
368
368
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
369
369
|
*/
|
|
370
370
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
371
|
+
/**
|
|
372
|
+
* @method
|
|
373
|
+
* @name paradex#fetchAllGreeks
|
|
374
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
375
|
+
* @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
|
|
376
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
377
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
378
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
379
|
+
*/
|
|
380
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
371
381
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
372
382
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
373
383
|
url: string;
|
package/js/src/paradex.js
CHANGED
|
@@ -76,6 +76,7 @@ export default class paradex extends Exchange {
|
|
|
76
76
|
'fetchFundingRateHistory': false,
|
|
77
77
|
'fetchFundingRates': false,
|
|
78
78
|
'fetchGreeks': true,
|
|
79
|
+
'fetchAllGreeks': true,
|
|
79
80
|
'fetchIndexOHLCV': false,
|
|
80
81
|
'fetchIsolatedBorrowRate': false,
|
|
81
82
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -2413,6 +2414,59 @@ export default class paradex extends Exchange {
|
|
|
2413
2414
|
const greeks = this.safeDict(data, 0, {});
|
|
2414
2415
|
return this.parseGreeks(greeks, market);
|
|
2415
2416
|
}
|
|
2417
|
+
/**
|
|
2418
|
+
* @method
|
|
2419
|
+
* @name paradex#fetchAllGreeks
|
|
2420
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
2421
|
+
* @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
|
|
2422
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
2423
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2424
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
2425
|
+
*/
|
|
2426
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
2427
|
+
await this.loadMarkets();
|
|
2428
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
2429
|
+
const request = {
|
|
2430
|
+
'market': 'ALL',
|
|
2431
|
+
};
|
|
2432
|
+
const response = await this.publicGetMarketsSummary(this.extend(request, params));
|
|
2433
|
+
//
|
|
2434
|
+
// {
|
|
2435
|
+
// "results": [
|
|
2436
|
+
// {
|
|
2437
|
+
// "symbol": "BTC-USD-114000-P",
|
|
2438
|
+
// "mark_price": "10835.66892602",
|
|
2439
|
+
// "mark_iv": "0.71781855",
|
|
2440
|
+
// "delta": "-0.98726024",
|
|
2441
|
+
// "greeks": {
|
|
2442
|
+
// "delta": "-0.9872602390817709",
|
|
2443
|
+
// "gamma": "0.000004560958862297231",
|
|
2444
|
+
// "vega": "227.11344863639806",
|
|
2445
|
+
// "rho": "-302.0617972461581",
|
|
2446
|
+
// "vanna": "0.06609830491614832",
|
|
2447
|
+
// "volga": "925.9501532805552"
|
|
2448
|
+
// },
|
|
2449
|
+
// "last_traded_price": "10551.5",
|
|
2450
|
+
// "bid": "10794.9",
|
|
2451
|
+
// "bid_iv": "0.05",
|
|
2452
|
+
// "ask": "10887.3",
|
|
2453
|
+
// "ask_iv": "0.8783283",
|
|
2454
|
+
// "last_iv": "0.05",
|
|
2455
|
+
// "volume_24h": "0",
|
|
2456
|
+
// "total_volume": "195240.72672261014",
|
|
2457
|
+
// "created_at": 1747644009995,
|
|
2458
|
+
// "underlying_price": "103164.79162649",
|
|
2459
|
+
// "open_interest": "0",
|
|
2460
|
+
// "funding_rate": "0.000004464241170536191",
|
|
2461
|
+
// "price_change_rate_24h": "0.074915",
|
|
2462
|
+
// "future_funding_rate": "0.0001"
|
|
2463
|
+
// }
|
|
2464
|
+
// ]
|
|
2465
|
+
// }
|
|
2466
|
+
//
|
|
2467
|
+
const results = this.safeList(response, 'results', []);
|
|
2468
|
+
return this.parseAllGreeks(results, symbols);
|
|
2469
|
+
}
|
|
2416
2470
|
parseGreeks(greeks, market = undefined) {
|
|
2417
2471
|
//
|
|
2418
2472
|
// {
|
package/js/src/phemex.js
CHANGED
|
@@ -2763,10 +2763,10 @@ export default class phemex extends Exchange {
|
|
|
2763
2763
|
let triggerDirection = undefined;
|
|
2764
2764
|
[triggerDirection, params] = this.handleParamString(params, 'triggerDirection');
|
|
2765
2765
|
if (triggerDirection === undefined) {
|
|
2766
|
-
throw new ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either '
|
|
2766
|
+
throw new ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either 'ascending' or 'descending' value");
|
|
2767
2767
|
}
|
|
2768
2768
|
// the flow defined per https://phemex-docs.github.io/#more-order-type-examples
|
|
2769
|
-
if (triggerDirection === 'up') {
|
|
2769
|
+
if (triggerDirection === 'ascending' || triggerDirection === 'up') {
|
|
2770
2770
|
if (side === 'sell') {
|
|
2771
2771
|
request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
|
|
2772
2772
|
}
|
|
@@ -2774,7 +2774,7 @@ export default class phemex extends Exchange {
|
|
|
2774
2774
|
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2775
2775
|
}
|
|
2776
2776
|
}
|
|
2777
|
-
else if (triggerDirection === 'down') {
|
|
2777
|
+
else if (triggerDirection === 'descending' || triggerDirection === 'down') {
|
|
2778
2778
|
if (side === 'sell') {
|
|
2779
2779
|
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2780
2780
|
}
|