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/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Int, Order, OrderBook, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, 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
|
@@ -979,7 +979,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
979
979
|
'deposit': {},
|
980
980
|
}
|
981
981
|
|
982
|
-
def parse_deposit_withdraw_fee(self, fee, currency=None):
|
982
|
+
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
983
983
|
#
|
984
984
|
# {
|
985
985
|
# "today_available_withdraw_BTC": "100.0000",
|
@@ -1030,7 +1030,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1030
1030
|
data = response['data']
|
1031
1031
|
return self.parse_deposit_withdraw_fee(data)
|
1032
1032
|
|
1033
|
-
def parse_ticker(self, ticker, market=None) -> Ticker:
|
1033
|
+
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
1034
1034
|
#
|
1035
1035
|
# spot
|
1036
1036
|
#
|
@@ -1294,7 +1294,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1294
1294
|
timestamp = self.safe_integer_2(data, 'ts', 'timestamp')
|
1295
1295
|
return self.parse_order_book(data, market['symbol'], timestamp)
|
1296
1296
|
|
1297
|
-
def parse_trade(self, trade, market=None) -> Trade:
|
1297
|
+
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1298
1298
|
#
|
1299
1299
|
# public fetchTrades spot( amount = count * price )
|
1300
1300
|
#
|
@@ -1426,7 +1426,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1426
1426
|
trades = self.safe_value(data, 'trades', [])
|
1427
1427
|
return self.parse_trades(trades, market, since, limit)
|
1428
1428
|
|
1429
|
-
def parse_ohlcv(self, ohlcv, market=None) -> list:
|
1429
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1430
1430
|
#
|
1431
1431
|
# spot
|
1432
1432
|
#
|
@@ -1573,7 +1573,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1573
1573
|
ohlcv = self.safe_value(response, 'data', [])
|
1574
1574
|
return self.parse_ohlcvs(ohlcv, market, timeframe, since, limit)
|
1575
1575
|
|
1576
|
-
def fetch_my_trades(self, symbol:
|
1576
|
+
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1577
1577
|
"""
|
1578
1578
|
:see: https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
|
1579
1579
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-trade-keyed
|
@@ -1675,7 +1675,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1675
1675
|
data = self.safe_value(response, 'data', [])
|
1676
1676
|
return self.parse_trades(data, market, since, limit)
|
1677
1677
|
|
1678
|
-
def fetch_order_trades(self, id: str, symbol:
|
1678
|
+
def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1679
1679
|
"""
|
1680
1680
|
:see: https://developer-pro.bitmart.com/en/spot/#order-trade-list-v4-signed
|
1681
1681
|
fetch all the trades made from a single order
|
@@ -1862,7 +1862,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1862
1862
|
#
|
1863
1863
|
return self.custom_parse_balance(response, marketType)
|
1864
1864
|
|
1865
|
-
def parse_trading_fee(self, fee, market=None):
|
1865
|
+
def parse_trading_fee(self, fee, market: Market = None):
|
1866
1866
|
#
|
1867
1867
|
# {
|
1868
1868
|
# "symbol": "ETH_USDT",
|
@@ -1909,7 +1909,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1909
1909
|
data = self.safe_value(response, 'data')
|
1910
1910
|
return self.parse_trading_fee(data)
|
1911
1911
|
|
1912
|
-
def parse_order(self, order, market=None) -> Order:
|
1912
|
+
def parse_order(self, order, market: Market = None) -> Order:
|
1913
1913
|
#
|
1914
1914
|
# createOrder
|
1915
1915
|
#
|
@@ -2042,17 +2042,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2042
2042
|
def parse_order_status_by_type(self, type, status):
|
2043
2043
|
statusesByType = {
|
2044
2044
|
'spot': {
|
2045
|
-
'1': '
|
2045
|
+
'1': 'rejected', # Order failure
|
2046
2046
|
'2': 'open', # Placing order
|
2047
|
-
'3': '
|
2047
|
+
'3': 'rejected', # Order failure, Freeze failure
|
2048
2048
|
'4': 'open', # Order success, Pending for fulfilment
|
2049
2049
|
'5': 'open', # Partially filled
|
2050
2050
|
'6': 'closed', # Fully filled
|
2051
|
-
'7': '
|
2051
|
+
'7': 'canceled', # Canceling
|
2052
2052
|
'8': 'canceled', # Canceled
|
2053
2053
|
'new': 'open',
|
2054
2054
|
'partially_filled': 'open',
|
2055
|
-
'filled': '
|
2055
|
+
'filled': 'closed',
|
2056
2056
|
'partially_canceled': 'canceled',
|
2057
2057
|
},
|
2058
2058
|
'swap': {
|
@@ -2243,7 +2243,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2243
2243
|
request['type'] = 'ioc'
|
2244
2244
|
return self.extend(request, params)
|
2245
2245
|
|
2246
|
-
def cancel_order(self, id: str, symbol:
|
2246
|
+
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2247
2247
|
"""
|
2248
2248
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
2249
2249
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
@@ -2318,7 +2318,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2318
2318
|
order = self.parse_order(id, market)
|
2319
2319
|
return self.extend(order, {'id': id})
|
2320
2320
|
|
2321
|
-
def cancel_all_orders(self, symbol:
|
2321
|
+
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2322
2322
|
"""
|
2323
2323
|
cancel all open orders in a market
|
2324
2324
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
@@ -2362,7 +2362,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2362
2362
|
#
|
2363
2363
|
return response
|
2364
2364
|
|
2365
|
-
def fetch_orders_by_status(self, status, symbol:
|
2365
|
+
def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2366
2366
|
self.check_required_symbol('fetchOrdersByStatus', symbol)
|
2367
2367
|
self.load_markets()
|
2368
2368
|
market = self.market(symbol)
|
@@ -2414,7 +2414,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2414
2414
|
orders = self.safe_value(data, 'orders', [])
|
2415
2415
|
return self.parse_orders(orders, market, since, limit)
|
2416
2416
|
|
2417
|
-
def fetch_open_orders(self, symbol:
|
2417
|
+
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2418
2418
|
"""
|
2419
2419
|
:see: https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
2420
2420
|
:see: https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
|
@@ -2513,14 +2513,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2513
2513
|
data = self.safe_value(response, 'data', [])
|
2514
2514
|
return self.parse_orders(data, market, since, limit)
|
2515
2515
|
|
2516
|
-
def fetch_closed_orders(self, symbol:
|
2516
|
+
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2517
2517
|
"""
|
2518
2518
|
:see: https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
2519
|
+
:see: https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
2519
2520
|
fetches information on multiple closed orders made by the user
|
2520
2521
|
:param str symbol: unified market symbol of the market orders were made in
|
2521
2522
|
:param int [since]: the earliest time in ms to fetch orders for
|
2522
2523
|
:param int [limit]: the maximum number of orde structures to retrieve
|
2523
2524
|
:param dict [params]: extra parameters specific to the bitmart api endpoint
|
2525
|
+
:param int [params.until]: timestamp in ms of the latest entry
|
2526
|
+
:param str [params.marginMode]: *spot only* 'cross' or 'isolated', for margin trading
|
2524
2527
|
:returns Order[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
2525
2528
|
"""
|
2526
2529
|
self.load_markets()
|
@@ -2532,20 +2535,28 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2532
2535
|
type = None
|
2533
2536
|
type, params = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
2534
2537
|
if type != 'spot':
|
2535
|
-
|
2538
|
+
self.check_required_symbol('fetchClosedOrders', symbol)
|
2536
2539
|
marginMode = None
|
2537
2540
|
marginMode, params = self.handle_margin_mode_and_params('fetchClosedOrders', params)
|
2538
2541
|
if marginMode == 'isolated':
|
2539
2542
|
request['orderMode'] = 'iso_margin'
|
2540
|
-
|
2543
|
+
startTimeKey = 'startTime' if (type == 'spot') else 'start_time'
|
2544
|
+
if since is not None:
|
2545
|
+
request[startTimeKey] = since
|
2546
|
+
endTimeKey = 'endTime' if (type == 'spot') else 'end_time'
|
2547
|
+
until = self.safe_integer_2(params, 'until', endTimeKey)
|
2541
2548
|
if until is not None:
|
2542
|
-
params = self.omit(params, ['
|
2543
|
-
request[
|
2544
|
-
response =
|
2545
|
-
|
2549
|
+
params = self.omit(params, ['until'])
|
2550
|
+
request[endTimeKey] = until
|
2551
|
+
response = None
|
2552
|
+
if type == 'spot':
|
2553
|
+
response = self.privatePostSpotV4QueryHistoryOrders(self.extend(request, params))
|
2554
|
+
else:
|
2555
|
+
response = self.privateGetContractPrivateOrderHistory(self.extend(request, params))
|
2556
|
+
data = self.safe_value(response, 'data', [])
|
2546
2557
|
return self.parse_orders(data, market, since, limit)
|
2547
2558
|
|
2548
|
-
def fetch_canceled_orders(self, symbol:
|
2559
|
+
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2549
2560
|
"""
|
2550
2561
|
fetches information on multiple canceled orders made by the user
|
2551
2562
|
:param str symbol: unified market symbol of the market orders were made in
|
@@ -2556,7 +2567,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2556
2567
|
"""
|
2557
2568
|
return self.fetch_orders_by_status('canceled', symbol, since, limit, params)
|
2558
2569
|
|
2559
|
-
def fetch_order(self, id: str, symbol:
|
2570
|
+
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2560
2571
|
"""
|
2561
2572
|
fetches information on an order made by the user
|
2562
2573
|
:see: https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
@@ -2749,7 +2760,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2749
2760
|
'tag': tag,
|
2750
2761
|
})
|
2751
2762
|
|
2752
|
-
def fetch_transactions_by_type(self, type, code:
|
2763
|
+
def fetch_transactions_by_type(self, type, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2753
2764
|
self.load_markets()
|
2754
2765
|
if limit is None:
|
2755
2766
|
limit = 50 # max 50
|
@@ -2801,7 +2812,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2801
2812
|
records = self.safe_value(data, 'records', [])
|
2802
2813
|
return self.parse_transactions(records, currency, since, limit)
|
2803
2814
|
|
2804
|
-
def fetch_deposit(self, id: str, code:
|
2815
|
+
def fetch_deposit(self, id: str, code: Str = None, params={}):
|
2805
2816
|
"""
|
2806
2817
|
fetch information on a deposit
|
2807
2818
|
:param str id: deposit id
|
@@ -2840,7 +2851,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2840
2851
|
record = self.safe_value(data, 'record', {})
|
2841
2852
|
return self.parse_transaction(record)
|
2842
2853
|
|
2843
|
-
def fetch_deposits(self, code:
|
2854
|
+
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2844
2855
|
"""
|
2845
2856
|
fetch all deposits made to an account
|
2846
2857
|
:param str code: unified currency code
|
@@ -2851,7 +2862,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2851
2862
|
"""
|
2852
2863
|
return self.fetch_transactions_by_type('deposit', code, since, limit, params)
|
2853
2864
|
|
2854
|
-
def fetch_withdrawal(self, id: str, code:
|
2865
|
+
def fetch_withdrawal(self, id: str, code: Str = None, params={}):
|
2855
2866
|
"""
|
2856
2867
|
fetch data on a currency withdrawal via the withdrawal id
|
2857
2868
|
:param str id: withdrawal id
|
@@ -2890,7 +2901,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2890
2901
|
record = self.safe_value(data, 'record', {})
|
2891
2902
|
return self.parse_transaction(record)
|
2892
2903
|
|
2893
|
-
def fetch_withdrawals(self, code:
|
2904
|
+
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2894
2905
|
"""
|
2895
2906
|
fetch all withdrawals made from an account
|
2896
2907
|
:param str code: unified currency code
|
@@ -2912,7 +2923,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2912
2923
|
}
|
2913
2924
|
return self.safe_string(statuses, status, status)
|
2914
2925
|
|
2915
|
-
def parse_transaction(self, transaction, currency=None) -> Transaction:
|
2926
|
+
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
2916
2927
|
#
|
2917
2928
|
# withdraw
|
2918
2929
|
#
|
@@ -2984,7 +2995,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2984
2995
|
'fee': fee,
|
2985
2996
|
}
|
2986
2997
|
|
2987
|
-
def repay_margin(self, code: str, amount, symbol:
|
2998
|
+
def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
|
2988
2999
|
"""
|
2989
3000
|
repay borrowed margin and interest
|
2990
3001
|
:see: https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated
|
@@ -3023,7 +3034,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3023
3034
|
'symbol': symbol,
|
3024
3035
|
})
|
3025
3036
|
|
3026
|
-
def borrow_margin(self, code: str, amount, symbol:
|
3037
|
+
def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
|
3027
3038
|
"""
|
3028
3039
|
create a loan to borrow margin
|
3029
3040
|
:see: https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated
|
@@ -3062,7 +3073,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3062
3073
|
'symbol': symbol,
|
3063
3074
|
})
|
3064
3075
|
|
3065
|
-
def parse_margin_loan(self, info, currency=None):
|
3076
|
+
def parse_margin_loan(self, info, currency: Currency = None):
|
3066
3077
|
#
|
3067
3078
|
# borrowMargin
|
3068
3079
|
#
|
@@ -3087,7 +3098,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3087
3098
|
'info': info,
|
3088
3099
|
}
|
3089
3100
|
|
3090
|
-
def
|
3101
|
+
def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
3091
3102
|
"""
|
3092
3103
|
fetch the rate of interest to borrow a currency for margin trading
|
3093
3104
|
:see: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount
|
@@ -3097,14 +3108,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3097
3108
|
"""
|
3098
3109
|
self.load_markets()
|
3099
3110
|
market = None
|
3100
|
-
if
|
3101
|
-
market = self.market(
|
3102
|
-
else:
|
3103
|
-
defaultSettle = self.safe_string(self.options, 'defaultSettle', 'USDT')
|
3104
|
-
if code == 'USDT':
|
3105
|
-
market = self.market('BTC' + '/' + defaultSettle)
|
3106
|
-
else:
|
3107
|
-
market = self.market(code + '/' + defaultSettle)
|
3111
|
+
if symbol is not None:
|
3112
|
+
market = self.market(symbol)
|
3108
3113
|
request = {
|
3109
3114
|
'symbol': market['id'],
|
3110
3115
|
}
|
@@ -3143,10 +3148,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3143
3148
|
#
|
3144
3149
|
data = self.safe_value(response, 'data', {})
|
3145
3150
|
symbols = self.safe_value(data, 'symbols', [])
|
3146
|
-
|
3147
|
-
return self.
|
3151
|
+
borrowRate = self.safe_value(symbols, 0)
|
3152
|
+
return self.parse_isolated_borrow_rate(borrowRate, market)
|
3148
3153
|
|
3149
|
-
def
|
3154
|
+
def parse_isolated_borrow_rate(self, info, market: Market = None):
|
3150
3155
|
#
|
3151
3156
|
# {
|
3152
3157
|
# "symbol": "BTC_USDT",
|
@@ -3170,18 +3175,29 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3170
3175
|
# }
|
3171
3176
|
# }
|
3172
3177
|
#
|
3173
|
-
|
3174
|
-
|
3178
|
+
marketId = self.safe_string(info, 'symbol')
|
3179
|
+
symbol = self.safe_symbol(marketId, market)
|
3180
|
+
baseData = self.safe_value(info, 'base')
|
3181
|
+
quoteData = self.safe_value(info, 'quote')
|
3182
|
+
baseId = self.safe_string(baseData, 'currency')
|
3183
|
+
quoteId = self.safe_string(quoteData, 'currency')
|
3184
|
+
base = self.safe_currency_code(baseId)
|
3185
|
+
quote = self.safe_currency_code(quoteId)
|
3186
|
+
baseRate = self.safe_number(baseData, 'hourly_interest')
|
3187
|
+
quoteRate = self.safe_number(quoteData, 'hourly_interest')
|
3175
3188
|
return {
|
3176
|
-
'
|
3177
|
-
'
|
3189
|
+
'symbol': symbol,
|
3190
|
+
'base': base,
|
3191
|
+
'baseRate': baseRate,
|
3192
|
+
'quote': quote,
|
3193
|
+
'quoteRate': quoteRate,
|
3178
3194
|
'period': 3600000, # 1-Hour
|
3179
|
-
'timestamp':
|
3180
|
-
'datetime':
|
3195
|
+
'timestamp': None,
|
3196
|
+
'datetime': None,
|
3181
3197
|
'info': info,
|
3182
3198
|
}
|
3183
3199
|
|
3184
|
-
def
|
3200
|
+
def fetch_isolated_borrow_rates(self, params={}):
|
3185
3201
|
"""
|
3186
3202
|
fetch the borrow interest rates of all currencies, currently only works for isolated margin
|
3187
3203
|
:see: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount
|
@@ -3224,46 +3240,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3224
3240
|
#
|
3225
3241
|
data = self.safe_value(response, 'data', {})
|
3226
3242
|
symbols = self.safe_value(data, 'symbols', [])
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
# "symbol": "BTC_USDT",
|
3233
|
-
# "max_leverage": "5",
|
3234
|
-
# "symbol_enabled": True,
|
3235
|
-
# "base": {
|
3236
|
-
# "currency": "BTC",
|
3237
|
-
# "daily_interest": "0.00055000",
|
3238
|
-
# "hourly_interest": "0.00002291",
|
3239
|
-
# "max_borrow_amount": "2.00000000",
|
3240
|
-
# "min_borrow_amount": "0.00000001",
|
3241
|
-
# "borrowable_amount": "0.00670810"
|
3242
|
-
# },
|
3243
|
-
# "quote": {
|
3244
|
-
# "currency": "USDT",
|
3245
|
-
# "daily_interest": "0.00055000",
|
3246
|
-
# "hourly_interest": "0.00002291",
|
3247
|
-
# "max_borrow_amount": "50000.00000000",
|
3248
|
-
# "min_borrow_amount": "0.00000001",
|
3249
|
-
# "borrowable_amount": "135.12575038"
|
3250
|
-
# }
|
3251
|
-
# }
|
3252
|
-
#
|
3253
|
-
timestamp = self.milliseconds()
|
3254
|
-
rates = []
|
3255
|
-
for i in range(0, len(info)):
|
3256
|
-
entry = info[i]
|
3257
|
-
base = self.safe_value(entry, 'base', {})
|
3258
|
-
rates.append({
|
3259
|
-
'currency': self.safe_currency_code(self.safe_string(base, 'currency')),
|
3260
|
-
'rate': self.safe_number(base, 'hourly_interest'),
|
3261
|
-
'period': 3600000, # 1-Hour
|
3262
|
-
'timestamp': timestamp,
|
3263
|
-
'datetime': self.iso8601(timestamp),
|
3264
|
-
'info': entry,
|
3265
|
-
})
|
3266
|
-
return rates
|
3243
|
+
result = []
|
3244
|
+
for i in range(0, len(symbols)):
|
3245
|
+
symbol = self.safe_value(symbols, i)
|
3246
|
+
result.append(self.parse_isolated_borrow_rate(symbol))
|
3247
|
+
return result
|
3267
3248
|
|
3268
3249
|
def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
|
3269
3250
|
"""
|
@@ -3356,7 +3337,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3356
3337
|
}
|
3357
3338
|
return self.safe_string(types, type, type)
|
3358
3339
|
|
3359
|
-
def parse_transfer(self, transfer, currency=None):
|
3340
|
+
def parse_transfer(self, transfer, currency: Currency = None):
|
3360
3341
|
#
|
3361
3342
|
# margin
|
3362
3343
|
#
|
@@ -3395,7 +3376,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3395
3376
|
'status': self.parse_transfer_status(self.safe_string(transfer, 'state')),
|
3396
3377
|
}
|
3397
3378
|
|
3398
|
-
def fetch_transfers(self, code:
|
3379
|
+
def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
3399
3380
|
"""
|
3400
3381
|
fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
|
3401
3382
|
:see: https://developer-pro.bitmart.com/en/futures/#get-transfer-list-signed
|
@@ -3451,7 +3432,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3451
3432
|
records = self.safe_value(data, 'records', [])
|
3452
3433
|
return self.parse_transfers(records, currency, since, limit)
|
3453
3434
|
|
3454
|
-
def fetch_borrow_interest(self, code:
|
3435
|
+
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3455
3436
|
"""
|
3456
3437
|
fetch the interest owed by the user for borrowing currency for margin trading
|
3457
3438
|
:see: https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated
|
@@ -3499,7 +3480,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3499
3480
|
interest = self.parse_borrow_interests(rows, market)
|
3500
3481
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
3501
3482
|
|
3502
|
-
def parse_borrow_interest(self, info, market=None):
|
3483
|
+
def parse_borrow_interest(self, info, market: Market = None):
|
3503
3484
|
#
|
3504
3485
|
# {
|
3505
3486
|
# "borrow_id": "1657664327844Lk5eJJugXmdHHZoe",
|
@@ -3559,7 +3540,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3559
3540
|
data = self.safe_value(response, 'data', {})
|
3560
3541
|
return self.parse_open_interest(data, market)
|
3561
3542
|
|
3562
|
-
def parse_open_interest(self, interest, market=None):
|
3543
|
+
def parse_open_interest(self, interest, market: Market = None):
|
3563
3544
|
#
|
3564
3545
|
# {
|
3565
3546
|
# "timestamp": 1694657502415,
|
@@ -3579,7 +3560,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3579
3560
|
'info': interest,
|
3580
3561
|
}, market)
|
3581
3562
|
|
3582
|
-
def set_leverage(self, leverage, symbol:
|
3563
|
+
def set_leverage(self, leverage, symbol: Str = None, params={}):
|
3583
3564
|
"""
|
3584
3565
|
set the level of leverage for a market
|
3585
3566
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
@@ -3636,7 +3617,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3636
3617
|
data = self.safe_value(response, 'data', {})
|
3637
3618
|
return self.parse_funding_rate(data, market)
|
3638
3619
|
|
3639
|
-
def parse_funding_rate(self, contract, market=None):
|
3620
|
+
def parse_funding_rate(self, contract, market: Market = None):
|
3640
3621
|
#
|
3641
3622
|
# {
|
3642
3623
|
# "timestamp": 1695184410697,
|
@@ -3770,7 +3751,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3770
3751
|
symbols = self.market_symbols(symbols)
|
3771
3752
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
3772
3753
|
|
3773
|
-
def parse_position(self, position, market=None):
|
3754
|
+
def parse_position(self, position, market: Market = None):
|
3774
3755
|
#
|
3775
3756
|
# {
|
3776
3757
|
# "symbol": "BTCUSDT",
|
@@ -3834,7 +3815,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3834
3815
|
'takeProfitPrice': None,
|
3835
3816
|
})
|
3836
3817
|
|
3837
|
-
def fetch_my_liquidations(self, symbol:
|
3818
|
+
def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3838
3819
|
"""
|
3839
3820
|
retrieves the users liquidated positions
|
3840
3821
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
@@ -3891,7 +3872,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3891
3872
|
result.append(entry)
|
3892
3873
|
return self.parse_liquidations(result, market, since, limit)
|
3893
3874
|
|
3894
|
-
def parse_liquidation(self, liquidation, market=None):
|
3875
|
+
def parse_liquidation(self, liquidation, market: Market = None):
|
3895
3876
|
#
|
3896
3877
|
# {
|
3897
3878
|
# "order_id": "231007865458273",
|