ccxt 4.4.9 → 4.4.10
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 +131 -131
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +2 -1
- package/dist/cjs/src/binance.js +4 -8
- package/dist/cjs/src/bingx.js +19 -20
- package/dist/cjs/src/bitfinex2.js +5 -16
- package/dist/cjs/src/bitget.js +5 -4
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bitmex.js +4 -3
- package/dist/cjs/src/blofin.js +4 -13
- package/dist/cjs/src/bybit.js +16 -14
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/delta.js +2 -1
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/gate.js +30 -9
- package/dist/cjs/src/hashkey.js +2 -2
- package/dist/cjs/src/hitbtc.js +2 -1
- package/dist/cjs/src/htx.js +19 -2
- package/dist/cjs/src/hyperliquid.js +6 -1
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoinfutures.js +11 -0
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/oceanex.js +83 -3
- package/dist/cjs/src/okx.js +14 -0
- package/dist/cjs/src/oxfun.js +4 -4
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +11 -0
- package/dist/cjs/src/pro/deribit.js +43 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/vertex.js +2 -1
- package/dist/cjs/src/whitebit.js +10 -9
- package/dist/cjs/src/woo.js +42 -17
- package/dist/cjs/src/woofipro.js +15 -2
- package/dist/cjs/src/xt.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/oceanex.d.ts +5 -0
- package/js/src/ascendex.d.ts +3 -21
- package/js/src/ascendex.js +2 -1
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/types.d.ts +1 -0
- package/js/src/binance.d.ts +4 -40
- package/js/src/binance.js +4 -8
- package/js/src/bingx.d.ts +4 -40
- package/js/src/bingx.js +19 -20
- package/js/src/bitfinex2.d.ts +3 -22
- package/js/src/bitfinex2.js +5 -16
- package/js/src/bitget.d.ts +3 -39
- package/js/src/bitget.js +5 -4
- package/js/src/bitmart.d.ts +3 -39
- package/js/src/bitmart.js +1 -0
- package/js/src/bitmex.d.ts +3 -21
- package/js/src/bitmex.js +4 -3
- package/js/src/blofin.d.ts +3 -39
- package/js/src/blofin.js +4 -13
- package/js/src/bybit.d.ts +3 -21
- package/js/src/bybit.js +16 -14
- package/js/src/coinex.d.ts +5 -40
- package/js/src/coinex.js +15 -1
- package/js/src/delta.d.ts +4 -40
- package/js/src/delta.js +2 -1
- package/js/src/deribit.d.ts +3 -39
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +4 -21
- package/js/src/digifinex.js +15 -1
- package/js/src/gate.d.ts +6 -41
- package/js/src/gate.js +30 -9
- package/js/src/hashkey.d.ts +4 -40
- package/js/src/hashkey.js +2 -2
- package/js/src/hitbtc.d.ts +4 -40
- package/js/src/hitbtc.js +2 -1
- package/js/src/htx.d.ts +5 -40
- package/js/src/htx.js +19 -2
- package/js/src/hyperliquid.js +6 -1
- package/js/src/krakenfutures.d.ts +3 -21
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoinfutures.d.ts +3 -20
- package/js/src/kucoinfutures.js +11 -0
- package/js/src/mexc.d.ts +3 -39
- package/js/src/mexc.js +1 -0
- package/js/src/oceanex.d.ts +9 -1
- package/js/src/oceanex.js +83 -3
- package/js/src/okx.d.ts +4 -39
- package/js/src/okx.js +14 -0
- package/js/src/oxfun.d.ts +3 -21
- package/js/src/oxfun.js +4 -4
- package/js/src/phemex.d.ts +3 -39
- package/js/src/phemex.js +1 -0
- package/js/src/poloniexfutures.d.ts +3 -20
- package/js/src/poloniexfutures.js +11 -0
- package/js/src/pro/deribit.d.ts +2 -1
- package/js/src/pro/deribit.js +43 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/vertex.d.ts +4 -40
- package/js/src/vertex.js +2 -1
- package/js/src/whitebit.d.ts +4 -21
- package/js/src/whitebit.js +10 -9
- package/js/src/woo.d.ts +4 -40
- package/js/src/woo.js +42 -17
- package/js/src/woofipro.d.ts +5 -40
- package/js/src/woofipro.js +15 -2
- package/js/src/xt.d.ts +3 -39
- package/js/src/xt.js +2 -0
- package/package.json +1 -1
package/dist/cjs/src/hashkey.js
CHANGED
|
@@ -3739,7 +3739,7 @@ class hashkey extends hashkey$1 {
|
|
|
3739
3739
|
* @see https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate
|
|
3740
3740
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
3741
3741
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3742
|
-
* @returns {object} a
|
|
3742
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
3743
3743
|
*/
|
|
3744
3744
|
await this.loadMarkets();
|
|
3745
3745
|
symbols = this.marketSymbols(symbols);
|
|
@@ -3758,7 +3758,6 @@ class hashkey extends hashkey$1 {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
parseFundingRate(contract, market = undefined) {
|
|
3760
3760
|
//
|
|
3761
|
-
// fetchFundingRates
|
|
3762
3761
|
// {
|
|
3763
3762
|
// "symbol": "ETHUSDT-PERPETUAL",
|
|
3764
3763
|
// "rate": "0.0001",
|
|
@@ -3787,6 +3786,7 @@ class hashkey extends hashkey$1 {
|
|
|
3787
3786
|
'previousFundingRate': undefined,
|
|
3788
3787
|
'previousFundingTimestamp': undefined,
|
|
3789
3788
|
'previousFundingDatetime': undefined,
|
|
3789
|
+
'interval': undefined,
|
|
3790
3790
|
};
|
|
3791
3791
|
}
|
|
3792
3792
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/hitbtc.js
CHANGED
|
@@ -2738,7 +2738,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
2738
2738
|
* @see https://api.hitbtc.com/#futures-info
|
|
2739
2739
|
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
2740
2740
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2741
|
-
* @returns {object}
|
|
2741
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2742
2742
|
*/
|
|
2743
2743
|
await this.loadMarkets();
|
|
2744
2744
|
let market = undefined;
|
|
@@ -3234,6 +3234,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
3234
3234
|
'previousFundingRate': undefined,
|
|
3235
3235
|
'previousFundingTimestamp': undefined,
|
|
3236
3236
|
'previousFundingDatetime': undefined,
|
|
3237
|
+
'interval': undefined,
|
|
3237
3238
|
};
|
|
3238
3239
|
}
|
|
3239
3240
|
async modifyMarginHelper(symbol, amount, type, params = {}) {
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -184,7 +184,7 @@ class htx extends htx$1 {
|
|
|
184
184
|
},
|
|
185
185
|
'www': 'https://www.huobi.com',
|
|
186
186
|
'referral': {
|
|
187
|
-
'url': 'https://www.
|
|
187
|
+
'url': 'https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223',
|
|
188
188
|
'discount': 0.15,
|
|
189
189
|
},
|
|
190
190
|
'doc': [
|
|
@@ -6997,6 +6997,9 @@ class htx extends htx$1 {
|
|
|
6997
6997
|
const nextFundingRate = this.safeNumber(contract, 'estimated_rate');
|
|
6998
6998
|
const fundingTimestamp = this.safeInteger(contract, 'funding_time');
|
|
6999
6999
|
const nextFundingTimestamp = this.safeInteger(contract, 'next_funding_time');
|
|
7000
|
+
const fundingTimeString = this.safeString(contract, 'funding_time');
|
|
7001
|
+
const nextFundingTimeString = this.safeString(contract, 'next_funding_time');
|
|
7002
|
+
const millisecondsInterval = Precise["default"].stringSub(nextFundingTimeString, fundingTimeString);
|
|
7000
7003
|
const marketId = this.safeString(contract, 'contract_code');
|
|
7001
7004
|
const symbol = this.safeSymbol(marketId, market);
|
|
7002
7005
|
return {
|
|
@@ -7017,8 +7020,19 @@ class htx extends htx$1 {
|
|
|
7017
7020
|
'previousFundingRate': undefined,
|
|
7018
7021
|
'previousFundingTimestamp': undefined,
|
|
7019
7022
|
'previousFundingDatetime': undefined,
|
|
7023
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
7020
7024
|
};
|
|
7021
7025
|
}
|
|
7026
|
+
parseFundingInterval(interval) {
|
|
7027
|
+
const intervals = {
|
|
7028
|
+
'3600000': '1h',
|
|
7029
|
+
'14400000': '4h',
|
|
7030
|
+
'28800000': '8h',
|
|
7031
|
+
'57600000': '16h',
|
|
7032
|
+
'86400000': '24h',
|
|
7033
|
+
};
|
|
7034
|
+
return this.safeString(intervals, interval, interval);
|
|
7035
|
+
}
|
|
7022
7036
|
async fetchFundingRate(symbol, params = {}) {
|
|
7023
7037
|
/**
|
|
7024
7038
|
* @method
|
|
@@ -7068,7 +7082,7 @@ class htx extends htx$1 {
|
|
|
7068
7082
|
* @description fetch the funding rate for multiple markets
|
|
7069
7083
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7070
7084
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7071
|
-
* @returns {object} a
|
|
7085
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
7072
7086
|
*/
|
|
7073
7087
|
await this.loadMarkets();
|
|
7074
7088
|
symbols = this.marketSymbols(symbols);
|
|
@@ -8835,6 +8849,9 @@ class htx extends htx$1 {
|
|
|
8835
8849
|
* @method
|
|
8836
8850
|
* @name htx#fetchSettlementHistory
|
|
8837
8851
|
* @description Fetches historical settlement records
|
|
8852
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
|
8853
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
|
8854
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-settlement-records-of-the-platform-interface
|
|
8838
8855
|
* @param {string} symbol unified symbol of the market to fetch the settlement history for
|
|
8839
8856
|
* @param {int} [since] timestamp in ms, value range = current time - 90 days,default = current time - 90 days
|
|
8840
8857
|
* @param {int} [limit] page items, default 20, shall not exceed 50
|
|
@@ -2035,6 +2035,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2035
2035
|
// "crossed": true,
|
|
2036
2036
|
// "dir": "Close Long",
|
|
2037
2037
|
// "fee": "0.050062",
|
|
2038
|
+
// "feeToken": "USDC",
|
|
2038
2039
|
// "hash": "0x09d77c96791e98b5775a04092584ab010d009445119c71e4005c0d634ea322bc",
|
|
2039
2040
|
// "liquidationMarkPx": null,
|
|
2040
2041
|
// "oid": 3929354691,
|
|
@@ -2094,7 +2095,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2094
2095
|
'price': price,
|
|
2095
2096
|
'amount': amount,
|
|
2096
2097
|
'cost': undefined,
|
|
2097
|
-
'fee': {
|
|
2098
|
+
'fee': {
|
|
2099
|
+
'cost': fee,
|
|
2100
|
+
'currency': this.safeString(trade, 'feeToken'),
|
|
2101
|
+
'rate': undefined,
|
|
2102
|
+
},
|
|
2098
2103
|
}, market);
|
|
2099
2104
|
}
|
|
2100
2105
|
async fetchPosition(symbol, params = {}) {
|
|
@@ -2162,8 +2162,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2162
2162
|
/**
|
|
2163
2163
|
* @method
|
|
2164
2164
|
* @name krakenfutures#fetchFundingRates
|
|
2165
|
+
* @description fetch the current funding rates for multiple markets
|
|
2165
2166
|
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
|
2166
|
-
* @description fetch the current funding rates
|
|
2167
2167
|
* @param {string[]} symbols unified market symbols
|
|
2168
2168
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2169
2169
|
* @returns {Order[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -2171,7 +2171,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2171
2171
|
await this.loadMarkets();
|
|
2172
2172
|
const marketIds = this.marketIds(symbols);
|
|
2173
2173
|
const response = await this.publicGetTickers(params);
|
|
2174
|
-
const tickers = this.
|
|
2174
|
+
const tickers = this.safeList(response, 'tickers', []);
|
|
2175
2175
|
const fundingRates = [];
|
|
2176
2176
|
for (let i = 0; i < tickers.length; i++) {
|
|
2177
2177
|
const entry = tickers[i];
|
|
@@ -2241,6 +2241,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2241
2241
|
'previousFundingRate': undefined,
|
|
2242
2242
|
'previousFundingTimestamp': undefined,
|
|
2243
2243
|
'previousFundingDatetime': undefined,
|
|
2244
|
+
'interval': undefined,
|
|
2244
2245
|
};
|
|
2245
2246
|
}
|
|
2246
2247
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2201,8 +2201,19 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2201
2201
|
'previousFundingRate': undefined,
|
|
2202
2202
|
'previousFundingTimestamp': undefined,
|
|
2203
2203
|
'previousFundingDatetime': undefined,
|
|
2204
|
+
'interval': this.parseFundingInterval(this.safeString(data, 'granularity')),
|
|
2204
2205
|
};
|
|
2205
2206
|
}
|
|
2207
|
+
parseFundingInterval(interval) {
|
|
2208
|
+
const intervals = {
|
|
2209
|
+
'3600000': '1h',
|
|
2210
|
+
'14400000': '4h',
|
|
2211
|
+
'28800000': '8h',
|
|
2212
|
+
'57600000': '16h',
|
|
2213
|
+
'86400000': '24h',
|
|
2214
|
+
};
|
|
2215
|
+
return this.safeString(intervals, interval, interval);
|
|
2216
|
+
}
|
|
2206
2217
|
parseBalance(response) {
|
|
2207
2218
|
const result = {
|
|
2208
2219
|
'info': response,
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -4213,6 +4213,7 @@ class mexc extends mexc$1 {
|
|
|
4213
4213
|
'previousFundingRate': undefined,
|
|
4214
4214
|
'previousFundingTimestamp': undefined,
|
|
4215
4215
|
'previousFundingDatetime': undefined,
|
|
4216
|
+
'interval': undefined,
|
|
4216
4217
|
};
|
|
4217
4218
|
}
|
|
4218
4219
|
async fetchFundingRate(symbol, params = {}) {
|
package/dist/cjs/src/oceanex.js
CHANGED
|
@@ -47,9 +47,9 @@ class oceanex extends oceanex$1 {
|
|
|
47
47
|
'fetchClosedOrders': true,
|
|
48
48
|
'fetchCrossBorrowRate': false,
|
|
49
49
|
'fetchCrossBorrowRates': false,
|
|
50
|
-
'fetchDepositAddress':
|
|
51
|
-
'fetchDepositAddresses':
|
|
52
|
-
'fetchDepositAddressesByNetwork':
|
|
50
|
+
'fetchDepositAddress': 'emulated',
|
|
51
|
+
'fetchDepositAddresses': undefined,
|
|
52
|
+
'fetchDepositAddressesByNetwork': true,
|
|
53
53
|
'fetchIsolatedBorrowRate': false,
|
|
54
54
|
'fetchIsolatedBorrowRates': false,
|
|
55
55
|
'fetchMarkets': true,
|
|
@@ -110,6 +110,11 @@ class oceanex extends oceanex$1 {
|
|
|
110
110
|
'order/delete',
|
|
111
111
|
'order/delete/multi',
|
|
112
112
|
'orders/clear',
|
|
113
|
+
'/withdraws/special/new',
|
|
114
|
+
'/deposit_address',
|
|
115
|
+
'/deposit_addresses',
|
|
116
|
+
'/deposit_history',
|
|
117
|
+
'/withdraw_history',
|
|
113
118
|
],
|
|
114
119
|
},
|
|
115
120
|
},
|
|
@@ -910,6 +915,81 @@ class oceanex extends oceanex$1 {
|
|
|
910
915
|
const data = this.safeList(response, 'data');
|
|
911
916
|
return this.parseOrders(data);
|
|
912
917
|
}
|
|
918
|
+
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
919
|
+
/**
|
|
920
|
+
* @method
|
|
921
|
+
* @name oceanex#fetchDepositAddressesByNetwork
|
|
922
|
+
* @description fetch the deposit addresses for a currency associated with this account
|
|
923
|
+
* @see https://api.oceanex.pro/doc/v1/#deposit-addresses-post
|
|
924
|
+
* @param {string} code unified currency code
|
|
925
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
926
|
+
* @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}, indexed by the network
|
|
927
|
+
*/
|
|
928
|
+
await this.loadMarkets();
|
|
929
|
+
const currency = this.currency(code);
|
|
930
|
+
const request = {
|
|
931
|
+
'currency': currency['id'],
|
|
932
|
+
};
|
|
933
|
+
const response = await this.privatePostDepositAddresses(this.extend(request, params));
|
|
934
|
+
//
|
|
935
|
+
// {
|
|
936
|
+
// code: '0',
|
|
937
|
+
// message: 'Operation successful',
|
|
938
|
+
// data: {
|
|
939
|
+
// data: {
|
|
940
|
+
// currency_id: 'usdt',
|
|
941
|
+
// display_name: 'USDT',
|
|
942
|
+
// num_of_resources: '3',
|
|
943
|
+
// resources: [
|
|
944
|
+
// {
|
|
945
|
+
// chain_name: 'TRC20',
|
|
946
|
+
// currency_id: 'usdt',
|
|
947
|
+
// address: 'TPcS7VgKMFmpRrWY82GbJzDeMnemWxEbpg',
|
|
948
|
+
// memo: '',
|
|
949
|
+
// deposit_status: 'enabled'
|
|
950
|
+
// },
|
|
951
|
+
// ...
|
|
952
|
+
// ]
|
|
953
|
+
// }
|
|
954
|
+
// }
|
|
955
|
+
// }
|
|
956
|
+
//
|
|
957
|
+
const data = this.safeDict(response, 'data', {});
|
|
958
|
+
const data2 = this.safeDict(data, 'data', {});
|
|
959
|
+
const resources = this.safeList(data2, 'resources', []);
|
|
960
|
+
const result = {};
|
|
961
|
+
for (let i = 0; i < resources.length; i++) {
|
|
962
|
+
const resource = resources[i];
|
|
963
|
+
const enabled = this.safeString(resource, 'deposit_status');
|
|
964
|
+
if (enabled === 'enabled') {
|
|
965
|
+
const parsedAddress = this.parseDepositAddress(resource, currency);
|
|
966
|
+
result[parsedAddress['currency']] = parsedAddress;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return result;
|
|
970
|
+
}
|
|
971
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
972
|
+
//
|
|
973
|
+
// {
|
|
974
|
+
// chain_name: 'TRC20',
|
|
975
|
+
// currency_id: 'usdt',
|
|
976
|
+
// address: 'TPcS7VgKMFmpRrWY82GbJzDeMnemWxEbpg',
|
|
977
|
+
// memo: '',
|
|
978
|
+
// deposit_status: 'enabled'
|
|
979
|
+
// }
|
|
980
|
+
//
|
|
981
|
+
const address = this.safeString(depositAddress, 'address');
|
|
982
|
+
this.checkAddress(address);
|
|
983
|
+
const currencyId = this.safeString(depositAddress, 'currency_id');
|
|
984
|
+
const networkId = this.safeString(depositAddress, 'chain_name');
|
|
985
|
+
return {
|
|
986
|
+
'info': depositAddress,
|
|
987
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
988
|
+
'address': address,
|
|
989
|
+
'tag': this.safeString(depositAddress, 'memo'),
|
|
990
|
+
'network': this.networkIdToCode(networkId),
|
|
991
|
+
};
|
|
992
|
+
}
|
|
913
993
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
914
994
|
let url = this.urls['api']['rest'] + '/' + this.version + '/' + this.implodeParams(path, params);
|
|
915
995
|
const query = this.omit(params, this.extractParams(path));
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -6049,6 +6049,9 @@ class okx extends okx$1 {
|
|
|
6049
6049
|
const symbol = this.safeSymbol(marketId, market);
|
|
6050
6050
|
const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
|
|
6051
6051
|
const fundingTime = this.safeInteger(contract, 'fundingTime');
|
|
6052
|
+
const fundingTimeString = this.safeString(contract, 'fundingTime');
|
|
6053
|
+
const nextFundingTimeString = this.safeString(contract, 'nextFundingRate');
|
|
6054
|
+
const millisecondsInterval = Precise["default"].stringSub(nextFundingTimeString, fundingTimeString);
|
|
6052
6055
|
// https://www.okx.com/support/hc/en-us/articles/360053909272-Ⅸ-Introduction-to-perpetual-swap-funding-fee
|
|
6053
6056
|
// > The current interest is 0.
|
|
6054
6057
|
return {
|
|
@@ -6069,8 +6072,19 @@ class okx extends okx$1 {
|
|
|
6069
6072
|
'previousFundingRate': undefined,
|
|
6070
6073
|
'previousFundingTimestamp': undefined,
|
|
6071
6074
|
'previousFundingDatetime': undefined,
|
|
6075
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
6072
6076
|
};
|
|
6073
6077
|
}
|
|
6078
|
+
parseFundingInterval(interval) {
|
|
6079
|
+
const intervals = {
|
|
6080
|
+
'3600000': '1h',
|
|
6081
|
+
'14400000': '4h',
|
|
6082
|
+
'28800000': '8h',
|
|
6083
|
+
'57600000': '16h',
|
|
6084
|
+
'86400000': '24h',
|
|
6085
|
+
};
|
|
6086
|
+
return this.safeString(intervals, interval, interval);
|
|
6087
|
+
}
|
|
6074
6088
|
async fetchFundingRate(symbol, params = {}) {
|
|
6075
6089
|
/**
|
|
6076
6090
|
* @method
|
package/dist/cjs/src/oxfun.js
CHANGED
|
@@ -67,7 +67,7 @@ class oxfun extends oxfun$1 {
|
|
|
67
67
|
'fetchDepositWithdrawFee': false,
|
|
68
68
|
'fetchDepositWithdrawFees': false,
|
|
69
69
|
'fetchFundingHistory': true,
|
|
70
|
-
'fetchFundingRate':
|
|
70
|
+
'fetchFundingRate': 'emulated',
|
|
71
71
|
'fetchFundingRateHistory': true,
|
|
72
72
|
'fetchFundingRates': true,
|
|
73
73
|
'fetchIndexOHLCV': false,
|
|
@@ -1001,8 +1001,8 @@ class oxfun extends oxfun$1 {
|
|
|
1001
1001
|
/**
|
|
1002
1002
|
* @method
|
|
1003
1003
|
* @name oxfun#fetchFundingRates
|
|
1004
|
+
* @description fetch the current funding rates for multiple markets
|
|
1004
1005
|
* @see https://docs.ox.fun/?json#get-v3-funding-estimates
|
|
1005
|
-
* @description fetch the current funding rates
|
|
1006
1006
|
* @param {string[]} symbols unified market symbols
|
|
1007
1007
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1008
1008
|
* @returns {Order[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -1038,8 +1038,7 @@ class oxfun extends oxfun$1 {
|
|
|
1038
1038
|
// "marketCode": "OX-USD-SWAP-LIN",
|
|
1039
1039
|
// "fundingAt": "1715515200000",
|
|
1040
1040
|
// "estFundingRate": "0.000200000"
|
|
1041
|
-
// }
|
|
1042
|
-
//
|
|
1041
|
+
// }
|
|
1043
1042
|
//
|
|
1044
1043
|
const symbol = this.safeString(fundingRate, 'marketCode');
|
|
1045
1044
|
market = this.market(symbol);
|
|
@@ -1062,6 +1061,7 @@ class oxfun extends oxfun$1 {
|
|
|
1062
1061
|
'previousFundingRate': undefined,
|
|
1063
1062
|
'previousFundingTimestamp': undefined,
|
|
1064
1063
|
'previousFundingDatetime': undefined,
|
|
1064
|
+
'interval': undefined,
|
|
1065
1065
|
};
|
|
1066
1066
|
}
|
|
1067
1067
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -4128,6 +4128,7 @@ class phemex extends phemex$1 {
|
|
|
4128
4128
|
'previousFundingRate': undefined,
|
|
4129
4129
|
'previousFundingTimestamp': undefined,
|
|
4130
4130
|
'previousFundingDatetime': undefined,
|
|
4131
|
+
'interval': undefined,
|
|
4131
4132
|
};
|
|
4132
4133
|
}
|
|
4133
4134
|
async setMargin(symbol, amount, params = {}) {
|
|
@@ -1655,8 +1655,19 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
1655
1655
|
'previousFundingRate': this.safeNumber(data, 'value'),
|
|
1656
1656
|
'previousFundingTimestamp': fundingTimestamp,
|
|
1657
1657
|
'previousFundingDatetime': this.iso8601(fundingTimestamp),
|
|
1658
|
+
'interval': this.parseFundingInterval(this.safeString(data, 'interval')),
|
|
1658
1659
|
};
|
|
1659
1660
|
}
|
|
1661
|
+
parseFundingInterval(interval) {
|
|
1662
|
+
const intervals = {
|
|
1663
|
+
'3600000': '1h',
|
|
1664
|
+
'14400000': '4h',
|
|
1665
|
+
'28800000': '8h',
|
|
1666
|
+
'57600000': '16h',
|
|
1667
|
+
'86400000': '24h',
|
|
1668
|
+
};
|
|
1669
|
+
return this.safeString(intervals, interval, interval);
|
|
1670
|
+
}
|
|
1660
1671
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1661
1672
|
/**
|
|
1662
1673
|
* @method
|
|
@@ -14,7 +14,7 @@ class deribit extends deribit$1 {
|
|
|
14
14
|
'ws': true,
|
|
15
15
|
'watchBalance': true,
|
|
16
16
|
'watchTicker': true,
|
|
17
|
-
'watchTickers':
|
|
17
|
+
'watchTickers': true,
|
|
18
18
|
'watchTrades': true,
|
|
19
19
|
'watchTradesForSymbols': true,
|
|
20
20
|
'watchMyTrades': true,
|
|
@@ -185,6 +185,48 @@ class deribit extends deribit$1 {
|
|
|
185
185
|
const request = this.deepExtend(message, params);
|
|
186
186
|
return await this.watch(url, channel, request, channel, request);
|
|
187
187
|
}
|
|
188
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
189
|
+
/**
|
|
190
|
+
* @method
|
|
191
|
+
* @name deribit#watchTickers
|
|
192
|
+
* @see https://docs.deribit.com/#ticker-instrument_name-interval
|
|
193
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
194
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
195
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
196
|
+
* @param {str} [params.interval] specify aggregation and frequency of notifications. Possible values: 100ms, raw
|
|
197
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
198
|
+
*/
|
|
199
|
+
await this.loadMarkets();
|
|
200
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
201
|
+
const url = this.urls['api']['ws'];
|
|
202
|
+
const interval = this.safeString(params, 'interval', '100ms');
|
|
203
|
+
params = this.omit(params, 'interval');
|
|
204
|
+
await this.loadMarkets();
|
|
205
|
+
if (interval === 'raw') {
|
|
206
|
+
await this.authenticate();
|
|
207
|
+
}
|
|
208
|
+
const channels = [];
|
|
209
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
210
|
+
const market = this.market(symbols[i]);
|
|
211
|
+
channels.push('ticker.' + market['id'] + '.' + interval);
|
|
212
|
+
}
|
|
213
|
+
const message = {
|
|
214
|
+
'jsonrpc': '2.0',
|
|
215
|
+
'method': 'public/subscribe',
|
|
216
|
+
'params': {
|
|
217
|
+
'channels': channels,
|
|
218
|
+
},
|
|
219
|
+
'id': this.requestId(),
|
|
220
|
+
};
|
|
221
|
+
const request = this.deepExtend(message, params);
|
|
222
|
+
const newTickers = await this.watchMultiple(url, channels, request, channels, request);
|
|
223
|
+
if (this.newUpdates) {
|
|
224
|
+
const tickers = {};
|
|
225
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
226
|
+
return tickers;
|
|
227
|
+
}
|
|
228
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
229
|
+
}
|
|
188
230
|
handleTicker(client, message) {
|
|
189
231
|
//
|
|
190
232
|
// {
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -341,7 +341,7 @@ class gate extends gate$1 {
|
|
|
341
341
|
throw new errors.NotSupported(this.id + ' fetchOrdersByStatusWs is only supported by swap markets. Use rest API for other markets');
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
const [request, requestParams] = this.
|
|
344
|
+
const [request, requestParams] = this.prepareOrdersByStatusRequest(status, symbol, since, limit, params);
|
|
345
345
|
const newRequest = this.omit(request, ['settle']);
|
|
346
346
|
const messageType = this.getTypeByMarket(market);
|
|
347
347
|
const channel = messageType + '.order_list';
|
package/dist/cjs/src/vertex.js
CHANGED
|
@@ -1242,6 +1242,7 @@ class vertex extends vertex$1 {
|
|
|
1242
1242
|
'previousFundingRate': undefined,
|
|
1243
1243
|
'previousFundingTimestamp': undefined,
|
|
1244
1244
|
'previousFundingDatetime': undefined,
|
|
1245
|
+
'interval': undefined,
|
|
1245
1246
|
};
|
|
1246
1247
|
}
|
|
1247
1248
|
async fetchFundingRate(symbol, params = {}) {
|
|
@@ -1279,7 +1280,7 @@ class vertex extends vertex$1 {
|
|
|
1279
1280
|
* @see https://docs.vertexprotocol.com/developer-resources/api/v2/contracts
|
|
1280
1281
|
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
1281
1282
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1282
|
-
* @returns {object} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1283
|
+
* @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1283
1284
|
*/
|
|
1284
1285
|
await this.loadMarkets();
|
|
1285
1286
|
const request = {};
|
package/dist/cjs/src/whitebit.js
CHANGED
|
@@ -2370,8 +2370,8 @@ class whitebit extends whitebit$1 {
|
|
|
2370
2370
|
/**
|
|
2371
2371
|
* @method
|
|
2372
2372
|
* @name whitebit#fetchFundingRate
|
|
2373
|
-
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2374
2373
|
* @description fetch the current funding rate
|
|
2374
|
+
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2375
2375
|
* @param {string} symbol unified market symbol
|
|
2376
2376
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2377
2377
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -2385,11 +2385,11 @@ class whitebit extends whitebit$1 {
|
|
|
2385
2385
|
/**
|
|
2386
2386
|
* @method
|
|
2387
2387
|
* @name whitebit#fetchFundingRates
|
|
2388
|
-
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2389
2388
|
* @description fetch the funding rate for multiple markets
|
|
2389
|
+
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2390
2390
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2391
2391
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2392
|
-
* @returns {object} a
|
|
2392
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2393
2393
|
*/
|
|
2394
2394
|
await this.loadMarkets();
|
|
2395
2395
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2438,7 +2438,7 @@ class whitebit extends whitebit$1 {
|
|
|
2438
2438
|
// }
|
|
2439
2439
|
// ]
|
|
2440
2440
|
//
|
|
2441
|
-
const data = this.
|
|
2441
|
+
const data = this.safeList(response, 'result', []);
|
|
2442
2442
|
const result = this.parseFundingRates(data);
|
|
2443
2443
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2444
2444
|
}
|
|
@@ -2481,7 +2481,7 @@ class whitebit extends whitebit$1 {
|
|
|
2481
2481
|
const indexPrice = this.safeNumber(contract, 'indexPrice');
|
|
2482
2482
|
const interestRate = this.safeNumber(contract, 'interestRate');
|
|
2483
2483
|
const fundingRate = this.safeNumber(contract, 'funding_rate');
|
|
2484
|
-
const
|
|
2484
|
+
const fundingTime = this.safeInteger(contract, 'next_funding_rate_timestamp');
|
|
2485
2485
|
return {
|
|
2486
2486
|
'info': contract,
|
|
2487
2487
|
'symbol': symbol,
|
|
@@ -2491,14 +2491,15 @@ class whitebit extends whitebit$1 {
|
|
|
2491
2491
|
'timestamp': undefined,
|
|
2492
2492
|
'datetime': undefined,
|
|
2493
2493
|
'fundingRate': fundingRate,
|
|
2494
|
-
'fundingTimestamp':
|
|
2495
|
-
'fundingDatetime': this.iso8601(
|
|
2494
|
+
'fundingTimestamp': fundingTime,
|
|
2495
|
+
'fundingDatetime': this.iso8601(fundingTime),
|
|
2496
2496
|
'nextFundingRate': undefined,
|
|
2497
|
-
'nextFundingTimestamp':
|
|
2498
|
-
'nextFundingDatetime':
|
|
2497
|
+
'nextFundingTimestamp': undefined,
|
|
2498
|
+
'nextFundingDatetime': undefined,
|
|
2499
2499
|
'previousFundingRate': undefined,
|
|
2500
2500
|
'previousFundingTimestamp': undefined,
|
|
2501
2501
|
'previousFundingDatetime': undefined,
|
|
2502
|
+
'interval': undefined,
|
|
2502
2503
|
};
|
|
2503
2504
|
}
|
|
2504
2505
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -2749,21 +2749,25 @@ class woo extends woo$1 {
|
|
|
2749
2749
|
}
|
|
2750
2750
|
parseFundingRate(fundingRate, market = undefined) {
|
|
2751
2751
|
//
|
|
2752
|
-
//
|
|
2753
|
-
//
|
|
2754
|
-
//
|
|
2755
|
-
//
|
|
2756
|
-
//
|
|
2757
|
-
//
|
|
2758
|
-
//
|
|
2759
|
-
//
|
|
2760
|
-
//
|
|
2752
|
+
// {
|
|
2753
|
+
// "success": true,
|
|
2754
|
+
// "timestamp": 1727427915529,
|
|
2755
|
+
// "symbol": "PERP_BTC_USDT",
|
|
2756
|
+
// "est_funding_rate": -0.00092719,
|
|
2757
|
+
// "est_funding_rate_timestamp": 1727427899060,
|
|
2758
|
+
// "last_funding_rate": -0.00092610,
|
|
2759
|
+
// "last_funding_rate_timestamp": 1727424000000,
|
|
2760
|
+
// "next_funding_time": 1727452800000,
|
|
2761
|
+
// "last_funding_rate_interval": 8,
|
|
2762
|
+
// "est_funding_rate_interval": 8
|
|
2763
|
+
// }
|
|
2761
2764
|
//
|
|
2762
2765
|
const symbol = this.safeString(fundingRate, 'symbol');
|
|
2763
2766
|
market = this.market(symbol);
|
|
2764
2767
|
const nextFundingTimestamp = this.safeInteger(fundingRate, 'next_funding_time');
|
|
2765
2768
|
const estFundingRateTimestamp = this.safeInteger(fundingRate, 'est_funding_rate_timestamp');
|
|
2766
2769
|
const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'last_funding_rate_timestamp');
|
|
2770
|
+
const intervalString = this.safeString(fundingRate, 'est_funding_rate_interval');
|
|
2767
2771
|
return {
|
|
2768
2772
|
'info': fundingRate,
|
|
2769
2773
|
'symbol': market['symbol'],
|
|
@@ -2782,9 +2786,19 @@ class woo extends woo$1 {
|
|
|
2782
2786
|
'previousFundingRate': this.safeNumber(fundingRate, 'last_funding_rate'),
|
|
2783
2787
|
'previousFundingTimestamp': lastFundingRateTimestamp,
|
|
2784
2788
|
'previousFundingDatetime': this.iso8601(lastFundingRateTimestamp),
|
|
2789
|
+
'interval': intervalString + 'h',
|
|
2785
2790
|
};
|
|
2786
2791
|
}
|
|
2787
2792
|
async fetchFundingRate(symbol, params = {}) {
|
|
2793
|
+
/**
|
|
2794
|
+
* @method
|
|
2795
|
+
* @name woo#fetchFundingRate
|
|
2796
|
+
* @description fetch the current funding rate
|
|
2797
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
|
|
2798
|
+
* @param {string} symbol unified market symbol
|
|
2799
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2800
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2801
|
+
*/
|
|
2788
2802
|
await this.loadMarkets();
|
|
2789
2803
|
const market = this.market(symbol);
|
|
2790
2804
|
const request = {
|
|
@@ -2793,19 +2807,30 @@ class woo extends woo$1 {
|
|
|
2793
2807
|
const response = await this.v1PublicGetFundingRateSymbol(this.extend(request, params));
|
|
2794
2808
|
//
|
|
2795
2809
|
// {
|
|
2796
|
-
// "success":true,
|
|
2797
|
-
// "timestamp":
|
|
2798
|
-
// "symbol":"PERP_BTC_USDT",
|
|
2799
|
-
// "est_funding_rate":0.
|
|
2800
|
-
// "est_funding_rate_timestamp":
|
|
2801
|
-
// "last_funding_rate":0.
|
|
2802
|
-
// "last_funding_rate_timestamp":
|
|
2803
|
-
// "next_funding_time":
|
|
2810
|
+
// "success": true,
|
|
2811
|
+
// "timestamp": 1727428037877,
|
|
2812
|
+
// "symbol": "PERP_BTC_USDT",
|
|
2813
|
+
// "est_funding_rate": -0.00092674,
|
|
2814
|
+
// "est_funding_rate_timestamp": 1727428019064,
|
|
2815
|
+
// "last_funding_rate": -0.00092610,
|
|
2816
|
+
// "last_funding_rate_timestamp": 1727424000000,
|
|
2817
|
+
// "next_funding_time": 1727452800000,
|
|
2818
|
+
// "last_funding_rate_interval": 8,
|
|
2819
|
+
// "est_funding_rate_interval": 8
|
|
2804
2820
|
// }
|
|
2805
2821
|
//
|
|
2806
2822
|
return this.parseFundingRate(response, market);
|
|
2807
2823
|
}
|
|
2808
2824
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
2825
|
+
/**
|
|
2826
|
+
* @method
|
|
2827
|
+
* @name woo#fetchFundingRates
|
|
2828
|
+
* @description fetch the funding rate for multiple markets
|
|
2829
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
|
|
2830
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2831
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2832
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2833
|
+
*/
|
|
2809
2834
|
await this.loadMarkets();
|
|
2810
2835
|
symbols = this.marketSymbols(symbols);
|
|
2811
2836
|
const response = await this.v1PublicGetFundingRates(params);
|