ccxt 4.4.71__py2.py3-none-any.whl → 4.4.73__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.
Files changed (99) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/bingx.py +1 -1
  3. ccxt/ace.py +36 -1
  4. ccxt/alpaca.py +46 -0
  5. ccxt/ascendex.py +2 -2
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/ace.py +36 -1
  8. ccxt/async_support/alpaca.py +46 -0
  9. ccxt/async_support/ascendex.py +2 -2
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/binance.py +19 -15
  12. ccxt/async_support/bingx.py +2 -2
  13. ccxt/async_support/bit2c.py +11 -0
  14. ccxt/async_support/bitfinex.py +1 -1
  15. ccxt/async_support/bitfinex1.py +1 -1
  16. ccxt/async_support/bitget.py +6 -5
  17. ccxt/async_support/bitrue.py +1 -1
  18. ccxt/async_support/bl3p.py +2 -2
  19. ccxt/async_support/bybit.py +32 -25
  20. ccxt/async_support/cex.py +1 -0
  21. ccxt/async_support/coinbase.py +3 -2
  22. ccxt/async_support/coinbaseexchange.py +3 -2
  23. ccxt/async_support/coinbaseinternational.py +3 -2
  24. ccxt/async_support/coinex.py +1 -1
  25. ccxt/async_support/defx.py +1 -1
  26. ccxt/async_support/deribit.py +2 -1
  27. ccxt/async_support/derive.py +13 -7
  28. ccxt/async_support/gate.py +3 -0
  29. ccxt/async_support/gemini.py +2 -1
  30. ccxt/async_support/hitbtc.py +1 -1
  31. ccxt/async_support/hyperliquid.py +38 -0
  32. ccxt/async_support/kraken.py +1 -1
  33. ccxt/async_support/krakenfutures.py +4 -0
  34. ccxt/async_support/kucoin.py +1 -1
  35. ccxt/async_support/kuna.py +1 -1
  36. ccxt/async_support/mexc.py +1 -1
  37. ccxt/async_support/ndax.py +1 -1
  38. ccxt/async_support/okcoin.py +4 -0
  39. ccxt/async_support/okx.py +21 -30
  40. ccxt/async_support/paradex.py +65 -7
  41. ccxt/async_support/paymium.py +1 -1
  42. ccxt/async_support/poloniex.py +2 -1
  43. ccxt/async_support/upbit.py +1 -1
  44. ccxt/async_support/whitebit.py +98 -2
  45. ccxt/async_support/woo.py +3 -1
  46. ccxt/async_support/woofipro.py +1 -1
  47. ccxt/async_support/yobit.py +2 -1
  48. ccxt/base/errors.py +6 -0
  49. ccxt/base/exchange.py +13 -12
  50. ccxt/binance.py +19 -15
  51. ccxt/bingx.py +2 -2
  52. ccxt/bit2c.py +11 -0
  53. ccxt/bitfinex.py +1 -1
  54. ccxt/bitfinex1.py +1 -1
  55. ccxt/bitget.py +6 -5
  56. ccxt/bitrue.py +1 -1
  57. ccxt/bl3p.py +2 -2
  58. ccxt/bybit.py +32 -25
  59. ccxt/cex.py +1 -0
  60. ccxt/coinbase.py +3 -2
  61. ccxt/coinbaseexchange.py +3 -2
  62. ccxt/coinbaseinternational.py +3 -2
  63. ccxt/coinex.py +1 -1
  64. ccxt/defx.py +1 -1
  65. ccxt/deribit.py +2 -1
  66. ccxt/derive.py +13 -7
  67. ccxt/gate.py +3 -0
  68. ccxt/gemini.py +2 -1
  69. ccxt/hitbtc.py +1 -1
  70. ccxt/hyperliquid.py +38 -0
  71. ccxt/kraken.py +1 -1
  72. ccxt/krakenfutures.py +4 -0
  73. ccxt/kucoin.py +1 -1
  74. ccxt/kuna.py +1 -1
  75. ccxt/mexc.py +1 -1
  76. ccxt/ndax.py +1 -1
  77. ccxt/okcoin.py +4 -0
  78. ccxt/okx.py +21 -30
  79. ccxt/paradex.py +65 -7
  80. ccxt/paymium.py +1 -1
  81. ccxt/poloniex.py +2 -1
  82. ccxt/pro/__init__.py +1 -3
  83. ccxt/pro/bingx.py +1 -1
  84. ccxt/pro/bitmart.py +15 -7
  85. ccxt/pro/derive.py +2 -2
  86. ccxt/pro/krakenfutures.py +1 -1
  87. ccxt/test/tests_async.py +6 -3
  88. ccxt/test/tests_sync.py +6 -3
  89. ccxt/upbit.py +1 -1
  90. ccxt/whitebit.py +98 -2
  91. ccxt/woo.py +3 -1
  92. ccxt/woofipro.py +1 -1
  93. ccxt/yobit.py +2 -1
  94. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/METADATA +5 -5
  95. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/RECORD +98 -99
  96. ccxt/abstract/bitfinex1.py +0 -69
  97. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/LICENSE.txt +0 -0
  98. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/WHEEL +0 -0
  99. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/top_level.txt +0 -0
