ccxt 4.3.30__py2.py3-none-any.whl → 4.3.32__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 +208 -175
- 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 +48 -36
- 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 +208 -175
- 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 +20 -20
- ccxt/pro/coinbase.py +32 -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/test/test_async.py +1 -1
- ccxt/test/test_sync.py +1 -1
- 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.32.dist-info}/METADATA +4 -4
- {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/RECORD +260 -260
- {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/WHEEL +0 -0
- {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/top_level.txt +0 -0
ccxt/async_support/okx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.okx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
10
|
+
from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
11
11
|
from typing import List
|
12
12
|
from typing import Any
|
13
13
|
from ccxt.base.errors import ExchangeError
|
@@ -1271,7 +1271,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1271
1271
|
#
|
1272
1272
|
data = self.safe_list(response, 'data', [])
|
1273
1273
|
dataLength = len(data)
|
1274
|
-
update = {
|
1274
|
+
update: dict = {
|
1275
1275
|
'updated': None,
|
1276
1276
|
'status': 'ok' if (dataLength == 0) else 'maintenance',
|
1277
1277
|
'eta': None,
|
@@ -1515,7 +1515,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1515
1515
|
})
|
1516
1516
|
|
1517
1517
|
async def fetch_markets_by_type(self, type, params={}):
|
1518
|
-
request = {
|
1518
|
+
request: dict = {
|
1519
1519
|
'instType': self.convert_to_instrument_type(type),
|
1520
1520
|
}
|
1521
1521
|
if type == 'option':
|
@@ -1570,7 +1570,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1570
1570
|
return self.parse_markets(dataResponse)
|
1571
1571
|
|
1572
1572
|
def safe_network(self, networkId):
|
1573
|
-
networksById = {
|
1573
|
+
networksById: dict = {
|
1574
1574
|
'Bitcoin': 'BTC',
|
1575
1575
|
'Omni': 'OMNI',
|
1576
1576
|
'TRON': 'TRC20',
|
@@ -1641,7 +1641,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1641
1641
|
# }
|
1642
1642
|
#
|
1643
1643
|
data = self.safe_list(response, 'data', [])
|
1644
|
-
result = {}
|
1644
|
+
result: dict = {}
|
1645
1645
|
dataByCurrencyId = self.group_by(data, 'ccy')
|
1646
1646
|
currencyIds = list(dataByCurrencyId.keys())
|
1647
1647
|
for i in range(0, len(currencyIds)):
|
@@ -1649,7 +1649,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1649
1649
|
currency = self.safe_currency(currencyId)
|
1650
1650
|
code = currency['code']
|
1651
1651
|
chains = dataByCurrencyId[currencyId]
|
1652
|
-
networks = {}
|
1652
|
+
networks: dict = {}
|
1653
1653
|
currencyActive = False
|
1654
1654
|
depositEnabled = False
|
1655
1655
|
withdrawEnabled = False
|
@@ -1722,7 +1722,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1722
1722
|
"""
|
1723
1723
|
await self.load_markets()
|
1724
1724
|
market = self.market(symbol)
|
1725
|
-
request = {
|
1725
|
+
request: dict = {
|
1726
1726
|
'instId': market['id'],
|
1727
1727
|
}
|
1728
1728
|
method = None
|
@@ -1828,7 +1828,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1828
1828
|
"""
|
1829
1829
|
await self.load_markets()
|
1830
1830
|
market = self.market(symbol)
|
1831
|
-
request = {
|
1831
|
+
request: dict = {
|
1832
1832
|
'instId': market['id'],
|
1833
1833
|
}
|
1834
1834
|
response = await self.publicGetMarketTicker(self.extend(request, params))
|
@@ -1875,7 +1875,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1875
1875
|
market = self.get_market_from_symbols(symbols)
|
1876
1876
|
marketType = None
|
1877
1877
|
marketType, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
1878
|
-
request = {
|
1878
|
+
request: dict = {
|
1879
1879
|
'instType': self.convert_to_instrument_type(marketType),
|
1880
1880
|
}
|
1881
1881
|
if marketType == 'option':
|
@@ -1915,7 +1915,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1915
1915
|
tickers = self.safe_list(response, 'data', [])
|
1916
1916
|
return self.parse_tickers(tickers, symbols)
|
1917
1917
|
|
1918
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1918
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1919
1919
|
#
|
1920
1920
|
# public fetchTrades
|
1921
1921
|
#
|
@@ -2023,7 +2023,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2023
2023
|
if paginate:
|
2024
2024
|
return await self.fetch_paginated_call_cursor('fetchTrades', symbol, since, limit, params, 'tradeId', 'after', None, 100)
|
2025
2025
|
market = self.market(symbol)
|
2026
|
-
request = {
|
2026
|
+
request: dict = {
|
2027
2027
|
'instId': market['id'],
|
2028
2028
|
}
|
2029
2029
|
response = None
|
@@ -2136,7 +2136,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2136
2136
|
bar = self.safe_string(self.timeframes, timeframe, timeframe)
|
2137
2137
|
if (timezone == 'UTC') and (duration >= 21600): # if utc and timeframe >= 6h
|
2138
2138
|
bar += timezone.lower()
|
2139
|
-
request = {
|
2139
|
+
request: dict = {
|
2140
2140
|
'instId': market['id'],
|
2141
2141
|
'bar': bar,
|
2142
2142
|
'limit': limit,
|
@@ -2210,7 +2210,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2210
2210
|
if paginate:
|
2211
2211
|
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 100)
|
2212
2212
|
market = self.market(symbol)
|
2213
|
-
request = {
|
2213
|
+
request: dict = {
|
2214
2214
|
'instId': market['id'],
|
2215
2215
|
}
|
2216
2216
|
if since is not None:
|
@@ -2262,7 +2262,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2262
2262
|
return self.parse_trading_balance(response)
|
2263
2263
|
|
2264
2264
|
def parse_trading_balance(self, response):
|
2265
|
-
result = {'info': response}
|
2265
|
+
result: dict = {'info': response}
|
2266
2266
|
data = self.safe_list(response, 'data', [])
|
2267
2267
|
first = self.safe_dict(data, 0, {})
|
2268
2268
|
timestamp = self.safe_integer(first, 'uTime')
|
@@ -2287,7 +2287,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2287
2287
|
return self.safe_balance(result)
|
2288
2288
|
|
2289
2289
|
def parse_funding_balance(self, response):
|
2290
|
-
result = {'info': response}
|
2290
|
+
result: dict = {'info': response}
|
2291
2291
|
data = self.safe_list(response, 'data', [])
|
2292
2292
|
for i in range(0, len(data)):
|
2293
2293
|
balance = data[i]
|
@@ -2301,7 +2301,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2301
2301
|
result[code] = account
|
2302
2302
|
return self.safe_balance(result)
|
2303
2303
|
|
2304
|
-
def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
|
2304
|
+
def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
|
2305
2305
|
# https://www.okx.com/docs-v5/en/#rest-api-account-get-fee-rates
|
2306
2306
|
#
|
2307
2307
|
# {
|
@@ -2335,7 +2335,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2335
2335
|
"""
|
2336
2336
|
await self.load_markets()
|
2337
2337
|
market = self.market(symbol)
|
2338
|
-
request = {
|
2338
|
+
request: dict = {
|
2339
2339
|
'instType': self.convert_to_instrument_type(market['type']), # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
2340
2340
|
# "instId": market["id"], # only applicable to SPOT/MARGIN
|
2341
2341
|
# "uly": market["id"], # only applicable to FUTURES/SWAP/OPTION
|
@@ -2380,7 +2380,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2380
2380
|
"""
|
2381
2381
|
await self.load_markets()
|
2382
2382
|
marketType, query = self.handle_market_type_and_params('fetchBalance', None, params)
|
2383
|
-
request = {
|
2383
|
+
request: dict = {
|
2384
2384
|
# 'ccy': 'BTC,ETH', # comma-separated list of currency ids
|
2385
2385
|
}
|
2386
2386
|
response = None
|
@@ -2528,7 +2528,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2528
2528
|
|
2529
2529
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2530
2530
|
market = self.market(symbol)
|
2531
|
-
request = {
|
2531
|
+
request: dict = {
|
2532
2532
|
'instId': market['id'],
|
2533
2533
|
# 'ccy': currency['id'], # only applicable to cross MARGIN orders in single-currency margin
|
2534
2534
|
# 'clOrdId': clientOrderId, # up to 32 characters, must be unique
|
@@ -2852,7 +2852,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2852
2852
|
|
2853
2853
|
def edit_order_request(self, id: str, symbol, type, side, amount=None, price=None, params={}):
|
2854
2854
|
market = self.market(symbol)
|
2855
|
-
request = {
|
2855
|
+
request: dict = {
|
2856
2856
|
'instId': market['id'],
|
2857
2857
|
}
|
2858
2858
|
isAlgoOrder = None
|
@@ -3010,7 +3010,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3010
3010
|
return self.safe_value(orderInner, 0)
|
3011
3011
|
await self.load_markets()
|
3012
3012
|
market = self.market(symbol)
|
3013
|
-
request = {
|
3013
|
+
request: dict = {
|
3014
3014
|
'instId': market['id'],
|
3015
3015
|
# 'ordId': id, # either ordId or clOrdId is required
|
3016
3016
|
# 'clOrdId': clientOrderId,
|
@@ -3159,7 +3159,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3159
3159
|
idKey = 'algoId'
|
3160
3160
|
elif clientOrderId is not None:
|
3161
3161
|
idKey = 'clOrdId'
|
3162
|
-
requestItem = {
|
3162
|
+
requestItem: dict = {
|
3163
3163
|
'instId': market['id'],
|
3164
3164
|
}
|
3165
3165
|
requestItem[idKey] = clientOrderId if (clientOrderId is not None) else id
|
@@ -3228,8 +3228,8 @@ class okx(Exchange, ImplicitAPI):
|
|
3228
3228
|
#
|
3229
3229
|
return response
|
3230
3230
|
|
3231
|
-
def parse_order_status(self, status):
|
3232
|
-
statuses = {
|
3231
|
+
def parse_order_status(self, status: Str):
|
3232
|
+
statuses: dict = {
|
3233
3233
|
'canceled': 'canceled',
|
3234
3234
|
'order_failed': 'canceled',
|
3235
3235
|
'live': 'open',
|
@@ -3239,7 +3239,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3239
3239
|
}
|
3240
3240
|
return self.safe_string(statuses, status, status)
|
3241
3241
|
|
3242
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
3242
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
3243
3243
|
#
|
3244
3244
|
# createOrder
|
3245
3245
|
#
|
@@ -3454,7 +3454,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3454
3454
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
3455
3455
|
await self.load_markets()
|
3456
3456
|
market = self.market(symbol)
|
3457
|
-
request = {
|
3457
|
+
request: dict = {
|
3458
3458
|
'instId': market['id'],
|
3459
3459
|
# 'clOrdId': 'abcdef12345', # optional, [a-z0-9]{1,32}
|
3460
3460
|
# 'ordId': id,
|
@@ -3603,7 +3603,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3603
3603
|
paginate, params = self.handle_option_and_params(params, 'fetchOpenOrders', 'paginate')
|
3604
3604
|
if paginate:
|
3605
3605
|
return await self.fetch_paginated_call_dynamic('fetchOpenOrders', symbol, since, limit, params)
|
3606
|
-
request = {
|
3606
|
+
request: dict = {
|
3607
3607
|
# 'instType': 'SPOT', # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
3608
3608
|
# 'uly': currency['id'],
|
3609
3609
|
# 'instId': market['id'],
|
@@ -3753,7 +3753,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3753
3753
|
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3754
3754
|
"""
|
3755
3755
|
await self.load_markets()
|
3756
|
-
request = {
|
3756
|
+
request: dict = {
|
3757
3757
|
# 'instType': type.upper(), # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
3758
3758
|
# 'uly': currency['id'],
|
3759
3759
|
# 'instId': market['id'],
|
@@ -3933,7 +3933,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3933
3933
|
paginate, params = self.handle_option_and_params(params, 'fetchClosedOrders', 'paginate')
|
3934
3934
|
if paginate:
|
3935
3935
|
return await self.fetch_paginated_call_dynamic('fetchClosedOrders', symbol, since, limit, params)
|
3936
|
-
request = {
|
3936
|
+
request: dict = {
|
3937
3937
|
# 'instType': type.upper(), # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
3938
3938
|
# 'uly': currency['id'],
|
3939
3939
|
# 'instId': market['id'],
|
@@ -4100,7 +4100,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4100
4100
|
paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
|
4101
4101
|
if paginate:
|
4102
4102
|
return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
|
4103
|
-
request = {
|
4103
|
+
request: dict = {
|
4104
4104
|
# 'instType': 'SPOT', # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
4105
4105
|
# 'uly': currency['id'],
|
4106
4106
|
# 'instId': market['id'],
|
@@ -4160,7 +4160,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4160
4160
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4161
4161
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
4162
4162
|
"""
|
4163
|
-
request = {
|
4163
|
+
request: dict = {
|
4164
4164
|
# 'instrument_id': market['id'],
|
4165
4165
|
'ordId': id,
|
4166
4166
|
# 'after': '1', # return the page after the specified page number
|
@@ -4193,7 +4193,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4193
4193
|
method = self.safe_string(options, 'method')
|
4194
4194
|
method = self.safe_string(params, 'method', method)
|
4195
4195
|
params = self.omit(params, 'method')
|
4196
|
-
request = {
|
4196
|
+
request: dict = {
|
4197
4197
|
# 'instType': None, # 'SPOT', 'MARGIN', 'SWAP', 'FUTURES", 'OPTION'
|
4198
4198
|
# 'ccy': None, # currency['id'],
|
4199
4199
|
# 'mgnMode': None, # 'isolated', 'cross'
|
@@ -4282,7 +4282,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4282
4282
|
return self.parse_ledger(data, currency, since, limit)
|
4283
4283
|
|
4284
4284
|
def parse_ledger_entry_type(self, type):
|
4285
|
-
types = {
|
4285
|
+
types: dict = {
|
4286
4286
|
'1': 'transfer', # transfer
|
4287
4287
|
'2': 'trade', # trade
|
4288
4288
|
'3': 'trade', # delivery
|
@@ -4297,7 +4297,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4297
4297
|
}
|
4298
4298
|
return self.safe_string(types, type, type)
|
4299
4299
|
|
4300
|
-
def parse_ledger_entry(self, item, currency: Currency = None):
|
4300
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
4301
4301
|
#
|
4302
4302
|
# privateGetAccountBills, privateGetAccountBillsArchive
|
4303
4303
|
#
|
@@ -4479,7 +4479,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4479
4479
|
"""
|
4480
4480
|
await self.load_markets()
|
4481
4481
|
currency = self.currency(code)
|
4482
|
-
request = {
|
4482
|
+
request: dict = {
|
4483
4483
|
'ccy': currency['id'],
|
4484
4484
|
}
|
4485
4485
|
response = await self.privateGetAssetDepositAddress(self.extend(request, params))
|
@@ -4559,7 +4559,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4559
4559
|
currency = self.currency(code)
|
4560
4560
|
if (tag is not None) and (len(tag) > 0):
|
4561
4561
|
address = address + ':' + tag
|
4562
|
-
request = {
|
4562
|
+
request: dict = {
|
4563
4563
|
'ccy': currency['id'],
|
4564
4564
|
'toAddr': address,
|
4565
4565
|
'dest': '4', # 2 = OKCoin International, 3 = OKX 4 = others
|
@@ -4616,7 +4616,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4616
4616
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
4617
4617
|
if paginate:
|
4618
4618
|
return await self.fetch_paginated_call_dynamic('fetchDeposits', code, since, limit, params)
|
4619
|
-
request = {
|
4619
|
+
request: dict = {
|
4620
4620
|
# 'ccy': currency['id'],
|
4621
4621
|
# 'state': 2, # 0 waiting for confirmation, 1 deposit credited, 2 deposit successful
|
4622
4622
|
# 'after': since,
|
@@ -4684,7 +4684,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4684
4684
|
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
4685
4685
|
"""
|
4686
4686
|
await self.load_markets()
|
4687
|
-
request = {
|
4687
|
+
request: dict = {
|
4688
4688
|
'depId': id,
|
4689
4689
|
}
|
4690
4690
|
currency = None
|
@@ -4713,7 +4713,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4713
4713
|
paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
|
4714
4714
|
if paginate:
|
4715
4715
|
return await self.fetch_paginated_call_dynamic('fetchWithdrawals', code, since, limit, params)
|
4716
|
-
request = {
|
4716
|
+
request: dict = {
|
4717
4717
|
# 'ccy': currency['id'],
|
4718
4718
|
# 'state': 2, # -3: pending cancel, -2 canceled, -1 failed, 0, pending, 1 sending, 2 sent, 3 awaiting email verification, 4 awaiting manual verification, 5 awaiting identity verification
|
4719
4719
|
# 'after': since,
|
@@ -4773,7 +4773,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4773
4773
|
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
4774
4774
|
"""
|
4775
4775
|
await self.load_markets()
|
4776
|
-
request = {
|
4776
|
+
request: dict = {
|
4777
4777
|
'wdId': id,
|
4778
4778
|
}
|
4779
4779
|
currency = None
|
@@ -4830,7 +4830,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4830
4830
|
# "5": "awaiting identity verification"
|
4831
4831
|
# }
|
4832
4832
|
#
|
4833
|
-
statuses = {
|
4833
|
+
statuses: dict = {
|
4834
4834
|
'-3': 'pending',
|
4835
4835
|
'-2': 'canceled',
|
4836
4836
|
'-1': 'failed',
|
@@ -4851,7 +4851,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4851
4851
|
}
|
4852
4852
|
return self.safe_string(statuses, status, status)
|
4853
4853
|
|
4854
|
-
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
4854
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
4855
4855
|
#
|
4856
4856
|
# withdraw
|
4857
4857
|
#
|
@@ -4961,7 +4961,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4961
4961
|
if (marginMode != 'cross') and (marginMode != 'isolated'):
|
4962
4962
|
raise BadRequest(self.id + ' fetchLeverage() requires a marginMode parameter that must be either cross or isolated')
|
4963
4963
|
market = self.market(symbol)
|
4964
|
-
request = {
|
4964
|
+
request: dict = {
|
4965
4965
|
'instId': market['id'],
|
4966
4966
|
'mgnMode': marginMode,
|
4967
4967
|
}
|
@@ -5020,7 +5020,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5020
5020
|
await self.load_markets()
|
5021
5021
|
market = self.market(symbol)
|
5022
5022
|
type, query = self.handle_market_type_and_params('fetchPosition', market, params)
|
5023
|
-
request = {
|
5023
|
+
request: dict = {
|
5024
5024
|
# instType str No Instrument type, MARGIN, SWAP, FUTURES, OPTION
|
5025
5025
|
'instId': market['id'],
|
5026
5026
|
# posId str No Single position ID or multiple position IDs(no more than 20) separated with comma
|
@@ -5091,7 +5091,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5091
5091
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
5092
5092
|
"""
|
5093
5093
|
await self.load_markets()
|
5094
|
-
request = {
|
5094
|
+
request: dict = {
|
5095
5095
|
# 'instType': 'MARGIN', # optional string, MARGIN, SWAP, FUTURES, OPTION
|
5096
5096
|
# 'instId': market['id'], # optional string, e.g. 'BTC-USD-190927-5000-C'
|
5097
5097
|
# 'posId': '307173036051017730', # optional string, Single or multiple position IDs(no more than 20) separated with commas
|
@@ -5175,7 +5175,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5175
5175
|
"""
|
5176
5176
|
return await self.fetch_positions([symbol], params)
|
5177
5177
|
|
5178
|
-
def parse_position(self, position, market: Market = None):
|
5178
|
+
def parse_position(self, position: dict, market: Market = None):
|
5179
5179
|
#
|
5180
5180
|
# {
|
5181
5181
|
# "adl": "3",
|
@@ -5349,7 +5349,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5349
5349
|
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
5350
5350
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
5351
5351
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
5352
|
-
request = {
|
5352
|
+
request: dict = {
|
5353
5353
|
'ccy': currency['id'],
|
5354
5354
|
'amt': self.currency_to_precision(code, amount),
|
5355
5355
|
'type': '0', # 0 = transfer within account by default, 1 = master account to sub-account, 2 = sub-account to master account, 3 = sub-account to master account(Only applicable to APIKey from sub-account), 4 = sub-account to sub-account
|
@@ -5467,14 +5467,14 @@ class okx(Exchange, ImplicitAPI):
|
|
5467
5467
|
}
|
5468
5468
|
|
5469
5469
|
def parse_transfer_status(self, status: Str) -> Str:
|
5470
|
-
statuses = {
|
5470
|
+
statuses: dict = {
|
5471
5471
|
'success': 'ok',
|
5472
5472
|
}
|
5473
5473
|
return self.safe_string(statuses, status, status)
|
5474
5474
|
|
5475
5475
|
async def fetch_transfer(self, id: str, code: Str = None, params={}) -> TransferEntry:
|
5476
5476
|
await self.load_markets()
|
5477
|
-
request = {
|
5477
|
+
request: dict = {
|
5478
5478
|
'transId': id,
|
5479
5479
|
# 'type': 0, # default is 0 transfer within account, 1 master to sub, 2 sub to master
|
5480
5480
|
}
|
@@ -5515,7 +5515,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5515
5515
|
"""
|
5516
5516
|
await self.load_markets()
|
5517
5517
|
currency = None
|
5518
|
-
request = {
|
5518
|
+
request: dict = {
|
5519
5519
|
'type': '1', # https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
5520
5520
|
}
|
5521
5521
|
if code is not None:
|
@@ -5680,7 +5680,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5680
5680
|
market = self.market(symbol)
|
5681
5681
|
if not market['swap']:
|
5682
5682
|
raise ExchangeError(self.id + ' fetchFundingRate() is only valid for swap markets')
|
5683
|
-
request = {
|
5683
|
+
request: dict = {
|
5684
5684
|
'instId': market['id'],
|
5685
5685
|
}
|
5686
5686
|
response = await self.publicGetPublicFundingRate(self.extend(request, params))
|
@@ -5715,7 +5715,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5715
5715
|
:returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
|
5716
5716
|
"""
|
5717
5717
|
await self.load_markets()
|
5718
|
-
request = {
|
5718
|
+
request: dict = {
|
5719
5719
|
# 'instType': 'SPOT', # SPOT, MARGIN, SWAP, FUTURES, OPTION
|
5720
5720
|
# 'ccy': currency['id'],
|
5721
5721
|
# 'mgnMode': 'isolated', # isolated, cross
|
@@ -5879,7 +5879,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5879
5879
|
marginMode = self.safe_string(params, 'mgnMode', 'cross') # cross marginMode
|
5880
5880
|
if (marginMode != 'cross') and (marginMode != 'isolated'):
|
5881
5881
|
raise BadRequest(self.id + ' setLeverage() requires a marginMode parameter that must be either cross or isolated')
|
5882
|
-
request = {
|
5882
|
+
request: dict = {
|
5883
5883
|
'lever': leverage,
|
5884
5884
|
'mgnMode': marginMode,
|
5885
5885
|
'instId': market['id'],
|
@@ -5951,7 +5951,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5951
5951
|
hedgeMode = 'long_short_mode'
|
5952
5952
|
else:
|
5953
5953
|
hedgeMode = 'net_mode'
|
5954
|
-
request = {
|
5954
|
+
request: dict = {
|
5955
5955
|
'posMode': hedgeMode,
|
5956
5956
|
}
|
5957
5957
|
response = await self.privatePostAccountSetPositionMode(self.extend(request, params))
|
@@ -5991,7 +5991,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5991
5991
|
if (lever is None) or (lever < 1) or (lever > 125):
|
5992
5992
|
raise BadRequest(self.id + ' setMarginMode() params["lever"] should be between 1 and 125')
|
5993
5993
|
params = self.omit(params, ['leverage'])
|
5994
|
-
request = {
|
5994
|
+
request: dict = {
|
5995
5995
|
'lever': lever,
|
5996
5996
|
'mgnMode': marginMode,
|
5997
5997
|
'instId': market['id'],
|
@@ -6050,7 +6050,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6050
6050
|
"""
|
6051
6051
|
await self.load_markets()
|
6052
6052
|
currency = self.currency(code)
|
6053
|
-
request = {
|
6053
|
+
request: dict = {
|
6054
6054
|
'ccy': currency['id'],
|
6055
6055
|
}
|
6056
6056
|
response = await self.privateGetAccountInterestRate(self.extend(request, params))
|
@@ -6103,7 +6103,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6103
6103
|
# ...
|
6104
6104
|
# ]
|
6105
6105
|
#
|
6106
|
-
borrowRateHistories = {}
|
6106
|
+
borrowRateHistories: dict = {}
|
6107
6107
|
for i in range(0, len(response)):
|
6108
6108
|
item = response[i]
|
6109
6109
|
code = self.safe_currency_code(self.safe_string(item, 'ccy'))
|
@@ -6138,7 +6138,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6138
6138
|
:returns dict: a dictionary of `borrow rate structures <https://docs.ccxt.com/#/?id=borrow-rate-structure>` indexed by the market symbol
|
6139
6139
|
"""
|
6140
6140
|
await self.load_markets()
|
6141
|
-
request = {
|
6141
|
+
request: dict = {
|
6142
6142
|
# 'ccy': currency['id'],
|
6143
6143
|
# 'after': self.milliseconds(), # Pagination of data to return records earlier than the requested ts,
|
6144
6144
|
# 'before': since, # Pagination of data to return records newer than the requested ts,
|
@@ -6178,7 +6178,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6178
6178
|
"""
|
6179
6179
|
await self.load_markets()
|
6180
6180
|
currency = self.currency(code)
|
6181
|
-
request = {
|
6181
|
+
request: dict = {
|
6182
6182
|
'ccy': currency['id'],
|
6183
6183
|
# 'after': self.milliseconds(), # Pagination of data to return records earlier than the requested ts,
|
6184
6184
|
# 'before': since, # Pagination of data to return records newer than the requested ts,
|
@@ -6211,7 +6211,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6211
6211
|
market = self.market(symbol)
|
6212
6212
|
posSide = self.safe_string(params, 'posSide', 'net')
|
6213
6213
|
params = self.omit(params, ['posSide'])
|
6214
|
-
request = {
|
6214
|
+
request: dict = {
|
6215
6215
|
'instId': market['id'],
|
6216
6216
|
'amt': amount,
|
6217
6217
|
'type': type,
|
@@ -6334,7 +6334,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6334
6334
|
"""
|
6335
6335
|
return await self.modify_margin_helper(symbol, amount, 'add', params)
|
6336
6336
|
|
6337
|
-
async def fetch_market_leverage_tiers(self, symbol: str, params={}):
|
6337
|
+
async def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
|
6338
6338
|
"""
|
6339
6339
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
6340
6340
|
:see: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
|
@@ -6354,7 +6354,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6354
6354
|
marginMode, params = self.handle_margin_mode_and_params('fetchMarketLeverageTiers', params)
|
6355
6355
|
if marginMode is None:
|
6356
6356
|
marginMode = self.safe_string(params, 'tdMode', 'cross') # cross marginMode
|
6357
|
-
request = {
|
6357
|
+
request: dict = {
|
6358
6358
|
'instType': type,
|
6359
6359
|
'tdMode': marginMode,
|
6360
6360
|
'uly': uly,
|
@@ -6386,7 +6386,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6386
6386
|
data = self.safe_list(response, 'data', [])
|
6387
6387
|
return self.parse_market_leverage_tiers(data, market)
|
6388
6388
|
|
6389
|
-
def parse_market_leverage_tiers(self, info, market: Market = None):
|
6389
|
+
def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
|
6390
6390
|
"""
|
6391
6391
|
* @ignore
|
6392
6392
|
:param dict info: Exchange response for 1 market
|
@@ -6442,7 +6442,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6442
6442
|
marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params)
|
6443
6443
|
if marginMode is None:
|
6444
6444
|
marginMode = self.safe_string(params, 'mgnMode', 'cross') # cross marginMode
|
6445
|
-
request = {
|
6445
|
+
request: dict = {
|
6446
6446
|
'mgnMode': marginMode,
|
6447
6447
|
}
|
6448
6448
|
market = None
|
@@ -6480,7 +6480,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6480
6480
|
interest = self.parse_borrow_interests(data)
|
6481
6481
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
6482
6482
|
|
6483
|
-
def parse_borrow_interest(self, info, market: Market = None):
|
6483
|
+
def parse_borrow_interest(self, info: dict, market: Market = None):
|
6484
6484
|
instId = self.safe_string(info, 'instId')
|
6485
6485
|
if instId is not None:
|
6486
6486
|
market = self.safe_market(instId, market)
|
@@ -6508,7 +6508,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6508
6508
|
"""
|
6509
6509
|
await self.load_markets()
|
6510
6510
|
currency = self.currency(code)
|
6511
|
-
request = {
|
6511
|
+
request: dict = {
|
6512
6512
|
'ccy': currency['id'],
|
6513
6513
|
'amt': self.currency_to_precision(code, amount),
|
6514
6514
|
'side': 'borrow',
|
@@ -6549,7 +6549,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6549
6549
|
if id is None:
|
6550
6550
|
raise ArgumentsRequired(self.id + ' repayCrossMargin() requires an id parameter')
|
6551
6551
|
currency = self.currency(code)
|
6552
|
-
request = {
|
6552
|
+
request: dict = {
|
6553
6553
|
'ccy': currency['id'],
|
6554
6554
|
'amt': self.currency_to_precision(code, amount),
|
6555
6555
|
'side': 'repay',
|
@@ -6612,7 +6612,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6612
6612
|
raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
|
6613
6613
|
type = self.convert_to_instrument_type(market['type'])
|
6614
6614
|
uly = self.safe_string(market['info'], 'uly')
|
6615
|
-
request = {
|
6615
|
+
request: dict = {
|
6616
6616
|
'instType': type,
|
6617
6617
|
'uly': uly,
|
6618
6618
|
'instId': market['id'],
|
@@ -6664,7 +6664,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6664
6664
|
else:
|
6665
6665
|
currency = self.currency(symbol)
|
6666
6666
|
currencyId = currency['id']
|
6667
|
-
request = {
|
6667
|
+
request: dict = {
|
6668
6668
|
'ccy': currencyId,
|
6669
6669
|
'period': timeframe,
|
6670
6670
|
}
|
@@ -6835,7 +6835,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6835
6835
|
# }
|
6836
6836
|
# ]
|
6837
6837
|
#
|
6838
|
-
depositWithdrawFees = {}
|
6838
|
+
depositWithdrawFees: dict = {}
|
6839
6839
|
codes = self.market_codes(codes)
|
6840
6840
|
for i in range(0, len(response)):
|
6841
6841
|
feeInfo = response[i]
|
@@ -6850,11 +6850,11 @@ class okx(Exchange, ImplicitAPI):
|
|
6850
6850
|
chainSplit = chain.split('-')
|
6851
6851
|
networkId = self.safe_value(chainSplit, 1)
|
6852
6852
|
withdrawFee = self.safe_number(feeInfo, 'minFee')
|
6853
|
-
withdrawResult = {
|
6853
|
+
withdrawResult: dict = {
|
6854
6854
|
'fee': withdrawFee,
|
6855
6855
|
'percentage': False if (withdrawFee is not None) else None,
|
6856
6856
|
}
|
6857
|
-
depositResult = {
|
6857
|
+
depositResult: dict = {
|
6858
6858
|
'fee': None,
|
6859
6859
|
'percentage': None,
|
6860
6860
|
}
|
@@ -6888,7 +6888,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6888
6888
|
type, params = self.handle_market_type_and_params('fetchSettlementHistory', market, params)
|
6889
6889
|
if type != 'future' and type != 'option':
|
6890
6890
|
raise NotSupported(self.id + ' fetchSettlementHistory() supports futures and options markets only')
|
6891
|
-
request = {
|
6891
|
+
request: dict = {
|
6892
6892
|
'instType': self.convert_to_instrument_type(type),
|
6893
6893
|
'uly': market['baseId'] + '-' + market['quoteId'],
|
6894
6894
|
}
|
@@ -6978,7 +6978,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6978
6978
|
marketType = 'option'
|
6979
6979
|
if (marketType != 'option') and (marketType != 'swap') and (marketType != 'future'):
|
6980
6980
|
raise NotSupported(self.id + ' fetchUnderlyingAssets() supports contract markets only')
|
6981
|
-
request = {
|
6981
|
+
request: dict = {
|
6982
6982
|
'instType': self.convert_to_instrument_type(marketType),
|
6983
6983
|
}
|
6984
6984
|
response = await self.publicGetPublicUnderlying(self.extend(request, params))
|
@@ -7009,7 +7009,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7009
7009
|
market = self.market(symbol)
|
7010
7010
|
marketId = market['id']
|
7011
7011
|
optionParts = marketId.split('-')
|
7012
|
-
request = {
|
7012
|
+
request: dict = {
|
7013
7013
|
'uly': market['info']['uly'],
|
7014
7014
|
'instFamily': market['info']['instFamily'],
|
7015
7015
|
'expTime': self.safe_string(optionParts, 2),
|
@@ -7123,7 +7123,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7123
7123
|
code = self.safe_string(params, 'code')
|
7124
7124
|
marginMode = None
|
7125
7125
|
marginMode, params = self.handle_margin_mode_and_params('closePosition', params, 'cross')
|
7126
|
-
request = {
|
7126
|
+
request: dict = {
|
7127
7127
|
'instId': market['id'],
|
7128
7128
|
'mgnMode': marginMode,
|
7129
7129
|
}
|
@@ -7171,7 +7171,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7171
7171
|
"""
|
7172
7172
|
await self.load_markets()
|
7173
7173
|
market = self.market(symbol)
|
7174
|
-
request = {
|
7174
|
+
request: dict = {
|
7175
7175
|
'instId': market['id'],
|
7176
7176
|
}
|
7177
7177
|
response = await self.publicGetMarketTicker(self.extend(request, params))
|
@@ -7216,7 +7216,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7216
7216
|
"""
|
7217
7217
|
await self.load_markets()
|
7218
7218
|
currency = self.currency(code)
|
7219
|
-
request = {
|
7219
|
+
request: dict = {
|
7220
7220
|
'uly': currency['code'] + '-USD',
|
7221
7221
|
'instType': 'OPTION',
|
7222
7222
|
}
|
@@ -7305,7 +7305,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7305
7305
|
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7306
7306
|
"""
|
7307
7307
|
await self.load_markets()
|
7308
|
-
request = {
|
7308
|
+
request: dict = {
|
7309
7309
|
'baseCcy': fromCode.upper(),
|
7310
7310
|
'quoteCcy': toCode.upper(),
|
7311
7311
|
'rfqSzCcy': fromCode.upper(),
|
@@ -7356,7 +7356,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7356
7356
|
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7357
7357
|
"""
|
7358
7358
|
await self.load_markets()
|
7359
|
-
request = {
|
7359
|
+
request: dict = {
|
7360
7360
|
'quoteId': id,
|
7361
7361
|
'baseCcy': fromCode,
|
7362
7362
|
'quoteCcy': toCode,
|
@@ -7405,7 +7405,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7405
7405
|
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7406
7406
|
"""
|
7407
7407
|
await self.load_markets()
|
7408
|
-
request = {
|
7408
|
+
request: dict = {
|
7409
7409
|
'clTReqId': id,
|
7410
7410
|
}
|
7411
7411
|
response = await self.privateGetAssetConvertHistory(self.extend(request, params))
|
@@ -7454,7 +7454,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7454
7454
|
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7455
7455
|
"""
|
7456
7456
|
await self.load_markets()
|
7457
|
-
request = {}
|
7457
|
+
request: dict = {}
|
7458
7458
|
request, params = self.handle_until_option('after', request, params)
|
7459
7459
|
if since is not None:
|
7460
7460
|
request['before'] = since
|
@@ -7578,7 +7578,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7578
7578
|
# "msg": ""
|
7579
7579
|
# }
|
7580
7580
|
#
|
7581
|
-
result = {}
|
7581
|
+
result: dict = {}
|
7582
7582
|
data = self.safe_list(response, 'data', [])
|
7583
7583
|
for i in range(0, len(data)):
|
7584
7584
|
entry = data[i]
|
@@ -7673,7 +7673,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7673
7673
|
subType = '162'
|
7674
7674
|
else:
|
7675
7675
|
raise BadRequest(self.id + ' cannot fetch margin adjustments for type ' + type)
|
7676
|
-
request = {
|
7676
|
+
request: dict = {
|
7677
7677
|
'subType': subType,
|
7678
7678
|
'mgnMode': 'isolated',
|
7679
7679
|
}
|
@@ -7765,7 +7765,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7765
7765
|
params = self.omit(params, ['until', 'marginMode', 'instType'])
|
7766
7766
|
if limit is None:
|
7767
7767
|
limit = 100
|
7768
|
-
request = {
|
7768
|
+
request: dict = {
|
7769
7769
|
'limit': limit,
|
7770
7770
|
}
|
7771
7771
|
if symbols is not None:
|