ccxt 4.4.29__py2.py3-none-any.whl → 4.4.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/alpaca.py +1 -0
- ccxt/abstract/binance.py +9 -0
- ccxt/abstract/binancecoinm.py +9 -0
- ccxt/abstract/binanceus.py +9 -0
- ccxt/abstract/binanceusdm.py +9 -0
- ccxt/ace.py +36 -12
- ccxt/alpaca.py +113 -28
- ccxt/ascendex.py +65 -30
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +36 -12
- ccxt/async_support/alpaca.py +113 -28
- ccxt/async_support/ascendex.py +65 -30
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/bigone.py +71 -27
- ccxt/async_support/binance.py +564 -323
- ccxt/async_support/bingx.py +208 -108
- ccxt/async_support/bit2c.py +34 -12
- ccxt/async_support/bitbank.py +42 -14
- ccxt/async_support/bitbns.py +29 -21
- ccxt/async_support/bitfinex.py +77 -33
- ccxt/async_support/bitfinex2.py +116 -44
- ccxt/async_support/bitflyer.py +54 -18
- ccxt/async_support/bitget.py +277 -145
- ccxt/async_support/bithumb.py +39 -14
- ccxt/async_support/bitmart.py +198 -132
- ccxt/async_support/bitmex.py +90 -30
- ccxt/async_support/bitopro.py +66 -22
- ccxt/async_support/bitrue.py +109 -57
- ccxt/async_support/bitso.py +55 -19
- ccxt/async_support/bitstamp.py +84 -36
- ccxt/async_support/bitteam.py +51 -17
- ccxt/async_support/bitvavo.py +57 -19
- ccxt/async_support/bl3p.py +26 -10
- ccxt/async_support/blockchaincom.py +63 -21
- ccxt/async_support/blofin.py +95 -38
- ccxt/async_support/btcalpha.py +48 -16
- ccxt/async_support/btcbox.py +27 -9
- ccxt/async_support/btcmarkets.py +57 -19
- ccxt/async_support/btcturk.py +36 -12
- ccxt/async_support/bybit.py +251 -95
- ccxt/async_support/cex.py +65 -22
- ccxt/async_support/coinbase.py +138 -56
- ccxt/async_support/coinbaseexchange.py +76 -28
- ccxt/async_support/coinbaseinternational.py +75 -27
- ccxt/async_support/coincatch.py +191 -97
- ccxt/async_support/coincheck.py +33 -11
- ccxt/async_support/coinex.py +212 -101
- ccxt/async_support/coinlist.py +87 -30
- ccxt/async_support/coinmate.py +55 -24
- ccxt/async_support/coinmetro.py +52 -18
- ccxt/async_support/coinone.py +27 -10
- ccxt/async_support/coinsph.py +73 -27
- ccxt/async_support/coinspot.py +25 -9
- ccxt/async_support/cryptocom.py +103 -38
- ccxt/async_support/currencycom.py +70 -23
- ccxt/async_support/delta.py +90 -30
- ccxt/async_support/deribit.py +138 -53
- ccxt/async_support/digifinex.py +114 -51
- ccxt/async_support/exmo.py +104 -45
- ccxt/async_support/gate.py +298 -155
- ccxt/async_support/gemini.py +57 -20
- ccxt/async_support/hashkey.py +151 -66
- ccxt/async_support/hitbtc.py +156 -73
- ccxt/async_support/hollaex.py +76 -25
- ccxt/async_support/htx.py +297 -240
- ccxt/async_support/huobijp.py +1 -0
- ccxt/async_support/hyperliquid.py +203 -42
- ccxt/async_support/idex.py +73 -24
- ccxt/async_support/independentreserve.py +12 -5
- ccxt/async_support/indodax.py +53 -16
- ccxt/async_support/kraken.py +107 -35
- ccxt/async_support/krakenfutures.py +88 -34
- ccxt/async_support/kucoin.py +211 -109
- ccxt/async_support/kucoinfutures.py +119 -42
- ccxt/async_support/kuna.py +80 -39
- ccxt/async_support/latoken.py +70 -33
- ccxt/async_support/lbank.py +90 -39
- ccxt/async_support/luno.py +54 -19
- ccxt/async_support/lykke.py +54 -19
- ccxt/async_support/mercado.py +1 -0
- ccxt/async_support/mexc.py +226 -108
- ccxt/async_support/ndax.py +58 -19
- ccxt/async_support/novadax.py +67 -22
- ccxt/async_support/oceanex.py +58 -19
- ccxt/async_support/okcoin.py +81 -38
- ccxt/async_support/okx.py +270 -109
- ccxt/async_support/onetrading.py +3 -1
- ccxt/async_support/oxfun.py +95 -36
- ccxt/async_support/p2b.py +49 -23
- ccxt/async_support/paradex.py +75 -27
- ccxt/async_support/paymium.py +31 -11
- ccxt/async_support/phemex.py +91 -41
- ccxt/async_support/poloniex.py +80 -30
- ccxt/async_support/poloniexfutures.py +72 -30
- ccxt/async_support/probit.py +64 -22
- ccxt/async_support/timex.py +58 -19
- ccxt/async_support/tokocrypto.py +63 -22
- ccxt/async_support/tradeogre.py +7 -2
- ccxt/async_support/upbit.py +72 -25
- ccxt/async_support/vertex.py +74 -28
- ccxt/async_support/wavesexchange.py +29 -8
- ccxt/async_support/wazirx.py +51 -17
- ccxt/async_support/whitebit.py +105 -41
- ccxt/async_support/woo.py +162 -65
- ccxt/async_support/woofipro.py +118 -49
- ccxt/async_support/xt.py +150 -73
- ccxt/async_support/yobit.py +49 -16
- ccxt/async_support/zaif.py +30 -10
- ccxt/async_support/zonda.py +46 -16
- ccxt/base/exchange.py +34 -34
- ccxt/base/types.py +1 -0
- ccxt/bigone.py +71 -27
- ccxt/binance.py +564 -323
- ccxt/bingx.py +208 -108
- ccxt/bit2c.py +34 -12
- ccxt/bitbank.py +42 -14
- ccxt/bitbns.py +29 -21
- ccxt/bitfinex.py +77 -33
- ccxt/bitfinex2.py +116 -44
- ccxt/bitflyer.py +54 -18
- ccxt/bitget.py +277 -145
- ccxt/bithumb.py +39 -14
- ccxt/bitmart.py +198 -132
- ccxt/bitmex.py +90 -30
- ccxt/bitopro.py +66 -22
- ccxt/bitrue.py +109 -57
- ccxt/bitso.py +55 -19
- ccxt/bitstamp.py +84 -36
- ccxt/bitteam.py +51 -17
- ccxt/bitvavo.py +57 -19
- ccxt/bl3p.py +26 -10
- ccxt/blockchaincom.py +63 -21
- ccxt/blofin.py +95 -38
- ccxt/btcalpha.py +48 -16
- ccxt/btcbox.py +27 -9
- ccxt/btcmarkets.py +57 -19
- ccxt/btcturk.py +36 -12
- ccxt/bybit.py +251 -95
- ccxt/cex.py +65 -22
- ccxt/coinbase.py +138 -56
- ccxt/coinbaseexchange.py +76 -28
- ccxt/coinbaseinternational.py +75 -27
- ccxt/coincatch.py +191 -97
- ccxt/coincheck.py +33 -11
- ccxt/coinex.py +212 -101
- ccxt/coinlist.py +87 -30
- ccxt/coinmate.py +55 -24
- ccxt/coinmetro.py +52 -18
- ccxt/coinone.py +27 -10
- ccxt/coinsph.py +73 -27
- ccxt/coinspot.py +25 -9
- ccxt/cryptocom.py +103 -38
- ccxt/currencycom.py +70 -23
- ccxt/delta.py +90 -30
- ccxt/deribit.py +138 -53
- ccxt/digifinex.py +114 -51
- ccxt/exmo.py +104 -45
- ccxt/gate.py +298 -155
- ccxt/gemini.py +57 -20
- ccxt/hashkey.py +151 -66
- ccxt/hitbtc.py +156 -73
- ccxt/hollaex.py +76 -25
- ccxt/htx.py +297 -240
- ccxt/huobijp.py +1 -0
- ccxt/hyperliquid.py +203 -42
- ccxt/idex.py +73 -24
- ccxt/independentreserve.py +12 -5
- ccxt/indodax.py +53 -16
- ccxt/kraken.py +107 -35
- ccxt/krakenfutures.py +88 -34
- ccxt/kucoin.py +211 -109
- ccxt/kucoinfutures.py +119 -42
- ccxt/kuna.py +80 -39
- ccxt/latoken.py +70 -33
- ccxt/lbank.py +90 -39
- ccxt/luno.py +54 -19
- ccxt/lykke.py +54 -19
- ccxt/mercado.py +1 -0
- ccxt/mexc.py +226 -108
- ccxt/ndax.py +58 -19
- ccxt/novadax.py +67 -22
- ccxt/oceanex.py +58 -19
- ccxt/okcoin.py +81 -38
- ccxt/okx.py +270 -109
- ccxt/onetrading.py +3 -1
- ccxt/oxfun.py +95 -36
- ccxt/p2b.py +49 -23
- ccxt/paradex.py +75 -27
- ccxt/paymium.py +31 -11
- ccxt/phemex.py +91 -41
- ccxt/poloniex.py +80 -30
- ccxt/poloniexfutures.py +72 -30
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +15 -5
- ccxt/pro/ascendex.py +18 -6
- ccxt/pro/binance.py +200 -119
- ccxt/pro/bingx.py +44 -24
- ccxt/pro/bitfinex.py +13 -5
- ccxt/pro/bitget.py +75 -36
- ccxt/pro/bithumb.py +12 -4
- ccxt/pro/bitmart.py +44 -20
- ccxt/pro/bitmex.py +42 -14
- ccxt/pro/bitopro.py +15 -5
- ccxt/pro/bitrue.py +7 -3
- ccxt/pro/bitvavo.py +51 -17
- ccxt/pro/blockchaincom.py +18 -6
- ccxt/pro/blofin.py +38 -13
- ccxt/pro/bybit.py +100 -42
- ccxt/pro/cex.py +48 -16
- ccxt/pro/coinbase.py +32 -12
- ccxt/pro/coinbaseexchange.py +1 -1
- ccxt/pro/coinbaseinternational.py +34 -14
- ccxt/pro/coincatch.py +54 -19
- ccxt/pro/coincheck.py +6 -2
- ccxt/pro/coinex.py +40 -20
- ccxt/pro/coinone.py +9 -3
- ccxt/pro/cryptocom.py +70 -26
- ccxt/pro/deribit.py +36 -12
- ccxt/pro/exmo.py +10 -4
- ccxt/pro/gate.py +64 -30
- ccxt/pro/gemini.py +21 -7
- ccxt/pro/hashkey.py +26 -8
- ccxt/pro/hitbtc.py +61 -37
- ccxt/pro/hollaex.py +15 -5
- ccxt/pro/htx.py +39 -21
- ccxt/pro/hyperliquid.py +41 -14
- ccxt/pro/kraken.py +49 -17
- ccxt/pro/krakenfutures.py +47 -24
- ccxt/pro/kucoin.py +60 -31
- ccxt/pro/kucoinfutures.py +41 -19
- ccxt/pro/lbank.py +27 -9
- ccxt/pro/luno.py +3 -1
- ccxt/pro/mexc.py +35 -17
- ccxt/pro/ndax.py +12 -4
- ccxt/pro/okcoin.py +18 -6
- ccxt/pro/okx.py +76 -28
- ccxt/pro/onetrading.py +21 -7
- ccxt/pro/oxfun.py +54 -20
- ccxt/pro/p2b.py +23 -11
- ccxt/pro/paradex.py +12 -4
- ccxt/pro/phemex.py +31 -19
- ccxt/pro/poloniex.py +50 -22
- ccxt/pro/poloniexfutures.py +17 -7
- ccxt/pro/probit.py +18 -6
- ccxt/pro/upbit.py +25 -9
- ccxt/pro/vertex.py +20 -6
- ccxt/pro/wazirx.py +21 -7
- ccxt/pro/whitebit.py +25 -9
- ccxt/pro/woo.py +32 -12
- ccxt/pro/woofipro.py +35 -13
- ccxt/pro/xt.py +46 -26
- ccxt/probit.py +64 -22
- ccxt/test/tests_helpers.py +2 -2
- ccxt/timex.py +58 -19
- ccxt/tokocrypto.py +63 -22
- ccxt/tradeogre.py +7 -2
- ccxt/upbit.py +72 -25
- ccxt/vertex.py +74 -28
- ccxt/wavesexchange.py +29 -8
- ccxt/wazirx.py +51 -17
- ccxt/whitebit.py +105 -41
- ccxt/woo.py +162 -65
- ccxt/woofipro.py +118 -49
- ccxt/xt.py +150 -73
- ccxt/yobit.py +49 -16
- ccxt/zaif.py +30 -10
- ccxt/zonda.py +46 -16
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/METADATA +5 -5
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/RECORD +273 -273
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/WHEEL +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitmart.py
CHANGED
@@ -723,7 +723,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
723
723
|
# }
|
724
724
|
# }
|
725
725
|
#
|
726
|
-
data = self.
|
726
|
+
data = self.safe_dict(response, 'data', {})
|
727
727
|
return self.safe_integer(data, 'server_time')
|
728
728
|
|
729
729
|
async def fetch_status(self, params={}):
|
@@ -732,7 +732,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
732
732
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
733
733
|
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
|
734
734
|
"""
|
735
|
-
options = self.
|
735
|
+
options = self.safe_dict(self.options, 'fetchStatus', {})
|
736
736
|
defaultType = self.safe_string(self.options, 'defaultType')
|
737
737
|
type = self.safe_string(options, 'type', defaultType)
|
738
738
|
type = self.safe_string(params, 'type', type)
|
@@ -763,12 +763,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
763
763
|
# }
|
764
764
|
# }
|
765
765
|
#
|
766
|
-
data = self.
|
767
|
-
services = self.
|
766
|
+
data = self.safe_dict(response, 'data', {})
|
767
|
+
services = self.safe_list(data, 'service', [])
|
768
768
|
servicesByType = self.index_by(services, 'service_type')
|
769
769
|
if type == 'swap':
|
770
770
|
type = 'contract'
|
771
|
-
service = self.
|
771
|
+
service = self.safe_string(servicesByType, type)
|
772
772
|
status = None
|
773
773
|
eta = None
|
774
774
|
if service is not None:
|
@@ -814,8 +814,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
814
814
|
# }
|
815
815
|
# }
|
816
816
|
#
|
817
|
-
data = self.
|
818
|
-
symbols = self.
|
817
|
+
data = self.safe_dict(response, 'data', {})
|
818
|
+
symbols = self.safe_list(data, 'symbols', [])
|
819
819
|
result = []
|
820
820
|
for i in range(0, len(symbols)):
|
821
821
|
market = symbols[i]
|
@@ -923,8 +923,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
923
923
|
# }
|
924
924
|
# }
|
925
925
|
#
|
926
|
-
data = self.
|
927
|
-
symbols = self.
|
926
|
+
data = self.safe_dict(response, 'data', {})
|
927
|
+
symbols = self.safe_list(data, 'symbols', [])
|
928
928
|
result = []
|
929
929
|
for i in range(0, len(symbols)):
|
930
930
|
market = symbols[i]
|
@@ -996,7 +996,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
996
996
|
|
997
997
|
async def fetch_markets(self, params={}) -> List[Market]:
|
998
998
|
"""
|
999
|
-
|
999
|
+
|
1000
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1001
|
+
|
1000
1002
|
retrieves data on all markets for bitmart
|
1001
1003
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1002
1004
|
:returns dict[]: an array of objects representing market data
|
@@ -1026,16 +1028,16 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1026
1028
|
# }
|
1027
1029
|
# }
|
1028
1030
|
#
|
1029
|
-
data = self.
|
1030
|
-
currencies = self.
|
1031
|
+
data = self.safe_dict(response, 'data', {})
|
1032
|
+
currencies = self.safe_list(data, 'currencies', [])
|
1031
1033
|
result: dict = {}
|
1032
1034
|
for i in range(0, len(currencies)):
|
1033
1035
|
currency = currencies[i]
|
1034
1036
|
id = self.safe_string(currency, 'id')
|
1035
1037
|
code = self.safe_currency_code(id)
|
1036
1038
|
name = self.safe_string(currency, 'name')
|
1037
|
-
withdrawEnabled = self.
|
1038
|
-
depositEnabled = self.
|
1039
|
+
withdrawEnabled = self.safe_bool(currency, 'withdraw_enabled')
|
1040
|
+
depositEnabled = self.safe_bool(currency, 'deposit_enabled')
|
1039
1041
|
active = withdrawEnabled and depositEnabled
|
1040
1042
|
result[code] = {
|
1041
1043
|
'id': id,
|
@@ -1056,7 +1058,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1056
1058
|
|
1057
1059
|
async def fetch_transaction_fee(self, code: str, params={}):
|
1058
1060
|
"""
|
1059
|
-
|
1061
|
+
@deprecated
|
1060
1062
|
please use fetchDepositWithdrawFee instead
|
1061
1063
|
:param str code: unified currency code
|
1062
1064
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1299,8 +1301,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1299
1301
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1300
1302
|
"""
|
1301
1303
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1302
|
-
|
1303
|
-
|
1304
|
+
|
1305
|
+
https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
1306
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1307
|
+
|
1304
1308
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1305
1309
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1306
1310
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1386,14 +1390,16 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1386
1390
|
else:
|
1387
1391
|
data = self.safe_dict(response, 'data', {})
|
1388
1392
|
tickers = self.safe_list(data, 'symbols', [])
|
1389
|
-
ticker = self.
|
1393
|
+
ticker = self.safe_dict(tickers, 0, {})
|
1390
1394
|
return self.parse_ticker(ticker, market)
|
1391
1395
|
|
1392
1396
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1393
1397
|
"""
|
1394
1398
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1395
|
-
|
1396
|
-
|
1399
|
+
|
1400
|
+
https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
1401
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1402
|
+
|
1397
1403
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1398
1404
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1399
1405
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1403,7 +1409,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1403
1409
|
type = None
|
1404
1410
|
market = None
|
1405
1411
|
if symbols is not None:
|
1406
|
-
symbol = self.
|
1412
|
+
symbol = self.safe_string(symbols, 0)
|
1407
1413
|
market = self.market(symbol)
|
1408
1414
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
1409
1415
|
response = None
|
@@ -1496,9 +1502,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1496
1502
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
1497
1503
|
"""
|
1498
1504
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1505
|
+
|
1506
|
+
https://developer-pro.bitmart.com/en/spot/#get-depth-v3
|
1507
|
+
https://developer-pro.bitmart.com/en/futures/#get-market-depth
|
1508
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
|
1509
|
+
|
1502
1510
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1503
1511
|
:param int [limit]: the maximum amount of order book entries to return
|
1504
1512
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1563,7 +1571,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1563
1571
|
# "trace": "4cad855074664097ac6ba5258c47305d.72.16952643834721135"
|
1564
1572
|
# }
|
1565
1573
|
#
|
1566
|
-
data = self.
|
1574
|
+
data = self.safe_dict(response, 'data', {})
|
1567
1575
|
timestamp = self.safe_integer_2(data, 'ts', 'timestamp')
|
1568
1576
|
return self.parse_order_book(data, market['symbol'], timestamp)
|
1569
1577
|
|
@@ -1672,7 +1680,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1672
1680
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1673
1681
|
"""
|
1674
1682
|
get a list of the most recent trades for a particular symbol
|
1675
|
-
|
1683
|
+
|
1684
|
+
https://developer-pro.bitmart.com/en/spot/#get-recent-trades-v3
|
1685
|
+
|
1676
1686
|
:param str symbol: unified symbol of the market to fetch trades for
|
1677
1687
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1678
1688
|
:param int [limit]: the maximum number of trades to fetch
|
@@ -1773,8 +1783,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1773
1783
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1774
1784
|
"""
|
1775
1785
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1776
|
-
|
1777
|
-
|
1786
|
+
|
1787
|
+
https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
|
1788
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
|
1789
|
+
|
1778
1790
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1779
1791
|
:param str timeframe: the length of time each candle represents
|
1780
1792
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1864,8 +1876,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1864
1876
|
|
1865
1877
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1866
1878
|
"""
|
1867
|
-
|
1868
|
-
|
1879
|
+
|
1880
|
+
https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
|
1881
|
+
https://developer-pro.bitmart.com/en/futures/#get-order-trade-keyed
|
1882
|
+
|
1869
1883
|
fetch all trades made by the user
|
1870
1884
|
:param str symbol: unified market symbol
|
1871
1885
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -1891,7 +1905,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1891
1905
|
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
1892
1906
|
if marginMode == 'isolated':
|
1893
1907
|
request['orderMode'] = 'iso_margin'
|
1894
|
-
options = self.
|
1908
|
+
options = self.safe_dict(self.options, 'fetchMyTrades', {})
|
1895
1909
|
defaultLimit = self.safe_integer(options, 'limit', 200)
|
1896
1910
|
if limit is None:
|
1897
1911
|
limit = defaultLimit
|
@@ -1967,7 +1981,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1967
1981
|
|
1968
1982
|
async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1969
1983
|
"""
|
1970
|
-
|
1984
|
+
|
1985
|
+
https://developer-pro.bitmart.com/en/spot/#order-trade-list-v4-signed
|
1986
|
+
|
1971
1987
|
fetch all the trades made from a single order
|
1972
1988
|
:param str id: order id
|
1973
1989
|
:param str symbol: unified market symbol
|
@@ -1985,22 +2001,22 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1985
2001
|
return self.parse_trades(data, None, since, limit)
|
1986
2002
|
|
1987
2003
|
def custom_parse_balance(self, response, marketType) -> Balances:
|
1988
|
-
data = self.
|
2004
|
+
data = self.safe_dict(response, 'data', {})
|
1989
2005
|
wallet = None
|
1990
2006
|
if marketType == 'swap':
|
1991
|
-
wallet = self.
|
2007
|
+
wallet = self.safe_list(response, 'data', [])
|
1992
2008
|
elif marketType == 'margin':
|
1993
|
-
wallet = self.
|
2009
|
+
wallet = self.safe_list(data, 'symbols', [])
|
1994
2010
|
else:
|
1995
|
-
wallet = self.
|
2011
|
+
wallet = self.safe_list(data, 'wallet', [])
|
1996
2012
|
result = {'info': response}
|
1997
2013
|
if marketType == 'margin':
|
1998
2014
|
for i in range(0, len(wallet)):
|
1999
2015
|
entry = wallet[i]
|
2000
2016
|
marketId = self.safe_string(entry, 'symbol')
|
2001
2017
|
symbol = self.safe_symbol(marketId, None, '_')
|
2002
|
-
base = self.
|
2003
|
-
quote = self.
|
2018
|
+
base = self.safe_dict(entry, 'base', {})
|
2019
|
+
quote = self.safe_dict(entry, 'quote', {})
|
2004
2020
|
baseCode = self.safe_currency_code(self.safe_string(base, 'currency'))
|
2005
2021
|
quoteCode = self.safe_currency_code(self.safe_string(quote, 'currency'))
|
2006
2022
|
subResult: dict = {}
|
@@ -2033,11 +2049,13 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2033
2049
|
async def fetch_balance(self, params={}) -> Balances:
|
2034
2050
|
"""
|
2035
2051
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2052
|
+
|
2053
|
+
https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
|
2054
|
+
https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
|
2055
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
|
2056
|
+
https://developer-pro.bitmart.com/en/spot/#get-account-balance
|
2057
|
+
https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
|
2058
|
+
|
2041
2059
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2042
2060
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
2043
2061
|
"""
|
@@ -2202,7 +2220,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2202
2220
|
# }
|
2203
2221
|
# }
|
2204
2222
|
#
|
2205
|
-
data = self.
|
2223
|
+
data = self.safe_dict(response, 'data', {})
|
2206
2224
|
return self.parse_trading_fee(data)
|
2207
2225
|
|
2208
2226
|
def parse_order(self, order: dict, market: Market = None) -> Order:
|
@@ -2361,13 +2379,15 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2361
2379
|
'4': 'closed', # Completed
|
2362
2380
|
},
|
2363
2381
|
}
|
2364
|
-
statuses = self.
|
2382
|
+
statuses = self.safe_dict(statusesByType, type, {})
|
2365
2383
|
return self.safe_string(statuses, status, status)
|
2366
2384
|
|
2367
2385
|
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
2368
2386
|
"""
|
2369
2387
|
create a market buy order by providing the symbol and cost
|
2370
|
-
|
2388
|
+
|
2389
|
+
https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
2390
|
+
|
2371
2391
|
:param str symbol: unified symbol of the market to create an order in
|
2372
2392
|
:param float cost: how much you want to trade in units of the quote currency
|
2373
2393
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2383,12 +2403,14 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2383
2403
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2384
2404
|
"""
|
2385
2405
|
create a trade order
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2406
|
+
|
2407
|
+
https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
2408
|
+
https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
2409
|
+
https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2410
|
+
https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2411
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2412
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
|
2413
|
+
|
2392
2414
|
:param str symbol: unified symbol of the market to create an order in
|
2393
2415
|
:param str type: 'market', 'limit' or 'trailing' for swap markets only
|
2394
2416
|
:param str side: 'buy' or 'sell'
|
@@ -2451,7 +2473,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2451
2473
|
# swap
|
2452
2474
|
# {"code":1000,"message":"Ok","data":{"order_id":231116359426639,"price":"market price"},"trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.62.16996369620521911"}
|
2453
2475
|
#
|
2454
|
-
data = self.
|
2476
|
+
data = self.safe_dict(response, 'data', {})
|
2455
2477
|
order = self.parse_order(data, market)
|
2456
2478
|
order['type'] = type
|
2457
2479
|
order['side'] = side
|
@@ -2462,7 +2484,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2462
2484
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
2463
2485
|
"""
|
2464
2486
|
create a list of trade orders
|
2465
|
-
|
2487
|
+
|
2488
|
+
https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
2489
|
+
|
2466
2490
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
2467
2491
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2468
2492
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -2523,12 +2547,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2523
2547
|
|
2524
2548
|
def create_swap_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2525
2549
|
"""
|
2526
|
-
|
2550
|
+
@ignore
|
2527
2551
|
create a trade order
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2552
|
+
https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2553
|
+
https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2554
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2555
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
|
2532
2556
|
:param str symbol: unified symbol of the market to create an order in
|
2533
2557
|
:param str type: 'market', 'limit', 'trailing', 'stop_loss', or 'take_profit'
|
2534
2558
|
:param str side: 'buy' or 'sell'
|
@@ -2643,10 +2667,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2643
2667
|
|
2644
2668
|
def create_spot_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2645
2669
|
"""
|
2646
|
-
|
2670
|
+
@ignore
|
2647
2671
|
create a spot order request
|
2648
|
-
|
2649
|
-
|
2672
|
+
https://developer-pro.bitmart.com/en/spot/#place-spot-order
|
2673
|
+
https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
2650
2674
|
:param str symbol: unified symbol of the market to create an order in
|
2651
2675
|
:param str type: 'market' or 'limit'
|
2652
2676
|
:param str side: 'buy' or 'sell'
|
@@ -2709,12 +2733,14 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2709
2733
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2710
2734
|
"""
|
2711
2735
|
cancels an open order
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2736
|
+
|
2737
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
2738
|
+
https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
2739
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2740
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2741
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
2742
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2743
|
+
|
2718
2744
|
:param str id: order id
|
2719
2745
|
:param str symbol: unified symbol of the market the order was made in
|
2720
2746
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2739,7 +2765,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2739
2765
|
if market['spot']:
|
2740
2766
|
response = await self.privatePostSpotV3CancelOrder(self.extend(request, params))
|
2741
2767
|
else:
|
2742
|
-
stop = self.
|
2768
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
2743
2769
|
params = self.omit(params, ['stop', 'trigger'])
|
2744
2770
|
if not stop:
|
2745
2771
|
response = await self.privatePostContractPrivateCancelOrder(self.extend(request, params))
|
@@ -2788,7 +2814,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2788
2814
|
async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
2789
2815
|
"""
|
2790
2816
|
cancel multiple orders
|
2791
|
-
|
2817
|
+
|
2818
|
+
https://developer-pro.bitmart.com/en/spot/#cancel-batch-order-v4-signed
|
2819
|
+
|
2792
2820
|
:param str[] ids: order ids
|
2793
2821
|
:param str symbol: unified symbol of the market the order was made in
|
2794
2822
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2842,10 +2870,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2842
2870
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
2843
2871
|
"""
|
2844
2872
|
cancel all open orders in a market
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2873
|
+
|
2874
|
+
https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
2875
|
+
https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
2876
|
+
https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
2877
|
+
https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
2878
|
+
|
2849
2879
|
:param str symbol: unified market symbol of the market to cancel orders in
|
2850
2880
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2851
2881
|
:param str [params.side]: *spot only* 'buy' or 'sell'
|
@@ -2935,15 +2965,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2935
2965
|
# }
|
2936
2966
|
# }
|
2937
2967
|
#
|
2938
|
-
data = self.
|
2968
|
+
data = self.safe_dict(response, 'data', {})
|
2939
2969
|
orders = self.safe_list(data, 'orders', [])
|
2940
2970
|
return self.parse_orders(orders, market, since, limit)
|
2941
2971
|
|
2942
2972
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2943
2973
|
"""
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2974
|
+
|
2975
|
+
https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
2976
|
+
https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
|
2977
|
+
https://developer-pro.bitmart.com/en/futures/#get-all-current-plan-orders-keyed
|
2978
|
+
|
2947
2979
|
fetch all unfilled currently open orders
|
2948
2980
|
:param str symbol: unified market symbol
|
2949
2981
|
:param int [since]: the earliest time in ms to fetch open orders for
|
@@ -2982,7 +3014,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2982
3014
|
request['endTime'] = until
|
2983
3015
|
response = await self.privatePostSpotV4QueryOpenOrders(self.extend(request, params))
|
2984
3016
|
elif type == 'swap':
|
2985
|
-
isStop = self.
|
3017
|
+
isStop = self.safe_bool_2(params, 'stop', 'trigger')
|
2986
3018
|
params = self.omit(params, ['stop', 'trigger'])
|
2987
3019
|
if isStop:
|
2988
3020
|
response = await self.privateGetContractPrivateCurrentPlanOrder(self.extend(request, params))
|
@@ -3056,9 +3088,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3056
3088
|
|
3057
3089
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3058
3090
|
"""
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3091
|
+
|
3092
|
+
https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
3093
|
+
https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
3094
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
3095
|
+
|
3062
3096
|
fetches information on multiple closed orders made by the user
|
3063
3097
|
:param str symbol: unified market symbol of the market orders were made in
|
3064
3098
|
:param int [since]: the earliest time in ms to fetch orders for
|
@@ -3113,10 +3147,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3113
3147
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3114
3148
|
"""
|
3115
3149
|
fetches information on an order made by the user
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3150
|
+
|
3151
|
+
https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
3152
|
+
https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
3153
|
+
https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
3154
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
3155
|
+
|
3120
3156
|
:param str id: the id of the order
|
3121
3157
|
:param str symbol: unified symbol of the market the order was made in
|
3122
3158
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3210,7 +3246,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3210
3246
|
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
3211
3247
|
"""
|
3212
3248
|
fetch the deposit address for a currency associated with self account
|
3213
|
-
|
3249
|
+
|
3250
|
+
https://developer-pro.bitmart.com/en/spot/#deposit-address-keyed
|
3251
|
+
|
3214
3252
|
:param str code: unified currency code
|
3215
3253
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3216
3254
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -3223,7 +3261,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3223
3261
|
if code == 'USDT':
|
3224
3262
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3225
3263
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3226
|
-
networks = self.
|
3264
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3227
3265
|
networkInner = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3228
3266
|
networkInner = self.safe_string(networks, networkInner, networkInner) # handle ERC20>ETH alias
|
3229
3267
|
if networkInner is not None:
|
@@ -3302,7 +3340,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3302
3340
|
if code == 'USDT':
|
3303
3341
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3304
3342
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3305
|
-
networks = self.
|
3343
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3306
3344
|
network = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3307
3345
|
network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
|
3308
3346
|
if network is not None:
|
@@ -3319,7 +3357,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3319
3357
|
# }
|
3320
3358
|
# }
|
3321
3359
|
#
|
3322
|
-
data = self.
|
3360
|
+
data = self.safe_dict(response, 'data', {})
|
3323
3361
|
transaction = self.parse_transaction(data, currency)
|
3324
3362
|
return self.extend(transaction, {
|
3325
3363
|
'code': code,
|
@@ -3343,7 +3381,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3343
3381
|
if code == 'USDT':
|
3344
3382
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3345
3383
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3346
|
-
networks = self.
|
3384
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3347
3385
|
network = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3348
3386
|
network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
|
3349
3387
|
if network is not None:
|
@@ -3375,7 +3413,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3375
3413
|
# }
|
3376
3414
|
# }
|
3377
3415
|
#
|
3378
|
-
data = self.
|
3416
|
+
data = self.safe_dict(response, 'data', {})
|
3379
3417
|
records = self.safe_list(data, 'records', [])
|
3380
3418
|
return self.parse_transactions(records, currency, since, limit)
|
3381
3419
|
|
@@ -3414,7 +3452,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3414
3452
|
# }
|
3415
3453
|
# }
|
3416
3454
|
#
|
3417
|
-
data = self.
|
3455
|
+
data = self.safe_dict(response, 'data', {})
|
3418
3456
|
record = self.safe_dict(data, 'record', {})
|
3419
3457
|
return self.parse_transaction(record)
|
3420
3458
|
|
@@ -3464,7 +3502,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3464
3502
|
# }
|
3465
3503
|
# }
|
3466
3504
|
#
|
3467
|
-
data = self.
|
3505
|
+
data = self.safe_dict(response, 'data', {})
|
3468
3506
|
record = self.safe_dict(data, 'record', {})
|
3469
3507
|
return self.parse_transaction(record)
|
3470
3508
|
|
@@ -3565,7 +3603,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3565
3603
|
async def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
3566
3604
|
"""
|
3567
3605
|
repay borrowed margin and interest
|
3568
|
-
|
3606
|
+
|
3607
|
+
https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated
|
3608
|
+
|
3569
3609
|
:param str symbol: unified market symbol
|
3570
3610
|
:param str code: unified currency code of the currency to repay
|
3571
3611
|
:param str amount: the amount to repay
|
@@ -3591,7 +3631,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3591
3631
|
# }
|
3592
3632
|
# }
|
3593
3633
|
#
|
3594
|
-
data = self.
|
3634
|
+
data = self.safe_dict(response, 'data', {})
|
3595
3635
|
transaction = self.parse_margin_loan(data, currency)
|
3596
3636
|
return self.extend(transaction, {
|
3597
3637
|
'amount': amount,
|
@@ -3601,7 +3641,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3601
3641
|
async def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
3602
3642
|
"""
|
3603
3643
|
create a loan to borrow margin
|
3604
|
-
|
3644
|
+
|
3645
|
+
https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated
|
3646
|
+
|
3605
3647
|
:param str symbol: unified market symbol
|
3606
3648
|
:param str code: unified currency code of the currency to borrow
|
3607
3649
|
:param str amount: the amount to borrow
|
@@ -3627,7 +3669,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3627
3669
|
# }
|
3628
3670
|
# }
|
3629
3671
|
#
|
3630
|
-
data = self.
|
3672
|
+
data = self.safe_dict(response, 'data', {})
|
3631
3673
|
transaction = self.parse_margin_loan(data, currency)
|
3632
3674
|
return self.extend(transaction, {
|
3633
3675
|
'amount': amount,
|
@@ -3661,7 +3703,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3661
3703
|
async def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
3662
3704
|
"""
|
3663
3705
|
fetch the rate of interest to borrow a currency for margin trading
|
3664
|
-
|
3706
|
+
|
3707
|
+
https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
3708
|
+
|
3665
3709
|
:param str symbol: unified symbol of the market to fetch the borrow rate for
|
3666
3710
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3667
3711
|
:returns dict: an `isolated borrow rate structure <https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure>`
|
@@ -3704,9 +3748,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3704
3748
|
# }
|
3705
3749
|
# }
|
3706
3750
|
#
|
3707
|
-
data = self.
|
3708
|
-
symbols = self.
|
3709
|
-
borrowRate = self.
|
3751
|
+
data = self.safe_dict(response, 'data', {})
|
3752
|
+
symbols = self.safe_list(data, 'symbols', [])
|
3753
|
+
borrowRate = self.safe_dict(symbols, 0, [])
|
3710
3754
|
return self.parse_isolated_borrow_rate(borrowRate, market)
|
3711
3755
|
|
3712
3756
|
def parse_isolated_borrow_rate(self, info: dict, market: Market = None) -> IsolatedBorrowRate:
|
@@ -3735,8 +3779,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3735
3779
|
#
|
3736
3780
|
marketId = self.safe_string(info, 'symbol')
|
3737
3781
|
symbol = self.safe_symbol(marketId, market)
|
3738
|
-
baseData = self.
|
3739
|
-
quoteData = self.
|
3782
|
+
baseData = self.safe_dict(info, 'base', {})
|
3783
|
+
quoteData = self.safe_dict(info, 'quote', {})
|
3740
3784
|
baseId = self.safe_string(baseData, 'currency')
|
3741
3785
|
quoteId = self.safe_string(quoteData, 'currency')
|
3742
3786
|
return {
|
@@ -3754,7 +3798,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3754
3798
|
async def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
|
3755
3799
|
"""
|
3756
3800
|
fetch the borrow interest rates of all currencies, currently only works for isolated margin
|
3757
|
-
|
3801
|
+
|
3802
|
+
https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
3803
|
+
|
3758
3804
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3759
3805
|
:returns dict: a list of `isolated borrow rate structures <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
|
3760
3806
|
"""
|
@@ -3792,16 +3838,18 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3792
3838
|
# }
|
3793
3839
|
# }
|
3794
3840
|
#
|
3795
|
-
data = self.
|
3796
|
-
symbols = self.
|
3841
|
+
data = self.safe_dict(response, 'data', {})
|
3842
|
+
symbols = self.safe_list(data, 'symbols', [])
|
3797
3843
|
return self.parse_isolated_borrow_rates(symbols)
|
3798
3844
|
|
3799
3845
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
3800
3846
|
"""
|
3801
3847
|
transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3848
|
+
|
3849
|
+
https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
3850
|
+
https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
3851
|
+
https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
3852
|
+
|
3805
3853
|
:param str code: unified currency code
|
3806
3854
|
:param float amount: amount to transfer
|
3807
3855
|
:param str fromAccount: account to transfer from
|
@@ -3861,7 +3909,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3861
3909
|
# }
|
3862
3910
|
# }
|
3863
3911
|
#
|
3864
|
-
data = self.
|
3912
|
+
data = self.safe_dict(response, 'data', {})
|
3865
3913
|
return self.extend(self.parse_transfer(data, currency), {
|
3866
3914
|
'status': self.parse_transfer_status(self.safe_string_2(response, 'code', 'message')),
|
3867
3915
|
})
|
@@ -3930,7 +3978,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3930
3978
|
async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
|
3931
3979
|
"""
|
3932
3980
|
fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
|
3933
|
-
|
3981
|
+
|
3982
|
+
https://developer-pro.bitmart.com/en/futures/#get-transfer-list-signed
|
3983
|
+
|
3934
3984
|
:param str code: unified currency code of the currency transferred
|
3935
3985
|
:param int [since]: the earliest time in ms to fetch transfers for
|
3936
3986
|
:param int [limit]: the maximum number of transfer structures to retrieve
|
@@ -3979,14 +4029,16 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3979
4029
|
# }
|
3980
4030
|
# }
|
3981
4031
|
#
|
3982
|
-
data = self.
|
4032
|
+
data = self.safe_dict(response, 'data', {})
|
3983
4033
|
records = self.safe_list(data, 'records', [])
|
3984
4034
|
return self.parse_transfers(records, currency, since, limit)
|
3985
4035
|
|
3986
4036
|
async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
|
3987
4037
|
"""
|
3988
4038
|
fetch the interest owed by the user for borrowing currency for margin trading
|
3989
|
-
|
4039
|
+
|
4040
|
+
https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated
|
4041
|
+
|
3990
4042
|
:param str code: unified currency code
|
3991
4043
|
:param str symbol: unified market symbol when fetch interest in isolated markets
|
3992
4044
|
:param int [since]: the earliest time in ms to fetch borrrow interest for
|
@@ -4027,8 +4079,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4027
4079
|
# }
|
4028
4080
|
# }
|
4029
4081
|
#
|
4030
|
-
data = self.
|
4031
|
-
rows = self.
|
4082
|
+
data = self.safe_dict(response, 'data', {})
|
4083
|
+
rows = self.safe_list(data, 'records', [])
|
4032
4084
|
interest = self.parse_borrow_interests(rows, market)
|
4033
4085
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
4034
4086
|
|
@@ -4063,7 +4115,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4063
4115
|
async def fetch_open_interest(self, symbol: str, params={}):
|
4064
4116
|
"""
|
4065
4117
|
Retrieves the open interest of a currency
|
4066
|
-
|
4118
|
+
|
4119
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
|
4120
|
+
|
4067
4121
|
:param str symbol: Unified CCXT market symbol
|
4068
4122
|
:param dict [params]: exchange specific parameters
|
4069
4123
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
@@ -4115,8 +4169,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4115
4169
|
async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
4116
4170
|
"""
|
4117
4171
|
set the level of leverage for a market
|
4118
|
-
|
4119
|
-
|
4172
|
+
|
4173
|
+
https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
4174
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
4175
|
+
|
4120
4176
|
:param float leverage: the rate of leverage
|
4121
4177
|
:param str symbol: unified market symbol
|
4122
4178
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4142,7 +4198,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4142
4198
|
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
4143
4199
|
"""
|
4144
4200
|
fetch the current funding rate
|
4145
|
-
|
4201
|
+
|
4202
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
4203
|
+
|
4146
4204
|
:param str symbol: unified market symbol
|
4147
4205
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4148
4206
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -4168,7 +4226,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4168
4226
|
# "trace": "4cad855074654097ac7ba5257c47305d.54.16951844206655589"
|
4169
4227
|
# }
|
4170
4228
|
#
|
4171
|
-
data = self.
|
4229
|
+
data = self.safe_dict(response, 'data', {})
|
4172
4230
|
return self.parse_funding_rate(data, market)
|
4173
4231
|
|
4174
4232
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
@@ -4206,8 +4264,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4206
4264
|
async def fetch_position(self, symbol: str, params={}):
|
4207
4265
|
"""
|
4208
4266
|
fetch data on a single open contract trade position
|
4209
|
-
|
4210
|
-
|
4267
|
+
|
4268
|
+
https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4269
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4270
|
+
|
4211
4271
|
:param str symbol: unified market symbol of the market the position is held in
|
4212
4272
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4213
4273
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4247,15 +4307,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4247
4307
|
# "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
4248
4308
|
# }
|
4249
4309
|
#
|
4250
|
-
data = self.
|
4310
|
+
data = self.safe_list(response, 'data', [])
|
4251
4311
|
first = self.safe_dict(data, 0, {})
|
4252
4312
|
return self.parse_position(first, market)
|
4253
4313
|
|
4254
4314
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
4255
4315
|
"""
|
4256
4316
|
fetch all open contract positions
|
4257
|
-
|
4258
|
-
|
4317
|
+
|
4318
|
+
https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4319
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4320
|
+
|
4259
4321
|
:param str[]|None symbols: list of unified market symbols
|
4260
4322
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4261
4323
|
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4301,7 +4363,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4301
4363
|
# "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
4302
4364
|
# }
|
4303
4365
|
#
|
4304
|
-
positions = self.
|
4366
|
+
positions = self.safe_list(response, 'data', [])
|
4305
4367
|
result = []
|
4306
4368
|
for i in range(0, len(positions)):
|
4307
4369
|
result.append(self.parse_position(positions[i]))
|
@@ -4375,7 +4437,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4375
4437
|
async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4376
4438
|
"""
|
4377
4439
|
retrieves the users liquidated positions
|
4378
|
-
|
4440
|
+
|
4441
|
+
https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
4442
|
+
|
4379
4443
|
:param str symbol: unified CCXT market symbol
|
4380
4444
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
4381
4445
|
:param int [limit]: the maximum number of liquidation structures to retrieve
|
@@ -4421,7 +4485,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4421
4485
|
# "trace": "4cad855074664097ac6ba4257c47305d.71.16965658195443021"
|
4422
4486
|
# }
|
4423
4487
|
#
|
4424
|
-
data = self.
|
4488
|
+
data = self.safe_list(response, 'data', [])
|
4425
4489
|
result = []
|
4426
4490
|
for i in range(0, len(data)):
|
4427
4491
|
entry = data[i]
|
@@ -4471,9 +4535,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4471
4535
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
|
4472
4536
|
"""
|
4473
4537
|
edits an open order
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4538
|
+
|
4539
|
+
https://developer-pro.bitmart.com/en/futuresv2/#modify-plan-order-signed
|
4540
|
+
https://developer-pro.bitmart.com/en/futuresv2/#modify-tp-sl-order-signed
|
4541
|
+
https://developer-pro.bitmart.com/en/futuresv2/#modify-preset-plan-order-signed
|
4542
|
+
|
4477
4543
|
:param str id: order id
|
4478
4544
|
:param str symbol: unified symbol of the market to edit an order in
|
4479
4545
|
:param str type: 'market' or 'limit'
|