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/__init__.py
CHANGED
ccxt/abstract/oceanex.py
CHANGED
@@ -20,3 +20,8 @@ class ImplicitAPI:
|
|
20
20
|
private_post_order_delete = privatePostOrderDelete = Entry('order/delete', 'private', 'POST', {})
|
21
21
|
private_post_order_delete_multi = privatePostOrderDeleteMulti = Entry('order/delete/multi', 'private', 'POST', {})
|
22
22
|
private_post_orders_clear = privatePostOrdersClear = Entry('orders/clear', 'private', 'POST', {})
|
23
|
+
private_post_withdraws_special_new = privatePostWithdrawsSpecialNew = Entry('/withdraws/special/new', 'private', 'POST', {})
|
24
|
+
private_post_deposit_address = privatePostDepositAddress = Entry('/deposit_address', 'private', 'POST', {})
|
25
|
+
private_post_deposit_addresses = privatePostDepositAddresses = Entry('/deposit_addresses', 'private', 'POST', {})
|
26
|
+
private_post_deposit_history = privatePostDepositHistory = Entry('/deposit_history', 'private', 'POST', {})
|
27
|
+
private_post_withdraw_history = privatePostWithdrawHistory = Entry('/withdraw_history', 'private', 'POST', {})
|
ccxt/ascendex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.ascendex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, 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
|
@@ -2619,7 +2619,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2619
2619
|
'takeProfitPrice': self.safe_number(position, 'takeProfitPrice'),
|
2620
2620
|
})
|
2621
2621
|
|
2622
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2622
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2623
2623
|
#
|
2624
2624
|
# {
|
2625
2625
|
# "time": 1640061364830,
|
@@ -2654,14 +2654,15 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2654
2654
|
'fundingRate': nextFundingRate,
|
2655
2655
|
'fundingTimestamp': nextFundingRateTimestamp,
|
2656
2656
|
'fundingDatetime': self.iso8601(nextFundingRateTimestamp),
|
2657
|
+
'interval': None,
|
2657
2658
|
}
|
2658
2659
|
|
2659
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2660
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2660
2661
|
"""
|
2661
2662
|
fetch the funding rate for multiple markets
|
2662
2663
|
:param str[]|None symbols: list of unified market symbols
|
2663
2664
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2664
|
-
:returns dict: a
|
2665
|
+
:returns dict[]: a list of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
|
2665
2666
|
"""
|
2666
2667
|
self.load_markets()
|
2667
2668
|
symbols = self.market_symbols(symbols)
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/ascendex.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.ascendex import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, 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
|
@@ -2620,7 +2620,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2620
2620
|
'takeProfitPrice': self.safe_number(position, 'takeProfitPrice'),
|
2621
2621
|
})
|
2622
2622
|
|
2623
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2623
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2624
2624
|
#
|
2625
2625
|
# {
|
2626
2626
|
# "time": 1640061364830,
|
@@ -2655,14 +2655,15 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2655
2655
|
'fundingRate': nextFundingRate,
|
2656
2656
|
'fundingTimestamp': nextFundingRateTimestamp,
|
2657
2657
|
'fundingDatetime': self.iso8601(nextFundingRateTimestamp),
|
2658
|
+
'interval': None,
|
2658
2659
|
}
|
2659
2660
|
|
2660
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2661
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2661
2662
|
"""
|
2662
2663
|
fetch the funding rate for multiple markets
|
2663
2664
|
:param str[]|None symbols: list of unified market symbols
|
2664
2665
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2665
|
-
:returns dict: a
|
2666
|
+
:returns dict[]: a list of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
|
2666
2667
|
"""
|
2667
2668
|
await self.load_markets()
|
2668
2669
|
symbols = self.market_symbols(symbols)
|
ccxt/async_support/binance.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
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
|
11
|
+
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
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -8643,7 +8643,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8643
8643
|
#
|
8644
8644
|
return self.parse_transfer(response, currency)
|
8645
8645
|
|
8646
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
8646
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
8647
8647
|
"""
|
8648
8648
|
fetch the current funding rate
|
8649
8649
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8690,7 +8690,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8690
8690
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
8691
8691
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8692
8692
|
:param int [params.until]: timestamp in ms of the latest funding rate
|
8693
|
-
: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)
|
8694
8694
|
:param str [params.subType]: "linear" or "inverse"
|
8695
8695
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
8696
8696
|
"""
|
@@ -8747,7 +8747,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8747
8747
|
sorted = self.sort_by(rates, 'timestamp')
|
8748
8748
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
8749
8749
|
|
8750
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
8750
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
8751
8751
|
"""
|
8752
8752
|
fetch the funding rate for multiple markets
|
8753
8753
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
|
@@ -8755,7 +8755,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8755
8755
|
:param str[]|None symbols: list of unified market symbols
|
8756
8756
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8757
8757
|
:param str [params.subType]: "linear" or "inverse"
|
8758
|
-
:returns dict: a
|
8758
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
8759
8759
|
"""
|
8760
8760
|
await self.load_markets()
|
8761
8761
|
symbols = self.market_symbols(symbols)
|
@@ -8771,14 +8771,10 @@ class binance(Exchange, ImplicitAPI):
|
|
8771
8771
|
response = await self.dapiPublicGetPremiumIndex(query)
|
8772
8772
|
else:
|
8773
8773
|
raise NotSupported(self.id + ' fetchFundingRates() supports linear and inverse contracts only')
|
8774
|
-
result =
|
8775
|
-
for i in range(0, len(response)):
|
8776
|
-
entry = response[i]
|
8777
|
-
parsed = self.parse_funding_rate(entry)
|
8778
|
-
result.append(parsed)
|
8774
|
+
result = self.parse_funding_rates(response)
|
8779
8775
|
return self.filter_by_array(result, 'symbol', symbols)
|
8780
8776
|
|
8781
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
8777
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
8782
8778
|
# ensure it matches with https://www.binance.com/en/futures/funding-history/0
|
8783
8779
|
#
|
8784
8780
|
# {
|
@@ -8819,6 +8815,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8819
8815
|
'previousFundingRate': None,
|
8820
8816
|
'previousFundingTimestamp': None,
|
8821
8817
|
'previousFundingDatetime': None,
|
8818
|
+
'interval': None,
|
8822
8819
|
}
|
8823
8820
|
|
8824
8821
|
def parse_account_positions(self, account, filterClosed=False):
|
ccxt/async_support/bingx.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.bingx import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import numbers
|
11
|
-
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
|
11
|
+
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
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -591,7 +591,6 @@ class bingx(Exchange, ImplicitAPI):
|
|
591
591
|
networkList = self.safe_list(entry, 'networkList')
|
592
592
|
networks: dict = {}
|
593
593
|
fee = None
|
594
|
-
active = None
|
595
594
|
depositEnabled = None
|
596
595
|
withdrawEnabled = None
|
597
596
|
defaultLimits: dict = {}
|
@@ -600,8 +599,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
600
599
|
network = self.safe_string(rawNetwork, 'network')
|
601
600
|
networkCode = self.network_id_to_code(network)
|
602
601
|
isDefault = self.safe_bool(rawNetwork, 'isDefault')
|
603
|
-
|
604
|
-
|
602
|
+
networkDepositEnabled = self.safe_bool(rawNetwork, 'depositEnable')
|
603
|
+
if networkDepositEnabled:
|
604
|
+
depositEnabled = True
|
605
|
+
networkWithdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
|
606
|
+
if networkDepositEnabled:
|
607
|
+
withdrawEnabled = True
|
605
608
|
limits: dict = {
|
606
609
|
'withdraw': {
|
607
610
|
'min': self.safe_number(rawNetwork, 'withdrawMin'),
|
@@ -610,19 +613,20 @@ class bingx(Exchange, ImplicitAPI):
|
|
610
613
|
}
|
611
614
|
if isDefault:
|
612
615
|
fee = self.safe_number(rawNetwork, 'withdrawFee')
|
613
|
-
active = depositEnabled or withdrawEnabled
|
614
616
|
defaultLimits = limits
|
617
|
+
networkActive = networkDepositEnabled or networkWithdrawEnabled
|
615
618
|
networks[networkCode] = {
|
616
619
|
'info': rawNetwork,
|
617
620
|
'id': network,
|
618
621
|
'network': networkCode,
|
619
622
|
'fee': fee,
|
620
|
-
'active':
|
621
|
-
'deposit':
|
622
|
-
'withdraw':
|
623
|
+
'active': networkActive,
|
624
|
+
'deposit': networkDepositEnabled,
|
625
|
+
'withdraw': networkWithdrawEnabled,
|
623
626
|
'precision': None,
|
624
627
|
'limits': limits,
|
625
628
|
}
|
629
|
+
active = depositEnabled or withdrawEnabled
|
626
630
|
result[code] = {
|
627
631
|
'info': entry,
|
628
632
|
'code': code,
|
@@ -1295,7 +1299,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1295
1299
|
timestamp = self.safe_integer_2(orderbook, 'T', 'ts')
|
1296
1300
|
return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1)
|
1297
1301
|
|
1298
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
1302
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1299
1303
|
"""
|
1300
1304
|
fetch the current funding rate
|
1301
1305
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
@@ -1333,28 +1337,22 @@ class bingx(Exchange, ImplicitAPI):
|
|
1333
1337
|
data = self.safe_list(response, 'data', [])
|
1334
1338
|
return self.parse_funding_rate(data, market)
|
1335
1339
|
|
1336
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
1340
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1337
1341
|
"""
|
1338
|
-
fetch the current funding rate
|
1342
|
+
fetch the current funding rate for multiple symbols
|
1339
1343
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
1340
1344
|
:param str[] [symbols]: list of unified market symbols
|
1341
1345
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1342
|
-
:returns dict: a `funding rate
|
1346
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1343
1347
|
"""
|
1344
1348
|
await self.load_markets()
|
1345
1349
|
symbols = self.market_symbols(symbols, 'swap', True)
|
1346
1350
|
response = await self.swapV2PublicGetQuotePremiumIndex(self.extend(params))
|
1347
1351
|
data = self.safe_list(response, 'data', [])
|
1348
|
-
|
1349
|
-
|
1350
|
-
item = data[i]
|
1351
|
-
marketId = self.safe_string(item, 'symbol')
|
1352
|
-
market = self.safe_market(marketId, None, None, 'swap')
|
1353
|
-
if (symbols is None) or self.in_array(market['symbol'], symbols):
|
1354
|
-
filteredResponse.append(self.parse_funding_rate(item, market))
|
1355
|
-
return filteredResponse
|
1352
|
+
result = self.parse_funding_rates(data)
|
1353
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
1356
1354
|
|
1357
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
1355
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
1358
1356
|
#
|
1359
1357
|
# {
|
1360
1358
|
# "symbol": "BTC-USDT",
|
@@ -1384,6 +1382,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1384
1382
|
'previousFundingRate': None,
|
1385
1383
|
'previousFundingTimestamp': None,
|
1386
1384
|
'previousFundingDatetime': None,
|
1385
|
+
'interval': None,
|
1387
1386
|
}
|
1388
1387
|
|
1389
1388
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bitfinex2 import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
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
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -83,7 +83,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
83
83
|
'fetchDepositAddress': True,
|
84
84
|
'fetchDepositsWithdrawals': True,
|
85
85
|
'fetchFundingHistory': False,
|
86
|
-
'fetchFundingRate':
|
86
|
+
'fetchFundingRate': 'emulated', # emulated in exchange
|
87
87
|
'fetchFundingRateHistory': True,
|
88
88
|
'fetchFundingRates': True,
|
89
89
|
'fetchIndexOHLCV': False,
|
@@ -2830,23 +2830,13 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2830
2830
|
ledgerObjects.append({'result': item})
|
2831
2831
|
return self.parse_ledger(ledgerObjects, currency, since, limit)
|
2832
2832
|
|
2833
|
-
async def
|
2833
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2834
2834
|
"""
|
2835
|
-
fetch the current funding rate
|
2836
|
-
:see: https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
2837
|
-
:param str symbol: unified market symbol
|
2838
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2839
|
-
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2840
|
-
"""
|
2841
|
-
return await self.fetch_funding_rates([symbol], params)
|
2842
|
-
|
2843
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2844
|
-
"""
|
2845
|
-
fetch the current funding rate
|
2835
|
+
fetch the current funding rate for multiple symbols
|
2846
2836
|
:see: https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
2847
2837
|
:param str[] symbols: list of unified market symbols
|
2848
2838
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2849
|
-
:returns dict: a `funding rate
|
2839
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2850
2840
|
"""
|
2851
2841
|
if symbols is None:
|
2852
2842
|
raise ArgumentsRequired(self.id + ' fetchFundingRates() requires a symbols argument')
|
@@ -2959,7 +2949,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2959
2949
|
reversedArray.append(valueAtIndex)
|
2960
2950
|
return reversedArray
|
2961
2951
|
|
2962
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2952
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2963
2953
|
#
|
2964
2954
|
# [
|
2965
2955
|
# "tBTCF0:USTF0",
|
@@ -3009,6 +2999,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
3009
2999
|
'previousFundingRate': None,
|
3010
3000
|
'previousFundingTimestamp': None,
|
3011
3001
|
'previousFundingDatetime': None,
|
3002
|
+
'interval': None,
|
3012
3003
|
}
|
3013
3004
|
|
3014
3005
|
def parse_funding_rate_history(self, contract, market: Market = None):
|
ccxt/async_support/bitget.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.bitget import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
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
|
11
|
+
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
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -1436,15 +1436,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
1436
1436
|
'sandboxMode': False,
|
1437
1437
|
'networks': {
|
1438
1438
|
'TRX': 'TRC20',
|
1439
|
-
'
|
1439
|
+
'ERC20': 'ERC20',
|
1440
1440
|
'BEP20': 'BSC',
|
1441
|
+
'ARB': 'ArbitrumOne',
|
1441
1442
|
'ZKSYNC': 'zkSyncEra',
|
1442
1443
|
'STARKNET': 'Starknet',
|
1443
|
-
'OPTIMISM': 'Optimism',
|
1444
|
-
'ARBITRUM': 'Arbitrum',
|
1445
1444
|
'APT': 'APTOS',
|
1446
|
-
'MATIC': '
|
1445
|
+
'MATIC': 'Polygon',
|
1447
1446
|
'VIC': 'VICTION',
|
1447
|
+
'AVAXC': 'C-Chain',
|
1448
1448
|
},
|
1449
1449
|
'networksById': {
|
1450
1450
|
},
|
@@ -6260,7 +6260,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6260
6260
|
sorted = self.sort_by(rates, 'timestamp')
|
6261
6261
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
6262
6262
|
|
6263
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
6263
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
6264
6264
|
"""
|
6265
6265
|
fetch the current funding rate
|
6266
6266
|
:see: https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
@@ -6301,7 +6301,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6301
6301
|
data = self.safe_value(response, 'data', [])
|
6302
6302
|
return self.parse_funding_rate(data[0], market)
|
6303
6303
|
|
6304
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
6304
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6305
6305
|
#
|
6306
6306
|
# {
|
6307
6307
|
# "symbol": "BTCUSDT",
|
@@ -6328,6 +6328,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6328
6328
|
'previousFundingRate': None,
|
6329
6329
|
'previousFundingTimestamp': None,
|
6330
6330
|
'previousFundingDatetime': None,
|
6331
|
+
'interval': None,
|
6331
6332
|
}
|
6332
6333
|
|
6333
6334
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[FundingHistory]:
|
ccxt/async_support/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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 await self.privatePostContractPrivateSubmitLeverage(self.extend(request, params))
|
4140
4140
|
|
4141
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
4141
|
+
async 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
|
async def fetch_position(self, symbol: str, params={}):
|
ccxt/async_support/bitmex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2334
|
+
async 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
|
await self.load_markets()
|
2343
2343
|
response = await 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
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/async_support/blofin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.blofin import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, LedgerEntry, Leverage, Leverages, MarginMode, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, LedgerEntry, Leverage, Leverages, MarginMode, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, 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
|
@@ -768,23 +768,16 @@ class blofin(Exchange, ImplicitAPI):
|
|
768
768
|
sorted = self.sort_by(rates, 'timestamp')
|
769
769
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
770
770
|
|
771
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
771
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
772
772
|
#
|
773
773
|
# {
|
774
774
|
# "fundingRate": "0.00027815",
|
775
775
|
# "fundingTime": "1634256000000",
|
776
776
|
# "instId": "BTC-USD-SWAP",
|
777
|
-
# "instType": "SWAP",
|
778
|
-
# "nextFundingRate": "0.00017",
|
779
|
-
# "nextFundingTime": "1634284800000"
|
780
777
|
# }
|
781
778
|
#
|
782
|
-
# in the response above nextFundingRate is actually two funding rates from now
|
783
|
-
#
|
784
|
-
nextFundingRateTimestamp = self.safe_integer(contract, 'nextFundingTime')
|
785
779
|
marketId = self.safe_string(contract, 'instId')
|
786
780
|
symbol = self.safe_symbol(marketId, market)
|
787
|
-
nextFundingRate = self.safe_number(contract, 'nextFundingRate')
|
788
781
|
fundingTime = self.safe_integer(contract, 'fundingTime')
|
789
782
|
# > The current interest is 0.
|
790
783
|
return {
|
@@ -799,15 +792,16 @@ class blofin(Exchange, ImplicitAPI):
|
|
799
792
|
'fundingRate': self.safe_number(contract, 'fundingRate'),
|
800
793
|
'fundingTimestamp': fundingTime,
|
801
794
|
'fundingDatetime': self.iso8601(fundingTime),
|
802
|
-
'nextFundingRate':
|
803
|
-
'nextFundingTimestamp':
|
804
|
-
'nextFundingDatetime':
|
795
|
+
'nextFundingRate': None,
|
796
|
+
'nextFundingTimestamp': None,
|
797
|
+
'nextFundingDatetime': None,
|
805
798
|
'previousFundingRate': None,
|
806
799
|
'previousFundingTimestamp': None,
|
807
800
|
'previousFundingDatetime': None,
|
801
|
+
'interval': None,
|
808
802
|
}
|
809
803
|
|
810
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
804
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
811
805
|
"""
|
812
806
|
fetch the current funding rate
|
813
807
|
:see: https://blofin.com/docs#get-funding-rate
|
@@ -831,9 +825,6 @@ class blofin(Exchange, ImplicitAPI):
|
|
831
825
|
# "fundingRate": "0.00027815",
|
832
826
|
# "fundingTime": "1634256000000",
|
833
827
|
# "instId": "BTC-USD-SWAP",
|
834
|
-
# "instType": "SWAP",
|
835
|
-
# "nextFundingRate": "0.00017",
|
836
|
-
# "nextFundingTime": "1634284800000"
|
837
828
|
# }
|
838
829
|
# ],
|
839
830
|
# "msg": ""
|