ccxt 4.3.75__py2.py3-none-any.whl → 4.3.76__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/bitmart.py +143 -82
- ccxt/async_support/coinbase.py +8 -4
- ccxt/async_support/gemini.py +1 -0
- ccxt/async_support/htx.py +4 -0
- ccxt/base/exchange.py +2 -1
- ccxt/bitmart.py +143 -82
- ccxt/coinbase.py +8 -4
- ccxt/gemini.py +1 -0
- ccxt/htx.py +4 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +24 -0
- ccxt/pro/bitmart.py +9 -8
- ccxt/pro/bybit.py +2 -2
- {ccxt-4.3.75.dist-info → ccxt-4.3.76.dist-info}/METADATA +4 -4
- {ccxt-4.3.75.dist-info → ccxt-4.3.76.dist-info}/RECORD +23 -23
- {ccxt-4.3.75.dist-info → ccxt-4.3.76.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.75.dist-info → ccxt-4.3.76.dist-info}/WHEEL +0 -0
- {ccxt-4.3.75.dist-info → ccxt-4.3.76.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.76'
|
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/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,8 @@ 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
|
2322
2369
|
:param str symbol: unified symbol of the market to create an order in
|
2323
2370
|
:param str type: 'market', 'limit' or 'trailing' for swap markets only
|
2324
2371
|
:param str side: 'buy' or 'sell'
|
@@ -2531,9 +2578,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2531
2578
|
if clientOrderId is not None:
|
2532
2579
|
params = self.omit(params, 'clientOrderId')
|
2533
2580
|
request['client_order_id'] = clientOrderId
|
2534
|
-
leverage = self.safe_integer(params, 'leverage'
|
2581
|
+
leverage = self.safe_integer(params, 'leverage')
|
2535
2582
|
params = self.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice'])
|
2536
|
-
|
2583
|
+
if leverage is not None:
|
2584
|
+
request['leverage'] = self.number_to_string(leverage)
|
2537
2585
|
return self.extend(request, params)
|
2538
2586
|
|
2539
2587
|
def create_spot_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2608,6 +2656,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2608
2656
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
2609
2657
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2610
2658
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2659
|
+
:see: https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
2660
|
+
:see: https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
2611
2661
|
:param str id: order id
|
2612
2662
|
:param str symbol: unified symbol of the market the order was made in
|
2613
2663
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2737,6 +2787,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2737
2787
|
cancel all open orders in a market
|
2738
2788
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
2739
2789
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
2790
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
2740
2791
|
:param str symbol: unified market symbol of the market to cancel orders in
|
2741
2792
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2742
2793
|
:param str [params.side]: *spot only* 'buy' or 'sell'
|
@@ -2949,6 +3000,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2949
3000
|
"""
|
2950
3001
|
:see: https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
2951
3002
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
3003
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
2952
3004
|
fetches information on multiple closed orders made by the user
|
2953
3005
|
:param str symbol: unified market symbol of the market orders were made in
|
2954
3006
|
:param int [since]: the earliest time in ms to fetch orders for
|
@@ -3006,6 +3058,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3006
3058
|
:see: https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
3007
3059
|
:see: https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
3008
3060
|
:see: https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
3061
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
3009
3062
|
:param str id: the id of the order
|
3010
3063
|
:param str symbol: unified symbol of the market the order was made in
|
3011
3064
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3694,6 +3747,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3694
3747
|
transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
3695
3748
|
:see: https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
3696
3749
|
:see: https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
3750
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
3697
3751
|
:param str code: unified currency code
|
3698
3752
|
:param float amount: amount to transfer
|
3699
3753
|
:param str fromAccount: account to transfer from
|
@@ -3955,7 +4009,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3955
4009
|
async def fetch_open_interest(self, symbol: str, params={}):
|
3956
4010
|
"""
|
3957
4011
|
Retrieves the open interest of a currency
|
3958
|
-
:see: https://developer-pro.bitmart.com/en/
|
4012
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
|
3959
4013
|
:param str symbol: Unified CCXT market symbol
|
3960
4014
|
:param dict [params]: exchange specific parameters
|
3961
4015
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
@@ -4008,6 +4062,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4008
4062
|
"""
|
4009
4063
|
set the level of leverage for a market
|
4010
4064
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
4065
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
4011
4066
|
:param float leverage: the rate of leverage
|
4012
4067
|
:param str symbol: unified market symbol
|
4013
4068
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4033,7 +4088,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4033
4088
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
4034
4089
|
"""
|
4035
4090
|
fetch the current funding rate
|
4036
|
-
:see: https://developer-pro.bitmart.com/en/
|
4091
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
4037
4092
|
:param str symbol: unified market symbol
|
4038
4093
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4039
4094
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -4097,6 +4152,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4097
4152
|
"""
|
4098
4153
|
fetch data on a single open contract trade position
|
4099
4154
|
:see: https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4155
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4100
4156
|
:param str symbol: unified market symbol of the market the position is held in
|
4101
4157
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4102
4158
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4144,6 +4200,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4144
4200
|
"""
|
4145
4201
|
fetch all open contract positions
|
4146
4202
|
:see: https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
4203
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4147
4204
|
:param str[]|None symbols: list of unified market symbols
|
4148
4205
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4149
4206
|
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -4360,7 +4417,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4360
4417
|
return self.milliseconds()
|
4361
4418
|
|
4362
4419
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
4363
|
-
|
4420
|
+
parts = path.split('/')
|
4421
|
+
# to do: refactor api endpoints with spot/swap sections
|
4422
|
+
category = self.safe_string(parts, 0, 'spot')
|
4423
|
+
market = 'spot' if (category == 'spot' or category == 'account') else 'swap'
|
4424
|
+
baseUrl = self.implode_hostname(self.urls['api'][market])
|
4364
4425
|
url = baseUrl + '/' + self.implode_params(path, params)
|
4365
4426
|
query = self.omit(params, self.extract_params(path))
|
4366
4427
|
queryString = ''
|
ccxt/async_support/coinbase.py
CHANGED
@@ -278,8 +278,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
278
278
|
},
|
279
279
|
'fees': {
|
280
280
|
'trading': {
|
281
|
-
'taker': self.parse_number('0.
|
282
|
-
'maker': self.parse_number('0.
|
281
|
+
'taker': self.parse_number('0.012'),
|
282
|
+
'maker': self.parse_number('0.006'), # {"pricing_tier":"Advanced 1","usd_from":"0","usd_to":"1000","taker_fee_rate":"0.012","maker_fee_rate":"0.006","aop_from":"","aop_to":""}
|
283
283
|
'tierBased': True,
|
284
284
|
'percentage': True,
|
285
285
|
'tiers': {
|
@@ -1327,6 +1327,10 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1327
1327
|
marketType = self.safe_string_lower(market, 'product_type')
|
1328
1328
|
tradingDisabled = self.safe_bool(market, 'trading_disabled')
|
1329
1329
|
stablePairs = self.safe_list(self.options, 'stablePairs', [])
|
1330
|
+
defaultTakerFee = self.safe_number(self.fees['trading'], 'taker')
|
1331
|
+
defaultMakerFee = self.safe_number(self.fees['trading'], 'maker')
|
1332
|
+
takerFee = 0.00001 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'taker_fee_rate', defaultTakerFee)
|
1333
|
+
makerFee = 0.0 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'maker_fee_rate', defaultMakerFee)
|
1330
1334
|
return self.safe_market_structure({
|
1331
1335
|
'id': id,
|
1332
1336
|
'symbol': base + '/' + quote,
|
@@ -1346,8 +1350,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1346
1350
|
'contract': False,
|
1347
1351
|
'linear': None,
|
1348
1352
|
'inverse': None,
|
1349
|
-
'taker':
|
1350
|
-
'maker':
|
1353
|
+
'taker': takerFee,
|
1354
|
+
'maker': makerFee,
|
1351
1355
|
'contractSize': None,
|
1352
1356
|
'expiry': None,
|
1353
1357
|
'expiryDatetime': None,
|
ccxt/async_support/gemini.py
CHANGED
ccxt/async_support/htx.py
CHANGED
@@ -5751,6 +5751,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5751
5751
|
|
5752
5752
|
async def fetch_deposit_addresses_by_network(self, code: str, params={}):
|
5753
5753
|
"""
|
5754
|
+
:see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
|
5754
5755
|
fetch a dictionary of addresses for a currency, indexed by network
|
5755
5756
|
:param str code: unified currency code of the currency for the deposit address
|
5756
5757
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -5781,6 +5782,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5781
5782
|
|
5782
5783
|
async def fetch_deposit_address(self, code: str, params={}):
|
5783
5784
|
"""
|
5785
|
+
:see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
|
5784
5786
|
fetch the deposit address for a currency associated with self account
|
5785
5787
|
:param str code: unified currency code
|
5786
5788
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -5827,6 +5829,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5827
5829
|
|
5828
5830
|
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
5829
5831
|
"""
|
5832
|
+
:see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4f050-7773-11ed-9966-0242ac110003
|
5830
5833
|
fetch all deposits made to an account
|
5831
5834
|
:param str code: unified currency code
|
5832
5835
|
:param int [since]: the earliest time in ms to fetch deposits for
|
@@ -6046,6 +6049,7 @@ class htx(Exchange, ImplicitAPI):
|
|
6046
6049
|
|
6047
6050
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
6048
6051
|
"""
|
6052
|
+
:see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
|
6049
6053
|
make a withdrawal
|
6050
6054
|
:param str code: unified currency code
|
6051
6055
|
:param float amount: the amount to withdraw
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.76'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -360,6 +360,7 @@ class Exchange(object):
|
|
360
360
|
self.trades = dict() if self.trades is None else self.trades
|
361
361
|
self.transactions = dict() if self.transactions is None else self.transactions
|
362
362
|
self.ohlcvs = dict() if self.ohlcvs is None else self.ohlcvs
|
363
|
+
self.liquidations = dict() if self.liquidations is None else self.liquidations
|
363
364
|
self.currencies = dict() if self.currencies is None else self.currencies
|
364
365
|
self.options = self.get_default_options() if self.options is None else self.options # Python does not allow to define properties in run-time with setattr
|
365
366
|
self.decimal_to_precision = decimal_to_precision
|