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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/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
- 'rest': 'https://api-cloud.{hostname}', # bitmart.info for Hong Kong users
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': BadRequest, # 403, ClientOrderId only allows a combination of numbers and letters
517
- '40049': BadRequest, # 403, The maximum length of clientOrderId cannot exceed 32
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
  def fetch_contract_markets(self, params={}):
878
881
  response = self.publicGetContractPublicDetails(params)
879
882
  #
880
- # {
881
- # "code": 1000,
882
- # "message": "Ok",
883
- # "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
884
- # "data": {
885
- # "symbols": [{
886
- # "symbol": "BTCUSDT",
887
- # "product_type": 1,
888
- # "open_timestamp": 1594080000,
889
- # "expire_timestamp": 0,
890
- # "settle_timestamp": 0,
891
- # "base_currency": "BTC",
892
- # "quote_currency": "USDT",
893
- # "last_price": "23920",
894
- # "volume_24h": "18969368",
895
- # "turnover_24h": "458933659.7858",
896
- # "index_price": "23945.25191635",
897
- # "index_name": "BTCUSDT",
898
- # "contract_size": "0.001",
899
- # "min_leverage": "1",
900
- # "max_leverage": "100",
901
- # "price_precision": "0.1",
902
- # "vol_precision": "1",
903
- # "max_volume": "500000",
904
- # "min_volume": "1"
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
  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
- # "contract_symbol":"DOGEUSDT",
1184
- # "last_price":"0.130340",
1185
- # "index_price":"0.13048245",
1186
- # "last_funding_rate":"0.00002287",
1187
- # "price_change_percent_24h":"-2.074",
1188
- # "volume_24h":"113705028.59482228",
1189
- # "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
1190
- # "high_price":"0.134520",
1191
- # "low_price":"0.128570",
1192
- # "legal_coin_price":"0.1302699"
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.safe_string(ticker, 'price_change_percent_24h')
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.safe_string_2(ticker, 'base_volume_24h', 'v_24h')
1210
- quoteVolume = self.safe_string_lower_2(ticker, 'quote_volume_24h', 'qv_24h')
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['contract_symbol'] = market['id']
1279
- response = self.publicGetContractV1Tickers(self.extend(request, params))
1306
+ request['symbol'] = market['id']
1307
+ response = 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, 'tickers', [])
1339
- tickersById = self.index_by(tickers, 'contract_symbol')
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
  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 = self.publicGetContractV1Tickers(params)
1414
+ response = self.publicGetContractPublicDetails(params)
1388
1415
  #
1389
- # {
1390
- # "message": "OK",
1391
- # "code": 1000,
1392
- # "trace": "c1dec681c24ea5d.105.171712565",
1393
- # "data": {
1394
- # "tickers": [
1395
- # {
1396
- # "contract_symbol": "SNTUSDT",
1397
- # "last_price": "0.0366600",
1398
- # "index_price": "0.03587373",
1399
- # "last_funding_rate": "0.00005000",
1400
- # "price_change_percent_24h": "-2.629",
1401
- # "volume_24h": "10102540.19909109848",
1402
- # "url": "https://futures.bitmart.com/en?symbol=SNTUSDT",
1403
- # "high_price": "0.0405600",
1404
- # "low_price": "0.0355000",
1405
- # "legal_coin_price": "0.03666697"
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, 'tickers', [])
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/futures/#get-k-line
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', 1)
2582
+ leverage = self.safe_integer(params, 'leverage')
2535
2583
  params = self.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice'])
2536
- request['leverage'] = self.number_to_string(leverage)
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
  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/futures/#get-futures-openinterest
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
  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/futures/#get-current-funding-rate
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
- baseUrl = self.implode_hostname(self.urls['api']['rest'])
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 = ''
ccxt/bybit.py CHANGED
@@ -3565,7 +3565,10 @@ class bybit(Exchange, ImplicitAPI):
3565
3565
  request['qty'] = self.cost_to_precision(symbol, amount)
3566
3566
  else:
3567
3567
  if not isTrailingAmountOrder and not isAlternativeEndpoint:
3568
- request['qty'] = self.amount_to_precision(symbol, amount)
3568
+ if market['option']:
3569
+ request['qty'] = self.number_to_string(amount)
3570
+ else:
3571
+ request['qty'] = self.amount_to_precision(symbol, amount)
3569
3572
  if isTrailingAmountOrder:
3570
3573
  if trailingTriggerPrice is not None:
3571
3574
  request['activePrice'] = self.price_to_precision(symbol, trailingTriggerPrice)
ccxt/coinbase.py CHANGED
@@ -277,8 +277,8 @@ class coinbase(Exchange, ImplicitAPI):
277
277
  },
