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