ccxt/derive.py CHANGED
@@ -600,6 +600,7 @@ class derive(Exchange, ImplicitAPI):
600
600
  swap = False
601
601
  option = False
602
602
  linear: Bool = None
603
+ inverse: Bool = None
603
604
  baseId = self.safe_string(market, 'base_currency')
604
605
  quoteId = self.safe_string(market, 'quote_currency')
605
606
  base = self.safe_currency_code(baseId)
@@ -622,6 +623,7 @@ class derive(Exchange, ImplicitAPI):
622
623
  symbol = base + '/' + quote + ':' + settle
623
624
  swap = True
624
625
  linear = True
626
+ inverse = False
625
627
  marketType = 'swap'
626
628
  elif type == 'option':
627
629
  settleId = 'USDC'
@@ -638,6 +640,8 @@ class derive(Exchange, ImplicitAPI):
638
640
  optionType = 'put'
639
641
  else:
640
642
  optionType = 'call'
643
+ linear = True
644
+ inverse = False
641
645
  return self.safe_market_structure({
642
646
  'id': marketId,
643
647
  'symbol': symbol,
@@ -656,7 +660,7 @@ class derive(Exchange, ImplicitAPI):
656
660
  'active': self.safe_bool(market, 'is_active'),
657
661
  'contract': (swap or option),
658
662
  'linear': linear,
659
- 'inverse': None,
663
+ 'inverse': inverse,
660
664
  'contractSize': None if (spot) else 1,
661
665
  'expiry': expiry,
662
666
  'expiryDatetime': self.iso8601(expiry),
@@ -1811,7 +1815,7 @@ class derive(Exchange, ImplicitAPI):
1811
1815
  order = self.safe_dict(rawOrder, 'data')
1812
1816
  if order is None:
1813
1817
  order = rawOrder
1814
- timestamp = self.safe_integer(rawOrder, 'nonce')
1818
+ timestamp = self.safe_integer_2(rawOrder, 'creation_timestamp', 'nonce')
1815
1819
  orderId = self.safe_string(order, 'order_id')
1816
1820
  marketId = self.safe_string(order, 'instrument_name')
1817
1821
  if marketId is not None:
@@ -2328,17 +2332,19 @@ class derive(Exchange, ImplicitAPI):
2328
2332
  result: dict = {
2329
2333
  'info': response,
2330
2334
  }
2331
- # TODO:
2332
- # checked multiple subaccounts
2333
- # checked balance after open orders / positions
2334
2335
  for i in range(0, len(response)):
2335
2336
  subaccount = response[i]
2336
2337
  collaterals = self.safe_list(subaccount, 'collaterals', [])
2337
2338
  for j in range(0, len(collaterals)):
2338
2339
  balance = collaterals[j]
2339
2340
  code = self.safe_currency_code(self.safe_string(balance, 'currency'))
2340
- account = self.account()
2341
- account['total'] = self.safe_string(balance, 'amount')
2341
+ account = self.safe_dict(result, code)
2342
+ if account is None:
2343
+ account = self.account()
2344
+ account['total'] = self.safe_string(balance, 'amount')
2345
+ else:
2346
+ amount = self.safe_string(balance, 'amount')
2347
+ account['total'] = Precise.string_add(account['total'], amount)
2342
2348
  result[code] = account
2343
2349
  return self.safe_balance(result)
2344
2350
 
ccxt/gate.py CHANGED
@@ -6363,6 +6363,9 @@ class gate(Exchange, ImplicitAPI):
6363
6363
  if (method == 'GET') or (method == 'DELETE') or requiresURLEncoding or (method == 'PATCH'):
6364
6364
  if query:
6365
6365
  queryString = self.urlencode(query)
6366
+ # https://github.com/ccxt/ccxt/issues/25570
6367
+ if queryString.find('currencies=') >= 0 and queryString.find('%2C') >= 0:
6368
+ queryString = queryString.replace('%2', ',')
6366
6369
  url += '?' + queryString
6367
6370
  if method == 'PATCH':
6368
6371
  body = self.json(query)
ccxt/gemini.py CHANGED
@@ -1873,7 +1873,7 @@ class gemini(Exchange, ImplicitAPI):
1873
1873
  raise ExchangeError(feedback) # unknown message
1874
1874
  return None
1875
1875
 
1876
- def create_deposit_address(self, code: str, params={}):
1876
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1877
1877
  """
1878
1878
  create a currency deposit address
1879
1879
 
@@ -1895,6 +1895,7 @@ class gemini(Exchange, ImplicitAPI):
1895
1895
  'currency': code,
1896
1896
  'address': address,
1897
1897
  'tag': None,
1898
+ 'network': None,
1898
1899
  'info': response,
1899
1900
  }
1900
1901
 
ccxt/hitbtc.py CHANGED
@@ -1020,7 +1020,7 @@ class hitbtc(Exchange, ImplicitAPI):
1020
1020
  }
1021
1021
  return result
1022
1022
 
1023
- def create_deposit_address(self, code: str, params={}):
1023
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1024
1024
  """
1025
1025
  create a currency deposit address
1026
1026
 
ccxt/hyperliquid.py CHANGED
@@ -1897,6 +1897,44 @@ class hyperliquid(Exchange, ImplicitAPI):
1897
1897
  statuses = self.safe_list(dataObject, 'statuses', [])
1898
1898
  return self.parse_orders(statuses)
1899
1899
 
1900
+ def create_vault(self, name: str, description: str, initialUsd: int, params={}):
1901
+ """
1902
+ creates a value
1903
+ :param str name: The name of the vault
1904
+ :param str description: The description of the vault
1905
+ :param number initialUsd: The initialUsd of the vault
1906
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1907
+ :returns dict: the api result
1908
+ """
1909
+ self.check_required_credentials()
1910
+ self.load_markets()
1911
+ nonce = self.milliseconds()
1912
+ request: dict = {
1913
+ 'nonce': nonce,
1914
+ }
1915
+ usd = self.parse_to_int(Precise.string_mul(self.number_to_string(initialUsd), '1000000'))
1916
+ action: dict = {
1917
+ 'type': 'createVault',
1918
+ 'name': name,
1919
+ 'description': description,
1920
+ 'initialUsd': usd,
1921
+ 'nonce': nonce,
1922
+ }
1923
+ signature = self.sign_l1_action(action, nonce)
1924
+ request['action'] = action
1925
+ request['signature'] = signature
1926
+ response = self.privatePostExchange(self.extend(request, params))
1927
+ #
1928
+ # {
1929
+ # "status": "ok",
1930
+ # "response": {
1931
+ # "type": "createVault",
1932
+ # "data": "0x04fddcbc9ce80219301bd16f18491bedf2a8c2b8"
1933
+ # }
1934
+ # }
1935
+ #
1936
+ return response
1937
+
1900
1938
  def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1901
1939
  """
1902
1940
  fetches historical funding rate prices
ccxt/kraken.py CHANGED
@@ -2900,7 +2900,7 @@ class kraken(Exchange, ImplicitAPI):
2900
2900
  data[dataLength - 1] = last
2901
2901
  return data
2902
2902
 
2903
- def create_deposit_address(self, code: str, params={}):
2903
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2904
2904
  """
2905
2905
  create a currency deposit address
2906
2906
 
ccxt/krakenfutures.py CHANGED
@@ -51,6 +51,10 @@ class krakenfutures(Exchange, ImplicitAPI):
51
51
  'cancelOrders': True,
52
52
  'createMarketOrder': False,
53
53
  'createOrder': True,
54
+ 'createPostOnlyOrder': True,
55
+ 'createReduceOnlyOrder': True,
56
+ 'createStopLimitOrder': True,
57
+ 'createStopMarketOrder': True,
54
58
  'createStopOrder': True,
55
59
  'createTriggerOrder': True,
56
60
  'editOrder': True,
ccxt/kucoin.py CHANGED
@@ -1959,7 +1959,7 @@ class kucoin(Exchange, ImplicitAPI):
1959
1959
  data = self.safe_list(response, 'data', [])
1960
1960
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
1961
1961
 
1962
- def create_deposit_address(self, code: str, params={}):
1962
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1963
1963
  """
1964
1964
 
1965
1965
  https://www.kucoin.com/docs/rest/funding/deposit/create-deposit-address-v3-
ccxt/kuna.py CHANGED
@@ -1572,7 +1572,7 @@ class kuna(Exchange, ImplicitAPI):
1572
1572
  data = self.safe_dict(response, 'data', {})
1573
1573
  return self.parse_transaction(data)
1574
1574
 
1575
- def create_deposit_address(self, code: str, params={}):
1575
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1576
1576
  """
1577
1577
  create a currency deposit address
1578
1578
 
ccxt/mexc.py CHANGED
@@ -4537,7 +4537,7 @@ class mexc(Exchange, ImplicitAPI):
4537
4537
  addressStructures = self.parse_deposit_addresses(response, None, False)
4538
4538
  return self.index_by(addressStructures, 'network')
4539
4539
 
4540
- def create_deposit_address(self, code: str, params={}):
4540
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
4541
4541
  """
4542
4542
  create a currency deposit address
4543
4543
 
ccxt/ndax.py CHANGED
@@ -2083,7 +2083,7 @@ class ndax(Exchange, ImplicitAPI):
2083
2083
  'tag': tag,
2084
2084
  }
2085
2085
 
2086
- def create_deposit_address(self, code: str, params={}):
2086
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2087
2087
  """
2088
2088
  create a currency deposit address
2089
2089
  :param str code: unified currency code of the currency for the deposit address
ccxt/okcoin.py CHANGED
@@ -56,6 +56,10 @@ class okcoin(Exchange, ImplicitAPI):
56
56
  'createMarketOrderWithCost': False,
57
57
  'createMarketSellOrderWithCost': False,
58
58
  'createOrder': True,
59
+ 'createPostOnlyOrder': True,
60
+ 'createReduceOnlyOrder': True,
61
+ 'createStopLimitOrder': True,
62
+ 'createStopMarketOrder': True,
59
63
  'createStopOrder': True,
60
64
  'createTriggerOrder': True,
61
65
  'fetchBalance': True,
ccxt/okx.py CHANGED
@@ -1623,11 +1623,12 @@ class okx(Exchange, ImplicitAPI):
1623
1623
  optionType = None
1624
1624
  if contract:
1625
1625
  symbol = symbol + ':' + settle
1626
- expiry = self.safe_integer(market, 'expTime')
1627
1626
  if future:
1627
+ expiry = self.safe_integer(market, 'expTime')
1628
1628
  ymd = self.yymmdd(expiry)
1629
1629
  symbol = symbol + '-' + ymd
1630
1630
  elif option:
1631
+ expiry = self.safe_integer(market, 'expTime')
1631
1632
  strikePrice = self.safe_string(market, 'stk')
1632
1633
  optionType = self.safe_string(market, 'optType')
1633
1634
  ymd = self.yymmdd(expiry)
@@ -1818,38 +1819,24 @@ class okx(Exchange, ImplicitAPI):
1818
1819
  code = currency['code']
1819
1820
  chains = dataByCurrencyId[currencyId]
1820
1821
  networks: dict = {}
1821
- currencyActive = False
1822
- depositEnabled = False
1823
- withdrawEnabled = False
1824
- maxPrecision = None
1825
- for j in range(0, len(chains)):
1822
+ type = 'crypto'
1823
+ chainsLength = len(chains)
1824
+ for j in range(0, chainsLength):
1826
1825
  chain = chains[j]
1827
- canDeposit = self.safe_bool(chain, 'canDep')
1828
- depositEnabled = canDeposit if (canDeposit) else depositEnabled
1829
- canWithdraw = self.safe_bool(chain, 'canWd')
1830
- withdrawEnabled = canWithdraw if (canWithdraw) else withdrawEnabled
1831
- canInternal = self.safe_bool(chain, 'canInternal')
1832
- active = True if (canDeposit and canWithdraw and canInternal) else False
1833
- currencyActive = active if (active) else currencyActive
1834
- networkId = self.safe_string(chain, 'chain')
1835
- if (networkId is not None) and (networkId.find('-') >= 0):
1826
+ networkId = self.safe_string(chain, 'chain') # USDT-BEP20, USDT-Avalance-C, etc
1827
+ if networkId is not None:
1836
1828
  idParts = networkId.split('-')
1837
1829
  parts = self.array_slice(idParts, 1)
1838
1830
  chainPart = '-'.join(parts)
1839
1831
  networkCode = self.network_id_to_code(chainPart, currency['code'])
1840
- precision = self.parse_precision(self.safe_string(chain, 'wdTickSz'))
1841
- if maxPrecision is None:
1842
- maxPrecision = precision
1843
- else:
1844
- maxPrecision = Precise.string_min(maxPrecision, precision)
1845
1832
  networks[networkCode] = {
1846
1833
  'id': networkId,
1847
1834
  'network': networkCode,
1848
- 'active': active,
1849
- 'deposit': canDeposit,
1850
- 'withdraw': canWithdraw,
1835
+ 'active': None,
1836
+ 'deposit': self.safe_bool(chain, 'canDep'),
1837
+ 'withdraw': self.safe_bool(chain, 'canWd'),
1851
1838
  'fee': self.safe_number(chain, 'fee'),
1852
- 'precision': self.parse_number(precision),
1839
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'wdTickSz'))),
1853
1840
  'limits': {
1854
1841
  'withdraw': {
1855
1842
  'min': self.safe_number(chain, 'minWd'),
@@ -1858,25 +1845,29 @@ class okx(Exchange, ImplicitAPI):
1858
1845
  },
1859
1846
  'info': chain,
1860
1847
  }
