ccxt 4.3.75__py2.py3-none-any.whl → 4.3.77__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/bitmart.py +2 -0
- ccxt/abstract/gemini.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +2 -2
- ccxt/async_support/bithumb.py +14 -14
- ccxt/async_support/bitmart.py +146 -82
- ccxt/async_support/bybit.py +4 -1
- ccxt/async_support/coinbase.py +8 -4
- ccxt/async_support/gemini.py +1 -0
- ccxt/async_support/htx.py +4 -0
- ccxt/async_support/kraken.py +2 -0
- ccxt/base/exchange.py +11 -2
- ccxt/binance.py +2 -2
- ccxt/bithumb.py +14 -14
- ccxt/bitmart.py +146 -82
- ccxt/bybit.py +4 -1
- ccxt/coinbase.py +8 -4
- ccxt/gemini.py +1 -0
- ccxt/htx.py +4 -0
- ccxt/kraken.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +24 -0
- ccxt/pro/bitmart.py +9 -8
- ccxt/pro/bybit.py +21 -2
- ccxt/pro/woo.py +1 -1
- ccxt/static_dependencies/starkware/crypto/utils.py +6 -1
- {ccxt-4.3.75.dist-info → ccxt-4.3.77.dist-info}/METADATA +4 -4
- {ccxt-4.3.75.dist-info → ccxt-4.3.77.dist-info}/RECORD +33 -35
- ccxt/static_dependencies/typing_extensions/__init__.py +0 -0
- ccxt/static_dependencies/typing_extensions/typing_extensions.py +0 -3839
- {ccxt-4.3.75.dist-info → ccxt-4.3.77.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.75.dist-info → ccxt-4.3.77.dist-info}/WHEEL +0 -0
- {ccxt-4.3.75.dist-info → ccxt-4.3.77.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bitmart.py
CHANGED
@@ -62,6 +62,8 @@ class ImplicitAPI:
|
|
62
62
|
private_get_contract_private_current_plan_order = privateGetContractPrivateCurrentPlanOrder = Entry('contract/private/current-plan-order', 'private', 'GET', {'cost': 1.2})
|
63
63
|
private_get_contract_private_trades = privateGetContractPrivateTrades = Entry('contract/private/trades', 'private', 'GET', {'cost': 10})
|
64
64
|
private_get_contract_private_position_risk = privateGetContractPrivatePositionRisk = Entry('contract/private/position-risk', 'private', 'GET', {'cost': 10})
|
65
|
+
private_get_contract_private_affilate_rebate_list = privateGetContractPrivateAffilateRebateList = Entry('contract/private/affilate/rebate-list', 'private', 'GET', {'cost': 10})
|
66
|
+
private_get_contract_private_affilate_trade_list = privateGetContractPrivateAffilateTradeList = Entry('contract/private/affilate/trade-list', 'private', 'GET', {'cost': 10})
|
65
67
|
private_post_account_sub_account_main_v1_sub_to_main = privatePostAccountSubAccountMainV1SubToMain = Entry('account/sub-account/main/v1/sub-to-main', 'private', 'POST', {'cost': 30})
|
66
68
|
private_post_account_sub_account_sub_v1_sub_to_main = privatePostAccountSubAccountSubV1SubToMain = Entry('account/sub-account/sub/v1/sub-to-main', 'private', 'POST', {'cost': 30})
|
67
69
|
private_post_account_sub_account_main_v1_main_to_sub = privatePostAccountSubAccountMainV1MainToSub = Entry('account/sub-account/main/v1/main-to-sub', 'private', 'POST', {'cost': 30})
|
ccxt/abstract/gemini.py
CHANGED
@@ -56,3 +56,4 @@ class ImplicitAPI:
|
|
56
56
|
private_post_v1_account_create = privatePostV1AccountCreate = Entry('v1/account/create', 'private', 'POST', {'cost': 1})
|
57
57
|
private_post_v1_account_list = privatePostV1AccountList = Entry('v1/account/list', 'private', 'POST', {'cost': 1})
|
58
58
|
private_post_v1_heartbeat = privatePostV1Heartbeat = Entry('v1/heartbeat', 'private', 'POST', {'cost': 1})
|
59
|
+
private_post_v1_roles = privatePostV1Roles = Entry('v1/roles', 'private', 'POST', {'cost': 1})
|
ccxt/async_support/__init__.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.3.
|
5
|
+
__version__ = '4.3.77'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -570,7 +570,7 @@ class Exchange(BaseExchange):
|
|
570
570
|
|
571
571
|
async def watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
572
572
|
if self.has['watchLiquidationsForSymbols']:
|
573
|
-
return self.watch_liquidations_for_symbols([symbol], since, limit, params)
|
573
|
+
return await self.watch_liquidations_for_symbols([symbol], since, limit, params)
|
574
574
|
raise NotSupported(self.id + ' watchLiquidations() is not supported yet')
|
575
575
|
|
576
576
|
async def watch_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
ccxt/async_support/binance.py
CHANGED
@@ -2785,7 +2785,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2785
2785
|
'active': depositEnable and withdrawEnable,
|
2786
2786
|
'deposit': depositEnable,
|
2787
2787
|
'withdraw': withdrawEnable,
|
2788
|
-
'fee':
|
2788
|
+
'fee': withdrawFee,
|
2789
2789
|
'precision': self.parse_number(precisionTick),
|
2790
2790
|
'limits': {
|
2791
2791
|
'withdraw': {
|
@@ -2793,7 +2793,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2793
2793
|
'max': self.safe_number(networkItem, 'withdrawMax'),
|
2794
2794
|
},
|
2795
2795
|
'deposit': {
|
2796
|
-
'min':
|
2796
|
+
'min': self.safe_number(networkItem, 'depositDust'),
|
2797
2797
|
'max': None,
|
2798
2798
|
},
|
2799
2799
|
},
|
ccxt/async_support/bithumb.py
CHANGED
@@ -208,7 +208,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
208
208
|
async def fetch_markets(self, params={}) -> List[Market]:
|
209
209
|
"""
|
210
210
|
retrieves data on all markets for bithumb
|
211
|
-
:see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
211
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
212
212
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
213
213
|
:returns dict[]: an array of objects representing market data
|
214
214
|
"""
|
@@ -342,7 +342,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
342
342
|
async def fetch_balance(self, params={}) -> Balances:
|
343
343
|
"""
|
344
344
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
345
|
-
:see: https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
345
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
346
346
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
347
347
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
348
348
|
"""
|
@@ -356,7 +356,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
356
356
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
357
357
|
"""
|
358
358
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
359
|
-
:see: https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
359
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
360
360
|
:param str symbol: unified symbol of the market to fetch the order book for
|
361
361
|
:param int [limit]: the maximum amount of order book entries to return
|
362
362
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -446,7 +446,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
446
446
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
447
447
|
"""
|
448
448
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
449
|
-
:see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
449
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
450
450
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
451
451
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
452
452
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -503,7 +503,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
503
503
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
504
504
|
"""
|
505
505
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
506
|
-
:see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
506
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
507
507
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
508
508
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
509
509
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -560,7 +560,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
560
560
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
561
561
|
"""
|
562
562
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
563
|
-
:see: https://apidocs.bithumb.com/reference/candlestick-rest-api
|
563
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api
|
564
564
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
565
565
|
:param str timeframe: the length of time each candle represents
|
566
566
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -677,7 +677,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
677
677
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
678
678
|
"""
|
679
679
|
get the list of most recent trades for a particular symbol
|
680
|
-
:see: https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
680
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
681
681
|
:param str symbol: unified symbol of the market to fetch trades for
|
682
682
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
683
683
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -713,9 +713,9 @@ class bithumb(Exchange, ImplicitAPI):
|
|
713
713
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
714
714
|
"""
|
715
715
|
create a trade order
|
716
|
-
:see: https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
717
|
-
:see: https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
718
|
-
:see: https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
716
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
717
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
718
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
719
719
|
:param str symbol: unified symbol of the market to create an order in
|
720
720
|
:param str type: 'market' or 'limit'
|
721
721
|
:param str side: 'buy' or 'sell'
|
@@ -752,7 +752,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
752
752
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
753
753
|
"""
|
754
754
|
fetches information on an order made by the user
|
755
|
-
:see: https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
|
755
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
|
756
756
|
:param str symbol: unified symbol of the market the order was made in
|
757
757
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
758
758
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -902,7 +902,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
902
902
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
903
903
|
"""
|
904
904
|
fetch all unfilled currently open orders
|
905
|
-
:see: https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
|
905
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
|
906
906
|
:param str symbol: unified market symbol
|
907
907
|
:param int [since]: the earliest time in ms to fetch open orders for
|
908
908
|
:param int [limit]: the maximum number of open order structures to retrieve
|
@@ -946,7 +946,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
946
946
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
947
947
|
"""
|
948
948
|
cancels an open order
|
949
|
-
:see: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
949
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
950
950
|
:param str id: order id
|
951
951
|
:param str symbol: unified symbol of the market the order was made in
|
952
952
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -986,7 +986,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
986
986
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
987
987
|
"""
|
988
988
|
make a withdrawal
|
989
|
-
:see: https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
|
989
|
+
:see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
|
990
990
|
:param str code: unified currency code
|
991
991
|
:param float amount: the amount to withdraw
|
992
992
|
:param str address: the address to withdraw to
|
ccxt/async_support/bitmart.py
CHANGED
@@ -129,7 +129,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
129
129
|
'urls': {
|
130
130
|
'logo': 'https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg',
|
131
131
|
'api': {
|
132
|
-
'
|
132
|
+
'spot': 'https://api-cloud.{hostname}',
|
133
|
+
'swap': 'https://api-cloud-v2.{hostname}', # bitmart.info for Hong Kong users
|
133
134
|
},
|
134
135
|
'www': 'https://www.bitmart.com/',
|
135
136
|
'doc': 'https://developer-pro.bitmart.com/',
|
@@ -220,6 +221,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
220
221
|
'contract/private/current-plan-order': 1.2,
|
221
222
|
'contract/private/trades': 10,
|
222
223
|
'contract/private/position-risk': 10,
|
224
|
+
'contract/private/affilate/rebate-list': 10,
|
225
|
+
'contract/private/affilate/trade-list': 10,
|
223
226
|
},
|
224
227
|
'post': {
|
225
228
|
# sub-account endpoints
|
@@ -513,8 +516,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
513
516
|
'40045': InvalidOrder, # 400, The order open type is invalid
|
514
517
|
'40046': PermissionDenied, # 403, The account is not opened futures
|
515
518
|
'40047': PermissionDenied, # 403, Services is not available in you countries and areas
|
516
|
-
'40048':
|
517
|
-
'40049':
|
519
|
+
'40048': InvalidOrder, # 403, ClientOrderId only allows a combination of numbers and letters
|
520
|
+
'40049': InvalidOrder, # 403, The maximum length of clientOrderId cannot exceed 32
|
518
521
|
'40050': InvalidOrder, # 403, Client OrderId duplicated with existing orders
|
519
522
|
},
|
520
523
|
'broad': {},
|
@@ -877,36 +880,43 @@ class bitmart(Exchange, ImplicitAPI):
|
|
877
880
|
async def fetch_contract_markets(self, params={}):
|
878
881
|
response = await self.publicGetContractPublicDetails(params)
|
879
882
|
#
|
880
|
-
#
|
881
|
-
#
|
882
|
-
#
|
883
|
-
#
|
884
|
-
#
|
885
|
-
# "symbols": [
|
886
|
-
#
|
887
|
-
#
|
888
|
-
#
|
889
|
-
#
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
#
|
894
|
-
#
|
895
|
-
#
|
896
|
-
#
|
897
|
-
#
|
898
|
-
#
|
899
|
-
#
|
900
|
-
#
|
901
|
-
#
|
902
|
-
#
|
903
|
-
#
|
904
|
-
#
|
905
|
-
#
|
906
|
-
#
|
907
|
-
#
|
908
|
-
#
|
883
|
+
# {
|
884
|
+
# "code": 1000,
|
885
|
+
# "message": "Ok",
|
886
|
+
# "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
887
|
+
# "data": {
|
888
|
+
# "symbols": [
|
889
|
+
# {
|
890
|
+
# "symbol": "BTCUSDT",
|
891
|
+
# "product_type": 1,
|
892
|
+
# "open_timestamp": 1594080000,
|
893
|
+
# "expire_timestamp": 0,
|
894
|
+
# "settle_timestamp": 0,
|
895
|
+
# "base_currency": "BTC",
|
896
|
+
# "quote_currency": "USDT",
|
897
|
+
# "last_price": "23920",
|
898
|
+
# "volume_24h": "18969368",
|
899
|
+
# "turnover_24h": "458933659.7858",
|
900
|
+
# "index_price": "23945.25191635",
|
901
|
+
# "index_name": "BTCUSDT",
|
902
|
+
# "contract_size": "0.001",
|
903
|
+
# "min_leverage": "1",
|
904
|
+
# "max_leverage": "100",
|
905
|
+
# "price_precision": "0.1",
|
906
|
+
# "vol_precision": "1",
|
907
|
+
# "max_volume": "500000",
|
908
|
+
# "min_volume": "1",
|
909
|
+
# "funding_rate": "0.0001",
|
910
|
+
# "expected_funding_rate": "0.00011",
|
911
|
+
# "open_interest": "4134180870",
|
912
|
+
# "open_interest_value": "94100888927.0433258",
|
913
|
+
# "high_24h": "23900",
|
914
|
+
# "low_24h": "23100",
|
915
|
+
# "change_24h": "0.004"
|
916
|
+
# },
|
917
|
+
# ]
|
909
918
|
# }
|
919
|
+
# }
|
910
920
|
#
|
911
921
|
data = self.safe_value(response, 'data', {})
|
912
922
|
symbols = self.safe_value(data, 'symbols', [])
|
@@ -981,6 +991,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
981
991
|
|
982
992
|
async def fetch_markets(self, params={}) -> List[Market]:
|
983
993
|
"""
|
994
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
984
995
|
retrieves data on all markets for bitmart
|
985
996
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
986
997
|
:returns dict[]: an array of objects representing market data
|
@@ -1179,25 +1190,41 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1179
1190
|
#
|
1180
1191
|
# swap
|
1181
1192
|
#
|
1182
|
-
#
|
1183
|
-
#
|
1184
|
-
#
|
1185
|
-
#
|
1186
|
-
#
|
1187
|
-
#
|
1188
|
-
#
|
1189
|
-
#
|
1190
|
-
#
|
1191
|
-
#
|
1192
|
-
#
|
1193
|
-
#
|
1193
|
+
# {
|
1194
|
+
# "symbol": "BTCUSDT",
|
1195
|
+
# "product_type": 1,
|
1196
|
+
# "open_timestamp": 1594080000,
|
1197
|
+
# "expire_timestamp": 0,
|
1198
|
+
# "settle_timestamp": 0,
|
1199
|
+
# "base_currency": "BTC",
|
1200
|
+
# "quote_currency": "USDT",
|
1201
|
+
# "last_price": "23920",
|
1202
|
+
# "volume_24h": "18969368",
|
1203
|
+
# "turnover_24h": "458933659.7858",
|
1204
|
+
# "index_price": "23945.25191635",
|
1205
|
+
# "index_name": "BTCUSDT",
|
1206
|
+
# "contract_size": "0.001",
|
1207
|
+
# "min_leverage": "1",
|
1208
|
+
# "max_leverage": "100",
|
1209
|
+
# "price_precision": "0.1",
|
1210
|
+
# "vol_precision": "1",
|
1211
|
+
# "max_volume": "500000",
|
1212
|
+
# "min_volume": "1",
|
1213
|
+
# "funding_rate": "0.0001",
|
1214
|
+
# "expected_funding_rate": "0.00011",
|
1215
|
+
# "open_interest": "4134180870",
|
1216
|
+
# "open_interest_value": "94100888927.0433258",
|
1217
|
+
# "high_24h": "23900",
|
1218
|
+
# "low_24h": "23100",
|
1219
|
+
# "change_24h": "0.004"
|
1220
|
+
# }
|
1194
1221
|
#
|
1195
1222
|
result = self.safe_list(ticker, 'result', [])
|
1196
1223
|
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
1197
1224
|
marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
|
1198
1225
|
timestamp = self.safe_integer_2(ticker, 'timestamp', 'ts')
|
1199
1226
|
last = self.safe_string_2(ticker, 'last_price', 'last')
|
1200
|
-
percentage = self.
|
1227
|
+
percentage = self.safe_string_2(ticker, 'price_change_percent_24h', 'change_24h')
|
1201
1228
|
change = self.safe_string(ticker, 'fluctuation')
|
1202
1229
|
high = self.safe_string_2(ticker, 'high_24h', 'high_price')
|
1203
1230
|
low = self.safe_string_2(ticker, 'low_24h', 'low_price')
|
@@ -1206,8 +1233,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1206
1233
|
ask = self.safe_string_2(ticker, 'best_ask', 'ask_px')
|
1207
1234
|
askVolume = self.safe_string_2(ticker, 'best_ask_size', 'ask_sz')
|
1208
1235
|
open = self.safe_string(ticker, 'open_24h')
|
1209
|
-
baseVolume = self.
|
1210
|
-
quoteVolume = self.
|
1236
|
+
baseVolume = self.safe_string_n(ticker, ['base_volume_24h', 'v_24h', 'volume_24h'])
|
1237
|
+
quoteVolume = self.safe_string_lower_n(ticker, ['quote_volume_24h', 'qv_24h', 'turnover_24h'])
|
1211
1238
|
listMarketId = self.safe_string(result, 0)
|
1212
1239
|
if listMarketId is not None:
|
1213
1240
|
marketId = listMarketId
|
@@ -1266,6 +1293,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1266
1293
|
"""
|
1267
1294
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1268
1295
|
:see: https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
1296
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1269
1297
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1270
1298
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1271
1299
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1275,8 +1303,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1275
1303
|
request: dict = {}
|
1276
1304
|
response = None
|
1277
1305
|
if market['swap']:
|
1278
|
-
request['
|
1279
|
-
response = await self.
|
1306
|
+
request['symbol'] = market['id']
|
1307
|
+
response = await self.publicGetContractPublicDetails(self.extend(request, params))
|
1280
1308
|
#
|
1281
1309
|
# {
|
1282
1310
|
# "message":"OK",
|
@@ -1328,22 +1356,21 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1328
1356
|
else:
|
1329
1357
|
raise NotSupported(self.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted')
|
1330
1358
|
# fails in naming for contract tickers 'contract_symbol'
|
1331
|
-
tickersById = None
|
1332
1359
|
tickers = []
|
1333
1360
|
ticker: dict = {}
|
1334
1361
|
if market['spot']:
|
1335
1362
|
ticker = self.safe_dict(response, 'data', {})
|
1336
1363
|
else:
|
1337
1364
|
data = self.safe_dict(response, 'data', {})
|
1338
|
-
tickers = self.safe_list(data, '
|
1339
|
-
|
1340
|
-
ticker = self.safe_dict(tickersById, market['id'])
|
1365
|
+
tickers = self.safe_list(data, 'symbols', [])
|
1366
|
+
ticker = self.safe_value(tickers, 0, {})
|
1341
1367
|
return self.parse_ticker(ticker, market)
|
1342
1368
|
|
1343
1369
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1344
1370
|
"""
|
1345
1371
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1346
1372
|
:see: https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
1373
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1347
1374
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1348
1375
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1349
1376
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1384,29 +1411,45 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1384
1411
|
# }
|
1385
1412
|
#
|
1386
1413
|
elif type == 'swap':
|
1387
|
-
response = await self.
|
1414
|
+
response = await self.publicGetContractPublicDetails(params)
|
1388
1415
|
#
|
1389
|
-
#
|
1390
|
-
#
|
1391
|
-
#
|
1392
|
-
#
|
1393
|
-
#
|
1394
|
-
#
|
1395
|
-
#
|
1396
|
-
#
|
1397
|
-
#
|
1398
|
-
#
|
1399
|
-
#
|
1400
|
-
#
|
1401
|
-
#
|
1402
|
-
#
|
1403
|
-
#
|
1404
|
-
#
|
1405
|
-
#
|
1406
|
-
#
|
1407
|
-
#
|
1408
|
-
#
|
1409
|
-
#
|
1416
|
+
# {
|
1417
|
+
# "code": 1000,
|
1418
|
+
# "message": "Ok",
|
1419
|
+
# "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
1420
|
+
# "data": {
|
1421
|
+
# "symbols": [
|
1422
|
+
# {
|
1423
|
+
# "symbol": "BTCUSDT",
|
1424
|
+
# "product_type": 1,
|
1425
|
+
# "open_timestamp": 1594080000,
|
1426
|
+
# "expire_timestamp": 0,
|
1427
|
+
# "settle_timestamp": 0,
|
1428
|
+
# "base_currency": "BTC",
|
1429
|
+
# "quote_currency": "USDT",
|
1430
|
+
# "last_price": "23920",
|
1431
|
+
# "volume_24h": "18969368",
|
1432
|
+
# "turnover_24h": "458933659.7858",
|
1433
|
+
# "index_price": "23945.25191635",
|
1434
|
+
# "index_name": "BTCUSDT",
|
1435
|
+
# "contract_size": "0.001",
|
1436
|
+
# "min_leverage": "1",
|
1437
|
+
# "max_leverage": "100",
|
1438
|
+
# "price_precision": "0.1",
|
1439
|
+
# "vol_precision": "1",
|
1440
|
+
# "max_volume": "500000",
|
1441
|
+
# "min_volume": "1",
|
1442
|
+
# "funding_rate": "0.0001",
|
1443
|
+
# "expected_funding_rate": "0.00011",
|
1444
|
+
# "open_interest": "4134180870",
|
1445
|
+
# "open_interest_value": "94100888927.0433258",
|
1446
|
+
# "high_24h": "23900",
|
1447
|
+
# "low_24h": "23100",
|
1448
|
+
# "change_24h": "0.004"
|
1449
|
+
# },
|
1450
|
+
# ]
|
1451
|
+
# }
|
1452
|
+
# }
|
1410
1453
|
#
|
1411
1454
|
else:
|
1412
1455
|
raise NotSupported(self.id + ' fetchTickers() does not support ' + type + ' markets, only spot and swap markets are accepted')
|
@@ -1415,7 +1458,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1415
1458
|
tickers = self.safe_list(response, 'data', [])
|
1416
1459
|
else:
|
1417
1460
|
data = self.safe_dict(response, 'data', {})
|
1418
|
-
tickers = self.safe_list(data, '
|
1461
|
+
tickers = self.safe_list(data, 'symbols', [])
|
1419
1462
|
result: dict = {}
|
1420
1463
|
for i in range(0, len(tickers)):
|
1421
1464
|
ticker: dict = {}
|
@@ -1432,6 +1475,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1432
1475
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1433
1476
|
:see: https://developer-pro.bitmart.com/en/spot/#get-depth-v3
|
1434
1477
|
:see: https://developer-pro.bitmart.com/en/futures/#get-market-depth
|
1478
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
|
1435
1479
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1436
1480
|
:param int [limit]: the maximum amount of order book entries to return
|
1437
1481
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1707,7 +1751,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1707
1751
|
"""
|
1708
1752
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1709
1753
|
:see: https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
|
1710
|
-
:see: https://developer-pro.bitmart.com/en/
|
1754
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
|
1711
1755
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1712
1756
|
:param str timeframe: the length of time each candle represents
|
1713
1757
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1968,6 +2012,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1968
2012
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
1969
2013
|
:see: https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
|
1970
2014
|
:see: https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
|
2015
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
|
1971
2016
|
:see: https://developer-pro.bitmart.com/en/spot/#get-account-balance
|
1972
2017
|
:see: https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
|
1973
2018
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2319,6 +2364,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2319
2364
|
:see: https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
2320
2365
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2321
2366
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2367
|
+
:see: https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2368
|
+
:see: https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2369
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2322
2370
|
:param str symbol: unified symbol of the market to create an order in
|
2323
2371
|
:param str type: 'market', 'limit' or 'trailing' for swap markets only
|
2324
2372
|
:param str side: 'buy' or 'sell'
|
@@ -2531,9 +2579,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2531
2579
|
if clientOrderId is not None:
|
2532
2580
|
params = self.omit(params, 'clientOrderId')
|
2533
2581
|
request['client_order_id'] = clientOrderId
|
2534
|
-
leverage = self.safe_integer(params, 'leverage'
|
2582
|
+
leverage = self.safe_integer(params, 'leverage')
|
2535
2583
|
params = self.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice'])
|
2536
|
-
|
2584
|
+
if leverage is not None:
|
2585
|
+
request['leverage'] = self.number_to_string(leverage)
|
2586
|
+
elif isTriggerOrder:
|
2587
|
+
request['leverage'] = '1' # for plan orders leverage is required, if not available default to 1
|
2537
2588
|
return self.extend(request, params)
|
2538
2589
|
|
2539
2590
|
def create_spot_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2608,6 +2659,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2608
2659
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
2609
2660
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2610
2661
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2662
|
+
:see: https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
2663
|
+
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2611
2664
|
:param str id: order id
|
2612
2665
|
:param str symbol: unified symbol of the market the order was made in
|
2613
2666
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2737,6 +2790,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2737
2790
|
cancel all open orders in a market
|
2738
2791
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
2739
2792
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
2793
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
2740
2794
|
:param str symbol: unified market symbol of the market to cancel orders in
|
2741
2795
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2742
2796
|
:param str [params.side]: *spot only* 'buy' or 'sell'
|
@@ -2949,6 +3003,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2949
3003
|
"""
|
2950
3004
|
:see: https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
2951
3005
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
3006
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
2952
3007
|
fetches information on multiple closed orders made by the user
|
2953
3008
|
:param str symbol: unified market symbol of the market orders were made in
|
2954
3009
|
:param int [since]: the earliest time in ms to fetch orders for
|
@@ -3006,6 +3061,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3006
3061
|
:see: https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
3007
3062
|
:see: https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
3008
3063
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
3064
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
3009
3065
|
:param str id: the id of the order
|
3010
3066
|
:param str symbol: unified symbol of the market the order was made in
|
3011
3067
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3694,6 +3750,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3694
3750
|
transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
3695
3751
|
:see: https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
3696
3752
|
:see: https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
3753
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
3697
3754
|
:param str code: unified currency code
|
3698
3755
|
:param float amount: amount to transfer
|
3699
3756
|
:param str fromAccount: account to transfer from
|
@@ -3955,7 +4012,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3955
4012
|
async def fetch_open_interest(self, symbol: str, params={}):
|
3956
4013
|
"""
|
3957
4014
|
Retrieves the open interest of a currency
|
3958
|
-
:see: https://developer-pro.bitmart.com/en/
|
4015
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
|
3959
4016
|
:param str symbol: Unified CCXT market symbol
|
3960
4017
|
:param dict [params]: exchange specific parameters
|
3961
4018
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
@@ -4008,6 +4065,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4008
4065
|
"""
|
4009
4066
|
set the level of leverage for a market
|
4010
4067
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
4068
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
4011
4069
|
:param float leverage: the rate of leverage
|
4012
4070
|
:param str symbol: unified market symbol
|
4013
4071
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4033,7 +4091,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4033
4091
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
4034
4092
|
"""
|
4035
4093
|
fetch the current funding rate
|
4036
|
-
:see: https://developer-pro.bitmart.com/en/
|
4094
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
4037
4095
|
:param str symbol: unified market symbol
|
4038
4096
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4039
4097
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -4097,6 +4155,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4097
4155
|
"""
|
4098
4156
|
fetch data on a single open contract trade position
|
4099
4157
|
:see: https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4158
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4100
4159
|
:param str symbol: unified market symbol of the market the position is held in
|
4101
4160
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4102
4161
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4144,6 +4203,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4144
4203
|
"""
|
4145
4204
|
fetch all open contract positions
|
4146
4205
|
:see: https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4206
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4147
4207
|
:param str[]|None symbols: list of unified market symbols
|
4148
4208
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4149
4209
|
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4360,7 +4420,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4360
4420
|
return self.milliseconds()
|
4361
4421
|
|
4362
4422
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
4363
|
-
|
4423
|
+
parts = path.split('/')
|
4424
|
+
# to do: refactor api endpoints with spot/swap sections
|
4425
|
+
category = self.safe_string(parts, 0, 'spot')
|
4426
|
+
market = 'spot' if (category == 'spot' or category == 'account') else 'swap'
|
4427
|
+
baseUrl = self.implode_hostname(self.urls['api'][market])
|
4364
4428
|
url = baseUrl + '/' + self.implode_params(path, params)
|
4365
4429
|
query = self.omit(params, self.extract_params(path))
|
4366
4430
|
queryString = ''
|