ccxt 4.4.86 → 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 +17 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +11 -1
- package/dist/cjs/src/abstract/modetrade.js +9 -0
- package/dist/cjs/src/base/Exchange.js +10 -8
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitteam.js +31 -0
- package/dist/cjs/src/coinmetro.js +5 -1
- 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/htx.js +10 -8
- package/dist/cjs/src/hyperliquid.js +32 -16
- package/dist/cjs/src/kraken.js +5 -8
- package/dist/cjs/src/modetrade.js +2839 -0
- package/dist/cjs/src/okx.js +95 -2
- package/dist/cjs/src/okxus.js +53 -0
- package/dist/cjs/src/paradex.js +6 -1
- package/dist/cjs/src/phemex.js +4 -6
- package/dist/cjs/src/poloniex.js +181 -170
- 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 +14 -2
- package/js/ccxt.js +10 -2
- package/js/src/abstract/modetrade.d.ts +122 -0
- package/js/src/abstract/modetrade.js +11 -0
- package/js/src/abstract/okxus.d.ts +352 -0
- package/js/src/abstract/okxus.js +11 -0
- package/js/src/base/Exchange.js +10 -8
- package/js/src/binance.js +1 -1
- package/js/src/bitteam.js +31 -0
- package/js/src/coinmetro.js +5 -1
- 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/htx.js +10 -8
- package/js/src/hyperliquid.js +32 -16
- package/js/src/kraken.js +5 -8
- package/js/src/modetrade.d.ts +475 -0
- package/js/src/modetrade.js +2840 -0
- package/js/src/okx.d.ts +24 -1
- package/js/src/okx.js +95 -2
- package/js/src/okxus.d.ts +4 -0
- package/js/src/okxus.js +54 -0
- package/js/src/paradex.js +6 -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/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/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,
|
|
@@ -6300,7 +6301,7 @@ export default class okx extends Exchange {
|
|
|
6300
6301
|
const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
|
|
6301
6302
|
const fundingTime = this.safeInteger(contract, 'fundingTime');
|
|
6302
6303
|
const fundingTimeString = this.safeString(contract, 'fundingTime');
|
|
6303
|
-
const nextFundingTimeString = this.safeString(contract, '
|
|
6304
|
+
const nextFundingTimeString = this.safeString(contract, 'nextFundingTime');
|
|
6304
6305
|
const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
|
|
6305
6306
|
// https://www.okx.com/support/hc/en-us/articles/360053909272-Ⅸ-Introduction-to-perpetual-swap-funding-fee
|
|
6306
6307
|
// > The current interest is 0.
|
|
@@ -6386,6 +6387,39 @@ export default class okx extends Exchange {
|
|
|
6386
6387
|
const entry = this.safeDict(data, 0, {});
|
|
6387
6388
|
return this.parseFundingRate(entry, market);
|
|
6388
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
|
+
}
|
|
6389
6423
|
/**
|
|
6390
6424
|
* @method
|
|
6391
6425
|
* @name okx#fetchFundingHistory
|
|
@@ -7390,6 +7424,65 @@ export default class okx extends Exchange {
|
|
|
7390
7424
|
const data = this.safeList(response, 'data', []);
|
|
7391
7425
|
return this.parseOpenInterest(data[0], market);
|
|
7392
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
|
+
}
|
|
7393
7486
|
/**
|
|
7394
7487
|
* @method
|
|
7395
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/paradex.js
CHANGED
|
@@ -1263,7 +1263,12 @@ export default class paradex extends Exchange {
|
|
|
1263
1263
|
const cancelReason = this.safeString(order, 'cancel_reason');
|
|
1264
1264
|
let status = this.safeString(order, 'status');
|
|
1265
1265
|
if (cancelReason !== undefined) {
|
|
1266
|
-
|
|
1266
|
+
if (cancelReason === 'NOT_ENOUGH_MARGIN') {
|
|
1267
|
+
status = 'rejected';
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
status = 'canceled';
|
|
1271
|
+
}
|
|
1267
1272
|
}
|
|
1268
1273
|
const side = this.safeStringLower(order, 'side');
|
|
1269
1274
|
const average = this.omitZero(this.safeString(order, 'avg_fill_price'));
|
package/js/src/phemex.js
CHANGED
|
@@ -1128,9 +1128,7 @@ export default class phemex extends Exchange {
|
|
|
1128
1128
|
for (let i = 0; i < currencies.length; i++) {
|
|
1129
1129
|
const currency = currencies[i];
|
|
1130
1130
|
const id = this.safeString(currency, 'currency');
|
|
1131
|
-
const name = this.safeString(currency, 'name');
|
|
1132
1131
|
const code = this.safeCurrencyCode(id);
|
|
1133
|
-
const status = this.safeString(currency, 'status');
|
|
1134
1132
|
const valueScaleString = this.safeString(currency, 'valueScale');
|
|
1135
1133
|
const valueScale = parseInt(valueScaleString);
|
|
1136
1134
|
const minValueEv = this.safeString(currency, 'minValueEv');
|
|
@@ -1144,12 +1142,12 @@ export default class phemex extends Exchange {
|
|
|
1144
1142
|
minAmount = this.parseNumber(Precise.stringMul(minValueEv, precisionString));
|
|
1145
1143
|
maxAmount = this.parseNumber(Precise.stringMul(maxValueEv, precisionString));
|
|
1146
1144
|
}
|
|
1147
|
-
result[code] = {
|
|
1145
|
+
result[code] = this.safeCurrencyStructure({
|
|
1148
1146
|
'id': id,
|
|
1149
1147
|
'info': currency,
|
|
1150
1148
|
'code': code,
|
|
1151
|
-
'name': name,
|
|
1152
|
-
'active': status === 'Listed',
|
|
1149
|
+
'name': this.safeString(currency, 'name'),
|
|
1150
|
+
'active': this.safeString(currency, 'status') === 'Listed',
|
|
1153
1151
|
'deposit': undefined,
|
|
1154
1152
|
'withdraw': undefined,
|
|
1155
1153
|
'fee': undefined,
|
|
@@ -1167,7 +1165,7 @@ export default class phemex extends Exchange {
|
|
|
1167
1165
|
'valueScale': valueScale,
|
|
1168
1166
|
'networks': undefined,
|
|
1169
1167
|
'type': 'crypto',
|
|
1170
|
-
};
|
|
1168
|
+
});
|
|
1171
1169
|
}
|
|
1172
1170
|
return result;
|
|
1173
1171
|
}
|
package/js/src/poloniex.d.ts
CHANGED
|
@@ -269,6 +269,8 @@ export default class poloniex extends Exchange {
|
|
|
269
269
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
270
270
|
*/
|
|
271
271
|
fetchDepositAddress(code: string, params?: {}): Promise<DepositAddress>;
|
|
272
|
+
prepareRequestForDepositAddress(code: string, params?: Dict): any;
|
|
273
|
+
parseDepositAddressSpecial(response: any, currency: any, networkEntry: any): DepositAddress;
|
|
272
274
|
/**
|
|
273
275
|
* @method
|
|
274
276
|
* @name poloniex#transfer
|