ccxt 4.4.85 → 4.4.87
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 +18 -7
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +16 -9
- package/dist/cjs/src/abstract/bittrade.js +9 -0
- package/dist/cjs/src/abstract/modetrade.js +9 -0
- package/dist/cjs/src/ascendex.js +189 -155
- package/dist/cjs/src/base/Exchange.js +10 -8
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitget.js +5 -4
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitteam.js +31 -0
- package/dist/cjs/src/bittrade.js +2049 -0
- package/dist/cjs/src/coinbase.js +2 -6
- package/dist/cjs/src/coinmetro.js +5 -1
- package/dist/cjs/src/deribit.js +4 -5
- package/dist/cjs/src/derive.js +4 -5
- package/dist/cjs/src/ellipx.js +2 -3
- package/dist/cjs/src/gate.js +92 -76
- package/dist/cjs/src/hollaex.js +107 -49
- package/dist/cjs/src/htx.js +30 -52
- package/dist/cjs/src/hyperliquid.js +36 -20
- package/dist/cjs/src/kraken.js +5 -8
- package/dist/cjs/src/mexc.js +2 -2
- package/dist/cjs/src/modetrade.js +2839 -0
- package/dist/cjs/src/ndax.js +25 -24
- package/dist/cjs/src/okcoin.js +12 -31
- package/dist/cjs/src/okx.js +104 -2
- package/dist/cjs/src/okxus.js +53 -0
- package/dist/cjs/src/onetrading.js +9 -6
- package/dist/cjs/src/oxfun.js +42 -114
- package/dist/cjs/src/paradex.js +10 -1
- package/dist/cjs/src/phemex.js +4 -6
- package/dist/cjs/src/poloniex.js +181 -170
- package/dist/cjs/src/pro/binance.js +1 -0
- package/dist/cjs/src/pro/bittrade.js +605 -0
- package/dist/cjs/src/pro/luno.js +6 -5
- package/dist/cjs/src/pro/mexc.js +3 -0
- package/dist/cjs/src/pro/modetrade.js +1334 -0
- package/dist/cjs/src/pro/okxus.js +38 -0
- package/dist/cjs/src/probit.js +18 -51
- package/dist/cjs/src/timex.js +5 -10
- package/dist/cjs/src/vertex.js +3 -4
- package/dist/cjs/src/whitebit.js +41 -11
- package/dist/cjs/src/woo.js +101 -77
- package/dist/cjs/src/woofipro.js +24 -21
- package/dist/cjs/src/xt.js +36 -44
- package/js/ccxt.d.ts +20 -11
- package/js/ccxt.js +14 -8
- package/js/src/abstract/modetrade.d.ts +122 -0
- package/js/src/abstract/myokx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/abstract/okxus.d.ts +352 -0
- package/js/src/abstract/okxus.js +11 -0
- package/js/src/ascendex.d.ts +2 -0
- package/js/src/ascendex.js +189 -155
- package/js/src/base/Exchange.js +10 -8
- package/js/src/bequant.js +1 -1
- package/js/src/binance.js +1 -1
- package/js/src/bitget.js +5 -4
- package/js/src/bitmart.js +1 -1
- package/js/src/bitteam.js +31 -0
- package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
- package/js/src/{huobijp.js → bittrade.js} +35 -35
- package/js/src/coinbase.js +2 -6
- package/js/src/coinmetro.js +5 -1
- package/js/src/deribit.js +4 -5
- package/js/src/derive.js +4 -3
- package/js/src/ellipx.d.ts +1 -1
- package/js/src/ellipx.js +3 -5
- package/js/src/gate.js +92 -76
- package/js/src/hollaex.js +107 -49
- package/js/src/htx.js +30 -52
- package/js/src/hyperliquid.js +36 -20
- package/js/src/kraken.js +5 -8
- package/js/src/mexc.js +2 -2
- package/js/src/modetrade.d.ts +475 -0
- package/js/src/modetrade.js +2840 -0
- package/js/src/ndax.js +25 -24
- package/js/src/okcoin.js +12 -31
- package/js/src/okx.d.ts +24 -1
- package/js/src/okx.js +104 -2
- package/js/src/okxus.d.ts +4 -0
- package/js/src/okxus.js +54 -0
- package/js/src/onetrading.js +9 -6
- package/js/src/oxfun.js +42 -114
- package/js/src/paradex.js +10 -1
- package/js/src/phemex.js +4 -6
- package/js/src/poloniex.d.ts +2 -0
- package/js/src/poloniex.js +181 -170
- package/js/src/pro/binance.js +1 -0
- package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
- package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
- package/js/src/pro/luno.js +6 -5
- package/js/src/pro/mexc.js +3 -0
- package/js/src/pro/modetrade.d.ts +155 -0
- package/js/src/pro/modetrade.js +1335 -0
- package/js/src/pro/okxus.d.ts +4 -0
- package/js/src/pro/okxus.js +39 -0
- package/js/src/probit.js +18 -51
- package/js/src/timex.js +5 -10
- package/js/src/vertex.js +3 -4
- package/js/src/whitebit.js +42 -11
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +101 -77
- package/js/src/woofipro.d.ts +2 -1
- package/js/src/woofipro.js +24 -21
- package/js/src/xt.js +36 -44
- package/package.json +1 -1
- package/js/src/abstract/kuna.d.ts +0 -185
- package/js/src/kuna.d.ts +0 -335
- package/js/src/kuna.js +0 -2006
- /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
- /package/js/src/abstract/{huobijp.js → bittrade.js} +0 -0
- /package/js/src/abstract/{kuna.js → modetrade.js} +0 -0
package/js/src/ndax.js
CHANGED
|
@@ -455,45 +455,45 @@ export default class ndax extends Exchange {
|
|
|
455
455
|
};
|
|
456
456
|
const response = await this.publicGetGetProducts(this.extend(request, params));
|
|
457
457
|
//
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
//
|
|
462
|
-
//
|
|
463
|
-
//
|
|
464
|
-
//
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
//
|
|
468
|
-
//
|
|
469
|
-
//
|
|
470
|
-
//
|
|
471
|
-
//
|
|
458
|
+
// [
|
|
459
|
+
// {
|
|
460
|
+
// "OMSId": "1",
|
|
461
|
+
// "ProductId": "1",
|
|
462
|
+
// "Product": "BTC",
|
|
463
|
+
// "ProductFullName": "Bitcoin",
|
|
464
|
+
// "MasterDataUniqueProductSymbol": "",
|
|
465
|
+
// "ProductType": "CryptoCurrency",
|
|
466
|
+
// "DecimalPlaces": "8",
|
|
467
|
+
// "TickSize": "0.0000000100000000000000000000",
|
|
468
|
+
// "DepositEnabled": true,
|
|
469
|
+
// "WithdrawEnabled": true,
|
|
470
|
+
// "NoFees": false,
|
|
471
|
+
// "IsDisabled": false,
|
|
472
|
+
// "MarginEnabled": false
|
|
473
|
+
// },
|
|
474
|
+
// ...
|
|
472
475
|
//
|
|
473
476
|
const result = {};
|
|
474
477
|
for (let i = 0; i < response.length; i++) {
|
|
475
478
|
const currency = response[i];
|
|
476
479
|
const id = this.safeString(currency, 'ProductId');
|
|
477
|
-
const
|
|
480
|
+
const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
|
|
478
481
|
const ProductType = this.safeString(currency, 'ProductType');
|
|
479
482
|
let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
|
|
480
483
|
if (ProductType === 'Unknown') {
|
|
481
484
|
// such currency is just a blanket entry
|
|
482
485
|
type = 'other';
|
|
483
486
|
}
|
|
484
|
-
|
|
485
|
-
const isDisabled = this.safeValue(currency, 'IsDisabled');
|
|
486
|
-
const active = !isDisabled;
|
|
487
|
-
result[code] = {
|
|
487
|
+
result[code] = this.safeCurrencyStructure({
|
|
488
488
|
'id': id,
|
|
489
|
-
'name':
|
|
489
|
+
'name': this.safeString(currency, 'ProductFullName'),
|
|
490
490
|
'code': code,
|
|
491
491
|
'type': type,
|
|
492
492
|
'precision': this.safeNumber(currency, 'TickSize'),
|
|
493
493
|
'info': currency,
|
|
494
|
-
'active':
|
|
495
|
-
'deposit':
|
|
496
|
-
'withdraw':
|
|
494
|
+
'active': !this.safeBool(currency, 'IsDisabled'),
|
|
495
|
+
'deposit': this.safeBool(currency, 'DepositEnabled'),
|
|
496
|
+
'withdraw': this.safeBool(currency, 'WithdrawEnabled'),
|
|
497
497
|
'fee': undefined,
|
|
498
498
|
'limits': {
|
|
499
499
|
'amount': {
|
|
@@ -506,7 +506,8 @@ export default class ndax extends Exchange {
|
|
|
506
506
|
},
|
|
507
507
|
},
|
|
508
508
|
'networks': {},
|
|
509
|
-
|
|
509
|
+
'margin': this.safeBool(currency, 'MarginEnabled'),
|
|
510
|
+
});
|
|
510
511
|
}
|
|
511
512
|
return result;
|
|
512
513
|
}
|
package/js/src/okcoin.js
CHANGED
|
@@ -829,49 +829,30 @@ export default class okcoin extends Exchange {
|
|
|
829
829
|
}
|
|
830
830
|
else {
|
|
831
831
|
const response = await this.privateGetAssetCurrencies(params);
|
|
832
|
-
const data = this.
|
|
832
|
+
const data = this.safeList(response, 'data', []);
|
|
833
833
|
const result = {};
|
|
834
834
|
const dataByCurrencyId = this.groupBy(data, 'ccy');
|
|
835
835
|
const currencyIds = Object.keys(dataByCurrencyId);
|
|
836
836
|
for (let i = 0; i < currencyIds.length; i++) {
|
|
837
837
|
const currencyId = currencyIds[i];
|
|
838
|
-
const
|
|
839
|
-
const code = currency['code'];
|
|
838
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
840
839
|
const chains = dataByCurrencyId[currencyId];
|
|
841
840
|
const networks = {};
|
|
842
|
-
let currencyActive = false;
|
|
843
|
-
let depositEnabled = false;
|
|
844
|
-
let withdrawEnabled = false;
|
|
845
|
-
let maxPrecision = undefined;
|
|
846
841
|
for (let j = 0; j < chains.length; j++) {
|
|
847
842
|
const chain = chains[j];
|
|
848
|
-
const canDeposit = this.safeValue(chain, 'canDep');
|
|
849
|
-
depositEnabled = (canDeposit) ? canDeposit : depositEnabled;
|
|
850
|
-
const canWithdraw = this.safeValue(chain, 'canWd');
|
|
851
|
-
withdrawEnabled = (canWithdraw) ? canWithdraw : withdrawEnabled;
|
|
852
|
-
const canInternal = this.safeValue(chain, 'canInternal');
|
|
853
|
-
const active = (canDeposit && canWithdraw && canInternal) ? true : false;
|
|
854
|
-
currencyActive = (active) ? active : currencyActive;
|
|
855
843
|
const networkId = this.safeString(chain, 'chain');
|
|
856
844
|
if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
|
|
857
845
|
const parts = networkId.split('-');
|
|
858
846
|
const chainPart = this.safeString(parts, 1, networkId);
|
|
859
847
|
const networkCode = this.networkIdToCode(chainPart);
|
|
860
|
-
const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
|
|
861
|
-
if (maxPrecision === undefined) {
|
|
862
|
-
maxPrecision = precision;
|
|
863
|
-
}
|
|
864
|
-
else {
|
|
865
|
-
maxPrecision = Precise.stringMin(maxPrecision, precision);
|
|
866
|
-
}
|
|
867
848
|
networks[networkCode] = {
|
|
868
849
|
'id': networkId,
|
|
869
850
|
'network': networkCode,
|
|
870
|
-
'active':
|
|
871
|
-
'deposit':
|
|
872
|
-
'withdraw':
|
|
851
|
+
'active': undefined,
|
|
852
|
+
'deposit': this.safeBool(chain, 'canDep'),
|
|
853
|
+
'withdraw': this.safeBool(chain, 'canWd'),
|
|
873
854
|
'fee': this.safeNumber(chain, 'minFee'),
|
|
874
|
-
'precision': this.parseNumber(
|
|
855
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
|
|
875
856
|
'limits': {
|
|
876
857
|
'withdraw': {
|
|
877
858
|
'min': this.safeNumber(chain, 'minWd'),
|
|
@@ -883,16 +864,16 @@ export default class okcoin extends Exchange {
|
|
|
883
864
|
}
|
|
884
865
|
}
|
|
885
866
|
const firstChain = this.safeValue(chains, 0);
|
|
886
|
-
result[code] = {
|
|
867
|
+
result[code] = this.safeCurrencyStructure({
|
|
887
868
|
'info': chains,
|
|
888
869
|
'code': code,
|
|
889
870
|
'id': currencyId,
|
|
890
871
|
'name': this.safeString(firstChain, 'name'),
|
|
891
|
-
'active':
|
|
892
|
-
'deposit':
|
|
893
|
-
'withdraw':
|
|
872
|
+
'active': undefined,
|
|
873
|
+
'deposit': undefined,
|
|
874
|
+
'withdraw': undefined,
|
|
894
875
|
'fee': undefined,
|
|
895
|
-
'precision':
|
|
876
|
+
'precision': undefined,
|
|
896
877
|
'limits': {
|
|
897
878
|
'amount': {
|
|
898
879
|
'min': undefined,
|
|
@@ -900,7 +881,7 @@ export default class okcoin extends Exchange {
|
|
|
900
881
|
},
|
|
901
882
|
},
|
|
902
883
|
'networks': networks,
|
|
903
|
-
};
|
|
884
|
+
});
|
|
904
885
|
}
|
|
905
886
|
return result;
|
|
906
887
|
}
|
package/js/src/okx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/okx.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry, FundingRate, DepositAddress, LongShortRatio, BorrowInterest } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest, OpenInterests } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class okx
|
|
5
5
|
* @augments Exchange
|
|
@@ -644,6 +644,16 @@ export default class okx extends Exchange {
|
|
|
644
644
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
645
645
|
*/
|
|
646
646
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
647
|
+
/**
|
|
648
|
+
* @method
|
|
649
|
+
* @name okx#fetchFundingRates
|
|
650
|
+
* @description fetches the current funding rates for multiple symbols
|
|
651
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
652
|
+
* @param {string[]} symbols unified market symbols
|
|
653
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
654
|
+
* @returns {object} a dictionary of [funding rates structure]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}
|
|
655
|
+
*/
|
|
656
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
647
657
|
/**
|
|
648
658
|
* @method
|
|
649
659
|
* @name okx#fetchFundingHistory
|
|
@@ -868,6 +878,19 @@ export default class okx extends Exchange {
|
|
|
868
878
|
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
869
879
|
*/
|
|
870
880
|
fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
|
|
881
|
+
/**
|
|
882
|
+
* @method
|
|
883
|
+
* @name okx#fetchOpenInterests
|
|
884
|
+
* @description Retrieves the open interests of some currencies
|
|
885
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
886
|
+
* @param {string[]} symbols Unified CCXT market symbols
|
|
887
|
+
* @param {object} [params] exchange specific parameters
|
|
888
|
+
* @param {string} params.instType Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP'
|
|
889
|
+
* @param {string} params.uly Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
|
|
890
|
+
* @param {string} params.instFamily Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
|
|
891
|
+
* @returns {object} an dictionary of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
892
|
+
*/
|
|
893
|
+
fetchOpenInterests(symbols?: Strings, params?: {}): Promise<OpenInterests>;
|
|
871
894
|
/**
|
|
872
895
|
* @method
|
|
873
896
|
* @name okx#fetchOpenInterestHistory
|
package/js/src/okx.js
CHANGED
|
@@ -86,7 +86,7 @@ export default class okx extends Exchange {
|
|
|
86
86
|
'fetchFundingIntervals': false,
|
|
87
87
|
'fetchFundingRate': true,
|
|
88
88
|
'fetchFundingRateHistory': true,
|
|
89
|
-
'fetchFundingRates':
|
|
89
|
+
'fetchFundingRates': true,
|
|
90
90
|
'fetchGreeks': true,
|
|
91
91
|
'fetchIndexOHLCV': true,
|
|
92
92
|
'fetchIsolatedBorrowRate': false,
|
|
@@ -109,6 +109,7 @@ export default class okx extends Exchange {
|
|
|
109
109
|
'fetchOHLCV': true,
|
|
110
110
|
'fetchOpenInterest': true,
|
|
111
111
|
'fetchOpenInterestHistory': true,
|
|
112
|
+
'fetchOpenInterests': true,
|
|
112
113
|
'fetchOpenOrder': undefined,
|
|
113
114
|
'fetchOpenOrders': true,
|
|
114
115
|
'fetchOption': true,
|
|
@@ -366,6 +367,7 @@ export default class okx extends Exchange {
|
|
|
366
367
|
'account/spot-manual-borrow-repay': 10,
|
|
367
368
|
'account/set-auto-repay': 4,
|
|
368
369
|
'account/spot-borrow-repay-history': 4,
|
|
370
|
+
'account/move-positions-history': 10,
|
|
369
371
|
// subaccount
|
|
370
372
|
'users/subaccount/list': 10,
|
|
371
373
|
'account/subaccount/balances': 10 / 3,
|
|
@@ -503,6 +505,7 @@ export default class okx extends Exchange {
|
|
|
503
505
|
'account/fixed-loan/manual-reborrow': 5,
|
|
504
506
|
'account/fixed-loan/repay-borrowing-order': 5,
|
|
505
507
|
'account/bills-history-archive': 72000,
|
|
508
|
+
'account/move-positions': 10,
|
|
506
509
|
// subaccount
|
|
507
510
|
'users/subaccount/modify-apikey': 10,
|
|
508
511
|
'asset/subaccount/transfer': 10,
|
|
@@ -969,6 +972,13 @@ export default class okx extends Exchange {
|
|
|
969
972
|
'70010': BadRequest,
|
|
970
973
|
'70013': BadRequest,
|
|
971
974
|
'70016': BadRequest,
|
|
975
|
+
'70060': BadRequest,
|
|
976
|
+
'70061': BadRequest,
|
|
977
|
+
'70062': BadRequest,
|
|
978
|
+
'70064': BadRequest,
|
|
979
|
+
'70065': BadRequest,
|
|
980
|
+
'70066': BadRequest,
|
|
981
|
+
'70067': BadRequest,
|
|
972
982
|
'1009': BadRequest,
|
|
973
983
|
'4001': AuthenticationError,
|
|
974
984
|
'4002': BadRequest,
|
|
@@ -6291,7 +6301,7 @@ export default class okx extends Exchange {
|
|
|
6291
6301
|
const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
|
|
6292
6302
|
const fundingTime = this.safeInteger(contract, 'fundingTime');
|
|
6293
6303
|
const fundingTimeString = this.safeString(contract, 'fundingTime');
|
|
6294
|
-
const nextFundingTimeString = this.safeString(contract, '
|
|
6304
|
+
const nextFundingTimeString = this.safeString(contract, 'nextFundingTime');
|
|
6295
6305
|
const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
|
|
6296
6306
|
// https://www.okx.com/support/hc/en-us/articles/360053909272-Ⅸ-Introduction-to-perpetual-swap-funding-fee
|
|
6297
6307
|
// > The current interest is 0.
|
|
@@ -6377,6 +6387,39 @@ export default class okx extends Exchange {
|
|
|
6377
6387
|
const entry = this.safeDict(data, 0, {});
|
|
6378
6388
|
return this.parseFundingRate(entry, market);
|
|
6379
6389
|
}
|
|
6390
|
+
/**
|
|
6391
|
+
* @method
|
|
6392
|
+
* @name okx#fetchFundingRates
|
|
6393
|
+
* @description fetches the current funding rates for multiple symbols
|
|
6394
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6395
|
+
* @param {string[]} symbols unified market symbols
|
|
6396
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6397
|
+
* @returns {object} a dictionary of [funding rates structure]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}
|
|
6398
|
+
*/
|
|
6399
|
+
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
6400
|
+
await this.loadMarkets();
|
|
6401
|
+
symbols = this.marketSymbols(symbols, 'swap', true);
|
|
6402
|
+
const request = { 'instId': 'ANY' };
|
|
6403
|
+
const response = await this.publicGetPublicFundingRate(this.extend(request, params));
|
|
6404
|
+
//
|
|
6405
|
+
// {
|
|
6406
|
+
// "code": "0",
|
|
6407
|
+
// "data": [
|
|
6408
|
+
// {
|
|
6409
|
+
// "fundingRate": "0.00027815",
|
|
6410
|
+
// "fundingTime": "1634256000000",
|
|
6411
|
+
// "instId": "BTC-USD-SWAP",
|
|
6412
|
+
// "instType": "SWAP",
|
|
6413
|
+
// "nextFundingRate": "0.00017",
|
|
6414
|
+
// "nextFundingTime": "1634284800000"
|
|
6415
|
+
// }
|
|
6416
|
+
// ],
|
|
6417
|
+
// "msg": ""
|
|
6418
|
+
// }
|
|
6419
|
+
//
|
|
6420
|
+
const data = this.safeList(response, 'data', []);
|
|
6421
|
+
return this.parseFundingRates(data, symbols);
|
|
6422
|
+
}
|
|
6380
6423
|
/**
|
|
6381
6424
|
* @method
|
|
6382
6425
|
* @name okx#fetchFundingHistory
|
|
@@ -7381,6 +7424,65 @@ export default class okx extends Exchange {
|
|
|
7381
7424
|
const data = this.safeList(response, 'data', []);
|
|
7382
7425
|
return this.parseOpenInterest(data[0], market);
|
|
7383
7426
|
}
|
|
7427
|
+
/**
|
|
7428
|
+
* @method
|
|
7429
|
+
* @name okx#fetchOpenInterests
|
|
7430
|
+
* @description Retrieves the open interests of some currencies
|
|
7431
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
7432
|
+
* @param {string[]} symbols Unified CCXT market symbols
|
|
7433
|
+
* @param {object} [params] exchange specific parameters
|
|
7434
|
+
* @param {string} params.instType Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP'
|
|
7435
|
+
* @param {string} params.uly Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
|
|
7436
|
+
* @param {string} params.instFamily Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
|
|
7437
|
+
* @returns {object} an dictionary of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7438
|
+
*/
|
|
7439
|
+
async fetchOpenInterests(symbols = undefined, params = {}) {
|
|
7440
|
+
await this.loadMarkets();
|
|
7441
|
+
symbols = this.marketSymbols(symbols, undefined, true, true);
|
|
7442
|
+
let market = undefined;
|
|
7443
|
+
if (symbols !== undefined) {
|
|
7444
|
+
market = this.market(symbols[0]);
|
|
7445
|
+
}
|
|
7446
|
+
let marketType = undefined;
|
|
7447
|
+
[marketType, params] = this.handleSubTypeAndParams('fetchOpenInterests', market, params, 'swap');
|
|
7448
|
+
let instType = 'SWAP';
|
|
7449
|
+
if (marketType === 'future') {
|
|
7450
|
+
instType = 'FUTURES';
|
|
7451
|
+
}
|
|
7452
|
+
else if (instType === 'option') {
|
|
7453
|
+
instType = 'OPTION';
|
|
7454
|
+
}
|
|
7455
|
+
const request = { 'instType': instType };
|
|
7456
|
+
const uly = this.safeString(params, 'uly');
|
|
7457
|
+
if (uly !== undefined) {
|
|
7458
|
+
request['uly'] = uly;
|
|
7459
|
+
}
|
|
7460
|
+
const instFamily = this.safeString(params, 'instFamily');
|
|
7461
|
+
if (instFamily !== undefined) {
|
|
7462
|
+
request['instFamily'] = instFamily;
|
|
7463
|
+
}
|
|
7464
|
+
if (instType === 'OPTION' && uly === undefined && instFamily === undefined) {
|
|
7465
|
+
throw new BadRequest(this.id + ' fetchOpenInterests() requires either uly or instFamily parameter for OPTION markets');
|
|
7466
|
+
}
|
|
7467
|
+
const response = await this.publicGetPublicOpenInterest(this.extend(request, params));
|
|
7468
|
+
//
|
|
7469
|
+
// {
|
|
7470
|
+
// "code": "0",
|
|
7471
|
+
// "data": [
|
|
7472
|
+
// {
|
|
7473
|
+
// "instId": "BTC-USDT-SWAP",
|
|
7474
|
+
// "instType": "SWAP",
|
|
7475
|
+
// "oi": "2125419",
|
|
7476
|
+
// "oiCcy": "21254.19",
|
|
7477
|
+
// "ts": "1664005108969"
|
|
7478
|
+
// }
|
|
7479
|
+
// ],
|
|
7480
|
+
// "msg": ""
|
|
7481
|
+
// }
|
|
7482
|
+
//
|
|
7483
|
+
const data = this.safeList(response, 'data', []);
|
|
7484
|
+
return this.parseOpenInterests(data, symbols);
|
|
7485
|
+
}
|
|
7384
7486
|
/**
|
|
7385
7487
|
* @method
|
|
7386
7488
|
* @name okx#fetchOpenInterestHistory
|
package/js/src/okxus.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
import okx from './okx.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
export default class okxus extends okx {
|
|
11
|
+
describe() {
|
|
12
|
+
return this.deepExtend(super.describe(), {
|
|
13
|
+
'id': 'okxus',
|
|
14
|
+
'name': 'OKX (US)',
|
|
15
|
+
'certified': false,
|
|
16
|
+
'pro': true,
|
|
17
|
+
'hostname': 'us.okx.com',
|
|
18
|
+
'urls': {
|
|
19
|
+
'logo': 'https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg',
|
|
20
|
+
'api': {
|
|
21
|
+
'rest': 'https://{hostname}',
|
|
22
|
+
},
|
|
23
|
+
'www': 'https://app.okx.com',
|
|
24
|
+
'doc': 'https://app.okx.com/docs-v5/en/#overview',
|
|
25
|
+
'fees': 'https://app.okx.com/pages/products/fees.html',
|
|
26
|
+
'referral': {
|
|
27
|
+
'url': 'https://www.app.okx.com/join/CCXT2023',
|
|
28
|
+
'discount': 0.2,
|
|
29
|
+
},
|
|
30
|
+
'test': {
|
|
31
|
+
'rest': 'https://{hostname}',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
'has': {
|
|
35
|
+
'CORS': undefined,
|
|
36
|
+
'spot': true,
|
|
37
|
+
'margin': undefined,
|
|
38
|
+
'swap': false,
|
|
39
|
+
'future': false,
|
|
40
|
+
'option': false,
|
|
41
|
+
},
|
|
42
|
+
'features': {
|
|
43
|
+
'swap': {
|
|
44
|
+
'linear': undefined,
|
|
45
|
+
'inverse': undefined,
|
|
46
|
+
},
|
|
47
|
+
'future': {
|
|
48
|
+
'linear': undefined,
|
|
49
|
+
'inverse': undefined,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
package/js/src/onetrading.js
CHANGED
|
@@ -395,9 +395,12 @@ export default class onetrading extends Exchange {
|
|
|
395
395
|
//
|
|
396
396
|
// [
|
|
397
397
|
// {
|
|
398
|
-
// "code":"
|
|
399
|
-
// "precision":
|
|
400
|
-
//
|
|
398
|
+
// "code": "USDT",
|
|
399
|
+
// "precision": 6,
|
|
400
|
+
// "unified_cryptoasset_id": 825,
|
|
401
|
+
// "name": "Tether USDt",
|
|
402
|
+
// "collateral_percentage": 0
|
|
403
|
+
// },
|
|
401
404
|
// ]
|
|
402
405
|
//
|
|
403
406
|
const result = {};
|
|
@@ -405,10 +408,10 @@ export default class onetrading extends Exchange {
|
|
|
405
408
|
const currency = response[i];
|
|
406
409
|
const id = this.safeString(currency, 'code');
|
|
407
410
|
const code = this.safeCurrencyCode(id);
|
|
408
|
-
result[code] = {
|
|
411
|
+
result[code] = this.safeCurrencyStructure({
|
|
409
412
|
'id': id,
|
|
410
413
|
'code': code,
|
|
411
|
-
'name':
|
|
414
|
+
'name': this.safeString(currency, 'name'),
|
|
412
415
|
'info': currency,
|
|
413
416
|
'active': undefined,
|
|
414
417
|
'fee': undefined,
|
|
@@ -420,7 +423,7 @@ export default class onetrading extends Exchange {
|
|
|
420
423
|
'withdraw': { 'min': undefined, 'max': undefined },
|
|
421
424
|
},
|
|
422
425
|
'networks': {},
|
|
423
|
-
};
|
|
426
|
+
});
|
|
424
427
|
}
|
|
425
428
|
return result;
|
|
426
429
|
}
|