ccxt 4.4.18__py2.py3-none-any.whl → 4.4.20__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/binance.py CHANGED
@@ -827,6 +827,7 @@ class binance(Exchange, ImplicitAPI):
827
827
  'constituents': 2,
828
828
  'apiTradingStatus': {'cost': 1, 'noSymbol': 10},
829
829
  'lvtKlines': 1,
830
+ 'convert/exchangeInfo': 4,
830
831
  },
831
832
  },
832
833
  'fapiData': {
@@ -880,6 +881,7 @@ class binance(Exchange, ImplicitAPI):
880
881
  'feeBurn': 1,
881
882
  'symbolConfig': 5,
882
883
  'accountConfig': 5,
884
+ 'convert/orderStatus': 5,
883
885
  },
884
886
  'post': {
885
887
  'batchOrders': 5,
@@ -895,6 +897,8 @@ class binance(Exchange, ImplicitAPI):
895
897
  'apiReferral/customization': 1,
896
898
  'apiReferral/userCustomization': 1,
897
899
  'feeBurn': 1,
900
+ 'convert/getQuote': 200, # 360 requests per hour
901
+ 'convert/acceptQuote': 20,
898
902
  },
899
903
  'put': {
900
904
  'listenKey': 1,
@@ -3161,14 +3165,15 @@ class binance(Exchange, ImplicitAPI):
3161
3165
  fees = self.fees
3162
3166
  linear = None
3163
3167
  inverse = None
3164
- strike = self.safe_string(market, 'strikePrice')
3165
3168
  symbol = base + '/' + quote
3169
+ strike = None
3166
3170
  if contract:
3167
3171
  if swap:
3168
3172
  symbol = symbol + ':' + settle
3169
3173
  elif future:
3170
3174
  symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry)
3171
3175
  elif option:
3176
+ strike = self.number_to_string(self.parse_to_numeric(self.safe_string(market, 'strikePrice')))
3172
3177
  symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' + strike + '-' + self.safe_string(optionParts, 3)
3173
3178
  contractSize = self.safe_number_2(market, 'contractSize', 'unit', self.parse_number('1'))
3174
3179
  linear = settle == quote
@@ -5946,11 +5951,21 @@ class binance(Exchange, ImplicitAPI):
5946
5951
  if isPortfolioMargin:
5947
5952
  request['quantity'] = self.parse_to_numeric(amount)
5948
5953
  else:
5949
- request['quantity'] = self.amount_to_precision(symbol, amount)
5954
+ marketAmountPrecision = self.safe_string(market['precision'], 'amount')
5955
+ isPrecisionAvailable = (marketAmountPrecision is not None)
5956
+ if isPrecisionAvailable:
5957
+ request['quantity'] = self.amount_to_precision(symbol, amount)
5958
+ else:
5959
+ request['quantity'] = self.parse_to_numeric(amount) # some options don't have the precision available
5950
5960
  if priceIsRequired and not isPriceMatch:
5951
5961
  if price is None:
5952
5962
  raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
5953
- request['price'] = self.price_to_precision(symbol, price)
5963
+ pricePrecision = self.safe_string(market['precision'], 'price')
5964
+ isPricePrecisionAvailable = (pricePrecision is not None)
5965
+ if isPricePrecisionAvailable:
5966
+ request['price'] = self.price_to_precision(symbol, price)
5967
+ else:
5968
+ request['price'] = self.parse_to_numeric(price) # some options don't have the precision available
5954
5969
  if stopPriceIsRequired:
5955
5970
  if market['contract']:
5956
5971
  if stopPrice is None:
ccxt/bingx.py CHANGED
@@ -508,6 +508,7 @@ class bingx(Exchange, ImplicitAPI):
508
508
  },
509
509
  'networks': {
510
510
  'ARB': 'ARBITRUM',
511
+ 'MATIC': 'POLYGON',
511
512
  },
512
513
  },
513
514
  })
@@ -771,7 +772,7 @@ class bingx(Exchange, ImplicitAPI):
771
772
  isActive = False
