ccxt 4.4.8__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/bigone.py +1 -1
- ccxt/abstract/kucoinfutures.py +5 -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/bigone.py +35 -86
- ccxt/async_support/binance.py +8 -11
- ccxt/async_support/bingx.py +27 -23
- ccxt/async_support/bitfinex2.py +7 -16
- ccxt/async_support/bitget.py +10 -6
- 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 +22 -17
- 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 +61 -13
- ccxt/async_support/hashkey.py +6 -6
- ccxt/async_support/hitbtc.py +6 -5
- ccxt/async_support/htx.py +25 -6
- ccxt/async_support/hyperliquid.py +6 -1
- ccxt/async_support/krakenfutures.py +6 -5
- ccxt/async_support/kucoin.py +1 -0
- ccxt/async_support/kucoinfutures.py +164 -4
- 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/bigone.py +35 -86
- ccxt/binance.py +8 -11
- ccxt/bingx.py +27 -23
- ccxt/bitfinex2.py +7 -16
- ccxt/bitget.py +10 -6
- ccxt/bitmart.py +4 -3
- ccxt/bitmex.py +7 -6
- ccxt/blofin.py +7 -16
- ccxt/bybit.py +22 -17
- ccxt/coinex.py +19 -5
- ccxt/delta.py +6 -5
- ccxt/deribit.py +4 -3
- ccxt/digifinex.py +18 -4
- ccxt/gate.py +61 -13
- ccxt/hashkey.py +6 -6
- ccxt/hitbtc.py +6 -5
- ccxt/htx.py +25 -6
- ccxt/hyperliquid.py +6 -1
- ccxt/krakenfutures.py +6 -5
- ccxt/kucoin.py +1 -0
- ccxt/kucoinfutures.py +164 -4
- 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/binance.py +3 -3
- ccxt/pro/deribit.py +39 -2
- ccxt/pro/gate.py +1 -1
- ccxt/pro/hitbtc.py +112 -44
- ccxt/pro/hollaex.py +5 -0
- ccxt/pro/okx.py +12 -1
- ccxt/pro/p2b.py +33 -2
- ccxt/pro/whitebit.py +29 -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.8.dist-info → ccxt-4.4.10.dist-info}/RECORD +88 -88
- ccxt-4.4.8.dist-info/METADATA +0 -636
- {ccxt-4.4.8.dist-info → ccxt-4.4.10.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.8.dist-info → ccxt-4.4.10.dist-info}/WHEEL +0 -0
- {ccxt-4.4.8.dist-info → ccxt-4.4.10.dist-info}/top_level.txt +0 -0
ccxt/bigone.py
CHANGED
@@ -167,7 +167,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
167
167
|
},
|
168
168
|
'webExchange': {
|
169
169
|
'get': [
|
170
|
-
'
|
170
|
+
'v3/assets',
|
171
171
|
],
|
172
172
|
},
|
173
173
|
},
|
@@ -346,7 +346,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
346
346
|
:returns dict: an associative dictionary of currencies
|
347
347
|
"""
|
348
348
|
# we use undocumented link(possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
|
349
|
-
data = self.fetch_web_endpoint('fetchCurrencies', '
|
349
|
+
data = self.fetch_web_endpoint('fetchCurrencies', 'webExchangeGetV3Assets', True)
|
350
350
|
if data is None:
|
351
351
|
return None
|
352
352
|
#
|
@@ -355,91 +355,40 @@ class bigone(Exchange, ImplicitAPI):
|
|
355
355
|
# "message": "",
|
356
356
|
# "data": [
|
357
357
|
# {
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
358
|
+
# "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
|
359
|
+
# "symbol": "USDT",
|
360
|
+
# "name": "TetherUS",
|
361
|
+
# "scale": 12,
|
362
|
+
# "is_fiat": False,
|
363
|
+
# "is_transfer_enabled": True,
|
364
|
+
# "transfer_scale": 12,
|
365
|
+
# "binding_gateways": [
|
366
|
+
# {
|
367
|
+
# "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
|
368
|
+
# "is_deposit_enabled": True,
|
369
|
+
# "gateway_name": "Ethereum",
|
370
|
+
# "min_withdrawal_amount": "0.000001",
|
371
|
+
# "withdrawal_fee": "5.71",
|
372
|
+
# "is_withdrawal_enabled": True,
|
373
|
+
# "min_deposit_amount": "0.000001",
|
374
|
+
# "is_memo_required": False,
|
375
|
+
# "withdrawal_scale": 6,
|
376
|
+
# "scale": 12
|
377
|
+
# },
|
378
|
+
# {
|
379
|
+
# "guid": "4e387a9a-a480-40a3-b4ae-ed1773c2db5a",
|
380
|
+
# "is_deposit_enabled": True,
|
381
|
+
# "gateway_name": "BinanceSmartChain",
|
382
|
+
# "min_withdrawal_amount": "10",
|
383
|
+
# "withdrawal_fee": "5",
|
384
|
+
# "is_withdrawal_enabled": False,
|
385
|
+
# "min_deposit_amount": "1",
|
386
|
+
# "is_memo_required": False,
|
387
|
+
# "withdrawal_scale": 8,
|
388
|
+
# "scale": 12
|
389
|
+
# }
|
390
|
+
# ]
|
370
391
|
# },
|
371
|
-
# "info_link": null,
|
372
|
-
# "scale": "12",
|
373
|
-
# "default_gateway": ..., # one object from "gateways"
|
374
|
-
# "gateways": [
|
375
|
-
# {
|
376
|
-
# "uuid": "f0fa5a85-7f65-428a-b7b7-13aad55c2837",
|
377
|
-
# "name": "Mixin",
|
378
|
-
# "kind": "CHAIN",
|
379
|
-
# "required_confirmations": "0",
|
380
|
-
# },
|
381
|
-
# {
|
382
|
-
# "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
|
383
|
-
# "name": "Ethereum",
|
384
|
-
# "kind": "CHAIN",
|
385
|
-
# "required_confirmations": "18",
|
386
|
-
# },
|
387
|
-
# {
|
388
|
-
# "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
|
389
|
-
# "name": "Tron",
|
390
|
-
# "kind": "CHAIN",
|
391
|
-
# "required_confirmations": "1",
|
392
|
-
# },
|
393
|
-
# ...
|
394
|
-
# ],
|
395
|
-
# "payments": [],
|
396
|
-
# "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
|
397
|
-
# "binding_gateways": [
|
398
|
-
# {
|
399
|
-
# "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
|
400
|
-
# "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
401
|
-
# "is_deposit_enabled": True,
|
402
|
-
# "display_name": "Ethereum(ERC20)",
|
403
|
-
# "gateway_name": "Ethereum",
|
404
|
-
# "min_withdrawal_amount": "0.000001",
|
405
|
-
# "min_internal_withdrawal_amount": "0.00000001",
|
406
|
-
# "withdrawal_fee": "14",
|
407
|
-
# "is_withdrawal_enabled": True,
|
408
|
-
# "min_deposit_amount": "0.000001",
|
409
|
-
# "is_memo_required": False,
|
410
|
-
# "withdrawal_scale": "2",
|
411
|
-
# "gateway": {
|
412
|
-
# "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
|
413
|
-
# "name": "Ethereum",
|
414
|
-
# "kind": "CHAIN",
|
415
|
-
# "required_confirmations": "18",
|
416
|
-
# },
|
417
|
-
# "scale": "12",
|
418
|
-
# },
|
419
|
-
# {
|
420
|
-
# "guid": "b80a4d13-cac7-4319-842d-b33c3bfab8ec",
|
421
|
-
# "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
422
|
-
# "is_deposit_enabled": True,
|
423
|
-
# "display_name": "Tron(TRC20)",
|
424
|
-
# "gateway_name": "Tron",
|
425
|
-
# "min_withdrawal_amount": "0.000001",
|
426
|
-
# "min_internal_withdrawal_amount": "0.00000001",
|
427
|
-
# "withdrawal_fee": "1",
|
428
|
-
# "is_withdrawal_enabled": True,
|
429
|
-
# "min_deposit_amount": "0.000001",
|
430
|
-
# "is_memo_required": False,
|
431
|
-
# "withdrawal_scale": "6",
|
432
|
-
# "gateway": {
|
433
|
-
# "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
|
434
|
-
# "name": "Tron",
|
435
|
-
# "kind": "CHAIN",
|
436
|
-
# "required_confirmations": "1",
|
437
|
-
# },
|
438
|
-
# "scale": "12",
|
439
|
-
# },
|
440
|
-
# ...
|
441
|
-
# ],
|
442
|
-
# },
|
443
392
|
# ...
|
444
393
|
# ],
|
445
394
|
# }
|
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,
|
@@ -654,7 +658,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
654
658
|
# "maxNotional": 20000,
|
655
659
|
# "status": 1,
|
656
660
|
# "tickSize": 0.000001,
|
657
|
-
# "stepSize": 1
|
661
|
+
# "stepSize": 1,
|
662
|
+
# "apiStateSell": True,
|
663
|
+
# "apiStateBuy": True,
|
664
|
+
# "timeOnline": 0,
|
665
|
+
# "offTime": 0,
|
666
|
+
# "maintainTime": 0
|
658
667
|
# },
|
659
668
|
# ...
|
660
669
|
# ]
|
@@ -758,7 +767,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
758
767
|
isActive = False
|
759
768
|
if (self.safe_string(market, 'apiStateOpen') == 'true') and (self.safe_string(market, 'apiStateClose') == 'true'):
|
760
769
|
isActive = True # swap active
|
761
|
-
elif self.safe_bool(market, 'apiStateSell') and self.safe_bool(market, 'apiStateBuy'):
|
770
|
+
elif self.safe_bool(market, 'apiStateSell') and self.safe_bool(market, 'apiStateBuy') and (self.safe_number(market, 'status') == 1):
|
762
771
|
isActive = True # spot active
|
763
772
|
isInverse = None if (spot) else checkIsInverse
|
764
773
|
isLinear = None if (spot) else checkIsLinear
|
@@ -1289,7 +1298,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1289
1298
|
timestamp = self.safe_integer_2(orderbook, 'T', 'ts')
|
1290
1299
|
return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1)
|
1291
1300
|
|
1292
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
1301
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1293
1302
|
"""
|
1294
1303
|
fetch the current funding rate
|
1295
1304
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
@@ -1327,28 +1336,22 @@ class bingx(Exchange, ImplicitAPI):
|
|
1327
1336
|
data = self.safe_list(response, 'data', [])
|
1328
1337
|
return self.parse_funding_rate(data, market)
|
1329
1338
|
|
1330
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
1339
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1331
1340
|
"""
|
1332
|
-
fetch the current funding rate
|
1341
|
+
fetch the current funding rate for multiple symbols
|
1333
1342
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
1334
1343
|
:param str[] [symbols]: list of unified market symbols
|
1335
1344
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1336
|
-
:returns dict: a `funding rate
|
1345
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1337
1346
|
"""
|
1338
1347
|
self.load_markets()
|
1339
1348
|
symbols = self.market_symbols(symbols, 'swap', True)
|
1340
1349
|
response = self.swapV2PublicGetQuotePremiumIndex(self.extend(params))
|
1341
1350
|
data = self.safe_list(response, 'data', [])
|
1342
|
-
|
1343
|
-
|
1344
|
-
item = data[i]
|
1345
|
-
marketId = self.safe_string(item, 'symbol')
|
1346
|
-
market = self.safe_market(marketId, None, None, 'swap')
|
1347
|
-
if (symbols is None) or self.in_array(market['symbol'], symbols):
|
1348
|
-
filteredResponse.append(self.parse_funding_rate(item, market))
|
1349
|
-
return filteredResponse
|
1351
|
+
result = self.parse_funding_rates(data)
|
1352
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
1350
1353
|
|
1351
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
1354
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
1352
1355
|
#
|
1353
1356
|
# {
|
1354
1357
|
# "symbol": "BTC-USDT",
|
@@ -1378,6 +1381,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1378
1381
|
'previousFundingRate': None,
|
1379
1382
|
'previousFundingTimestamp': None,
|
1380
1383
|
'previousFundingDatetime': None,
|
1384
|
+
'interval': None,
|
1381
1385
|
}
|
1382
1386
|
|
1383
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,12 +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
|
-
'
|
1443
|
-
'
|
1443
|
+
'APT': 'APTOS',
|
1444
|
+
'MATIC': 'Polygon',
|
1445
|
+
'VIC': 'VICTION',
|
1446
|
+
'AVAXC': 'C-Chain',
|
1444
1447
|
},
|
1445
1448
|
'networksById': {
|
1446
1449
|
},
|
@@ -6256,7 +6259,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6256
6259
|
sorted = self.sort_by(rates, 'timestamp')
|
6257
6260
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
6258
6261
|
|
6259
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
6262
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
6260
6263
|
"""
|
6261
6264
|
fetch the current funding rate
|
6262
6265
|
:see: https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
@@ -6297,7 +6300,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6297
6300
|
data = self.safe_value(response, 'data', [])
|
6298
6301
|
return self.parse_funding_rate(data[0], market)
|
6299
6302
|
|
6300
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
6303
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6301
6304
|
#
|
6302
6305
|
# {
|
6303
6306
|
# "symbol": "BTCUSDT",
|
@@ -6324,6 +6327,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6324
6327
|
'previousFundingRate': None,
|
6325
6328
|
'previousFundingTimestamp': None,
|
6326
6329
|
'previousFundingDatetime': None,
|
6330
|
+
'interval': None,
|
6327
6331
|
}
|
6328
6332
|
|
6329
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={}):
|
ccxt/blofin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.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
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
804
|
+
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": ""
|