278
278
  'fees': {
279
279
  'trading': {
280
- 'taker': self.parse_number('0.006'),
281
- 'maker': self.parse_number('0.004'),
280
+ 'taker': self.parse_number('0.012'),
281
+ '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":""}
282
282
  'tierBased': True,
283
283
  'percentage': True,
284
284
  'tiers': {
@@ -1326,6 +1326,10 @@ class coinbase(Exchange, ImplicitAPI):
1326
1326
  marketType = self.safe_string_lower(market, 'product_type')
1327
1327
  tradingDisabled = self.safe_bool(market, 'trading_disabled')
1328
1328
  stablePairs = self.safe_list(self.options, 'stablePairs', [])
1329
+ defaultTakerFee = self.safe_number(self.fees['trading'], 'taker')
1330
+ defaultMakerFee = self.safe_number(self.fees['trading'], 'maker')
1331
+ takerFee = 0.00001 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'taker_fee_rate', defaultTakerFee)
1332
+ makerFee = 0.0 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'maker_fee_rate', defaultMakerFee)
1329
1333
  return self.safe_market_structure({
1330
1334
  'id': id,
1331
1335
  'symbol': base + '/' + quote,
@@ -1345,8 +1349,8 @@ class coinbase(Exchange, ImplicitAPI):
1345
1349
  'contract': False,
1346
1350
  'linear': None,
1347
1351
  'inverse': None,
1348
- 'taker': 0.00001 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'taker_fee_rate'),
1349
- 'maker': 0.0 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'maker_fee_rate'),
1352
+ 'taker': takerFee,
1353
+ 'maker': makerFee,
1350
1354
  'contractSize': None,
1351
1355
  'expiry': None,
1352
1356
  'expiryDatetime': None,
ccxt/gemini.py CHANGED
@@ -199,6 +199,7 @@ class gemini(Exchange, ImplicitAPI):
199
199
  'v1/account/create': 1,
200
200
  'v1/account/list': 1,
201
201
  'v1/heartbeat': 1,
202
+ 'v1/roles': 1,
202
203
  },
203
204
  },
204
205
  },
ccxt/htx.py CHANGED
@@ -5750,6 +5750,7 @@ class htx(Exchange, ImplicitAPI):
5750
5750
 
5751
5751
  def fetch_deposit_addresses_by_network(self, code: str, params={}):
5752
5752
  """
5753
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
5753
5754
  fetch a dictionary of addresses for a currency, indexed by network
5754
5755
  :param str code: unified currency code of the currency for the deposit address
5755
5756
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5780,6 +5781,7 @@ class htx(Exchange, ImplicitAPI):
5780
5781
 
5781
5782
  def fetch_deposit_address(self, code: str, params={}):
5782
5783
  """
5784
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
5783
5785
  fetch the deposit address for a currency associated with self account
5784
5786
  :param str code: unified currency code
5785
5787
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5826,6 +5828,7 @@ class htx(Exchange, ImplicitAPI):
5826
5828
 
5827
5829
  def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5828
5830
  """
5831
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4f050-7773-11ed-9966-0242ac110003
5829
5832
  fetch all deposits made to an account
5830
5833
  :param str code: unified currency code
5831
5834
  :param int [since]: the earliest time in ms to fetch deposits for
@@ -6045,6 +6048,7 @@ class htx(Exchange, ImplicitAPI):
6045
6048
 
6046
6049
  def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
6047
6050
  """
6051
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
6048
6052
  make a withdrawal
6049
6053
  :param str code: unified currency code
6050
6054
  :param float amount: the amount to withdraw
ccxt/kraken.py CHANGED
@@ -1750,6 +1750,8 @@ class kraken(Exchange, ImplicitAPI):
1750
1750
  if postOnly:
1751
1751
  extendedPostFlags = flags + ',post' if (flags is not None) else 'post'
1752
1752
  request['oflags'] = extendedPostFlags
1753
+ if (flags is not None) and (request['oflags'] is None):
1754
+ request['oflags'] = flags
1753
1755
  params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset'])
1754
1756
  return [request, params]
1755
1757
 
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.75'
7
+ __version__ = '4.3.77'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/binance.py CHANGED
@@ -513,6 +513,12 @@ class binance(ccxt.async_support.binance):
513
513
 
514
514
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
515
515
  """
516
+ :see: https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
517
+ :see: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
518
+ :see: https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
519
+ :see: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
520
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
521
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
516
522
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
517
523
  :param str symbol: unified symbol of the market to fetch the order book for
518
524
  :param int [limit]: the maximum amount of order book entries to return
@@ -560,6 +566,12 @@ class binance(ccxt.async_support.binance):
560
566
 
561
567
  async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}) -> OrderBook:
562
568
  """
569
+ :see: https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
570
+ :see: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
571
+ :see: https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
572
+ :see: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
573
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
574
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
563
575
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
564
576
  :param str[] symbols: unified array of symbols
565
577
  :param int [limit]: the maximum amount of order book entries to return
@@ -1373,6 +1385,12 @@ class binance(ccxt.async_support.binance):
1373
1385
 
1374
1386
  async def watch_ticker(self, symbol: str, params={}) -> Ticker:
1375
1387
  """
1388
+ :see: https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
1389
+ :see: https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
1390
+ :see: https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
1391
+ :see: https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
1392
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
1393
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
1376
1394
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1377
1395
  :param str symbol: unified symbol of the market to fetch the ticker for
1378
1396
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1386,6 +1404,12 @@ class binance(ccxt.async_support.binance):
1386
1404
 
1387
1405
  async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1388
1406
  """
1407
+ :see: https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
1408
+ :see: https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
1409
+ :see: https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
1410
+ :see: https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
1411
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
1412
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
1389
1413
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
1390
1414
  :param str[] symbols: unified symbol of the market to fetch the ticker for
1391
1415
  :param dict [params]: extra parameters specific to the exchange API endpoint