772
773
  if (self.safe_string(market, 'apiStateOpen') == 'true') and (self.safe_string(market, 'apiStateClose') == 'true'):
773
774
  isActive = True # swap active
774
- elif self.safe_bool(market, 'apiStateSell') and self.safe_bool(market, 'apiStateBuy') and (self.safe_number(market, 'status') == 1):
775
+ elif self.safe_bool(market, 'apiStateSell') and self.safe_bool(market, 'apiStateBuy') and (self.safe_string(market, 'status') == '1'):
775
776
  isActive = True # spot active
776
777
  isInverse = None if (spot) else checkIsInverse
777
778
  isLinear = None if (spot) else checkIsLinear
ccxt/bitget.py CHANGED
@@ -1444,7 +1444,7 @@ class bitget(Exchange, ImplicitAPI):
1444
1444
  'ARB': 'ArbitrumOne',
1445
1445
  'ZKSYNC': 'zkSyncEra',
1446
1446
  'STARKNET': 'Starknet',
1447
- 'APT': 'APTOS',
1447
+ 'APT': 'Aptos',
1448
1448
  'MATIC': 'Polygon',
1449
1449
  'VIC': 'VICTION',
1450
1450
  'AVAXC': 'C-Chain',
ccxt/bybit.py CHANGED
@@ -6702,7 +6702,8 @@ class bybit(Exchange, ImplicitAPI):
6702
6702
  paginate = self.safe_bool(params, 'paginate')
6703
6703
  if paginate:
6704
6704
  params = self.omit(params, 'paginate')
6705
- return self.fetch_paginated_call_deterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500)
6705
+ params['timeframe'] = timeframe
6706
+ return self.fetch_paginated_call_cursor('fetchOpenInterestHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 200)
6706
6707
  market = self.market(symbol)
6707
6708
  if market['spot'] or market['option']:
6708
6709
  raise BadRequest(self.id + ' fetchOpenInterestHistory() symbol does not support market ' + symbol)
ccxt/gate.py CHANGED
@@ -4420,6 +4420,7 @@ class gate(Exchange, ImplicitAPI):
4420
4420
  """
4421
4421
  fetch all unfilled currently open orders
4422
4422
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
4423
+ :see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
4423
4424
  :param str symbol: unified market symbol
4424
4425
  :param int [since]: the earliest time in ms to fetch open orders for
4425
4426
  :param int [limit]: the maximum number of open orders structures to retrieve
ccxt/htx.py CHANGED
@@ -1253,6 +1253,16 @@ class htx(Exchange, ImplicitAPI):
1253
1253
  })
1254
1254
 
1255
1255
  def fetch_status(self, params={}):
1256
+ """
1257
+ the latest known information on the availability of the exchange API
1258
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#get-system-status
1259
+ :see: https://huobiapi.github.io/docs/dm/v1/en/#get-system-status
1260
+ :see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-system-status
1261
+ :see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#get-system-status
1262
+ :see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#query-whether-the-system-is-available # contractPublicGetHeartbeat
1263
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1264
+ :returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
1265
+ """
1256
1266
  self.load_markets()
1257
1267
  marketType = None
1258
1268
  marketType, params = self.handle_market_type_and_params('fetchStatus', None, params)
@@ -1464,6 +1474,8 @@ class htx(Exchange, ImplicitAPI):
1464
1474
  def fetch_time(self, params={}):
1465
1475
  """
1466
1476
  fetches the current integer timestamp in milliseconds from the exchange server
1477
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#get-current-timestamp
1478
+ :see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-current-system-timestamp
1467
1479
  :param dict [params]: extra parameters specific to the exchange API endpoint
1468
1480
  :returns int: the current integer timestamp in milliseconds from the exchange server
1469
1481
  """
@@ -1510,6 +1522,7 @@ class htx(Exchange, ImplicitAPI):
1510
1522
  def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1511
1523
  """
1512
1524
  fetch the trading fees for a market
1525
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
1513
1526
  :param str symbol: unified market symbol
1514
1527
  :param dict [params]: extra parameters specific to the exchange API endpoint
1515
1528
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
@@ -1553,6 +1566,13 @@ class htx(Exchange, ImplicitAPI):
1553
1566
  return result
1554
1567
 
1555
1568
  def fetch_trading_limits_by_id(self, id: str, params={}):
1569
+ """
1570
+ * @ignore
1571
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
1572
+ :param str id: market id
1573
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1574
+ :returns dict: the limits object of a market structure
1575
+ """
1556
1576
  request: dict = {
1557
1577
  'symbol': id,
1558
1578
  }
ccxt/hyperliquid.py CHANGED
@@ -1879,6 +1879,10 @@ class hyperliquid(Exchange, ImplicitAPI):
1879
1879
  statuses: dict = {
1880
1880
  'triggered': 'open',
1881
1881
  'filled': 'closed',
1882
+ 'open': 'open',
1883
+ 'canceled': 'canceled',
1884
+ 'rejected': 'rejected',
1885
+ 'marginCanceled': 'canceled',
1882
1886
  }
1883
1887
  return self.safe_string(statuses, status, status)
1884
1888
 
ccxt/kucoin.py CHANGED
@@ -4724,7 +4724,7 @@ class kucoin(Exchange, ImplicitAPI):
4724
4724
  headers = headers if (headers is not None) else {}
4725
4725
  url = self.urls['api'][api]
4726
4726
  if not self.is_empty(query):
4727
- if (method == 'GET') or (method == 'DELETE'):
4727
+ if ((method == 'GET') or (method == 'DELETE')) and (path != 'orders/multi-cancel'):
4728
4728
  endpoint += '?' + self.rawencode(query)
4729
4729
  else:
4730
4730
  body = self.json(query)
ccxt/kucoinfutures.py CHANGED
@@ -46,6 +46,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
46
46
  'addMargin': True,
47
47
  'cancelAllOrders': True,
48
48
  'cancelOrder': True,
49
+ 'cancelOrders': True,
49
50
  'closeAllPositions': False,
50
51
  'closePosition': True,
51
52
  'closePositions': False,
@@ -217,6 +218,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
217
218
  'stopOrders': 1,
218
219
  'sub/api-key': 1,
219
220
  'orders/client-order/{clientOid}': 1,
221
+ 'orders/multi-cancel': 20,
220
222
  },
