ccxt 4.4.9__py2.py3-none-any.whl → 4.4.11__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/ascendex.py +5 -4
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +5 -4
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +9 -11
- ccxt/async_support/bingx.py +20 -21
- ccxt/async_support/bitfinex2.py +7 -16
- ccxt/async_support/bitget.py +9 -8
- ccxt/async_support/bitmart.py +4 -3
- ccxt/async_support/bitmex.py +7 -6
- ccxt/async_support/blofin.py +7 -16
- ccxt/async_support/bybit.py +18 -16
- ccxt/async_support/coinex.py +19 -5
- ccxt/async_support/delta.py +6 -5
- ccxt/async_support/deribit.py +4 -3
- ccxt/async_support/digifinex.py +18 -4
- ccxt/async_support/gate.py +32 -13
- ccxt/async_support/hashkey.py +6 -6
- ccxt/async_support/hitbtc.py +6 -5
- ccxt/async_support/htx.py +29 -6
- ccxt/async_support/hyperliquid.py +6 -1
- ccxt/async_support/kraken.py +35 -13
- ccxt/async_support/krakenfutures.py +6 -5
- ccxt/async_support/kucoinfutures.py +13 -2
- ccxt/async_support/mexc.py +14 -7
- ccxt/async_support/oceanex.py +80 -4
- ccxt/async_support/okx.py +19 -3
- ccxt/async_support/oxfun.py +7 -7
- ccxt/async_support/phemex.py +4 -3
- ccxt/async_support/poloniexfutures.py +13 -2
- ccxt/async_support/vertex.py +6 -5
- ccxt/async_support/whitebit.py +14 -13
- ccxt/async_support/woo.py +42 -21
- ccxt/async_support/woofipro.py +19 -6
- ccxt/async_support/xt.py +5 -3
- ccxt/base/exchange.py +1 -1
- ccxt/base/types.py +1 -0
- ccxt/binance.py +9 -11
- ccxt/bingx.py +20 -21
- ccxt/bitfinex2.py +7 -16
- ccxt/bitget.py +9 -8
- ccxt/bitmart.py +4 -3
- ccxt/bitmex.py +7 -6
- ccxt/blofin.py +7 -16
- ccxt/bybit.py +18 -16
- ccxt/coinex.py +19 -5
- ccxt/delta.py +6 -5
- ccxt/deribit.py +4 -3
- ccxt/digifinex.py +18 -4
- ccxt/gate.py +32 -13
- ccxt/hashkey.py +6 -6
- ccxt/hitbtc.py +6 -5
- ccxt/htx.py +29 -6
- ccxt/hyperliquid.py +6 -1
- ccxt/kraken.py +35 -13
- ccxt/krakenfutures.py +6 -5
- ccxt/kucoinfutures.py +13 -2
- ccxt/mexc.py +14 -7
- ccxt/oceanex.py +80 -4
- ccxt/okx.py +19 -3
- ccxt/oxfun.py +7 -7
- ccxt/phemex.py +4 -3
- ccxt/poloniexfutures.py +13 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/deribit.py +114 -2
- ccxt/pro/exmo.py +29 -2
- ccxt/pro/gate.py +1 -1
- ccxt/pro/okx.py +1 -1
- ccxt/vertex.py +6 -5
- ccxt/whitebit.py +14 -13
- ccxt/woo.py +42 -21
- ccxt/woofipro.py +19 -6
- ccxt/xt.py +5 -3
- ccxt-4.4.11.dist-info/METADATA +636 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/RECORD +84 -84
- ccxt-4.4.9.dist-info/METADATA +0 -636
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/WHEEL +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/top_level.txt +0 -0
ccxt/async_support/phemex.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.phemex import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -3741,7 +3741,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3741
3741
|
value = Precise.string_mul(value, tickPrecision)
|
3742
3742
|
return value
|
3743
3743
|
|
3744
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
3744
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
3745
3745
|
"""
|
3746
3746
|
fetch the current funding rate
|
3747
3747
|
:param str symbol: unified market symbol
|
@@ -3786,7 +3786,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3786
3786
|
result = self.safe_value(response, 'result', {})
|
3787
3787
|
return self.parse_funding_rate(result, market)
|
3788
3788
|
|
3789
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
3789
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
3790
3790
|
#
|
3791
3791
|
# {
|
3792
3792
|
# "askEp": 2332500,
|
@@ -3845,6 +3845,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3845
3845
|
'previousFundingRate': None,
|
3846
3846
|
'previousFundingTimestamp': None,
|
3847
3847
|
'previousFundingDatetime': None,
|
3848
|
+
'interval': None,
|
3848
3849
|
}
|
3849
3850
|
|
3850
3851
|
async def set_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.poloniexfutures import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
9
|
+
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
12
12
|
from ccxt.base.errors import AccountSuspended
|
@@ -1527,7 +1527,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
1527
1527
|
'trades': None,
|
1528
1528
|
}, market)
|
1529
1529
|
|
1530
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
1530
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1531
1531
|
"""
|
1532
1532
|
fetch the current funding rate
|
1533
1533
|
:see: https://api-docs.poloniex.com/futures/api/futures-index#get-premium-index
|
@@ -1571,8 +1571,19 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
1571
1571
|
'previousFundingRate': self.safe_number(data, 'value'),
|
1572
1572
|
'previousFundingTimestamp': fundingTimestamp,
|
1573
1573
|
'previousFundingDatetime': self.iso8601(fundingTimestamp),
|
1574
|
+
'interval': self.parse_funding_interval(self.safe_string(data, 'interval')),
|
1574
1575
|
}
|
1575
1576
|
|
1577
|
+
def parse_funding_interval(self, interval):
|
1578
|
+
intervals: dict = {
|
1579
|
+
'3600000': '1h',
|
1580
|
+
'14400000': '4h',
|
1581
|
+
'28800000': '8h',
|
1582
|
+
'57600000': '16h',
|
1583
|
+
'86400000': '24h',
|
1584
|
+
}
|
1585
|
+
return self.safe_string(intervals, interval, interval)
|
1586
|
+
|
1576
1587
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1577
1588
|
"""
|
1578
1589
|
fetch all trades made by the user
|
ccxt/async_support/vertex.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.vertex import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
|
8
|
+
from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
@@ -1154,7 +1154,7 @@ class vertex(Exchange, ImplicitAPI):
|
|
1154
1154
|
rows = self.safe_list(response, 'candlesticks', [])
|
1155
1155
|
return self.parse_ohlcvs(rows, market, timeframe, since, limit)
|
1156
1156
|
|
1157
|
-
def parse_funding_rate(self, ticker, market: Market = None):
|
1157
|
+
def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
|
1158
1158
|
#
|
1159
1159
|
# {
|
1160
1160
|
# "product_id": 4,
|
@@ -1208,9 +1208,10 @@ class vertex(Exchange, ImplicitAPI):
|
|
1208
1208
|
'previousFundingRate': None,
|
1209
1209
|
'previousFundingTimestamp': None,
|
1210
1210
|
'previousFundingDatetime': None,
|
1211
|
+
'interval': None,
|
1211
1212
|
}
|
1212
1213
|
|
1213
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
1214
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1214
1215
|
"""
|
1215
1216
|
fetch the current funding rate
|
1216
1217
|
:see: https://docs.vertexprotocol.com/developer-resources/api/archive-indexer/funding-rate
|
@@ -1235,13 +1236,13 @@ class vertex(Exchange, ImplicitAPI):
|
|
1235
1236
|
#
|
1236
1237
|
return self.parse_funding_rate(response, market)
|
1237
1238
|
|
1238
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
1239
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1239
1240
|
"""
|
1240
1241
|
fetches funding rates for multiple markets
|
1241
1242
|
:see: https://docs.vertexprotocol.com/developer-resources/api/v2/contracts
|
1242
1243
|
:param str[] symbols: unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
1243
1244
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1244
|
-
:returns dict: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1245
|
+
:returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1245
1246
|
"""
|
1246
1247
|
await self.load_markets()
|
1247
1248
|
request = {}
|
ccxt/async_support/whitebit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.whitebit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2219,10 +2219,10 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2219
2219
|
'info': info,
|
2220
2220
|
}
|
2221
2221
|
|
2222
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
2222
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2223
2223
|
"""
|
2224
|
-
:see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
2225
2224
|
fetch the current funding rate
|
2225
|
+
:see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
2226
2226
|
:param str symbol: unified market symbol
|
2227
2227
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2228
2228
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -2232,13 +2232,13 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2232
2232
|
response = await self.fetch_funding_rates([symbol], params)
|
2233
2233
|
return self.safe_value(response, symbol)
|
2234
2234
|
|
2235
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2235
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2236
2236
|
"""
|
2237
|
-
:see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
2238
2237
|
fetch the funding rate for multiple markets
|
2238
|
+
:see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
2239
2239
|
:param str[]|None symbols: list of unified market symbols
|
2240
2240
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2241
|
-
:returns dict: a
|
2241
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
2242
2242
|
"""
|
2243
2243
|
await self.load_markets()
|
2244
2244
|
symbols = self.market_symbols(symbols)
|
@@ -2287,11 +2287,11 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2287
2287
|
# }
|
2288
2288
|
# ]
|
2289
2289
|
#
|
2290
|
-
data = self.
|
2290
|
+
data = self.safe_list(response, 'result', [])
|
2291
2291
|
result = self.parse_funding_rates(data)
|
2292
2292
|
return self.filter_by_array(result, 'symbol', symbols)
|
2293
2293
|
|
2294
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2294
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2295
2295
|
#
|
2296
2296
|
# {
|
2297
2297
|
# "ticker_id":"ADA_PERP",
|
@@ -2330,7 +2330,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2330
2330
|
indexPrice = self.safe_number(contract, 'indexPrice')
|
2331
2331
|
interestRate = self.safe_number(contract, 'interestRate')
|
2332
2332
|
fundingRate = self.safe_number(contract, 'funding_rate')
|
2333
|
-
|
2333
|
+
fundingTime = self.safe_integer(contract, 'next_funding_rate_timestamp')
|
2334
2334
|
return {
|
2335
2335
|
'info': contract,
|
2336
2336
|
'symbol': symbol,
|
@@ -2340,14 +2340,15 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2340
2340
|
'timestamp': None,
|
2341
2341
|
'datetime': None,
|
2342
2342
|
'fundingRate': fundingRate,
|
2343
|
-
'fundingTimestamp':
|
2344
|
-
'fundingDatetime': self.iso8601(
|
2343
|
+
'fundingTimestamp': fundingTime,
|
2344
|
+
'fundingDatetime': self.iso8601(fundingTime),
|
2345
2345
|
'nextFundingRate': None,
|
2346
|
-
'nextFundingTimestamp':
|
2347
|
-
'nextFundingDatetime':
|
2346
|
+
'nextFundingTimestamp': None,
|
2347
|
+
'nextFundingDatetime': None,
|
2348
2348
|
'previousFundingRate': None,
|
2349
2349
|
'previousFundingTimestamp': None,
|
2350
2350
|
'previousFundingDatetime': None,
|
2351
|
+
'interval': None,
|
2351
2352
|
}
|
2352
2353
|
|
2353
2354
|
async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
ccxt/async_support/woo.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woo import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from typing import Any
|
12
12
|
from ccxt.base.errors import ExchangeError
|
@@ -2548,23 +2548,27 @@ class woo(Exchange, ImplicitAPI):
|
|
2548
2548
|
result[resultLength - 1] = lastItem
|
2549
2549
|
return self.parse_incomes(result, market, since, limit)
|
2550
2550
|
|
2551
|
-
def parse_funding_rate(self, fundingRate, market: Market = None):
|
2552
|
-
#
|
2553
|
-
# {
|
2554
|
-
# "symbol":"PERP_AAVE_USDT",
|
2555
|
-
# "est_funding_rate":-0.00003447,
|
2556
|
-
# "est_funding_rate_timestamp":1653633959001,
|
2557
|
-
# "last_funding_rate":-0.00002094,
|
2558
|
-
# "last_funding_rate_timestamp":1653631200000,
|
2559
|
-
# "next_funding_time":1653634800000
|
2560
|
-
# }
|
2551
|
+
def parse_funding_rate(self, fundingRate, market: Market = None) -> FundingRate:
|
2561
2552
|
#
|
2553
|
+
# {
|
2554
|
+
# "success": True,
|
2555
|
+
# "timestamp": 1727427915529,
|
2556
|
+
# "symbol": "PERP_BTC_USDT",
|
2557
|
+
# "est_funding_rate": -0.00092719,
|
2558
|
+
# "est_funding_rate_timestamp": 1727427899060,
|
2559
|
+
# "last_funding_rate": -0.00092610,
|
2560
|
+
# "last_funding_rate_timestamp": 1727424000000,
|
2561
|
+
# "next_funding_time": 1727452800000,
|
2562
|
+
# "last_funding_rate_interval": 8,
|
2563
|
+
# "est_funding_rate_interval": 8
|
2564
|
+
# }
|
2562
2565
|
#
|
2563
2566
|
symbol = self.safe_string(fundingRate, 'symbol')
|
2564
2567
|
market = self.market(symbol)
|
2565
2568
|
nextFundingTimestamp = self.safe_integer(fundingRate, 'next_funding_time')
|
2566
2569
|
estFundingRateTimestamp = self.safe_integer(fundingRate, 'est_funding_rate_timestamp')
|
2567
2570
|
lastFundingRateTimestamp = self.safe_integer(fundingRate, 'last_funding_rate_timestamp')
|
2571
|
+
intervalString = self.safe_string(fundingRate, 'est_funding_rate_interval')
|
2568
2572
|
return {
|
2569
2573
|
'info': fundingRate,
|
2570
2574
|
'symbol': market['symbol'],
|
@@ -2583,9 +2587,17 @@ class woo(Exchange, ImplicitAPI):
|
|
2583
2587
|
'previousFundingRate': self.safe_number(fundingRate, 'last_funding_rate'),
|
2584
2588
|
'previousFundingTimestamp': lastFundingRateTimestamp,
|
2585
2589
|
'previousFundingDatetime': self.iso8601(lastFundingRateTimestamp),
|
2590
|
+
'interval': intervalString + 'h',
|
2586
2591
|
}
|
2587
2592
|
|
2588
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
2593
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2594
|
+
"""
|
2595
|
+
fetch the current funding rate
|
2596
|
+
:see: https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
|
2597
|
+
:param str symbol: unified market symbol
|
2598
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2599
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2600
|
+
"""
|
2589
2601
|
await self.load_markets()
|
2590
2602
|
market = self.market(symbol)
|
2591
2603
|
request: dict = {
|
@@ -2594,19 +2606,28 @@ class woo(Exchange, ImplicitAPI):
|
|
2594
2606
|
response = await self.v1PublicGetFundingRateSymbol(self.extend(request, params))
|
2595
2607
|
#
|
2596
2608
|
# {
|
2597
|
-
# "success":
|
2598
|
-
# "timestamp":
|
2599
|
-
# "symbol":"PERP_BTC_USDT",
|
2600
|
-
# "est_funding_rate":0.
|
2601
|
-
# "est_funding_rate_timestamp":
|
2602
|
-
# "last_funding_rate":0.
|
2603
|
-
# "last_funding_rate_timestamp":
|
2604
|
-
# "next_funding_time":
|
2609
|
+
# "success": True,
|
2610
|
+
# "timestamp": 1727428037877,
|
2611
|
+
# "symbol": "PERP_BTC_USDT",
|
2612
|
+
# "est_funding_rate": -0.00092674,
|
2613
|
+
# "est_funding_rate_timestamp": 1727428019064,
|
2614
|
+
# "last_funding_rate": -0.00092610,
|
2615
|
+
# "last_funding_rate_timestamp": 1727424000000,
|
2616
|
+
# "next_funding_time": 1727452800000,
|
2617
|
+
# "last_funding_rate_interval": 8,
|
2618
|
+
# "est_funding_rate_interval": 8
|
2605
2619
|
# }
|
2606
2620
|
#
|
2607
2621
|
return self.parse_funding_rate(response, market)
|
2608
2622
|
|
2609
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2623
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2624
|
+
"""
|
2625
|
+
fetch the funding rate for multiple markets
|
2626
|
+
:see: https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
|
2627
|
+
:param str[]|None symbols: list of unified market symbols
|
2628
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2629
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
2630
|
+
"""
|
2610
2631
|
await self.load_markets()
|
2611
2632
|
symbols = self.market_symbols(symbols)
|
2612
2633
|
response = await self.v1PublicGetFundingRates(params)
|
ccxt/async_support/woofipro.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woofipro import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
|
9
9
|
from typing import List
|
10
10
|
from typing import Any
|
11
11
|
from ccxt.base.errors import ExchangeError
|
@@ -736,7 +736,7 @@ class woofipro(Exchange, ImplicitAPI):
|
|
736
736
|
rows = self.safe_list(data, 'rows', [])
|
737
737
|
return self.parse_trades(rows, market, since, limit)
|
738
738
|
|
739
|
-
def parse_funding_rate(self, fundingRate, market: Market = None):
|
739
|
+
def parse_funding_rate(self, fundingRate, market: Market = None) -> FundingRate:
|
740
740
|
#
|
741
741
|
# {
|
742
742
|
# "symbol":"PERP_AAVE_USDT",
|
@@ -748,12 +748,14 @@ class woofipro(Exchange, ImplicitAPI):
|
|
748
748
|
# "sum_unitary_funding": 521.367
|
749
749
|
# }
|
750
750
|
#
|
751
|
-
#
|
752
751
|
symbol = self.safe_string(fundingRate, 'symbol')
|
753
752
|
market = self.market(symbol)
|
754
753
|
nextFundingTimestamp = self.safe_integer(fundingRate, 'next_funding_time')
|
755
754
|
estFundingRateTimestamp = self.safe_integer(fundingRate, 'est_funding_rate_timestamp')
|
756
755
|
lastFundingRateTimestamp = self.safe_integer(fundingRate, 'last_funding_rate_timestamp')
|
756
|
+
fundingTimeString = self.safe_string(fundingRate, 'last_funding_rate_timestamp')
|
757
|
+
nextFundingTimeString = self.safe_string(fundingRate, 'next_funding_time')
|
758
|
+
millisecondsInterval = Precise.string_sub(nextFundingTimeString, fundingTimeString)
|
757
759
|
return {
|
758
760
|
'info': fundingRate,
|
759
761
|
'symbol': market['symbol'],
|
@@ -772,9 +774,20 @@ class woofipro(Exchange, ImplicitAPI):
|
|
772
774
|
'previousFundingRate': self.safe_number(fundingRate, 'last_funding_rate'),
|
773
775
|
'previousFundingTimestamp': lastFundingRateTimestamp,
|
774
776
|
'previousFundingDatetime': self.iso8601(lastFundingRateTimestamp),
|
777
|
+
'interval': self.parse_funding_interval(millisecondsInterval),
|
778
|
+
}
|
779
|
+
|
780
|
+
def parse_funding_interval(self, interval):
|
781
|
+
intervals: dict = {
|
782
|
+
'3600000': '1h',
|
783
|
+
'14400000': '4h',
|
784
|
+
'28800000': '8h',
|
785
|
+
'57600000': '16h',
|
786
|
+
'86400000': '24h',
|
775
787
|
}
|
788
|
+
return self.safe_string(intervals, interval, interval)
|
776
789
|
|
777
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
790
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
778
791
|
"""
|
779
792
|
fetch the current funding rate
|
780
793
|
:see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
|
@@ -806,9 +819,9 @@ class woofipro(Exchange, ImplicitAPI):
|
|
806
819
|
data = self.safe_dict(response, 'data', {})
|
807
820
|
return self.parse_funding_rate(data, market)
|
808
821
|
|
809
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
822
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
810
823
|
"""
|
811
|
-
fetch the current funding
|
824
|
+
fetch the current funding rate for multiple markets
|
812
825
|
:see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
|
813
826
|
:param str[] symbols: unified market symbols
|
814
827
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
ccxt/async_support/xt.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.xt import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Currencies, Currency, Int, LedgerEntry, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Currencies, Currency, Int, LedgerEntry, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, FundingRate, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -4030,7 +4030,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4030
4030
|
sorted = self.sort_by(rates, 'timestamp')
|
4031
4031
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
4032
4032
|
|
4033
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
4033
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
4034
4034
|
"""
|
4035
4035
|
fetch the current funding rate
|
4036
4036
|
:see: https://doc.xt.com/#futures_quotesgetFundingRate
|
@@ -4068,7 +4068,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4068
4068
|
result = self.safe_value(response, 'result', {})
|
4069
4069
|
return self.parse_funding_rate(result, market)
|
4070
4070
|
|
4071
|
-
def parse_funding_rate(self, contract, market=None):
|
4071
|
+
def parse_funding_rate(self, contract, market=None) -> FundingRate:
|
4072
4072
|
#
|
4073
4073
|
# {
|
4074
4074
|
# "symbol": "btc_usdt",
|
@@ -4080,6 +4080,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4080
4080
|
marketId = self.safe_string(contract, 'symbol')
|
4081
4081
|
symbol = self.safe_symbol(marketId, market, '_', 'swap')
|
4082
4082
|
timestamp = self.safe_integer(contract, 'nextCollectionTime')
|
4083
|
+
interval = self.safe_string(contract, 'collectionInternal')
|
4083
4084
|
return {
|
4084
4085
|
'info': contract,
|
4085
4086
|
'symbol': symbol,
|
@@ -4098,6 +4099,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4098
4099
|
'previousFundingRate': None,
|
4099
4100
|
'previousFundingTimestamp': None,
|
4100
4101
|
'previousFundingDatetime': None,
|
4102
|
+
'interval': interval + 'h',
|
4101
4103
|
}
|
4102
4104
|
|
4103
4105
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/base/exchange.py
CHANGED
ccxt/base/types.py
CHANGED
ccxt/binance.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.binance import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -1115,6 +1115,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1115
1115
|
'listenKey': 1, # 1
|
1116
1116
|
'asset-collection': 3,
|
1117
1117
|
'margin/repay-debt': 0.4, # Weight(Order): 0.4 =>(1000 / (50 * 0.4)) * 60 = 3000
|
1118
|
+
'um/feeBurn': 1,
|
1118
1119
|
},
|
1119
1120
|
'put': {
|
1120
1121
|
'listenKey': 1, # 1
|
@@ -8642,7 +8643,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8642
8643
|
#
|
8643
8644
|
return self.parse_transfer(response, currency)
|
8644
8645
|
|
8645
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
8646
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
8646
8647
|
"""
|
8647
8648
|
fetch the current funding rate
|
8648
8649
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8689,7 +8690,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8689
8690
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
8690
8691
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8691
8692
|
:param int [params.until]: timestamp in ms of the latest funding rate
|
8692
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
8693
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
8693
8694
|
:param str [params.subType]: "linear" or "inverse"
|
8694
8695
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
8695
8696
|
"""
|
@@ -8746,7 +8747,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8746
8747
|
sorted = self.sort_by(rates, 'timestamp')
|
8747
8748
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
8748
8749
|
|
8749
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
8750
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
8750
8751
|
"""
|
8751
8752
|
fetch the funding rate for multiple markets
|
8752
8753
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8754,7 +8755,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8754
8755
|
:param str[]|None symbols: list of unified market symbols
|
8755
8756
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8756
8757
|
:param str [params.subType]: "linear" or "inverse"
|
8757
|
-
:returns dict: a
|
8758
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
8758
8759
|
"""
|
8759
8760
|
self.load_markets()
|
8760
8761
|
symbols = self.market_symbols(symbols)
|
@@ -8770,14 +8771,10 @@ class binance(Exchange, ImplicitAPI):
|
|
8770
8771
|
response = self.dapiPublicGetPremiumIndex(query)
|
8771
8772
|
else:
|
8772
8773
|
raise NotSupported(self.id + ' fetchFundingRates() supports linear and inverse contracts only')
|
8773
|
-
result =
|
8774
|
-
for i in range(0, len(response)):
|
8775
|
-
entry = response[i]
|
8776
|
-
parsed = self.parse_funding_rate(entry)
|
8777
|
-
result.append(parsed)
|
8774
|
+
result = self.parse_funding_rates(response)
|
8778
8775
|
return self.filter_by_array(result, 'symbol', symbols)
|
8779
8776
|
|
8780
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
8777
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
8781
8778
|
# ensure it matches with https://www.binance.com/en/futures/funding-history/0
|
8782
8779
|
#
|
8783
8780
|
# {
|
@@ -8818,6 +8815,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8818
8815
|
'previousFundingRate': None,
|
8819
8816
|
'previousFundingTimestamp': None,
|
8820
8817
|
'previousFundingDatetime': None,
|
8818
|
+
'interval': None,
|
8821
8819
|
}
|
8822
8820
|
|
8823
8821
|
def parse_account_positions(self, account, filterClosed=False):
|
ccxt/bingx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bingx import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -590,7 +590,6 @@ class bingx(Exchange, ImplicitAPI):
|
|
590
590
|
networkList = self.safe_list(entry, 'networkList')
|
591
591
|
networks: dict = {}
|
592
592
|
fee = None
|
593
|
-
active = None
|
594
593
|
depositEnabled = None
|
595
594
|
withdrawEnabled = None
|
596
595
|
defaultLimits: dict = {}
|
@@ -599,8 +598,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
599
598
|
network = self.safe_string(rawNetwork, 'network')
|
600
599
|
networkCode = self.network_id_to_code(network)
|
601
600
|
isDefault = self.safe_bool(rawNetwork, 'isDefault')
|
602
|
-
|
603
|
-
|
601
|
+
networkDepositEnabled = self.safe_bool(rawNetwork, 'depositEnable')
|
602
|
+
if networkDepositEnabled:
|
603
|
+
depositEnabled = True
|
604
|
+
networkWithdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
|
605
|
+
if networkDepositEnabled:
|
606
|
+
withdrawEnabled = True
|
604
607
|
limits: dict = {
|
605
608
|
'withdraw': {
|
606
609
|
'min': self.safe_number(rawNetwork, 'withdrawMin'),
|
@@ -609,19 +612,20 @@ class bingx(Exchange, ImplicitAPI):
|
|
609
612
|
}
|
610
613
|
if isDefault:
|
611
614
|
fee = self.safe_number(rawNetwork, 'withdrawFee')
|
612
|
-
active = depositEnabled or withdrawEnabled
|
613
615
|
defaultLimits = limits
|
616
|
+
networkActive = networkDepositEnabled or networkWithdrawEnabled
|
614
617
|
networks[networkCode] = {
|
615
618
|
'info': rawNetwork,
|
616
619
|
'id': network,
|
617
620
|
'network': networkCode,
|
618
621
|
'fee': fee,
|
619
|
-
'active':
|
620
|
-
'deposit':
|
621
|
-
'withdraw':
|
622
|
+
'active': networkActive,
|
623
|
+
'deposit': networkDepositEnabled,
|
624
|
+
'withdraw': networkWithdrawEnabled,
|
622
625
|
'precision': None,
|
623
626
|
'limits': limits,
|
624
627
|
}
|
628
|
+
active = depositEnabled or withdrawEnabled
|
625
629
|
result[code] = {
|
626
630
|
'info': entry,
|
627
631
|
'code': code,
|
@@ -1294,7 +1298,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1294
1298
|
timestamp = self.safe_integer_2(orderbook, 'T', 'ts')
|
1295
1299
|
return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1)
|
1296
1300
|
|
1297
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
1301
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1298
1302
|
"""
|
1299
1303
|
fetch the current funding rate
|
1300
1304
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
@@ -1332,28 +1336,22 @@ class bingx(Exchange, ImplicitAPI):
|
|
1332
1336
|
data = self.safe_list(response, 'data', [])
|
1333
1337
|
return self.parse_funding_rate(data, market)
|
1334
1338
|
|
1335
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
1339
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1336
1340
|
"""
|
1337
|
-
fetch the current funding rate
|
1341
|
+
fetch the current funding rate for multiple symbols
|
1338
1342
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
1339
1343
|
:param str[] [symbols]: list of unified market symbols
|
1340
1344
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1341
|
-
:returns dict: a `funding rate
|
1345
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1342
1346
|
"""
|
1343
1347
|
self.load_markets()
|
1344
1348
|
symbols = self.market_symbols(symbols, 'swap', True)
|
1345
1349
|
response = self.swapV2PublicGetQuotePremiumIndex(self.extend(params))
|
1346
1350
|
data = self.safe_list(response, 'data', [])
|
1347
|
-
|
1348
|
-
|
1349
|
-
item = data[i]
|
1350
|
-
marketId = self.safe_string(item, 'symbol')
|
1351
|
-
market = self.safe_market(marketId, None, None, 'swap')
|
1352
|
-
if (symbols is None) or self.in_array(market['symbol'], symbols):
|
1353
|
-
filteredResponse.append(self.parse_funding_rate(item, market))
|
1354
|
-
return filteredResponse
|
1351
|
+
result = self.parse_funding_rates(data)
|
1352
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
1355
1353
|
|
1356
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
1354
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
1357
1355
|
#
|
1358
1356
|
# {
|
1359
1357
|
# "symbol": "BTC-USDT",
|
@@ -1383,6 +1381,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1383
1381
|
'previousFundingRate': None,
|
1384
1382
|
'previousFundingTimestamp': None,
|
1385
1383
|
'previousFundingDatetime': None,
|
1384
|
+
'interval': None,
|
1386
1385
|
}
|
1387
1386
|
|
1388
1387
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|