1848
+ else:
1849
+ # only happens for FIAT currency
1850
+ type = 'fiat'
1861
1851
  firstChain = self.safe_dict(chains, 0, {})
1862
- result[code] = {
1852
+ result[code] = self.safe_currency_structure({
1863
1853
  'info': chains,
1864
1854
  'code': code,
1865
1855
  'id': currencyId,
1866
1856
  'name': self.safe_string(firstChain, 'name'),
1867
- 'active': currencyActive,
1868
- 'deposit': depositEnabled,
1869
- 'withdraw': withdrawEnabled,
1857
+ 'active': None,
1858
+ 'deposit': None,
1859
+ 'withdraw': None,
1870
1860
  'fee': None,
1871
- 'precision': self.parse_number(maxPrecision),
1861
+ 'precision': None,
1872
1862
  'limits': {
1873
1863
  'amount': {
1874
1864
  'min': None,
1875
1865
  'max': None,
1876
1866
  },
1877
1867
  },
1868
+ 'type': type,
1878
1869
  'networks': networks,
1879
- }
1870
+ })
1880
1871
  return result
1881
1872
 
1882
1873
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
ccxt/paradex.py CHANGED
@@ -496,6 +496,57 @@ class paradex(Exchange, ImplicitAPI):
496
496
  # "max_tob_spread": "0.2"
497
497
  # }
498
498
  #
499
+ # {
500
+ # "symbol":"BTC-USD-96000-C",
501
+ # "base_currency":"BTC",
502
+ # "quote_currency":"USD",
503
+ # "settlement_currency":"USDC",
504
+ # "order_size_increment":"0.001",
505
+ # "price_tick_size":"0.01",
506
+ # "min_notional":"100",
507
+ # "open_at":"1736764200000",
508
+ # "expiry_at":"0",
509
+ # "asset_kind":"PERP_OPTION",
510
+ # "market_kind":"cross",
511
+ # "position_limit":"10",
512
+ # "price_bands_width":"0.05",
513
+ # "iv_bands_width":"0.05",
514
+ # "max_open_orders":"100",
515
+ # "max_funding_rate":"0.02",
516
+ # "option_cross_margin_params":{
517
+ # "imf":{
518
+ # "long_itm":"0.2",
519
+ # "short_itm":"0.15",
520
+ # "short_otm":"0.1",
521
+ # "short_put_cap":"0.5",
522
+ # "premium_multiplier":"1"
523
+ # },
524
+ # "mmf":{
525
+ # "long_itm":"0.1",
526
+ # "short_itm":"0.075",
527
+ # "short_otm":"0.05",
528
+ # "short_put_cap":"0.5",
529
+ # "premium_multiplier":"0.5"
530
+ # }
531
+ # },
532
+ # "price_feed_id":"GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU",
533
+ # "oracle_ewma_factor":"0.20000046249626113",
534
+ # "max_order_size":"2",
535
+ # "max_funding_rate_change":"0.02",
536
+ # "max_tob_spread":"0.2",
537
+ # "interest_rate":"0.0001",
538
+ # "clamp_rate":"0.02",
539
+ # "option_type":"CALL",
540
+ # "strike_price":"96000",
541
+ # "funding_period_hours":"24",
542
+ # "tags":[
543
+ # ]
544
+ # }
545
+ #
546
+ assetKind = self.safe_string(market, 'asset_kind')
547
+ isOption = (assetKind == 'PERP_OPTION')
548
+ type = 'option' if (isOption) else 'swap'
549
+ isSwap = (type == 'swap')
499
550
  marketId = self.safe_string(market, 'symbol')