221
223
  },
222
224
  'webExchange': {
@@ -1584,6 +1586,61 @@ class kucoinfutures(kucoin, ImplicitAPI):
1584
1586
  #
1585
1587
  return self.safe_value(response, 'data')
1586
1588
 
1589
+ def cancel_orders(self, ids, symbol: Str = None, params={}):
1590
+ """
1591
+ cancel multiple orders
1592
+ :see: https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders
1593
+ :param str[] ids: order ids
1594
+ :param str symbol: unified symbol of the market the order was made in
1595
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1596
+ :param str[] [params.clientOrderIds]: client order ids
1597
+ :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1598
+ """
1599
+ self.load_markets()
1600
+ market = None
1601
+ if symbol is not None:
1602
+ market = self.market(symbol)
1603
+ ordersRequests = []
1604
+ clientOrderIds = self.safe_list_2(params, 'clientOrderIds', 'clientOids', [])
1605
+ params = self.omit(params, ['clientOrderIds', 'clientOids'])
1606
+ useClientorderId = False
1607
+ for i in range(0, len(clientOrderIds)):
1608
+ useClientorderId = True
1609
+ if symbol is None:
1610
+ raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument when cancelling by clientOrderIds')
1611
+ ordersRequests.append({
1612
+ 'symbol': market['id'],
1613
+ 'clientOid': self.safe_string(clientOrderIds, i),
1614
+ })
1615
+ for i in range(0, len(ids)):
1616
+ ordersRequests.append(ids[i])
1617
+ requestKey = 'clientOidsList' if useClientorderId else 'orderIdsList'
1618
+ request: dict = {}
1619
+ request[requestKey] = ordersRequests
1620
+ response = self.futuresPrivateDeleteOrdersMultiCancel(self.extend(request, params))
1621
+ #
1622
+ # {
1623
+ # "code": "200000",
1624
+ # "data":
1625
+ # [
1626
+ # {
1627
+ # "orderId": "80465574458560512",
1628
+ # "clientOid": null,
1629
+ # "code": "200",
1630
+ # "msg": "success"
1631
+ # },
1632
+ # {
1633
+ # "orderId": "80465575289094144",
1634
+ # "clientOid": null,
1635
+ # "code": "200",
1636
+ # "msg": "success"
1637
+ # }
1638
+ # ]
1639
+ # }
1640
+ #
1641
+ orders = self.safe_list(response, 'data', [])
1642
+ return self.parse_orders(orders, market)
1643
+
1587
1644
  def cancel_all_orders(self, symbol: Str = None, params={}):
1588
1645
  """
1589
1646
  cancel all open orders
ccxt/lbank.py CHANGED
@@ -975,15 +975,15 @@ class lbank(Exchange, ImplicitAPI):
975
975
  limit = min(limit, 2000)
976
976
  if since is None:
977
977
  duration = self.parse_timeframe(timeframe)
978
- since = self.milliseconds() - duration * 1000 * limit
978
+ since = self.milliseconds() - (duration * 1000 * limit)
979
979
  request: dict = {
980
980
  'symbol': market['id'],
981
981
  'type': self.safe_string(self.timeframes, timeframe, timeframe),
982
982
  'time': self.parse_to_int(since / 1000),
983
- 'size': limit, # max 2000
983
+ 'size': min(limit + 1, 2000), # max 2000
984
984
  }
985
985
  response = self.spotPublicGetKline(self.extend(request, params))
986
- ohlcvs = self.safe_value(response, 'data', [])
986
+ ohlcvs = self.safe_list(response, 'data', [])
987
987
  #
988
988
  #
989
989
  # [
ccxt/phemex.py CHANGED
@@ -82,6 +82,7 @@ class phemex(Exchange, ImplicitAPI):
82
82
  'fetchMarkOHLCV': False,
83
83
  'fetchMyTrades': True,
84
84
  'fetchOHLCV': True,
85
+ 'fetchOpenInterest': True,
85
86
  'fetchOpenOrders': True,
86
87
  'fetchOrder': True,
87
88
  'fetchOrderBook': True,
@@ -4494,6 +4495,77 @@ class phemex(Exchange, ImplicitAPI):
4494
4495
  data = self.safe_dict(response, 'data', {})
4495
4496
  return self.parse_transaction(data, currency)
4496
4497
 
4498
+ def fetch_open_interest(self, symbol: str, params={}):
4499
+ """
4500
+ retrieves the open interest of a trading pair
4501
+ :see: https://phemex-docs.github.io/#query-24-hours-ticker
4502
+ :param str symbol: unified CCXT market symbol
4503
+ :param dict [params]: exchange specific parameters
4504
+ :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
4505
+ """
4506
+ self.load_markets()
4507
+ market = self.market(symbol)
4508
+ if not market['contract']:
4509
+ raise BadRequest(self.id + ' fetchOpenInterest is only supported for contract markets.')
4510
+ request: dict = {
4511
+ 'symbol': market['id'],
4512
+ }
4513
+ response = self.v2GetMdV2Ticker24hr(self.extend(request, params))
4514
+ #
4515
+ # {
4516
+ # error: null,
4517
+ # id: '0',
4518
+ # result: {
4519
+ # closeRp: '67550.1',
4520
+ # fundingRateRr: '0.0001',
4521
+ # highRp: '68400',
4522
+ # indexPriceRp: '67567.15389794',
4523
+ # lowRp: '66096.4',
4524
+ # markPriceRp: '67550.1',
4525
+ # openInterestRv: '1848.1144186',
4526
+ # openRp: '66330',
4527
+ # predFundingRateRr: '0.0001',
4528
+ # symbol: 'BTCUSDT',
4529
+ # timestamp: '1729114315443343001',
4530
+ # turnoverRv: '228863389.3237532',
4531
+ # volumeRq: '3388.5600312'
4532
+ # }
4533
+ # }
4534
+ #
4535
+ result = self.safe_dict(response, 'result')
4536
+ return self.parse_open_interest(result, market)
4537
+
4538
+ def parse_open_interest(self, interest, market: Market = None):
4539
+ #
4540
+ # {
4541
+ # closeRp: '67550.1',
4542
+ # fundingRateRr: '0.0001',
4543
+ # highRp: '68400',
4544
+ # indexPriceRp: '67567.15389794',
4545
+ # lowRp: '66096.4',
4546
+ # markPriceRp: '67550.1',
4547
+ # openInterestRv: '1848.1144186',
4548
+ # openRp: '66330',
4549
+ # predFundingRateRr: '0.0001',
4550
+ # symbol: 'BTCUSDT',
4551
+ # timestamp: '1729114315443343001',
4552
+ # turnoverRv: '228863389.3237532',
4553
+ # volumeRq: '3388.5600312'
4554
+ # }
4555
+ #
4556
+ timestamp = self.safe_integer(interest, 'timestamp') / 1000000
4557
+ id = self.safe_string(interest, 'symbol')
4558
+ return self.safe_open_interest({
4559
+ 'info': interest,
4560
+ 'symbol': self.safe_symbol(id, market),
4561
+ 'baseVolume': self.safe_string(interest, 'volumeRq'),
4562
+ 'quoteVolume': None, # deprecated
4563
+ 'openInterestAmount': self.safe_string(interest, 'openInterestRv'),
4564
+ 'openInterestValue': None,
4565
+ 'timestamp': timestamp,
4566
+ 'datetime': self.iso8601(timestamp),
4567
+ }, market)
4568
+
4497
4569
  def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4498
4570
  if response is None:
4499
4571
  return None # fallback to default error handler
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.18'
7
+ __version__ = '4.4.20'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -37,6 +37,7 @@ from ccxt.pro.blofin import blofin # noqa
37
37
  from ccxt.pro.bybit import bybit # noqa: F401
38
38
  from ccxt.pro.cex import cex # noqa: F401
39
39
  from ccxt.pro.coinbase import coinbase # noqa: F401
40
+ from ccxt.pro.coinbaseadvanced import coinbaseadvanced # noqa: F401
40
41
  from ccxt.pro.coinbaseexchange import coinbaseexchange # noqa: F401
41
42
  from ccxt.pro.coinbaseinternational import coinbaseinternational # noqa: F401
42
43
  from ccxt.pro.coincheck import coincheck # noqa: F401
@@ -110,6 +111,7 @@ exchanges = [
110
111
  'bybit',
111
112
  'cex',
112
113
  'coinbase',
114
+ 'coinbaseadvanced',
113
115
  'coinbaseexchange',
114
116
  'coinbaseinternational',
115
117
  'coincheck',
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+
6
+ from ccxt.pro.coinbase import coinbase
7
+
8
+
9
+ class coinbaseadvanced(coinbase):
10
+
11
+ def describe(self):
12
+ return self.deep_extend(super(coinbaseadvanced, self).describe(), {
13
+ 'id': 'coinbaseadvanced',
14
+ 'name': 'Coinbase Advanced',
15
+ 'alias': True,
16
+ })
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.4.18
3
+ Version: 4.4.20
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -271,13 +271,13 @@ console.log(version, Object.keys(exchanges));
271
271
 
272
272
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
273
273
 
274
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.18/dist/ccxt.browser.min.js
275
- * unpkg: https://unpkg.com/ccxt@4.4.18/dist/ccxt.browser.min.js
274
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.20/dist/ccxt.browser.min.js
275
+ * unpkg: https://unpkg.com/ccxt@4.4.20/dist/ccxt.browser.min.js
276
276
 
277
277
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
278
278
 
279
279
  ```HTML
280
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.18/dist/ccxt.browser.min.js"></script>
280
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.20/dist/ccxt.browser.min.js"></script>
281
281
  ```
282
282
 
283
283
  Creates a global `ccxt` object: