ccxt 4.4.21__py2.py3-none-any.whl → 4.4.23__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 +3 -1
- ccxt/abstract/binance.py +64 -43
- ccxt/abstract/binancecoinm.py +64 -43
- ccxt/abstract/binanceus.py +64 -43
- ccxt/abstract/binanceusdm.py +64 -43
- ccxt/abstract/bitflyer.py +1 -0
- ccxt/abstract/bitget.py +3 -0
- ccxt/abstract/cex.py +28 -29
- ccxt/abstract/coincatch.py +94 -0
- ccxt/abstract/gate.py +5 -0
- ccxt/abstract/gateio.py +5 -0
- ccxt/abstract/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/abstract/okx.py +1 -0
- ccxt/alpaca.py +1 -0
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/alpaca.py +1 -0
- ccxt/async_support/base/exchange.py +7 -1
- ccxt/async_support/bigone.py +3 -0
- ccxt/async_support/binance.py +183 -63
- ccxt/async_support/bitfinex.py +4 -0
- ccxt/async_support/bitflyer.py +57 -1
- ccxt/async_support/bitget.py +73 -1
- ccxt/async_support/bitrue.py +3 -0
- ccxt/async_support/bybit.py +76 -3
- ccxt/async_support/cex.py +1247 -1322
- ccxt/async_support/coinbase.py +1 -1
- ccxt/async_support/coinbaseexchange.py +3 -0
- ccxt/async_support/coincatch.py +4955 -0
- ccxt/async_support/coinex.py +60 -1
- ccxt/async_support/cryptocom.py +1 -1
- ccxt/async_support/gate.py +97 -2
- ccxt/async_support/htx.py +1 -5
- ccxt/async_support/hyperliquid.py +10 -8
- ccxt/async_support/kucoin.py +27 -57
- ccxt/async_support/latoken.py +6 -0
- ccxt/async_support/mexc.py +1 -1
- ccxt/async_support/oceanex.py +2 -0
- ccxt/async_support/okcoin.py +1 -0
- ccxt/async_support/okx.py +67 -1
- ccxt/async_support/poloniex.py +5 -0
- ccxt/base/exchange.py +21 -1
- ccxt/base/types.py +9 -0
- ccxt/bigone.py +3 -0
- ccxt/binance.py +183 -63
- ccxt/bitfinex.py +4 -0
- ccxt/bitflyer.py +57 -1
- ccxt/bitget.py +73 -1
- ccxt/bitrue.py +3 -0
- ccxt/bybit.py +76 -3
- ccxt/cex.py +1246 -1322
- ccxt/coinbase.py +1 -1
- ccxt/coinbaseexchange.py +3 -0
- ccxt/coincatch.py +4955 -0
- ccxt/coinex.py +60 -1
- ccxt/cryptocom.py +1 -1
- ccxt/gate.py +97 -2
- ccxt/htx.py +1 -5
- ccxt/hyperliquid.py +10 -8
- ccxt/kucoin.py +27 -57
- ccxt/latoken.py +6 -0
- ccxt/mexc.py +1 -1
- ccxt/oceanex.py +2 -0
- ccxt/okcoin.py +1 -0
- ccxt/okx.py +67 -1
- ccxt/poloniex.py +5 -0
- ccxt/pro/__init__.py +3 -1
- ccxt/pro/coincatch.py +1429 -0
- ccxt/test/tests_async.py +19 -5
- ccxt/test/tests_sync.py +19 -5
- ccxt-4.4.23.dist-info/METADATA +636 -0
- {ccxt-4.4.21.dist-info → ccxt-4.4.23.dist-info}/RECORD +75 -71
- ccxt-4.4.21.dist-info/METADATA +0 -635
- {ccxt-4.4.21.dist-info → ccxt-4.4.23.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.21.dist-info → ccxt-4.4.23.dist-info}/WHEEL +0 -0
- {ccxt-4.4.21.dist-info → ccxt-4.4.23.dist-info}/top_level.txt +0 -0
ccxt/bybit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import LongShortRatio, Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, 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
|
@@ -105,6 +105,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
105
105
|
'fetchLedger': True,
|
106
106
|
'fetchLeverage': True,
|
107
107
|
'fetchLeverageTiers': True,
|
108
|
+
'fetchLongShortRatio': False,
|
109
|
+
'fetchLongShortRatioHistory': True,
|
108
110
|
'fetchMarginAdjustmentHistory': False,
|
109
111
|
'fetchMarketLeverageTiers': True,
|
110
112
|
'fetchMarkets': True,
|
@@ -7085,13 +7087,13 @@ class bybit(Exchange, ImplicitAPI):
|
|
7085
7087
|
|
7086
7088
|
def parse_margin_loan(self, info, currency: Currency = None):
|
7087
7089
|
#
|
7088
|
-
#
|
7090
|
+
# borrowCrossMargin
|
7089
7091
|
#
|
7090
7092
|
# {
|
7091
7093
|
# "transactId": "14143"
|
7092
7094
|
# }
|
7093
7095
|
#
|
7094
|
-
#
|
7096
|
+
# repayCrossMargin
|
7095
7097
|
#
|
7096
7098
|
# {
|
7097
7099
|
# "repayId": "12128"
|
@@ -8664,6 +8666,77 @@ class bybit(Exchange, ImplicitAPI):
|
|
8664
8666
|
'fee': None,
|
8665
8667
|
}
|
8666
8668
|
|
8669
|
+
def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LongShortRatio]:
|
8670
|
+
"""
|
8671
|
+
fetches the long short ratio history for a unified market symbol
|
8672
|
+
:see: https://bybit-exchange.github.io/docs/v5/market/long-short-ratio
|
8673
|
+
:param str symbol: unified symbol of the market to fetch the long short ratio for
|
8674
|
+
:param str [timeframe]: the period for the ratio, default is 24 hours
|
8675
|
+
:param int [since]: the earliest time in ms to fetch ratios for
|
8676
|
+
:param int [limit]: the maximum number of long short ratio structures to retrieve
|
8677
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8678
|
+
:returns dict[]: an array of `long short ratio structures <https://docs.ccxt.com/#/?id=long-short-ratio-structure>`
|
8679
|
+
"""
|
8680
|
+
self.load_markets()
|
8681
|
+
market = self.market(symbol)
|
8682
|
+
type = None
|
8683
|
+
type, params = self.get_bybit_type('fetchLongShortRatioHistory', market, params)
|
8684
|
+
if type == 'spot' or type == 'option':
|
8685
|
+
raise NotSupported(self.id + ' fetchLongShortRatioHistory() only support linear and inverse markets')
|
8686
|
+
if timeframe is None:
|
8687
|
+
timeframe = '1d'
|
8688
|
+
request: dict = {
|
8689
|
+
'symbol': market['id'],
|
8690
|
+
'period': timeframe,
|
8691
|
+
'category': type,
|
8692
|
+
}
|
8693
|
+
if limit is not None:
|
8694
|
+
request['limit'] = limit
|
8695
|
+
response = self.publicGetV5MarketAccountRatio(self.extend(request, params))
|
8696
|
+
#
|
8697
|
+
# {
|
8698
|
+
# "retCode": 0,
|
8699
|
+
# "retMsg": "OK",
|
8700
|
+
# "result": {
|
8701
|
+
# "list": [
|
8702
|
+
# {
|
8703
|
+
# "symbol": "BTCUSDT",
|
8704
|
+
# "buyRatio": "0.5707",
|
8705
|
+
# "sellRatio": "0.4293",
|
8706
|
+
# "timestamp": "1729123200000"
|
8707
|
+
# },
|
8708
|
+
# ]
|
8709
|
+
# },
|
8710
|
+
# "retExtInfo": {},
|
8711
|
+
# "time": 1729147842516
|
8712
|
+
# }
|
8713
|
+
#
|
8714
|
+
result = self.safe_dict(response, 'result', {})
|
8715
|
+
data = self.safe_list(result, 'list', [])
|
8716
|
+
return self.parse_long_short_ratio_history(data, market)
|
8717
|
+
|
8718
|
+
def parse_long_short_ratio(self, info: dict, market: Market = None) -> LongShortRatio:
|
8719
|
+
#
|
8720
|
+
# {
|
8721
|
+
# "symbol": "BTCUSDT",
|
8722
|
+
# "buyRatio": "0.5707",
|
8723
|
+
# "sellRatio": "0.4293",
|
8724
|
+
# "timestamp": "1729123200000"
|
8725
|
+
# }
|
8726
|
+
#
|
8727
|
+
marketId = self.safe_string(info, 'symbol')
|
8728
|
+
timestamp = self.safe_integer_omit_zero(info, 'timestamp')
|
8729
|
+
longString = self.safe_string(info, 'buyRatio')
|
8730
|
+
shortString = self.safe_string(info, 'sellRatio')
|
8731
|
+
return {
|
8732
|
+
'info': info,
|
8733
|
+
'symbol': self.safe_symbol(marketId, market, None, 'contract'),
|
8734
|
+
'timestamp': timestamp,
|
8735
|
+
'datetime': self.iso8601(timestamp),
|
8736
|
+
'timeframe': None,
|
8737
|
+
'longShortRatio': self.parse_to_numeric(Precise.string_div(longString, shortString)),
|
8738
|
+
}
|
8739
|
+
|
8667
8740
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
8668
8741
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
8669
8742
|
if api == 'public':
|