ccxt 4.3.30__py2.py3-none-any.whl → 4.3.31__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +2 -0
- ccxt/abstract/binancecoinm.py +2 -0
- ccxt/abstract/binanceus.py +2 -0
- ccxt/abstract/binanceusdm.py +2 -0
- ccxt/ace.py +14 -14
- ccxt/alpaca.py +16 -16
- ccxt/ascendex.py +46 -46
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +14 -14
- ccxt/async_support/alpaca.py +16 -16
- ccxt/async_support/ascendex.py +46 -46
- ccxt/async_support/base/exchange.py +23 -23
- ccxt/async_support/bigone.py +32 -32
- ccxt/async_support/binance.py +105 -96
- ccxt/async_support/bingx.py +21 -21
- ccxt/async_support/bit2c.py +13 -13
- ccxt/async_support/bitbank.py +19 -19
- ccxt/async_support/bitbns.py +17 -17
- ccxt/async_support/bitfinex.py +24 -24
- ccxt/async_support/bitfinex2.py +142 -109
- ccxt/async_support/bitflyer.py +23 -23
- ccxt/async_support/bitget.py +76 -76
- ccxt/async_support/bithumb.py +20 -20
- ccxt/async_support/bitmart.py +55 -55
- ccxt/async_support/bitmex.py +41 -41
- ccxt/async_support/bitopro.py +30 -30
- ccxt/async_support/bitrue.py +37 -37
- ccxt/async_support/bitso.py +30 -30
- ccxt/async_support/bitstamp.py +31 -31
- ccxt/async_support/bitteam.py +26 -26
- ccxt/async_support/bitvavo.py +27 -27
- ccxt/async_support/bl3p.py +8 -8
- ccxt/async_support/blockchaincom.py +24 -24
- ccxt/async_support/blofin.py +37 -37
- ccxt/async_support/btcalpha.py +19 -19
- ccxt/async_support/btcbox.py +11 -11
- ccxt/async_support/btcmarkets.py +22 -22
- ccxt/async_support/btcturk.py +13 -13
- ccxt/async_support/bybit.py +96 -96
- ccxt/async_support/cex.py +21 -21
- ccxt/async_support/coinbase.py +53 -53
- ccxt/async_support/coinbaseexchange.py +29 -29
- ccxt/async_support/coinbaseinternational.py +32 -32
- ccxt/async_support/coincheck.py +14 -14
- ccxt/async_support/coinex.py +168 -139
- ccxt/async_support/coinlist.py +35 -35
- ccxt/async_support/coinmate.py +22 -22
- ccxt/async_support/coinmetro.py +22 -22
- ccxt/async_support/coinone.py +18 -18
- ccxt/async_support/coinsph.py +32 -32
- ccxt/async_support/coinspot.py +8 -8
- ccxt/async_support/cryptocom.py +43 -43
- ccxt/async_support/currencycom.py +33 -33
- ccxt/async_support/delta.py +35 -35
- ccxt/async_support/deribit.py +54 -54
- ccxt/async_support/digifinex.py +56 -56
- ccxt/async_support/exmo.py +34 -34
- ccxt/async_support/gate.py +60 -60
- ccxt/async_support/gemini.py +24 -24
- ccxt/async_support/hitbtc.py +51 -51
- ccxt/async_support/hollaex.py +29 -29
- ccxt/async_support/htx.py +73 -73
- ccxt/async_support/huobijp.py +30 -30
- ccxt/async_support/hyperliquid.py +58 -58
- ccxt/async_support/idex.py +33 -33
- ccxt/async_support/independentreserve.py +12 -12
- ccxt/async_support/indodax.py +21 -21
- ccxt/async_support/kraken.py +46 -51
- ccxt/async_support/krakenfutures.py +29 -29
- ccxt/async_support/kucoin.py +51 -51
- ccxt/async_support/kucoinfutures.py +33 -33
- ccxt/async_support/kuna.py +27 -27
- ccxt/async_support/latoken.py +27 -27
- ccxt/async_support/lbank.py +35 -35
- ccxt/async_support/luno.py +19 -19
- ccxt/async_support/lykke.py +20 -20
- ccxt/async_support/mercado.py +17 -17
- ccxt/async_support/mexc.py +64 -64
- ccxt/async_support/ndax.py +38 -38
- ccxt/async_support/novadax.py +26 -26
- ccxt/async_support/oceanex.py +21 -21
- ccxt/async_support/okcoin.py +35 -35
- ccxt/async_support/okx.py +85 -85
- ccxt/async_support/onetrading.py +32 -32
- ccxt/async_support/p2b.py +14 -14
- ccxt/async_support/paymium.py +12 -12
- ccxt/async_support/phemex.py +50 -50
- ccxt/async_support/poloniex.py +35 -35
- ccxt/async_support/poloniexfutures.py +25 -21
- ccxt/async_support/probit.py +30 -30
- ccxt/async_support/timex.py +22 -22
- ccxt/async_support/tokocrypto.py +26 -26
- ccxt/async_support/tradeogre.py +12 -12
- ccxt/async_support/upbit.py +28 -28
- ccxt/async_support/wavesexchange.py +33 -33
- ccxt/async_support/wazirx.py +21 -21
- ccxt/async_support/whitebit.py +37 -37
- ccxt/async_support/woo.py +51 -51
- ccxt/async_support/woofipro.py +46 -46
- ccxt/async_support/yobit.py +20 -20
- ccxt/async_support/zaif.py +12 -12
- ccxt/async_support/zonda.py +22 -22
- ccxt/base/exchange.py +35 -35
- ccxt/base/types.py +13 -0
- ccxt/bigone.py +32 -32
- ccxt/binance.py +105 -96
- ccxt/bingx.py +21 -21
- ccxt/bit2c.py +13 -13
- ccxt/bitbank.py +19 -19
- ccxt/bitbns.py +17 -17
- ccxt/bitfinex.py +24 -24
- ccxt/bitfinex2.py +142 -109
- ccxt/bitflyer.py +23 -23
- ccxt/bitget.py +76 -76
- ccxt/bithumb.py +20 -20
- ccxt/bitmart.py +55 -55
- ccxt/bitmex.py +41 -41
- ccxt/bitopro.py +30 -30
- ccxt/bitrue.py +37 -37
- ccxt/bitso.py +30 -30
- ccxt/bitstamp.py +31 -31
- ccxt/bitteam.py +26 -26
- ccxt/bitvavo.py +27 -27
- ccxt/bl3p.py +8 -8
- ccxt/blockchaincom.py +24 -24
- ccxt/blofin.py +37 -37
- ccxt/btcalpha.py +19 -19
- ccxt/btcbox.py +11 -11
- ccxt/btcmarkets.py +22 -22
- ccxt/btcturk.py +13 -13
- ccxt/bybit.py +96 -96
- ccxt/cex.py +21 -21
- ccxt/coinbase.py +53 -53
- ccxt/coinbaseexchange.py +29 -29
- ccxt/coinbaseinternational.py +32 -32
- ccxt/coincheck.py +14 -14
- ccxt/coinex.py +168 -139
- ccxt/coinlist.py +35 -35
- ccxt/coinmate.py +22 -22
- ccxt/coinmetro.py +22 -22
- ccxt/coinone.py +18 -18
- ccxt/coinsph.py +32 -32
- ccxt/coinspot.py +8 -8
- ccxt/cryptocom.py +43 -43
- ccxt/currencycom.py +33 -33
- ccxt/delta.py +35 -35
- ccxt/deribit.py +54 -54
- ccxt/digifinex.py +56 -56
- ccxt/exmo.py +34 -34
- ccxt/gate.py +60 -60
- ccxt/gemini.py +24 -24
- ccxt/hitbtc.py +51 -51
- ccxt/hollaex.py +29 -29
- ccxt/htx.py +73 -73
- ccxt/huobijp.py +30 -30
- ccxt/hyperliquid.py +58 -58
- ccxt/idex.py +33 -33
- ccxt/independentreserve.py +12 -12
- ccxt/indodax.py +21 -21
- ccxt/kraken.py +46 -51
- ccxt/krakenfutures.py +29 -29
- ccxt/kucoin.py +51 -51
- ccxt/kucoinfutures.py +33 -33
- ccxt/kuna.py +27 -27
- ccxt/latoken.py +27 -27
- ccxt/lbank.py +35 -35
- ccxt/luno.py +19 -19
- ccxt/lykke.py +20 -20
- ccxt/mercado.py +17 -17
- ccxt/mexc.py +64 -64
- ccxt/ndax.py +38 -38
- ccxt/novadax.py +26 -26
- ccxt/oceanex.py +21 -21
- ccxt/okcoin.py +35 -35
- ccxt/okx.py +85 -85
- ccxt/onetrading.py +32 -32
- ccxt/p2b.py +14 -14
- ccxt/paymium.py +12 -12
- ccxt/phemex.py +50 -50
- ccxt/poloniex.py +35 -35
- ccxt/poloniexfutures.py +25 -21
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +8 -8
- ccxt/pro/ascendex.py +4 -4
- ccxt/pro/binance.py +56 -56
- ccxt/pro/bingx.py +5 -5
- ccxt/pro/bitfinex.py +6 -6
- ccxt/pro/bitfinex2.py +10 -10
- ccxt/pro/bitget.py +17 -17
- ccxt/pro/bithumb.py +6 -6
- ccxt/pro/bitmart.py +8 -8
- ccxt/pro/bitmex.py +16 -16
- ccxt/pro/bitopro.py +4 -4
- ccxt/pro/bitrue.py +8 -8
- ccxt/pro/bitstamp.py +5 -5
- ccxt/pro/bitvavo.py +14 -14
- ccxt/pro/blockchaincom.py +7 -7
- ccxt/pro/bybit.py +12 -12
- ccxt/pro/cex.py +19 -19
- ccxt/pro/coinbase.py +2 -2
- ccxt/pro/coinbaseexchange.py +10 -10
- ccxt/pro/coinbaseinternational.py +4 -4
- ccxt/pro/coincheck.py +2 -2
- ccxt/pro/coinex.py +15 -15
- ccxt/pro/coinone.py +4 -4
- ccxt/pro/cryptocom.py +11 -11
- ccxt/pro/currencycom.py +4 -4
- ccxt/pro/deribit.py +9 -9
- ccxt/pro/exmo.py +9 -9
- ccxt/pro/gate.py +12 -12
- ccxt/pro/gemini.py +11 -11
- ccxt/pro/hitbtc.py +13 -13
- ccxt/pro/hollaex.py +6 -6
- ccxt/pro/htx.py +15 -15
- ccxt/pro/huobijp.py +16 -16
- ccxt/pro/hyperliquid.py +9 -9
- ccxt/pro/idex.py +12 -12
- ccxt/pro/independentreserve.py +2 -2
- ccxt/pro/kraken.py +14 -14
- ccxt/pro/krakenfutures.py +12 -12
- ccxt/pro/kucoin.py +12 -12
- ccxt/pro/kucoinfutures.py +16 -16
- ccxt/pro/lbank.py +12 -12
- ccxt/pro/luno.py +4 -4
- ccxt/pro/mexc.py +14 -14
- ccxt/pro/ndax.py +12 -12
- ccxt/pro/okcoin.py +6 -6
- ccxt/pro/okx.py +30 -30
- ccxt/pro/onetrading.py +13 -13
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/phemex.py +9 -9
- ccxt/pro/poloniex.py +9 -9
- ccxt/pro/poloniexfutures.py +10 -10
- ccxt/pro/probit.py +8 -8
- ccxt/pro/upbit.py +1 -1
- ccxt/pro/wazirx.py +10 -10
- ccxt/pro/whitebit.py +8 -8
- ccxt/pro/woo.py +14 -14
- ccxt/pro/woofipro.py +14 -14
- ccxt/probit.py +30 -30
- ccxt/test/base/test_shared_methods.py +1 -0
- ccxt/timex.py +22 -22
- ccxt/tokocrypto.py +26 -26
- ccxt/tradeogre.py +12 -12
- ccxt/upbit.py +28 -28
- ccxt/wavesexchange.py +33 -33
- ccxt/wazirx.py +21 -21
- ccxt/whitebit.py +37 -37
- ccxt/woo.py +51 -51
- ccxt/woofipro.py +46 -46
- ccxt/yobit.py +20 -20
- ccxt/zaif.py +12 -12
- ccxt/zonda.py +22 -22
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/METADATA +4 -4
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/RECORD +258 -258
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/WHEEL +0 -0
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.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, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
|
9
|
+
from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1333,14 +1333,14 @@ class bybit(Exchange, ImplicitAPI):
|
|
1333
1333
|
#
|
1334
1334
|
data = self.safe_dict(response, 'result', {})
|
1335
1335
|
rows = self.safe_list(data, 'rows', [])
|
1336
|
-
result = {}
|
1336
|
+
result: dict = {}
|
1337
1337
|
for i in range(0, len(rows)):
|
1338
1338
|
currency = rows[i]
|
1339
1339
|
currencyId = self.safe_string(currency, 'coin')
|
1340
1340
|
code = self.safe_currency_code(currencyId)
|
1341
1341
|
name = self.safe_string(currency, 'name')
|
1342
1342
|
chains = self.safe_list(currency, 'chains', [])
|
1343
|
-
networks = {}
|
1343
|
+
networks: dict = {}
|
1344
1344
|
minPrecision = None
|
1345
1345
|
minWithdrawFeeString = None
|
1346
1346
|
minWithdrawString = None
|
@@ -1453,7 +1453,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1453
1453
|
return self.array_concat(spotMarkets, derivativeMarkets)
|
1454
1454
|
|
1455
1455
|
def fetch_spot_markets(self, params):
|
1456
|
-
request = {
|
1456
|
+
request: dict = {
|
1457
1457
|
'category': 'spot',
|
1458
1458
|
}
|
1459
1459
|
response = self.publicGetV5MarketInstrumentsInfo(self.extend(request, params))
|
@@ -1726,7 +1726,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1726
1726
|
return result
|
1727
1727
|
|
1728
1728
|
def fetch_option_markets(self, params):
|
1729
|
-
request = {
|
1729
|
+
request: dict = {
|
1730
1730
|
'category': 'option',
|
1731
1731
|
}
|
1732
1732
|
response = self.publicGetV5MarketInstrumentsInfo(self.extend(request, params))
|
@@ -1982,7 +1982,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1982
1982
|
raise ArgumentsRequired(self.id + ' fetchTicker() requires a symbol argument')
|
1983
1983
|
self.load_markets()
|
1984
1984
|
market = self.market(symbol)
|
1985
|
-
request = {
|
1985
|
+
request: dict = {
|
1986
1986
|
'symbol': market['id'],
|
1987
1987
|
# 'baseCoin': '', Base coin. For option only
|
1988
1988
|
# 'expDate': '', Expiry date. e.g., 25DEC22. For option only
|
@@ -2072,7 +2072,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2072
2072
|
elif market['type'] != currentType:
|
2073
2073
|
raise BadRequest(self.id + ' fetchTickers can only accept a list of symbols of the same type')
|
2074
2074
|
parsedSymbols.append(market['symbol'])
|
2075
|
-
request = {
|
2075
|
+
request: dict = {
|
2076
2076
|
# 'symbol': market['id'],
|
2077
2077
|
# 'baseCoin': '', # Base coin. For option only
|
2078
2078
|
# 'expDate': '', # Expiry date. e.g., 25DEC22. For option only
|
@@ -2181,7 +2181,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2181
2181
|
if paginate:
|
2182
2182
|
return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
|
2183
2183
|
market = self.market(symbol)
|
2184
|
-
request = {
|
2184
|
+
request: dict = {
|
2185
2185
|
'symbol': market['id'],
|
2186
2186
|
}
|
2187
2187
|
if limit is None:
|
@@ -2321,7 +2321,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2321
2321
|
"""
|
2322
2322
|
self.load_markets()
|
2323
2323
|
market = None
|
2324
|
-
request = {}
|
2324
|
+
request: dict = {}
|
2325
2325
|
if symbols is not None:
|
2326
2326
|
symbols = self.market_symbols(symbols)
|
2327
2327
|
market = self.market(symbols[0])
|
@@ -2376,7 +2376,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2376
2376
|
tickerList = self.safe_value(response, 'result', [])
|
2377
2377
|
timestamp = self.safe_integer(response, 'time')
|
2378
2378
|
tickerList = self.safe_value(tickerList, 'list')
|
2379
|
-
fundingRates = {}
|
2379
|
+
fundingRates: dict = {}
|
2380
2380
|
for i in range(0, len(tickerList)):
|
2381
2381
|
rawTicker = tickerList[i]
|
2382
2382
|
rawTicker['timestamp'] = timestamp # will be removed inside the parser
|
@@ -2406,7 +2406,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2406
2406
|
return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 200)
|
2407
2407
|
if limit is None:
|
2408
2408
|
limit = 200
|
2409
|
-
request = {
|
2409
|
+
request: dict = {
|
2410
2410
|
# 'category': '', # Product type. linear,inverse
|
2411
2411
|
# 'symbol': '', # Symbol name
|
2412
2412
|
# 'startTime': 0, # The start timestamp(ms)
|
@@ -2468,7 +2468,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2468
2468
|
sorted = self.sort_by(rates, 'timestamp')
|
2469
2469
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
2470
2470
|
|
2471
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
2471
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
2472
2472
|
#
|
2473
2473
|
# public https://bybit-exchange.github.io/docs/v5/market/recent-trade
|
2474
2474
|
#
|
@@ -2653,7 +2653,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2653
2653
|
raise ArgumentsRequired(self.id + ' fetchTrades() requires a symbol argument')
|
2654
2654
|
self.load_markets()
|
2655
2655
|
market = self.market(symbol)
|
2656
|
-
request = {
|
2656
|
+
request: dict = {
|
2657
2657
|
'symbol': market['id'],
|
2658
2658
|
# 'baseCoin': '', # Base coin. For option only. If not passed, return BTC data by default
|
2659
2659
|
# 'optionType': 'Call', # Option type. Call or Put. For option only
|
@@ -2705,7 +2705,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2705
2705
|
raise ArgumentsRequired(self.id + ' fetchOrderBook() requires a symbol argument')
|
2706
2706
|
self.load_markets()
|
2707
2707
|
market = self.market(symbol)
|
2708
|
-
request = {
|
2708
|
+
request: dict = {
|
2709
2709
|
'symbol': market['id'],
|
2710
2710
|
}
|
2711
2711
|
defaultLimit = 25
|
@@ -2858,7 +2858,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2858
2858
|
# }
|
2859
2859
|
#
|
2860
2860
|
timestamp = self.safe_integer(response, 'time')
|
2861
|
-
result = {
|
2861
|
+
result: dict = {
|
2862
2862
|
'info': response,
|
2863
2863
|
'timestamp': timestamp,
|
2864
2864
|
'datetime': self.iso8601(timestamp),
|
@@ -2916,7 +2916,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2916
2916
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
2917
2917
|
"""
|
2918
2918
|
self.load_markets()
|
2919
|
-
request = {}
|
2919
|
+
request: dict = {}
|
2920
2920
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
2921
2921
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
2922
2922
|
type = None
|
@@ -3048,8 +3048,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3048
3048
|
#
|
3049
3049
|
return self.parse_balance(response)
|
3050
3050
|
|
3051
|
-
def parse_order_status(self, status):
|
3052
|
-
statuses = {
|
3051
|
+
def parse_order_status(self, status: Str):
|
3052
|
+
statuses: dict = {
|
3053
3053
|
# v3 spot
|
3054
3054
|
'NEW': 'open',
|
3055
3055
|
'PARTIALLY_FILLED': 'open',
|
@@ -3076,8 +3076,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3076
3076
|
}
|
3077
3077
|
return self.safe_string(statuses, status, status)
|
3078
3078
|
|
3079
|
-
def parse_time_in_force(self, timeInForce):
|
3080
|
-
timeInForces = {
|
3079
|
+
def parse_time_in_force(self, timeInForce: Str):
|
3080
|
+
timeInForces: dict = {
|
3081
3081
|
'GoodTillCancel': 'GTC',
|
3082
3082
|
'ImmediateOrCancel': 'IOC',
|
3083
3083
|
'FillOrKill': 'FOK',
|
@@ -3085,7 +3085,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3085
3085
|
}
|
3086
3086
|
return self.safe_string(timeInForces, timeInForce, timeInForce)
|
3087
3087
|
|
3088
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
3088
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
3089
3089
|
#
|
3090
3090
|
# v1 for usdc normal account
|
3091
3091
|
# {
|
@@ -3395,7 +3395,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3395
3395
|
raise ArgumentsRequired(self.id + ' createOrder requires a price argument for limit orders')
|
3396
3396
|
defaultMethod = None
|
3397
3397
|
defaultMethod, params = self.handle_option_and_params(params, 'createOrder', 'method', 'privatePostV5OrderCreate')
|
3398
|
-
request = {
|
3398
|
+
request: dict = {
|
3399
3399
|
'symbol': market['id'],
|
3400
3400
|
# 'side': self.capitalize(side),
|
3401
3401
|
# 'orderType': self.capitalize(lowerCaseType), # limit or market
|
@@ -3603,7 +3603,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3603
3603
|
category, params = self.get_bybit_type('createOrders', market, params)
|
3604
3604
|
if category == 'inverse':
|
3605
3605
|
raise NotSupported(self.id + ' createOrders does not allow inverse orders')
|
3606
|
-
request = {
|
3606
|
+
request: dict = {
|
3607
3607
|
'category': category,
|
3608
3608
|
'request': ordersRequests,
|
3609
3609
|
}
|
@@ -3665,7 +3665,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3665
3665
|
lowerCaseType = type.lower()
|
3666
3666
|
if (price is None) and (lowerCaseType == 'limit'):
|
3667
3667
|
raise ArgumentsRequired(self.id + ' createOrder requires a price argument for limit orders')
|
3668
|
-
request = {
|
3668
|
+
request: dict = {
|
3669
3669
|
'symbol': market['id'],
|
3670
3670
|
'side': self.capitalize(side),
|
3671
3671
|
'orderType': self.capitalize(lowerCaseType), # limit or market
|
@@ -3771,7 +3771,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3771
3771
|
def edit_usdc_order(self, id, symbol, type, side, amount=None, price=None, params={}):
|
3772
3772
|
self.load_markets()
|
3773
3773
|
market = self.market(symbol)
|
3774
|
-
request = {
|
3774
|
+
request: dict = {
|
3775
3775
|
'symbol': market['id'],
|
3776
3776
|
'orderId': id,
|
3777
3777
|
}
|
@@ -3818,7 +3818,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3818
3818
|
|
3819
3819
|
def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3820
3820
|
market = self.market(symbol)
|
3821
|
-
request = {
|
3821
|
+
request: dict = {
|
3822
3822
|
'symbol': market['id'],
|
3823
3823
|
'orderId': id,
|
3824
3824
|
# 'orderLinkId': 'string', # unique client order id, max 36 characters
|
@@ -3939,7 +3939,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3939
3939
|
raise ArgumentsRequired(self.id + ' cancelUsdcOrder() requires a symbol argument')
|
3940
3940
|
self.load_markets()
|
3941
3941
|
market = self.market(symbol)
|
3942
|
-
request = {
|
3942
|
+
request: dict = {
|
3943
3943
|
'symbol': market['id'],
|
3944
3944
|
# 'orderLinkId': 'string', # one of order_id, stop_order_id or order_link_id is required
|
3945
3945
|
# 'orderId': id,
|
@@ -3972,7 +3972,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3972
3972
|
|
3973
3973
|
def cancel_order_request(self, id: str, symbol: Str = None, params={}):
|
3974
3974
|
market = self.market(symbol)
|
3975
|
-
request = {
|
3975
|
+
request: dict = {
|
3976
3976
|
'symbol': market['id'],
|
3977
3977
|
# 'orderLinkId': 'string',
|
3978
3978
|
# 'orderId': id,
|
@@ -4064,7 +4064,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4064
4064
|
'symbol': market['id'],
|
4065
4065
|
'orderId': self.safe_string(ids, i),
|
4066
4066
|
})
|
4067
|
-
request = {
|
4067
|
+
request: dict = {
|
4068
4068
|
'category': category,
|
4069
4069
|
'request': ordersRequests,
|
4070
4070
|
}
|
@@ -4137,12 +4137,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
4137
4137
|
idKey = 'orderId'
|
4138
4138
|
if clientOrderId is not None:
|
4139
4139
|
idKey = 'orderLinkId'
|
4140
|
-
orderItem = {
|
4140
|
+
orderItem: dict = {
|
4141
4141
|
'symbol': market['id'],
|
4142
4142
|
}
|
4143
4143
|
orderItem[idKey] = id if (idKey == 'orderId') else clientOrderId
|
4144
4144
|
ordersRequests.append(orderItem)
|
4145
|
-
request = {
|
4145
|
+
request: dict = {
|
4146
4146
|
'category': category,
|
4147
4147
|
'request': ordersRequests,
|
4148
4148
|
}
|
@@ -4191,7 +4191,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4191
4191
|
raise ArgumentsRequired(self.id + ' cancelAllUsdcOrders() requires a symbol argument')
|
4192
4192
|
self.load_markets()
|
4193
4193
|
market = self.market(symbol)
|
4194
|
-
request = {
|
4194
|
+
request: dict = {
|
4195
4195
|
'symbol': market['id'],
|
4196
4196
|
}
|
4197
4197
|
response = None
|
@@ -4244,7 +4244,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4244
4244
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4245
4245
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4246
4246
|
market = None
|
4247
|
-
request = {}
|
4247
|
+
request: dict = {}
|
4248
4248
|
if symbol is not None:
|
4249
4249
|
market = self.market(symbol)
|
4250
4250
|
isUsdcSettled = market['settle'] == 'USDC'
|
@@ -4303,7 +4303,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4303
4303
|
def fetch_usdc_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4304
4304
|
self.load_markets()
|
4305
4305
|
market = None
|
4306
|
-
request = {
|
4306
|
+
request: dict = {
|
4307
4307
|
# 'category': '', # Type. PERPETUAL, OPTION
|
4308
4308
|
# 'symbol': '', # Contract name
|
4309
4309
|
# 'baseCoin': '', # Base currency
|
@@ -4396,7 +4396,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4396
4396
|
market = self.market(symbol)
|
4397
4397
|
if market['spot']:
|
4398
4398
|
raise NotSupported(self.id + ' fetchOrder() is not supported for spot markets')
|
4399
|
-
request = {
|
4399
|
+
request: dict = {
|
4400
4400
|
'orderId': id,
|
4401
4401
|
}
|
4402
4402
|
result = self.fetch_orders(symbol, None, None, self.extend(request, params))
|
@@ -4468,7 +4468,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4468
4468
|
return self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4469
4469
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4470
4470
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4471
|
-
request = {}
|
4471
|
+
request: dict = {}
|
4472
4472
|
market = None
|
4473
4473
|
isUsdcSettled = False
|
4474
4474
|
if symbol is not None:
|
@@ -4563,7 +4563,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4563
4563
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4564
4564
|
"""
|
4565
4565
|
self.load_markets()
|
4566
|
-
request = {
|
4566
|
+
request: dict = {
|
4567
4567
|
'orderId': id,
|
4568
4568
|
}
|
4569
4569
|
result = self.fetch_closed_orders(symbol, None, None, self.extend(request, params))
|
@@ -4592,7 +4592,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4592
4592
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4593
4593
|
"""
|
4594
4594
|
self.load_markets()
|
4595
|
-
request = {
|
4595
|
+
request: dict = {
|
4596
4596
|
'orderId': id,
|
4597
4597
|
}
|
4598
4598
|
result = self.fetch_open_orders(symbol, None, None, self.extend(request, params))
|
@@ -4628,7 +4628,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4628
4628
|
return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4629
4629
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4630
4630
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4631
|
-
request = {}
|
4631
|
+
request: dict = {}
|
4632
4632
|
market = None
|
4633
4633
|
isUsdcSettled = False
|
4634
4634
|
if symbol is not None:
|
@@ -4724,7 +4724,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4724
4724
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
4725
4725
|
"""
|
4726
4726
|
self.load_markets()
|
4727
|
-
request = {
|
4727
|
+
request: dict = {
|
4728
4728
|
'orderStatus': 'Filled',
|
4729
4729
|
}
|
4730
4730
|
return self.fetch_canceled_and_closed_orders(symbol, since, limit, self.extend(request, params))
|
@@ -4746,14 +4746,14 @@ class bybit(Exchange, ImplicitAPI):
|
|
4746
4746
|
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
4747
4747
|
"""
|
4748
4748
|
self.load_markets()
|
4749
|
-
request = {
|
4749
|
+
request: dict = {
|
4750
4750
|
'orderStatus': 'Cancelled',
|
4751
4751
|
}
|
4752
4752
|
return self.fetch_canceled_and_closed_orders(symbol, since, limit, self.extend(request, params))
|
4753
4753
|
|
4754
4754
|
def fetch_usdc_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4755
4755
|
self.load_markets()
|
4756
|
-
request = {}
|
4756
|
+
request: dict = {}
|
4757
4757
|
market = None
|
4758
4758
|
if symbol is not None:
|
4759
4759
|
market = self.market(symbol)
|
@@ -4811,7 +4811,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4811
4811
|
self.load_markets()
|
4812
4812
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4813
4813
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4814
|
-
request = {}
|
4814
|
+
request: dict = {}
|
4815
4815
|
market = None
|
4816
4816
|
isUsdcSettled = False
|
4817
4817
|
if symbol is not None:
|
@@ -4900,7 +4900,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4900
4900
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4901
4901
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
4902
4902
|
"""
|
4903
|
-
request = {}
|
4903
|
+
request: dict = {}
|
4904
4904
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'orderLinkId')
|
4905
4905
|
if clientOrderId is not None:
|
4906
4906
|
request['orderLinkId'] = clientOrderId
|
@@ -4912,7 +4912,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4912
4912
|
def fetch_my_usdc_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4913
4913
|
self.load_markets()
|
4914
4914
|
market = None
|
4915
|
-
request = {}
|
4915
|
+
request: dict = {}
|
4916
4916
|
if symbol is not None:
|
4917
4917
|
market = self.market(symbol)
|
4918
4918
|
request['symbol'] = market['id']
|
@@ -4972,7 +4972,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4972
4972
|
return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
4973
4973
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4974
4974
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4975
|
-
request = {
|
4975
|
+
request: dict = {
|
4976
4976
|
'execType': 'Trade',
|
4977
4977
|
}
|
4978
4978
|
market = None
|
@@ -5067,7 +5067,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5067
5067
|
"""
|
5068
5068
|
self.load_markets()
|
5069
5069
|
currency = self.currency(code)
|
5070
|
-
request = {
|
5070
|
+
request: dict = {
|
5071
5071
|
'coin': currency['id'],
|
5072
5072
|
}
|
5073
5073
|
response = self.privateGetV5AssetDepositQueryAddress(self.extend(request, params))
|
@@ -5111,7 +5111,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5111
5111
|
networkCode, query = self.handle_network_code_and_params(params)
|
5112
5112
|
networkId = self.network_code_to_id(networkCode)
|
5113
5113
|
currency = self.currency(code)
|
5114
|
-
request = {
|
5114
|
+
request: dict = {
|
5115
5115
|
'coin': currency['id'],
|
5116
5116
|
}
|
5117
5117
|
if networkId is not None:
|
@@ -5162,7 +5162,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5162
5162
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
5163
5163
|
if paginate:
|
5164
5164
|
return self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
5165
|
-
request = {
|
5165
|
+
request: dict = {
|
5166
5166
|
# 'coin': currency['id'],
|
5167
5167
|
# 'limit': 20, # max 50
|
5168
5168
|
# 'cursor': '',
|
@@ -5224,7 +5224,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5224
5224
|
paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
|
5225
5225
|
if paginate:
|
5226
5226
|
return self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
5227
|
-
request = {
|
5227
|
+
request: dict = {
|
5228
5228
|
# 'coin': currency['id'],
|
5229
5229
|
# 'limit': 20, # max 50
|
5230
5230
|
# 'cusor': '',
|
@@ -5284,7 +5284,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5284
5284
|
return self.parse_transactions(data, currency, since, limit)
|
5285
5285
|
|
5286
5286
|
def parse_transaction_status(self, status):
|
5287
|
-
statuses = {
|
5287
|
+
statuses: dict = {
|
5288
5288
|
# v3 deposit status
|
5289
5289
|
'0': 'unknown',
|
5290
5290
|
'1': 'pending',
|
@@ -5302,7 +5302,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5302
5302
|
}
|
5303
5303
|
return self.safe_string(statuses, status, status)
|
5304
5304
|
|
5305
|
-
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
5305
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
5306
5306
|
#
|
5307
5307
|
# fetchWithdrawals
|
5308
5308
|
#
|
@@ -5391,7 +5391,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5391
5391
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
5392
5392
|
"""
|
5393
5393
|
self.load_markets()
|
5394
|
-
request = {
|
5394
|
+
request: dict = {
|
5395
5395
|
# 'coin': currency['id'],
|
5396
5396
|
# 'currency': currency['id'], # alias
|
5397
5397
|
# 'start_date': self.iso8601(since),
|
@@ -5536,7 +5536,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5536
5536
|
data = self.add_pagination_cursor_to_result(response)
|
5537
5537
|
return self.parse_ledger(data, currency, since, limit)
|
5538
5538
|
|
5539
|
-
def parse_ledger_entry(self, item, currency: Currency = None):
|
5539
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
5540
5540
|
#
|
5541
5541
|
# {
|
5542
5542
|
# "id": 234467,
|
@@ -5607,7 +5607,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5607
5607
|
}
|
5608
5608
|
|
5609
5609
|
def parse_ledger_entry_type(self, type):
|
5610
|
-
types = {
|
5610
|
+
types: dict = {
|
5611
5611
|
'Deposit': 'transaction',
|
5612
5612
|
'Withdraw': 'transaction',
|
5613
5613
|
'RealisedPNL': 'trade',
|
@@ -5646,7 +5646,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5646
5646
|
self.load_markets()
|
5647
5647
|
self.check_address(address)
|
5648
5648
|
currency = self.currency(code)
|
5649
|
-
request = {
|
5649
|
+
request: dict = {
|
5650
5650
|
'coin': currency['id'],
|
5651
5651
|
'amount': self.number_to_string(amount),
|
5652
5652
|
'address': address,
|
@@ -5685,7 +5685,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5685
5685
|
raise ArgumentsRequired(self.id + ' fetchPosition() requires a symbol argument')
|
5686
5686
|
self.load_markets()
|
5687
5687
|
market = self.market(symbol)
|
5688
|
-
request = {
|
5688
|
+
request: dict = {
|
5689
5689
|
'symbol': market['id'],
|
5690
5690
|
}
|
5691
5691
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
@@ -5751,7 +5751,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5751
5751
|
|
5752
5752
|
def fetch_usdc_positions(self, symbols: Strings = None, params={}):
|
5753
5753
|
self.load_markets()
|
5754
|
-
request = {}
|
5754
|
+
request: dict = {}
|
5755
5755
|
market = None
|
5756
5756
|
if isinstance(symbols, list):
|
5757
5757
|
length = len(symbols)
|
@@ -5845,7 +5845,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5845
5845
|
self.load_markets()
|
5846
5846
|
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
5847
5847
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
5848
|
-
request = {}
|
5848
|
+
request: dict = {}
|
5849
5849
|
market = None
|
5850
5850
|
isUsdcSettled = False
|
5851
5851
|
if symbol is not None:
|
@@ -5917,7 +5917,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5917
5917
|
results.append(self.parse_position(rawPosition))
|
5918
5918
|
return self.filter_by_array_positions(results, 'symbol', symbols, False)
|
5919
5919
|
|
5920
|
-
def parse_position(self, position, market: Market = None):
|
5920
|
+
def parse_position(self, position: dict, market: Market = None):
|
5921
5921
|
#
|
5922
5922
|
# linear swap
|
5923
5923
|
#
|
@@ -6193,7 +6193,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6193
6193
|
marginMode = 'PORTFOLIO_MARGIN'
|
6194
6194
|
else:
|
6195
6195
|
raise NotSupported(self.id + ' setMarginMode() marginMode must be either [isolated, cross, portfolio]')
|
6196
|
-
request = {
|
6196
|
+
request: dict = {
|
6197
6197
|
'setMarginMode': marginMode,
|
6198
6198
|
}
|
6199
6199
|
response = self.privatePostV5AccountSetMarginMode(self.extend(request, params))
|
@@ -6209,7 +6209,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6209
6209
|
marginMode = 'PORTFOLIO_MARGIN'
|
6210
6210
|
else:
|
6211
6211
|
raise NotSupported(self.id + ' setMarginMode() for usdc market marginMode must be either [cross, portfolio]')
|
6212
|
-
request = {
|
6212
|
+
request: dict = {
|
6213
6213
|
'setMarginMode': marginMode,
|
6214
6214
|
}
|
6215
6215
|
response = self.privatePostV5AccountSetMarginMode(self.extend(request, params))
|
@@ -6240,7 +6240,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6240
6240
|
sellLeverage = leverage
|
6241
6241
|
buyLeverage = leverage
|
6242
6242
|
params = self.omit(params, 'leverage')
|
6243
|
-
request = {
|
6243
|
+
request: dict = {
|
6244
6244
|
'category': type,
|
6245
6245
|
'symbol': market['id'],
|
6246
6246
|
'tradeMode': tradeMode,
|
@@ -6273,7 +6273,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6273
6273
|
# engage in leverage setting
|
6274
6274
|
# we reuse the code here instead of having two methods
|
6275
6275
|
leverageString = self.number_to_string(leverage)
|
6276
|
-
request = {
|
6276
|
+
request: dict = {
|
6277
6277
|
'symbol': market['id'],
|
6278
6278
|
'buyLeverage': leverageString,
|
6279
6279
|
'sellLeverage': leverageString,
|
@@ -6312,7 +6312,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6312
6312
|
mode = 3
|
6313
6313
|
else:
|
6314
6314
|
mode = 0
|
6315
|
-
request = {
|
6315
|
+
request: dict = {
|
6316
6316
|
'mode': mode,
|
6317
6317
|
}
|
6318
6318
|
if symbol is None:
|
@@ -6347,7 +6347,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6347
6347
|
interval = self.safe_string(intervals, timeframe) # 5min,15min,30min,1h,4h,1d
|
6348
6348
|
if interval is None:
|
6349
6349
|
raise BadRequest(self.id + ' fetchOpenInterestHistory() cannot use the ' + timeframe + ' timeframe')
|
6350
|
-
request = {
|
6350
|
+
request: dict = {
|
6351
6351
|
'symbol': market['id'],
|
6352
6352
|
'intervalTime': interval,
|
6353
6353
|
'category': category,
|
@@ -6411,7 +6411,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6411
6411
|
raise BadRequest(self.id + ' fetchOpenInterest() cannot use the ' + timeframe + ' timeframe')
|
6412
6412
|
subType = 'linear' if market['linear'] else 'inverse'
|
6413
6413
|
category = self.safe_string(params, 'category', subType)
|
6414
|
-
request = {
|
6414
|
+
request: dict = {
|
6415
6415
|
'symbol': market['id'],
|
6416
6416
|
'intervalTime': interval,
|
6417
6417
|
'category': category,
|
@@ -6468,7 +6468,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6468
6468
|
market = self.market(symbol)
|
6469
6469
|
if market['spot'] or market['option']:
|
6470
6470
|
raise BadRequest(self.id + ' fetchOpenInterestHistory() symbol does not support market ' + symbol)
|
6471
|
-
request = {
|
6471
|
+
request: dict = {
|
6472
6472
|
'symbol': market['id'],
|
6473
6473
|
}
|
6474
6474
|
if limit is not None:
|
@@ -6503,7 +6503,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6503
6503
|
"""
|
6504
6504
|
self.load_markets()
|
6505
6505
|
currency = self.currency(code)
|
6506
|
-
request = {
|
6506
|
+
request: dict = {
|
6507
6507
|
'coin': currency['id'],
|
6508
6508
|
}
|
6509
6509
|
response = self.privateGetV5SpotCrossMarginTradeLoanInfo(self.extend(request, params))
|
@@ -6559,7 +6559,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6559
6559
|
:returns dict[]: a list of `borrow interest structures <https://docs.ccxt.com/#/?id=borrow-interest-structure>`
|
6560
6560
|
"""
|
6561
6561
|
self.load_markets()
|
6562
|
-
request = {}
|
6562
|
+
request: dict = {}
|
6563
6563
|
response = self.privateGetV5SpotCrossMarginTradeAccount(self.extend(request, params))
|
6564
6564
|
#
|
6565
6565
|
# {
|
@@ -6591,7 +6591,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6591
6591
|
interest = self.parse_borrow_interests(rows, None)
|
6592
6592
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
6593
6593
|
|
6594
|
-
def parse_borrow_interest(self, info, market: Market = None):
|
6594
|
+
def parse_borrow_interest(self, info: dict, market: Market = None):
|
6595
6595
|
#
|
6596
6596
|
# {
|
6597
6597
|
# "tokenId": "BTC",
|
@@ -6633,7 +6633,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6633
6633
|
toId = self.safe_string(accountTypes, toAccount, toAccount)
|
6634
6634
|
currency = self.currency(code)
|
6635
6635
|
amountToPrecision = self.currency_to_precision(code, amount)
|
6636
|
-
request = {
|
6636
|
+
request: dict = {
|
6637
6637
|
'transferId': transferId,
|
6638
6638
|
'fromAccountType': fromId,
|
6639
6639
|
'toAccountType': toId,
|
@@ -6683,7 +6683,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6683
6683
|
if paginate:
|
6684
6684
|
return self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
6685
6685
|
currency = None
|
6686
|
-
request = {}
|
6686
|
+
request: dict = {}
|
6687
6687
|
if code is not None:
|
6688
6688
|
currency = self.safe_currency_code(code)
|
6689
6689
|
request['coin'] = currency
|
@@ -6729,7 +6729,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6729
6729
|
"""
|
6730
6730
|
self.load_markets()
|
6731
6731
|
currency = self.currency(code)
|
6732
|
-
request = {
|
6732
|
+
request: dict = {
|
6733
6733
|
'coin': currency['id'],
|
6734
6734
|
'qty': self.currency_to_precision(code, amount),
|
6735
6735
|
}
|
@@ -6763,7 +6763,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6763
6763
|
"""
|
6764
6764
|
self.load_markets()
|
6765
6765
|
currency = self.currency(code)
|
6766
|
-
request = {
|
6766
|
+
request: dict = {
|
6767
6767
|
'coin': currency['id'],
|
6768
6768
|
'qty': self.number_to_string(amount),
|
6769
6769
|
}
|
@@ -6811,7 +6811,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6811
6811
|
}
|
6812
6812
|
|
6813
6813
|
def parse_transfer_status(self, status: Str) -> Str:
|
6814
|
-
statuses = {
|
6814
|
+
statuses: dict = {
|
6815
6815
|
'0': 'ok',
|
6816
6816
|
'OK': 'ok',
|
6817
6817
|
'SUCCESS': 'ok',
|
@@ -6860,7 +6860,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6860
6860
|
def fetch_derivatives_market_leverage_tiers(self, symbol: str, params={}):
|
6861
6861
|
self.load_markets()
|
6862
6862
|
market = self.market(symbol)
|
6863
|
-
request = {
|
6863
|
+
request: dict = {
|
6864
6864
|
'symbol': market['id'],
|
6865
6865
|
}
|
6866
6866
|
if market['linear']:
|
@@ -6895,7 +6895,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6895
6895
|
tiers = self.safe_list(result, 'list')
|
6896
6896
|
return self.parse_market_leverage_tiers(tiers, market)
|
6897
6897
|
|
6898
|
-
def fetch_market_leverage_tiers(self, symbol: str, params={}):
|
6898
|
+
def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
|
6899
6899
|
"""
|
6900
6900
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
6901
6901
|
:see: https://bybit-exchange.github.io/docs/v5/market/risk-limit
|
@@ -6904,7 +6904,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6904
6904
|
:returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
|
6905
6905
|
"""
|
6906
6906
|
self.load_markets()
|
6907
|
-
request = {}
|
6907
|
+
request: dict = {}
|
6908
6908
|
market = None
|
6909
6909
|
market = self.market(symbol)
|
6910
6910
|
if market['spot'] or market['option']:
|
@@ -6912,7 +6912,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6912
6912
|
request['symbol'] = market['id']
|
6913
6913
|
return self.fetch_derivatives_market_leverage_tiers(symbol, params)
|
6914
6914
|
|
6915
|
-
def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
|
6915
|
+
def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
|
6916
6916
|
#
|
6917
6917
|
# {
|
6918
6918
|
# "symbol": "ETHUSDT",
|
@@ -6942,7 +6942,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6942
6942
|
"""
|
6943
6943
|
self.load_markets()
|
6944
6944
|
market = self.market(symbol)
|
6945
|
-
request = {
|
6945
|
+
request: dict = {
|
6946
6946
|
'symbol': market['id'],
|
6947
6947
|
}
|
6948
6948
|
category = None
|
@@ -7011,7 +7011,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7011
7011
|
#
|
7012
7012
|
fees = self.safe_dict(response, 'result', {})
|
7013
7013
|
fees = self.safe_list(fees, 'list', [])
|
7014
|
-
result = {}
|
7014
|
+
result: dict = {}
|
7015
7015
|
for i in range(0, len(fees)):
|
7016
7016
|
fee = self.parse_trading_fee(fees[i])
|
7017
7017
|
symbol = fee['symbol']
|
@@ -7041,7 +7041,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7041
7041
|
#
|
7042
7042
|
chains = self.safe_list(fee, 'chains', [])
|
7043
7043
|
chainsLength = len(chains)
|
7044
|
-
result = {
|
7044
|
+
result: dict = {
|
7045
7045
|
'info': fee,
|
7046
7046
|
'withdraw': {
|
7047
7047
|
'fee': None,
|
@@ -7126,7 +7126,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7126
7126
|
:returns dict[]: a list of [settlement history objects]
|
7127
7127
|
"""
|
7128
7128
|
self.load_markets()
|
7129
|
-
request = {}
|
7129
|
+
request: dict = {}
|
7130
7130
|
market = None
|
7131
7131
|
if symbol is not None:
|
7132
7132
|
market = self.market(symbol)
|
@@ -7177,7 +7177,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7177
7177
|
:returns dict[]: a list of [settlement history objects]
|
7178
7178
|
"""
|
7179
7179
|
self.load_markets()
|
7180
|
-
request = {}
|
7180
|
+
request: dict = {}
|
7181
7181
|
market = None
|
7182
7182
|
if symbol is not None:
|
7183
7183
|
market = self.market(symbol)
|
@@ -7296,7 +7296,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7296
7296
|
"""
|
7297
7297
|
self.load_markets()
|
7298
7298
|
currency = self.currency(code)
|
7299
|
-
request = {
|
7299
|
+
request: dict = {
|
7300
7300
|
'category': 'option',
|
7301
7301
|
'baseCoin': currency['id'],
|
7302
7302
|
}
|
@@ -7348,7 +7348,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7348
7348
|
"""
|
7349
7349
|
self.load_markets()
|
7350
7350
|
market = self.market(symbol)
|
7351
|
-
request = {
|
7351
|
+
request: dict = {
|
7352
7352
|
'symbol': market['id'],
|
7353
7353
|
'category': 'option',
|
7354
7354
|
}
|
@@ -7474,7 +7474,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7474
7474
|
paginate, params = self.handle_option_and_params(params, 'fetchMyLiquidations', 'paginate')
|
7475
7475
|
if paginate:
|
7476
7476
|
return self.fetch_paginated_call_cursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
7477
|
-
request = {
|
7477
|
+
request: dict = {
|
7478
7478
|
'execType': 'BustTrade',
|
7479
7479
|
}
|
7480
7480
|
market = None
|
@@ -7592,7 +7592,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7592
7592
|
return self.fetch_paginated_call_cursor('getLeverageTiersPaginated', symbol, None, None, params, 'nextPageCursor', 'cursor', None, 100)
|
7593
7593
|
subType = None
|
7594
7594
|
subType, params = self.handle_sub_type_and_params('getLeverageTiersPaginated', market, params, 'linear')
|
7595
|
-
request = {
|
7595
|
+
request: dict = {
|
7596
7596
|
'category': subType,
|
7597
7597
|
}
|
7598
7598
|
response = self.publicGetV5MarketRiskLimit(self.extend(request, params))
|
@@ -7608,7 +7608,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7608
7608
|
result[lastIndex] = last
|
7609
7609
|
return result
|
7610
7610
|
|
7611
|
-
def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
7611
|
+
def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
|
7612
7612
|
"""
|
7613
7613
|
:see: https://bybit-exchange.github.io/docs/v5/market/risk-limit
|
7614
7614
|
retrieve information on the maximum leverage, for different trade sizes
|
@@ -7644,7 +7644,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7644
7644
|
# }
|
7645
7645
|
# ]
|
7646
7646
|
#
|
7647
|
-
tiers = {}
|
7647
|
+
tiers: dict = {}
|
7648
7648
|
marketIds = self.market_ids(symbols)
|
7649
7649
|
filteredResults = self.filter_by_array(response, marketIdKey, marketIds, False)
|
7650
7650
|
grouped = self.group_by(filteredResults, marketIdKey)
|
@@ -7660,7 +7660,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7660
7660
|
tiers[symbol] = self.parse_market_leverage_tiers(self.sort_by(entry, 'id'), market)
|
7661
7661
|
return tiers
|
7662
7662
|
|
7663
|
-
def parse_market_leverage_tiers(self, info, market: Market = None):
|
7663
|
+
def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
|
7664
7664
|
#
|
7665
7665
|
# [
|
7666
7666
|
# {
|
@@ -7709,7 +7709,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7709
7709
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
7710
7710
|
if paginate:
|
7711
7711
|
return self.fetch_paginated_call_cursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
7712
|
-
request = {
|
7712
|
+
request: dict = {
|
7713
7713
|
'execType': 'Funding',
|
7714
7714
|
}
|
7715
7715
|
market: Market = None
|
@@ -7794,7 +7794,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7794
7794
|
"""
|
7795
7795
|
self.load_markets()
|
7796
7796
|
market = self.market(symbol)
|
7797
|
-
request = {
|
7797
|
+
request: dict = {
|
7798
7798
|
'category': 'option',
|
7799
7799
|
'symbol': market['id'],
|
7800
7800
|
}
|
@@ -7854,7 +7854,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7854
7854
|
"""
|
7855
7855
|
self.load_markets()
|
7856
7856
|
currency = self.currency(code)
|
7857
|
-
request = {
|
7857
|
+
request: dict = {
|
7858
7858
|
'category': 'option',
|
7859
7859
|
'baseCoin': currency['id'],
|
7860
7860
|
}
|
@@ -7978,7 +7978,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
7978
7978
|
until = self.safe_integer(params, 'until')
|
7979
7979
|
subType, params = self.handle_sub_type_and_params('fetchPositionsHistory', market, params, 'linear')
|
7980
7980
|
params = self.omit(params, 'until')
|
7981
|
-
request = {
|
7981
|
+
request: dict = {
|
7982
7982
|
'category': subType,
|
7983
7983
|
}
|
7984
7984
|
if (symbols is not None) and (symbolsLength == 1):
|