500
551
  quoteId = self.safe_string(market, 'quote_currency')
501
552
  baseId = self.safe_string(market, 'base_currency')
@@ -505,6 +556,13 @@ class paradex(Exchange, ImplicitAPI):
505
556
  settle = self.safe_currency_code(settleId)
506
557
  symbol = base + '/' + quote + ':' + settle
507
558
  expiry = self.safe_integer(market, 'expiry_at')
559
+ optionType = self.safe_string(market, 'option_type')
560
+ strikePrice = self.safe_string(market, 'strike_price')
561
+ if isOption:
562
+ optionTypeSuffix = 'C' if (optionType == 'CALL') else 'P'
563
+ symbol = symbol + '-' + strikePrice + '-' + optionTypeSuffix
564
+ else:
565
+ expiry = None
508
566
  takerFee = self.parse_number('0.0003')
509
567
  makerFee = self.parse_number('-0.00005')
510
568
  return self.safe_market_structure({
@@ -516,23 +574,23 @@ class paradex(Exchange, ImplicitAPI):
516
574
  'baseId': baseId,
517
575
  'quoteId': quoteId,
518
576
  'settleId': settleId,
519
- 'type': 'swap',
577
+ 'type': type,
520
578
  'spot': False,
521
579
  'margin': None,
522
- 'swap': True,
580
+ 'swap': isSwap,
523
581
  'future': False,
524
- 'option': False,
582
+ 'option': isOption,
525
583
  'active': self.safe_bool(market, 'enableTrading'),
526
584
  'contract': True,
527
585
  'linear': True,
528
- 'inverse': None,
586
+ 'inverse': False,
529
587
  'taker': takerFee,
530
588
  'maker': makerFee,
531
589
  'contractSize': self.parse_number('1'),
532
- 'expiry': None if (expiry == 0) else expiry,
590
+ 'expiry': expiry,
533
591
  'expiryDatetime': None if (expiry == 0) else self.iso8601(expiry),
534
- 'strike': None,
535
- 'optionType': None,
592
+ 'strike': self.parse_number(strikePrice),
593
+ 'optionType': self.safe_string_lower(market, 'option_type'),
536
594
  'precision': {
537
595
  'amount': self.safe_number(market, 'order_size_increment'),
538
596
  'price': self.safe_number(market, 'price_tick_size'),
ccxt/paymium.py CHANGED
@@ -333,7 +333,7 @@ class paymium(Exchange, ImplicitAPI):
333
333
  response = self.publicGetDataCurrencyTrades(self.extend(request, params))
334
334
  return self.parse_trades(response, market, since, limit)
335
335
 
336
- def create_deposit_address(self, code: str, params={}):
336
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
337
337
  """
338
338
  create a currency deposit address
339
339
 
ccxt/poloniex.py CHANGED
@@ -428,6 +428,7 @@ class poloniex(Exchange, ImplicitAPI):
428
428
  'untilDays': None,
429
429
  'trigger': False,
430
430
  'trailing': False,
431
+ 'symbolRequired': False,
431
432
  },
432
433
  'fetchMyTrades': {
433
434
  'limit': 100,
@@ -2571,7 +2572,7 @@ class poloniex(Exchange, ImplicitAPI):
2571
2572
  'nonce': None,
2572
2573
  }
2573
2574
 
2574
- def create_deposit_address(self, code: str, params={}):
2575
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2575
2576
  """
2576
2577
  create a currency deposit address
2577
2578
 
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.71'
7
+ __version__ = '4.4.73'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -22,7 +22,6 @@ from ccxt.pro.binanceusdm import binanceusdm # noqa
22
22
  from ccxt.pro.bingx import bingx # noqa: F401
23
23
  from ccxt.pro.bitcoincom import bitcoincom # noqa: F401
24
24
  from ccxt.pro.bitfinex import bitfinex # noqa: F401
25
- from ccxt.pro.bitfinex1 import bitfinex1 # noqa: F401
26
25
  from ccxt.pro.bitget import bitget # noqa: F401
27
26
  from ccxt.pro.bithumb import bithumb # noqa: F401
28
27
  from ccxt.pro.bitmart import bitmart # noqa: F401
@@ -97,7 +96,6 @@ exchanges = [
97
96
  'bingx',
98
97
  'bitcoincom',
99
98
  'bitfinex',
100
- 'bitfinex1',
101
99
  'bitget',
102
100
  'bithumb',
103
101
  'bitmart',
ccxt/pro/bingx.py CHANGED
@@ -42,7 +42,7 @@ class bingx(ccxt.async_support.bingx):
42
42
  },
43
43
  },
44
44
  'options': {
45
- 'listenKeyRefreshRate': 3540000, # 1 hour(59 mins so we have 1min to renew the token)
45
+ 'listenKeyRefreshRate': 3540000, # 1 hour(59 mins so we have 1 min to renew the token)
46
46
  'ws': {
47
47
  'gunzip': True,
48
48
  },
ccxt/pro/bitmart.py CHANGED
@@ -858,15 +858,12 @@ class bitmart(ccxt.async_support.bitmart):
858
858
  # "data":[
859
859
  # {
860
860
  # "trade_id":6798697637,
861
- # "contract_id":1,
862
861
  # "symbol":"BTCUSDT",
863
862
  # "deal_price":"39735.8",
864
863
  # "deal_vol":"2",
865
- # "type":0,
866
864
  # "way":1,
867
- # "create_time":1701618503,
868
- # "create_time_mill":1701618503517,
869
- # "created_at":"2023-12-03T15:48:23.517518538Z"
865
+ # "created_at":"2023-12-03T15:48:23.517518538Z",
866
+ # "m": True,
870
867
  # }
871
868
  # ]
872
869
  # }
@@ -899,6 +896,7 @@ class bitmart(ccxt.async_support.bitmart):
899
896
  return symbol
900
897
 
901
898
  def parse_ws_trade(self, trade: dict, market: Market = None):
899
+ #
902
900
  # spot
903
901
  # {
904
902
  # "ms_t": 1740320841473,
@@ -929,6 +927,16 @@ class bitmart(ccxt.async_support.bitmart):
929
927
  timestamp = self.parse8601(datetime)
930
928
  else:
931
929
  datetime = self.iso8601(timestamp)
930
+ takerOrMaker = None # True for public trades
931
+ side = self.safe_string(trade, 'side')
932
+ buyerMaker = self.safe_bool(trade, 'm')
933
+ if buyerMaker is not None:
934
+ if side is None:
935
+ if buyerMaker:
936
+ side = 'sell'
937
+ else:
938
+ side = 'buy'
939
+ takerOrMaker = 'taker'
932
940
  return self.safe_trade({
933
941
  'info': trade,
934
942
  'id': self.safe_string(trade, 'trade_id'),
@@ -937,11 +945,11 @@ class bitmart(ccxt.async_support.bitmart):
937
945
  'datetime': datetime,
938
946
  'symbol': market['symbol'],
939
947
  'type': None,
940
- 'side': self.safe_string(trade, 'side'),
948
+ 'side': side,
941
949
  'price': self.safe_string_2(trade, 'price', 'deal_price'),
942
950
  'amount': self.safe_string_2(trade, 'size', 'deal_vol'),
943
951
  'cost': None,
944
- 'takerOrMaker': None,
952
+ 'takerOrMaker': takerOrMaker,
945
953
  'fee': None,
946
954
  }, market)
947
955
 
ccxt/pro/derive.py CHANGED
@@ -417,12 +417,12 @@ class derive(ccxt.async_support.derive):
417
417
  requestId = self.request_id(url)
418
418
  now = str(self.milliseconds())
419
419
  signature = self.signMessage(now, self.privateKey)
420
- contractWalletAddress = self.safe_string(self.options, 'contractWalletAddress')
420
+ deriveWalletAddress = self.safe_string(self.options, 'deriveWalletAddress')
421
421
  request: dict = {
422
422
  'id': requestId,
423
423
  'method': 'public/login',
424
424
  'params': {
425
- 'wallet': contractWalletAddress,
425
+ 'wallet': deriveWalletAddress,
426
426
  'timestamp': now,
427
427
  'signature': signature,
428
428
  },
ccxt/pro/krakenfutures.py CHANGED
@@ -460,7 +460,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
460
460
  # {
461
461
  # "feed": "trade",
462
462
  # "product_id": "PI_XBTUSD",
463
- # "uid": "caa9c653-420b-4c24-a9f1-462a054d86f1",
463
+ # "uid": "caa9c653-420b-4c24-a9f2-462a054d86f1",
464
464
  # "side": "sell",
465
465
  # "type": "fill",
466
466
  # "seq": 655508,
ccxt/test/tests_async.py CHANGED
@@ -1156,7 +1156,9 @@ class testMainClass:
1156
1156
 
1157
1157
  async def test_binance(self):
1158
1158
  exchange = self.init_offline_exchange('binance')
1159
- spot_id = 'x-R4BD3S82'
1159
+ spot_id = 'x-TKT5PX2F'
1160
+ swap_id = 'x-cvBPrNm9'
1161
+ inverse_swap_id = 'x-xcKtGhcu'
1160
1162
  spot_order_request = None
1161
1163
  try:
1162
1164
  await exchange.create_order('BTC/USDT', 'limit', 'buy', 1, 20000)
@@ -1165,7 +1167,6 @@ class testMainClass:
1165
1167
  client_order_id = spot_order_request['newClientOrderId']
1166
1168
  spot_id_string = str(spot_id)
1167
1169
  assert client_order_id.startswith(spot_id_string), 'binance - spot clientOrderId: ' + client_order_id + ' does not start with spotId' + spot_id_string
1168
- swap_id = 'x-xcKtGhcu'
1169
1170
  swap_order_request = None
1170
1171
  try:
1171
1172
  await exchange.create_order('BTC/USDT:USDT', 'limit', 'buy', 1, 20000)
@@ -1176,11 +1177,13 @@ class testMainClass:
1176
1177
  await exchange.create_order('BTC/USD:BTC', 'limit', 'buy', 1, 20000)
1177
1178
  except Exception as e:
1178
1179
  swap_inverse_order_request = self.urlencoded_to_dict(exchange.last_request_body)
1180
+ # linear swap
1179
1181
  client_order_id_swap = swap_order_request['newClientOrderId']
1180
1182
  swap_id_string = str(swap_id)
1181
1183
  assert client_order_id_swap.startswith(swap_id_string), 'binance - swap clientOrderId: ' + client_order_id_swap + ' does not start with swapId' + swap_id_string
1184
+ # inverse swap
1182
1185
  client_order_id_inverse = swap_inverse_order_request['newClientOrderId']
1183
- assert client_order_id_inverse.startswith(swap_id_string), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + swap_id_string
1186
+ assert client_order_id_inverse.startswith(inverse_swap_id), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + inverse_swap_id
1184
1187
  create_orders_request = None
1185
1188
  try:
1186
1189
  orders = [{
ccxt/test/tests_sync.py CHANGED
@@ -1153,7 +1153,9 @@ class testMainClass:
1153
1153
 
1154
1154
  def test_binance(self):
1155
1155
  exchange = self.init_offline_exchange('binance')
1156
- spot_id = 'x-R4BD3S82'
1156
+ spot_id = 'x-TKT5PX2F'
1157
+ swap_id = 'x-cvBPrNm9'
1158
+ inverse_swap_id = 'x-xcKtGhcu'
1157
1159
  spot_order_request = None
1158
1160
  try:
1159
1161
  exchange.create_order('BTC/USDT', 'limit', 'buy', 1, 20000)
@@ -1162,7 +1164,6 @@ class testMainClass:
1162
1164
  client_order_id = spot_order_request['newClientOrderId']
1163
1165
  spot_id_string = str(spot_id)
1164
1166
  assert client_order_id.startswith(spot_id_string), 'binance - spot clientOrderId: ' + client_order_id + ' does not start with spotId' + spot_id_string
1165
- swap_id = 'x-xcKtGhcu'
1166
1167
  swap_order_request = None
1167
1168
  try:
1168
1169
  exchange.create_order('BTC/USDT:USDT', 'limit', 'buy', 1, 20000)
@@ -1173,11 +1174,13 @@ class testMainClass:
1173
1174
  exchange.create_order('BTC/USD:BTC', 'limit', 'buy', 1, 20000)
1174
1175
  except Exception as e:
1175
1176
  swap_inverse_order_request = self.urlencoded_to_dict(exchange.last_request_body)
1177
+ # linear swap
1176
1178
  client_order_id_swap = swap_order_request['newClientOrderId']
1177
1179
  swap_id_string = str(swap_id)
1178
1180
  assert client_order_id_swap.startswith(swap_id_string), 'binance - swap clientOrderId: ' + client_order_id_swap + ' does not start with swapId' + swap_id_string
1181
+ # inverse swap
1179
1182
  client_order_id_inverse = swap_inverse_order_request['newClientOrderId']
1180
- assert client_order_id_inverse.startswith(swap_id_string), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + swap_id_string
1183
+ assert client_order_id_inverse.startswith(inverse_swap_id), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + inverse_swap_id
1181
1184
  create_orders_request = None
1182
1185
  try:
1183
1186
  orders = [{