ccxt 4.1.54__py2.py3-none-any.whl → 4.1.56__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +2 -2
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/bitbank.py +1 -0
- ccxt/abstract/coinbase.py +2 -0
- ccxt/abstract/htx.py +3 -0
- ccxt/abstract/huobi.py +3 -0
- ccxt/abstract/huobipro.py +3 -0
- ccxt/abstract/okex.py +3 -1
- ccxt/abstract/okex5.py +3 -1
- ccxt/abstract/okx.py +3 -1
- ccxt/ace.py +23 -23
- ccxt/alpaca.py +8 -8
- ccxt/ascendex.py +26 -26
- ccxt/async_support/__init__.py +2 -2
- ccxt/async_support/ace.py +23 -23
- ccxt/async_support/alpaca.py +8 -8
- ccxt/async_support/ascendex.py +26 -26
- ccxt/async_support/base/exchange.py +4 -2216
- ccxt/async_support/bigone.py +21 -24
- ccxt/async_support/binance.py +61 -54
- ccxt/async_support/bingx.py +28 -28
- ccxt/async_support/bit2c.py +9 -9
- ccxt/async_support/bitbank.py +11 -10
- ccxt/async_support/bitbns.py +11 -11
- ccxt/async_support/bitfinex.py +15 -15
- ccxt/async_support/bitfinex2.py +22 -22
- ccxt/async_support/bitflyer.py +13 -13
- ccxt/async_support/bitforex.py +10 -10
- ccxt/async_support/bitget.py +44 -44
- ccxt/async_support/bithumb.py +9 -9
- ccxt/async_support/bitmart.py +85 -104
- ccxt/async_support/bitmex.py +27 -27
- ccxt/async_support/bitopro.py +18 -18
- ccxt/async_support/bitpanda.py +18 -18
- ccxt/async_support/bitrue.py +14 -14
- ccxt/async_support/bitso.py +17 -17
- ccxt/async_support/bitstamp.py +17 -17
- ccxt/async_support/bittrex.py +22 -24
- ccxt/async_support/bitvavo.py +15 -15
- ccxt/async_support/bl3p.py +4 -4
- ccxt/async_support/blockchaincom.py +17 -17
- ccxt/async_support/btcalpha.py +14 -14
- ccxt/async_support/btcbox.py +9 -9
- ccxt/async_support/btcmarkets.py +17 -17
- ccxt/async_support/btcturk.py +9 -9
- ccxt/async_support/bybit.py +46 -46
- ccxt/async_support/cex.py +10 -10
- ccxt/async_support/coinbase.py +69 -25
- ccxt/async_support/coinbasepro.py +19 -19
- ccxt/async_support/coincheck.py +10 -10
- ccxt/async_support/coinex.py +57 -66
- ccxt/async_support/coinlist.py +22 -22
- ccxt/async_support/coinmate.py +10 -10
- ccxt/async_support/coinone.py +10 -10
- ccxt/async_support/coinsph.py +17 -17
- ccxt/async_support/coinspot.py +5 -5
- ccxt/async_support/cryptocom.py +27 -27
- ccxt/async_support/currencycom.py +18 -18
- ccxt/async_support/delta.py +21 -21
- ccxt/async_support/deribit.py +24 -24
- ccxt/async_support/digifinex.py +35 -35
- ccxt/async_support/exmo.py +19 -19
- ccxt/async_support/gate.py +38 -38
- ccxt/async_support/gemini.py +11 -11
- ccxt/async_support/hitbtc.py +27 -27
- ccxt/async_support/hollaex.py +19 -19
- ccxt/async_support/htx.py +47 -44
- ccxt/async_support/huobijp.py +22 -22
- ccxt/async_support/idex.py +20 -20
- ccxt/async_support/independentreserve.py +9 -9
- ccxt/async_support/indodax.py +10 -10
- ccxt/async_support/kraken.py +25 -25
- ccxt/async_support/krakenfutures.py +17 -17
- ccxt/async_support/kucoin.py +27 -27
- ccxt/async_support/kucoinfutures.py +20 -20
- ccxt/async_support/kuna.py +19 -19
- ccxt/async_support/latoken.py +14 -14
- ccxt/async_support/lbank.py +18 -18
- ccxt/async_support/luno.py +14 -14
- ccxt/async_support/lykke.py +12 -12
- ccxt/async_support/mercado.py +11 -11
- ccxt/async_support/mexc.py +36 -36
- ccxt/async_support/ndax.py +18 -18
- ccxt/async_support/novadax.py +17 -17
- ccxt/async_support/oceanex.py +12 -12
- ccxt/async_support/okcoin.py +19 -19
- ccxt/async_support/okx.py +48 -45
- ccxt/async_support/p2b.py +6 -6
- ccxt/async_support/paymium.py +6 -6
- ccxt/async_support/phemex.py +57 -57
- ccxt/async_support/poloniex.py +31 -30
- ccxt/async_support/poloniexfutures.py +16 -16
- ccxt/async_support/probit.py +22 -22
- ccxt/async_support/tidex.py +15 -15
- ccxt/async_support/timex.py +20 -20
- ccxt/async_support/tokocrypto.py +16 -16
- ccxt/async_support/upbit.py +15 -15
- ccxt/async_support/wavesexchange.py +12 -12
- ccxt/async_support/wazirx.py +13 -13
- ccxt/async_support/whitebit.py +26 -26
- ccxt/async_support/woo.py +47 -47
- ccxt/async_support/yobit.py +8 -8
- ccxt/async_support/zaif.py +10 -10
- ccxt/async_support/zonda.py +16 -16
- ccxt/base/errors.py +17 -16
- ccxt/base/exchange.py +57 -97
- ccxt/base/types.py +138 -139
- ccxt/bigone.py +21 -24
- ccxt/binance.py +61 -54
- ccxt/bingx.py +28 -28
- ccxt/bit2c.py +9 -9
- ccxt/bitbank.py +11 -10
- ccxt/bitbns.py +11 -11
- ccxt/bitfinex.py +15 -15
- ccxt/bitfinex2.py +22 -22
- ccxt/bitflyer.py +13 -13
- ccxt/bitforex.py +10 -10
- ccxt/bitget.py +44 -44
- ccxt/bithumb.py +9 -9
- ccxt/bitmart.py +85 -104
- ccxt/bitmex.py +27 -27
- ccxt/bitopro.py +18 -18
- ccxt/bitpanda.py +18 -18
- ccxt/bitrue.py +14 -14
- ccxt/bitso.py +17 -17
- ccxt/bitstamp.py +17 -17
- ccxt/bittrex.py +22 -24
- ccxt/bitvavo.py +15 -15
- ccxt/bl3p.py +4 -4
- ccxt/blockchaincom.py +17 -17
- ccxt/btcalpha.py +14 -14
- ccxt/btcbox.py +9 -9
- ccxt/btcmarkets.py +17 -17
- ccxt/btcturk.py +9 -9
- ccxt/bybit.py +46 -46
- ccxt/cex.py +10 -10
- ccxt/coinbase.py +69 -25
- ccxt/coinbasepro.py +19 -19
- ccxt/coincheck.py +10 -10
- ccxt/coinex.py +57 -66
- ccxt/coinlist.py +22 -22
- ccxt/coinmate.py +10 -10
- ccxt/coinone.py +10 -10
- ccxt/coinsph.py +17 -17
- ccxt/coinspot.py +5 -5
- ccxt/cryptocom.py +27 -27
- ccxt/currencycom.py +18 -18
- ccxt/delta.py +21 -21
- ccxt/deribit.py +24 -24
- ccxt/digifinex.py +35 -35
- ccxt/exmo.py +19 -19
- ccxt/gate.py +38 -38
- ccxt/gemini.py +11 -11
- ccxt/hitbtc.py +27 -27
- ccxt/hollaex.py +19 -19
- ccxt/htx.py +47 -44
- ccxt/huobijp.py +22 -22
- ccxt/idex.py +20 -20
- ccxt/independentreserve.py +9 -9
- ccxt/indodax.py +10 -10
- ccxt/kraken.py +25 -25
- ccxt/krakenfutures.py +17 -17
- ccxt/kucoin.py +27 -27
- ccxt/kucoinfutures.py +20 -20
- ccxt/kuna.py +19 -19
- ccxt/latoken.py +14 -14
- ccxt/lbank.py +18 -18
- ccxt/luno.py +14 -14
- ccxt/lykke.py +12 -12
- ccxt/mercado.py +11 -11
- ccxt/mexc.py +36 -36
- ccxt/ndax.py +18 -18
- ccxt/novadax.py +17 -17
- ccxt/oceanex.py +12 -12
- ccxt/okcoin.py +19 -19
- ccxt/okx.py +48 -45
- ccxt/p2b.py +6 -6
- ccxt/paymium.py +6 -6
- ccxt/phemex.py +57 -57
- ccxt/poloniex.py +31 -30
- ccxt/poloniexfutures.py +16 -16
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +3 -3
- ccxt/pro/ascendex.py +2 -2
- ccxt/pro/binance.py +9 -9
- ccxt/pro/bingx.py +3 -3
- ccxt/pro/bitfinex.py +3 -3
- ccxt/pro/bitfinex2.py +3 -3
- ccxt/pro/bitget.py +3 -3
- ccxt/pro/bitmart.py +2 -2
- ccxt/pro/bitmex.py +3 -3
- ccxt/pro/bitpanda.py +3 -3
- ccxt/pro/bitrue.py +2 -2
- ccxt/pro/bitstamp.py +2 -2
- ccxt/pro/bittrex.py +3 -3
- ccxt/pro/bitvavo.py +3 -3
- ccxt/pro/blockchaincom.py +2 -2
- ccxt/pro/bybit.py +4 -4
- ccxt/pro/cex.py +3 -3
- ccxt/pro/coinbasepro.py +3 -3
- ccxt/pro/coinex.py +2 -2
- ccxt/pro/cryptocom.py +5 -5
- ccxt/pro/deribit.py +3 -3
- ccxt/pro/exmo.py +2 -2
- ccxt/pro/gate.py +3 -3
- ccxt/pro/gemini.py +2 -2
- ccxt/pro/hitbtc.py +4 -4
- ccxt/pro/hollaex.py +3 -3
- ccxt/pro/htx.py +3 -3
- ccxt/pro/idex.py +3 -3
- ccxt/pro/kraken.py +7 -7
- ccxt/pro/krakenfutures.py +4 -4
- ccxt/pro/kucoin.py +3 -3
- ccxt/pro/kucoinfutures.py +3 -3
- ccxt/pro/mexc.py +3 -3
- ccxt/pro/okcoin.py +2 -2
- ccxt/pro/okx.py +6 -6
- ccxt/pro/phemex.py +3 -3
- ccxt/pro/poloniex.py +3 -3
- ccxt/pro/poloniexfutures.py +3 -3
- ccxt/pro/probit.py +3 -3
- ccxt/pro/wazirx.py +3 -3
- ccxt/pro/whitebit.py +3 -3
- ccxt/pro/woo.py +2 -2
- ccxt/probit.py +22 -22
- ccxt/test/base/test_shared_methods.py +3 -3
- ccxt/test/test_async.py +543 -535
- ccxt/test/test_sync.py +542 -534
- ccxt/tidex.py +15 -15
- ccxt/timex.py +20 -20
- ccxt/tokocrypto.py +16 -16
- ccxt/upbit.py +15 -15
- ccxt/wavesexchange.py +12 -12
- ccxt/wazirx.py +13 -13
- ccxt/whitebit.py +26 -26
- ccxt/woo.py +47 -47
- ccxt/yobit.py +8 -8
- ccxt/zaif.py +10 -10
- ccxt/zonda.py +16 -16
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/METADATA +10 -8
- ccxt-4.1.56.dist-info/RECORD +449 -0
- ccxt/async_support/bitstamp1.py +0 -402
- ccxt/async_support/lbank2.py +0 -2620
- ccxt/bitstamp1.py +0 -402
- ccxt/lbank2.py +0 -2619
- ccxt-4.1.54.dist-info/RECORD +0 -453
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/WHEEL +0 -0
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.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 Balances, Greeks, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -203,6 +203,7 @@ class okx(Exchange, ImplicitAPI):
|
|
203
203
|
'market/open-oracle': 50,
|
204
204
|
'market/exchange-rate': 20,
|
205
205
|
'market/index-components': 1,
|
206
|
+
'public/economic-calendar': 50,
|
206
207
|
'market/block-tickers': 1,
|
207
208
|
'market/block-ticker': 1,
|
208
209
|
'public/block-trades': 1,
|
@@ -334,7 +335,6 @@ class okx(Exchange, ImplicitAPI):
|
|
334
335
|
'asset/subaccount/bills': 5 / 3,
|
335
336
|
'asset/subaccount/managed-subaccount-bills': 5 / 3,
|
336
337
|
'users/entrust-subaccount-list': 10,
|
337
|
-
'users/partner/if-rebate': 1,
|
338
338
|
'account/subaccount/interest-limits': 4,
|
339
339
|
# grid trading
|
340
340
|
'tradingBot/grid/orders-algo-pending': 1,
|
@@ -381,6 +381,9 @@ class okx(Exchange, ImplicitAPI):
|
|
381
381
|
'finance/sfp/dcd/orders': 2,
|
382
382
|
'broker/fd/rebate-per-orders': 300,
|
383
383
|
'broker/fd/if-rebate': 5,
|
384
|
+
# affiliate
|
385
|
+
'affiliate/invitee/detail': 1,
|
386
|
+
'users/partner/if-rebate': 1,
|
384
387
|
},
|
385
388
|
'post': {
|
386
389
|
# rfq
|
@@ -1672,7 +1675,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1672
1675
|
timestamp = self.safe_integer(first, 'ts')
|
1673
1676
|
return self.parse_order_book(first, symbol, timestamp)
|
1674
1677
|
|
1675
|
-
def parse_ticker(self, ticker, market=None) -> Ticker:
|
1678
|
+
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
1676
1679
|
#
|
1677
1680
|
# {
|
1678
1681
|
# "instType": "SPOT",
|
@@ -1830,7 +1833,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1830
1833
|
type, query = self.handle_market_type_and_params('fetchTickers', market, params)
|
1831
1834
|
return self.fetch_tickers_by_type(type, symbols, query)
|
1832
1835
|
|
1833
|
-
def parse_trade(self, trade, market=None) -> Trade:
|
1836
|
+
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1834
1837
|
#
|
1835
1838
|
# public fetchTrades
|
1836
1839
|
#
|
@@ -1990,7 +1993,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1990
1993
|
data = self.safe_value(response, 'data', [])
|
1991
1994
|
return self.parse_trades(data, market, since, limit)
|
1992
1995
|
|
1993
|
-
def parse_ohlcv(self, ohlcv, market=None) -> list:
|
1996
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1994
1997
|
#
|
1995
1998
|
# [
|
1996
1999
|
# "1678928760000", # timestamp
|
@@ -2108,7 +2111,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2108
2111
|
data = self.safe_value(response, 'data', [])
|
2109
2112
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
2110
2113
|
|
2111
|
-
def fetch_funding_rate_history(self, symbol:
|
2114
|
+
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2112
2115
|
"""
|
2113
2116
|
fetches historical funding rate prices
|
2114
2117
|
:see: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
@@ -2217,7 +2220,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2217
2220
|
result[code] = account
|
2218
2221
|
return self.safe_balance(result)
|
2219
2222
|
|
2220
|
-
def parse_trading_fee(self, fee, market=None):
|
2223
|
+
def parse_trading_fee(self, fee, market: Market = None):
|
2221
2224
|
# https://www.okx.com/docs-v5/en/#rest-api-account-get-fee-rates
|
2222
2225
|
#
|
2223
2226
|
# {
|
@@ -2517,7 +2520,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2517
2520
|
request['ordType'] = 'ioc'
|
2518
2521
|
elif fok:
|
2519
2522
|
request['ordType'] = 'fok'
|
2520
|
-
|
2523
|
+
if stopLossDefined or takeProfitDefined:
|
2521
2524
|
if stopLossDefined:
|
2522
2525
|
stopLossTriggerPrice = self.safe_value_n(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx'])
|
2523
2526
|
if stopLossTriggerPrice is None:
|
@@ -2805,7 +2808,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2805
2808
|
order['side'] = side
|
2806
2809
|
return order
|
2807
2810
|
|
2808
|
-
def cancel_order(self, id: str, symbol:
|
2811
|
+
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2809
2812
|
"""
|
2810
2813
|
cancels an open order
|
2811
2814
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
@@ -2849,7 +2852,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2849
2852
|
else:
|
2850
2853
|
return ids
|
2851
2854
|
|
2852
|
-
def cancel_orders(self, ids, symbol:
|
2855
|
+
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
2853
2856
|
"""
|
2854
2857
|
cancel multiple orders
|
2855
2858
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
@@ -2941,7 +2944,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2941
2944
|
}
|
2942
2945
|
return self.safe_string(statuses, status, status)
|
2943
2946
|
|
2944
|
-
def parse_order(self, order, market=None) -> Order:
|
2947
|
+
def parse_order(self, order, market: Market = None) -> Order:
|
2945
2948
|
#
|
2946
2949
|
# createOrder
|
2947
2950
|
#
|
@@ -3141,7 +3144,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3141
3144
|
'reduceOnly': reduceOnly,
|
3142
3145
|
}, market)
|
3143
3146
|
|
3144
|
-
def fetch_order(self, id: str, symbol:
|
3147
|
+
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3145
3148
|
"""
|
3146
3149
|
fetch an order by the id
|
3147
3150
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
|
@@ -3278,7 +3281,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3278
3281
|
order = self.safe_value(data, 0)
|
3279
3282
|
return self.parse_order(order, market)
|
3280
3283
|
|
3281
|
-
def fetch_open_orders(self, symbol:
|
3284
|
+
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3282
3285
|
"""
|
3283
3286
|
Fetch orders that are still open
|
3284
3287
|
fetch all unfilled currently open orders
|
@@ -3427,7 +3430,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3427
3430
|
data = self.safe_value(response, 'data', [])
|
3428
3431
|
return self.parse_orders(data, market, since, limit)
|
3429
3432
|
|
3430
|
-
def fetch_canceled_orders(self, symbol:
|
3433
|
+
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3431
3434
|
"""
|
3432
3435
|
fetches information on multiple canceled orders made by the user
|
3433
3436
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
@@ -3592,7 +3595,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3592
3595
|
data = self.safe_value(response, 'data', [])
|
3593
3596
|
return self.parse_orders(data, market, since, limit)
|
3594
3597
|
|
3595
|
-
def fetch_closed_orders(self, symbol:
|
3598
|
+
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3596
3599
|
"""
|
3597
3600
|
fetches information on multiple closed orders made by the user
|
3598
3601
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
@@ -3754,7 +3757,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3754
3757
|
data = self.safe_value(response, 'data', [])
|
3755
3758
|
return self.parse_orders(data, market, since, limit)
|
3756
3759
|
|
3757
|
-
def fetch_my_trades(self, symbol:
|
3760
|
+
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3758
3761
|
"""
|
3759
3762
|
fetch all trades made by the user
|
3760
3763
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
@@ -3818,7 +3821,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3818
3821
|
data = self.safe_value(response, 'data', [])
|
3819
3822
|
return self.parse_trades(data, market, since, limit, query)
|
3820
3823
|
|
3821
|
-
def fetch_order_trades(self, id: str, symbol:
|
3824
|
+
def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3822
3825
|
"""
|
3823
3826
|
fetch all the trades made from a single order
|
3824
3827
|
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
@@ -3838,7 +3841,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3838
3841
|
}
|
3839
3842
|
return self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
|
3840
3843
|
|
3841
|
-
def fetch_ledger(self, code:
|
3844
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
3842
3845
|
"""
|
3843
3846
|
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
3844
3847
|
:see: https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
@@ -3960,7 +3963,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3960
3963
|
}
|
3961
3964
|
return self.safe_string(types, type, type)
|
3962
3965
|
|
3963
|
-
def parse_ledger_entry(self, item, currency=None):
|
3966
|
+
def parse_ledger_entry(self, item, currency: Currency = None):
|
3964
3967
|
#
|
3965
3968
|
# privateGetAccountBills, privateGetAccountBillsArchive
|
3966
3969
|
#
|
@@ -4037,7 +4040,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4037
4040
|
'fee': fee,
|
4038
4041
|
}
|
4039
4042
|
|
4040
|
-
def parse_deposit_address(self, depositAddress, currency=None):
|
4043
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
4041
4044
|
#
|
4042
4045
|
# {
|
4043
4046
|
# "addr": "okbtothemoon",
|
@@ -4272,7 +4275,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4272
4275
|
transaction = self.safe_value(data, 0)
|
4273
4276
|
return self.parse_transaction(transaction, currency)
|
4274
4277
|
|
4275
|
-
def fetch_deposits(self, code:
|
4278
|
+
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4276
4279
|
"""
|
4277
4280
|
fetch all deposits made to an account
|
4278
4281
|
:see: https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
@@ -4347,7 +4350,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4347
4350
|
data = self.safe_value(response, 'data', [])
|
4348
4351
|
return self.parse_transactions(data, currency, since, limit, params)
|
4349
4352
|
|
4350
|
-
def fetch_deposit(self, id: str, code:
|
4353
|
+
def fetch_deposit(self, id: str, code: Str = None, params={}):
|
4351
4354
|
"""
|
4352
4355
|
fetch data on a currency deposit via the deposit id
|
4353
4356
|
:see: https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
@@ -4369,7 +4372,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4369
4372
|
deposit = self.safe_value(data, 0, {})
|
4370
4373
|
return self.parse_transaction(deposit, currency)
|
4371
4374
|
|
4372
|
-
def fetch_withdrawals(self, code:
|
4375
|
+
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4373
4376
|
"""
|
4374
4377
|
fetch all withdrawals made from an account
|
4375
4378
|
:see: https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
@@ -4436,7 +4439,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4436
4439
|
data = self.safe_value(response, 'data', [])
|
4437
4440
|
return self.parse_transactions(data, currency, since, limit, params)
|
4438
4441
|
|
4439
|
-
def fetch_withdrawal(self, id: str, code:
|
4442
|
+
def fetch_withdrawal(self, id: str, code: Str = None, params={}):
|
4440
4443
|
"""
|
4441
4444
|
fetch data on a currency withdrawal via the withdrawal id
|
4442
4445
|
:see: https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
@@ -4516,7 +4519,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4516
4519
|
}
|
4517
4520
|
return self.safe_string(statuses, status, status)
|
4518
4521
|
|
4519
|
-
def parse_transaction(self, transaction, currency=None) -> Transaction:
|
4522
|
+
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
4520
4523
|
#
|
4521
4524
|
# withdraw
|
4522
4525
|
#
|
@@ -4798,7 +4801,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4798
4801
|
result.append(self.parse_position(positions[i]))
|
4799
4802
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
4800
4803
|
|
4801
|
-
def parse_position(self, position, market=None):
|
4804
|
+
def parse_position(self, position, market: Market = None):
|
4802
4805
|
#
|
4803
4806
|
# {
|
4804
4807
|
# "adl": "3",
|
@@ -4987,7 +4990,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4987
4990
|
rawTransfer = self.safe_value(data, 0, {})
|
4988
4991
|
return self.parse_transfer(rawTransfer, currency)
|
4989
4992
|
|
4990
|
-
def parse_transfer(self, transfer, currency=None):
|
4993
|
+
def parse_transfer(self, transfer, currency: Currency = None):
|
4991
4994
|
#
|
4992
4995
|
# transfer
|
4993
4996
|
#
|
@@ -5069,7 +5072,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5069
5072
|
}
|
5070
5073
|
return self.safe_string(statuses, status, status)
|
5071
5074
|
|
5072
|
-
def fetch_transfer(self, id: str, code:
|
5075
|
+
def fetch_transfer(self, id: str, code: Str = None, params={}):
|
5073
5076
|
self.load_markets()
|
5074
5077
|
request = {
|
5075
5078
|
'transId': id,
|
@@ -5100,7 +5103,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5100
5103
|
transfer = self.safe_value(data, 0)
|
5101
5104
|
return self.parse_transfer(transfer)
|
5102
5105
|
|
5103
|
-
def fetch_transfers(self, code:
|
5106
|
+
def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
5104
5107
|
"""
|
5105
5108
|
fetch a history of internal transfers made on an account
|
5106
5109
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
@@ -5209,7 +5212,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5209
5212
|
headers['OK-ACCESS-SIGN'] = signature
|
5210
5213
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
5211
5214
|
|
5212
|
-
def parse_funding_rate(self, contract, market=None):
|
5215
|
+
def parse_funding_rate(self, contract, market: Market = None):
|
5213
5216
|
#
|
5214
5217
|
# {
|
5215
5218
|
# "fundingRate": "0.00027815",
|
@@ -5285,7 +5288,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5285
5288
|
entry = self.safe_value(data, 0, {})
|
5286
5289
|
return self.parse_funding_rate(entry, market)
|
5287
5290
|
|
5288
|
-
def fetch_funding_history(self, symbol:
|
5291
|
+
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
5289
5292
|
"""
|
5290
5293
|
fetch the history of funding payments paid and received on self account
|
5291
5294
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
@@ -5435,7 +5438,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5435
5438
|
sorted = self.sort_by(result, 'timestamp')
|
5436
5439
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
5437
5440
|
|
5438
|
-
def set_leverage(self, leverage, symbol:
|
5441
|
+
def set_leverage(self, leverage, symbol: Str = None, params={}):
|
5439
5442
|
"""
|
5440
5443
|
set the level of leverage for a market
|
5441
5444
|
:see: https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage
|
@@ -5487,7 +5490,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5487
5490
|
#
|
5488
5491
|
return response
|
5489
5492
|
|
5490
|
-
def set_position_mode(self, hedged, symbol:
|
5493
|
+
def set_position_mode(self, hedged, symbol: Str = None, params={}):
|
5491
5494
|
"""
|
5492
5495
|
set hedged to True or False for a market
|
5493
5496
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
|
@@ -5518,7 +5521,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5518
5521
|
#
|
5519
5522
|
return response
|
5520
5523
|
|
5521
|
-
def set_margin_mode(self, marginMode, symbol:
|
5524
|
+
def set_margin_mode(self, marginMode, symbol: Str = None, params={}):
|
5522
5525
|
"""
|
5523
5526
|
set margin mode to 'cross' or 'isolated'
|
5524
5527
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
|
@@ -5630,7 +5633,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5630
5633
|
rate = self.safe_value(data, 0)
|
5631
5634
|
return self.parse_borrow_rate(rate)
|
5632
5635
|
|
5633
|
-
def parse_borrow_rate(self, info, currency=None):
|
5636
|
+
def parse_borrow_rate(self, info, currency: Currency = None):
|
5634
5637
|
#
|
5635
5638
|
# {
|
5636
5639
|
# "amt": "992.10341195",
|
@@ -5793,7 +5796,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5793
5796
|
#
|
5794
5797
|
return self.parse_margin_modification(response, market)
|
5795
5798
|
|
5796
|
-
def parse_margin_modification(self, data, market=None):
|
5799
|
+
def parse_margin_modification(self, data, market: Market = None):
|
5797
5800
|
innerData = self.safe_value(data, 'data', [])
|
5798
5801
|
entry = self.safe_value(innerData, 0, {})
|
5799
5802
|
errorCode = self.safe_string(data, 'code')
|
@@ -5887,7 +5890,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5887
5890
|
data = self.safe_value(response, 'data')
|
5888
5891
|
return self.parse_market_leverage_tiers(data, market)
|
5889
5892
|
|
5890
|
-
def parse_market_leverage_tiers(self, info, market=None):
|
5893
|
+
def parse_market_leverage_tiers(self, info, market: Market = None):
|
5891
5894
|
"""
|
5892
5895
|
* @ignore
|
5893
5896
|
:param dict info: Exchange response for 1 market
|
@@ -5925,7 +5928,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5925
5928
|
})
|
5926
5929
|
return tiers
|
5927
5930
|
|
5928
|
-
def fetch_borrow_interest(self, code:
|
5931
|
+
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
5929
5932
|
"""
|
5930
5933
|
fetch the interest owed by the user for borrowing currency for margin trading
|
5931
5934
|
:see: https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
@@ -5981,7 +5984,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5981
5984
|
interest = self.parse_borrow_interests(data)
|
5982
5985
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
5983
5986
|
|
5984
|
-
def parse_borrow_interest(self, info, market=None):
|
5987
|
+
def parse_borrow_interest(self, info, market: Market = None):
|
5985
5988
|
instId = self.safe_string(info, 'instId')
|
5986
5989
|
if instId is not None:
|
5987
5990
|
market = self.safe_market(instId, market)
|
@@ -5998,7 +6001,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5998
6001
|
'info': info,
|
5999
6002
|
}
|
6000
6003
|
|
6001
|
-
def borrow_margin(self, code: str, amount, symbol:
|
6004
|
+
def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
|
6002
6005
|
"""
|
6003
6006
|
create a loan to borrow margin
|
6004
6007
|
:see: https://www.okx.com/docs-v5/en/#rest-api-account-vip-loans-borrow-and-repay
|
@@ -6040,7 +6043,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6040
6043
|
'symbol': symbol,
|
6041
6044
|
})
|
6042
6045
|
|
6043
|
-
def repay_margin(self, code: str, amount, symbol:
|
6046
|
+
def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
|
6044
6047
|
"""
|
6045
6048
|
repay borrowed margin and interest
|
6046
6049
|
:see: https://www.okx.com/docs-v5/en/#rest-api-account-vip-loans-borrow-and-repay
|
@@ -6082,7 +6085,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6082
6085
|
'symbol': symbol,
|
6083
6086
|
})
|
6084
6087
|
|
6085
|
-
def parse_margin_loan(self, info, currency=None):
|
6088
|
+
def parse_margin_loan(self, info, currency: Currency = None):
|
6086
6089
|
#
|
6087
6090
|
# {
|
6088
6091
|
# "amt": "102",
|
@@ -6205,7 +6208,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6205
6208
|
data = self.safe_value(response, 'data', [])
|
6206
6209
|
return self.parse_open_interests(data, None, since, limit)
|
6207
6210
|
|
6208
|
-
def parse_open_interest(self, interest, market=None):
|
6211
|
+
def parse_open_interest(self, interest, market: Market = None):
|
6209
6212
|
#
|
6210
6213
|
# fetchOpenInterestHistory
|
6211
6214
|
#
|
@@ -6377,7 +6380,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6377
6380
|
depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
|
6378
6381
|
return depositWithdrawFees
|
6379
6382
|
|
6380
|
-
def fetch_settlement_history(self, symbol:
|
6383
|
+
def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
6381
6384
|
"""
|
6382
6385
|
fetches historical settlement records
|
6383
6386
|
:see: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
|
@@ -6557,7 +6560,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6557
6560
|
if entryMarketId == marketId:
|
6558
6561
|
return self.parse_greeks(entry, market)
|
6559
6562
|
|
6560
|
-
def parse_greeks(self, greeks, market=None):
|
6563
|
+
def parse_greeks(self, greeks, market: Market = None):
|
6561
6564
|
#
|
6562
6565
|
# {
|
6563
6566
|
# "askVol": "0",
|
ccxt/p2b.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.p2b import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Int, Order, OrderSide, OrderType, Strings, Ticker, Tickers
|
9
|
+
from ccxt.base.types import Int, Market, Order, OrderSide, OrderType, Strings, Ticker, Tickers
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ArgumentsRequired
|
12
12
|
from ccxt.base.errors import BadRequest
|
@@ -114,7 +114,7 @@ class p2b(Exchange, ImplicitAPI):
|
|
114
114
|
'urls': {
|
115
115
|
'extension': '.json',
|
116
116
|
'referral': 'https://p2pb2b.com?referral=ee784c53',
|
117
|
-
'logo': 'https://
|
117
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755',
|
118
118
|
'api': {
|
119
119
|
'public': 'https://api.p2pb2b.com/api/v2/public',
|
120
120
|
'private': 'https://api.p2pb2b.com/api/v2',
|
@@ -416,7 +416,7 @@ class p2b(Exchange, ImplicitAPI):
|
|
416
416
|
self.parse_ticker(result, market)
|
417
417
|
)
|
418
418
|
|
419
|
-
def parse_ticker(self, ticker, market=None):
|
419
|
+
def parse_ticker(self, ticker, market: Market = None):
|
420
420
|
#
|
421
421
|
# parseTickers
|
422
422
|
#
|
@@ -570,7 +570,7 @@ class p2b(Exchange, ImplicitAPI):
|
|
570
570
|
result = self.safe_value(response, 'result', [])
|
571
571
|
return self.parse_trades(result, market, since, limit)
|
572
572
|
|
573
|
-
def parse_trade(self, trade, market=None):
|
573
|
+
def parse_trade(self, trade, market: Market = None):
|
574
574
|
#
|
575
575
|
# fetchTrades
|
576
576
|
#
|
@@ -683,7 +683,7 @@ class p2b(Exchange, ImplicitAPI):
|
|
683
683
|
result = self.safe_value(response, 'result', [])
|
684
684
|
return self.parse_ohlcvs(result, market, timeframe, since, limit)
|
685
685
|
|
686
|
-
def parse_ohlcv(self, ohlcv, market=None) -> list:
|
686
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
687
687
|
#
|
688
688
|
# [
|
689
689
|
# 1699253400, # Kline open time
|
@@ -1094,7 +1094,7 @@ class p2b(Exchange, ImplicitAPI):
|
|
1094
1094
|
orders = self.array_concat(orders, parsedOrders)
|
1095
1095
|
return orders
|
1096
1096
|
|
1097
|
-
def parse_order(self, order, market=None) -> Order:
|
1097
|
+
def parse_order(self, order, market: Market = None) -> Order:
|
1098
1098
|
#
|
1099
1099
|
# cancelOrder, fetchOpenOrders, createOrder
|
1100
1100
|
#
|
ccxt/paymium.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.paymium import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Int, OrderBook, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
@@ -158,7 +158,7 @@ class paymium(Exchange, ImplicitAPI):
|
|
158
158
|
response = self.publicGetDataCurrencyDepth(self.extend(request, params))
|
159
159
|
return self.parse_order_book(response, market['symbol'], None, 'bids', 'asks', 'price', 'amount')
|
160
160
|
|
161
|
-
def parse_ticker(self, ticker, market=None) -> Ticker:
|
161
|
+
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
162
162
|
#
|
163
163
|
# {
|
164
164
|
# "high":"33740.82",
|
@@ -240,7 +240,7 @@ class paymium(Exchange, ImplicitAPI):
|
|
240
240
|
#
|
241
241
|
return self.parse_ticker(ticker, market)
|
242
242
|
|
243
|
-
def parse_trade(self, trade, market=None) -> Trade:
|
243
|
+
def parse_trade(self, trade, market: Market = None) -> Trade:
|
244
244
|
timestamp = self.safe_timestamp(trade, 'created_at_int')
|
245
245
|
id = self.safe_string(trade, 'uuid')
|
246
246
|
market = self.safe_market(None, market)
|
@@ -347,7 +347,7 @@ class paymium(Exchange, ImplicitAPI):
|
|
347
347
|
#
|
348
348
|
return self.parse_deposit_addresses(response, codes)
|
349
349
|
|
350
|
-
def parse_deposit_address(self, depositAddress, currency=None):
|
350
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
351
351
|
#
|
352
352
|
# {
|
353
353
|
# "address": "1HdjGr6WCTcnmW1tNNsHX7fh4Jr5C2PeKe",
|
@@ -394,7 +394,7 @@ class paymium(Exchange, ImplicitAPI):
|
|
394
394
|
'id': response['uuid'],
|
395
395
|
}, market)
|
396
396
|
|
397
|
-
def cancel_order(self, id: str, symbol:
|
397
|
+
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
398
398
|
"""
|
399
399
|
cancels an open order
|
400
400
|
:see: https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders~1%7Buuid%7D/delete
|
@@ -467,7 +467,7 @@ class paymium(Exchange, ImplicitAPI):
|
|
467
467
|
#
|
468
468
|
return self.parse_transfer(response, currency)
|
469
469
|
|
470
|
-
def parse_transfer(self, transfer, currency=None):
|
470
|
+
def parse_transfer(self, transfer, currency: Currency = None):
|
471
471
|
#
|
472
472
|
# {
|
473
473
|
# "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
|