ccxt 4.4.9__py2.py3-none-any.whl → 4.4.10__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/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 +8 -11
- ccxt/async_support/bingx.py +20 -21
- ccxt/async_support/bitfinex2.py +7 -16
- ccxt/async_support/bitget.py +8 -7
- 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 +23 -6
- ccxt/async_support/hyperliquid.py +6 -1
- ccxt/async_support/krakenfutures.py +6 -5
- ccxt/async_support/kucoinfutures.py +13 -2
- ccxt/async_support/mexc.py +4 -3
- ccxt/async_support/oceanex.py +80 -4
- ccxt/async_support/okx.py +17 -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 +8 -11
- ccxt/bingx.py +20 -21
- ccxt/bitfinex2.py +7 -16
- ccxt/bitget.py +8 -7
- 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 +23 -6
- ccxt/hyperliquid.py +6 -1
- ccxt/krakenfutures.py +6 -5
- ccxt/kucoinfutures.py +13 -2
- ccxt/mexc.py +4 -3
- ccxt/oceanex.py +80 -4
- ccxt/okx.py +17 -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 +39 -2
- ccxt/pro/gate.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.10.dist-info/METADATA +636 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.10.dist-info}/RECORD +76 -76
- ccxt-4.4.9.dist-info/METADATA +0 -636
- {ccxt-4.4.9.dist-info → ccxt-4.4.10.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.10.dist-info}/WHEEL +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.10.dist-info}/top_level.txt +0 -0
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
|
@@ -8642,7 +8642,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8642
8642
|
#
|
8643
8643
|
return self.parse_transfer(response, currency)
|
8644
8644
|
|
8645
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
8645
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
8646
8646
|
"""
|
8647
8647
|
fetch the current funding rate
|
8648
8648
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8689,7 +8689,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8689
8689
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
8690
8690
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8691
8691
|
: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 [
|
8692
|
+
: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
8693
|
:param str [params.subType]: "linear" or "inverse"
|
8694
8694
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
8695
8695
|
"""
|
@@ -8746,7 +8746,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8746
8746
|
sorted = self.sort_by(rates, 'timestamp')
|
8747
8747
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
8748
8748
|
|
8749
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
8749
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
8750
8750
|
"""
|
8751
8751
|
fetch the funding rate for multiple markets
|
8752
8752
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8754,7 +8754,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8754
8754
|
:param str[]|None symbols: list of unified market symbols
|
8755
8755
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8756
8756
|
:param str [params.subType]: "linear" or "inverse"
|
8757
|
-
:returns dict: a
|
8757
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
8758
8758
|
"""
|
8759
8759
|
self.load_markets()
|
8760
8760
|
symbols = self.market_symbols(symbols)
|
@@ -8770,14 +8770,10 @@ class binance(Exchange, ImplicitAPI):
|
|
8770
8770
|
response = self.dapiPublicGetPremiumIndex(query)
|
8771
8771
|
else:
|
8772
8772
|
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)
|
8773
|
+
result = self.parse_funding_rates(response)
|
8778
8774
|
return self.filter_by_array(result, 'symbol', symbols)
|
8779
8775
|
|
8780
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
8776
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
8781
8777
|
# ensure it matches with https://www.binance.com/en/futures/funding-history/0
|
8782
8778
|
#
|
8783
8779
|
# {
|
@@ -8818,6 +8814,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8818
8814
|
'previousFundingRate': None,
|
8819
8815
|
'previousFundingTimestamp': None,
|
8820
8816
|
'previousFundingDatetime': None,
|
8817
|
+
'interval': None,
|
8821
8818
|
}
|
8822
8819
|
|
8823
8820
|
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={}):
|
ccxt/bitfinex2.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitfinex2 import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, 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
|
@@ -82,7 +82,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
82
82
|
'fetchDepositAddress': True,
|
83
83
|
'fetchDepositsWithdrawals': True,
|
84
84
|
'fetchFundingHistory': False,
|
85
|
-
'fetchFundingRate':
|
85
|
+
'fetchFundingRate': 'emulated', # emulated in exchange
|
86
86
|
'fetchFundingRateHistory': True,
|
87
87
|
'fetchFundingRates': True,
|
88
88
|
'fetchIndexOHLCV': False,
|
@@ -2829,23 +2829,13 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2829
2829
|
ledgerObjects.append({'result': item})
|
2830
2830
|
return self.parse_ledger(ledgerObjects, currency, since, limit)
|
2831
2831
|
|
2832
|
-
def
|
2832
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2833
2833
|
"""
|
2834
|
-
fetch the current funding rate
|
2835
|
-
:see: https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
2836
|
-
:param str symbol: unified market symbol
|
2837
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2838
|
-
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2839
|
-
"""
|
2840
|
-
return self.fetch_funding_rates([symbol], params)
|
2841
|
-
|
2842
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2843
|
-
"""
|
2844
|
-
fetch the current funding rate
|
2834
|
+
fetch the current funding rate for multiple symbols
|
2845
2835
|
:see: https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
2846
2836
|
:param str[] symbols: list of unified market symbols
|
2847
2837
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2848
|
-
:returns dict: a `funding rate
|
2838
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2849
2839
|
"""
|
2850
2840
|
if symbols is None:
|
2851
2841
|
raise ArgumentsRequired(self.id + ' fetchFundingRates() requires a symbols argument')
|
@@ -2958,7 +2948,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2958
2948
|
reversedArray.append(valueAtIndex)
|
2959
2949
|
return reversedArray
|
2960
2950
|
|
2961
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2951
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2962
2952
|
#
|
2963
2953
|
# [
|
2964
2954
|
# "tBTCF0:USTF0",
|
@@ -3008,6 +2998,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
3008
2998
|
'previousFundingRate': None,
|
3009
2999
|
'previousFundingTimestamp': None,
|
3010
3000
|
'previousFundingDatetime': None,
|
3001
|
+
'interval': None,
|
3011
3002
|
}
|
3012
3003
|
|
3013
3004
|
def parse_funding_rate_history(self, contract, market: Market = None):
|
ccxt/bitget.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bitget import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, 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
|
@@ -1435,15 +1435,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
1435
1435
|
'sandboxMode': False,
|
1436
1436
|
'networks': {
|
1437
1437
|
'TRX': 'TRC20',
|
1438
|
-
'
|
1438
|
+
'ERC20': 'ERC20',
|
1439
1439
|
'BEP20': 'BSC',
|
1440
|
+
'ARB': 'ArbitrumOne',
|
1440
1441
|
'ZKSYNC': 'zkSyncEra',
|
1441
1442
|
'STARKNET': 'Starknet',
|
1442
|
-
'OPTIMISM': 'Optimism',
|
1443
|
-
'ARBITRUM': 'Arbitrum',
|
1444
1443
|
'APT': 'APTOS',
|
1445
|
-
'MATIC': '
|
1444
|
+
'MATIC': 'Polygon',
|
1446
1445
|
'VIC': 'VICTION',
|
1446
|
+
'AVAXC': 'C-Chain',
|
1447
1447
|
},
|
1448
1448
|
'networksById': {
|
1449
1449
|
},
|
@@ -6259,7 +6259,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6259
6259
|
sorted = self.sort_by(rates, 'timestamp')
|
6260
6260
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
6261
6261
|
|
6262
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
6262
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
6263
6263
|
"""
|
6264
6264
|
fetch the current funding rate
|
6265
6265
|
:see: https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
@@ -6300,7 +6300,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6300
6300
|
data = self.safe_value(response, 'data', [])
|
6301
6301
|
return self.parse_funding_rate(data[0], market)
|
6302
6302
|
|
6303
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
6303
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6304
6304
|
#
|
6305
6305
|
# {
|
6306
6306
|
# "symbol": "BTCUSDT",
|
@@ -6327,6 +6327,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6327
6327
|
'previousFundingRate': None,
|
6328
6328
|
'previousFundingTimestamp': None,
|
6329
6329
|
'previousFundingDatetime': None,
|
6330
|
+
'interval': None,
|
6330
6331
|
}
|
6331
6332
|
|
6332
6333
|
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[FundingHistory]:
|
ccxt/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -4138,7 +4138,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4138
4138
|
}
|
4139
4139
|
return self.privatePostContractPrivateSubmitLeverage(self.extend(request, params))
|
4140
4140
|
|
4141
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
4141
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
4142
4142
|
"""
|
4143
4143
|
fetch the current funding rate
|
4144
4144
|
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
@@ -4170,7 +4170,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4170
4170
|
data = self.safe_value(response, 'data', {})
|
4171
4171
|
return self.parse_funding_rate(data, market)
|
4172
4172
|
|
4173
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
4173
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
4174
4174
|
#
|
4175
4175
|
# {
|
4176
4176
|
# "timestamp": 1695184410697,
|
@@ -4199,6 +4199,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4199
4199
|
'previousFundingRate': self.safe_number(contract, 'rate_value'),
|
4200
4200
|
'previousFundingTimestamp': None,
|
4201
4201
|
'previousFundingDatetime': None,
|
4202
|
+
'interval': None,
|
4202
4203
|
}
|
4203
4204
|
|
4204
4205
|
def fetch_position(self, symbol: str, params={}):
|
ccxt/bitmex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -67,7 +67,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
67
67
|
'fetchDepositWithdrawFee': 'emulated',
|
68
68
|
'fetchDepositWithdrawFees': True,
|
69
69
|
'fetchFundingHistory': False,
|
70
|
-
'fetchFundingRate':
|
70
|
+
'fetchFundingRate': 'emulated', # emulated in exchange
|
71
71
|
'fetchFundingRateHistory': True,
|
72
72
|
'fetchFundingRates': True,
|
73
73
|
'fetchIndexOHLCV': False,
|
@@ -2331,13 +2331,13 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2331
2331
|
#
|
2332
2332
|
return self.parse_transaction(response, currency)
|
2333
2333
|
|
2334
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2334
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2335
2335
|
"""
|
2336
2336
|
fetch the funding rate for multiple markets
|
2337
2337
|
:see: https://www.bitmex.com/api/explorer/#not /Instrument/Instrument_getActiveAndIndices
|
2338
2338
|
:param str[]|None symbols: list of unified market symbols
|
2339
2339
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2340
|
-
:returns dict: a
|
2340
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
2341
2341
|
"""
|
2342
2342
|
self.load_markets()
|
2343
2343
|
response = self.publicGetInstrumentActiveAndIndices(params)
|
@@ -2354,7 +2354,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2354
2354
|
result = self.parse_funding_rates(filteredResponse)
|
2355
2355
|
return self.filter_by_array(result, 'symbol', symbols)
|
2356
2356
|
|
2357
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2357
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2358
2358
|
# see response sample under "fetchMarkets" because same endpoint is being used here
|
2359
2359
|
datetime = self.safe_string(contract, 'timestamp')
|
2360
2360
|
marketId = self.safe_string(contract, 'symbol')
|
@@ -2369,7 +2369,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2369
2369
|
'timestamp': self.parse8601(datetime),
|
2370
2370
|
'datetime': datetime,
|
2371
2371
|
'fundingRate': self.safe_number(contract, 'fundingRate'),
|
2372
|
-
'fundingTimestamp': self.iso8601(fundingDatetime),
|
2372
|
+
'fundingTimestamp': self.parse_to_numeric(self.iso8601(fundingDatetime)),
|
2373
2373
|
'fundingDatetime': fundingDatetime,
|
2374
2374
|
'nextFundingRate': self.safe_number(contract, 'indicativeFundingRate'),
|
2375
2375
|
'nextFundingTimestamp': None,
|
@@ -2377,6 +2377,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2377
2377
|
'previousFundingRate': None,
|
2378
2378
|
'previousFundingTimestamp': None,
|
2379
2379
|
'previousFundingDatetime': None,
|
2380
|
+
'interval': None,
|
2380
2381
|
}
|
2381
2382
|
|
2382
2383
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|