ccxt 4.4.71__py2.py3-none-any.whl → 4.4.72__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 (82) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +1 -1
  3. ccxt/ascendex.py +1 -1
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ascendex.py +1 -1
  6. ccxt/async_support/base/exchange.py +1 -1
  7. ccxt/async_support/binance.py +1 -1
  8. ccxt/async_support/bingx.py +2 -2
  9. ccxt/async_support/bitfinex.py +1 -1
  10. ccxt/async_support/bitfinex1.py +1 -1
  11. ccxt/async_support/bl3p.py +2 -2
  12. ccxt/async_support/cex.py +1 -0
  13. ccxt/async_support/coinbase.py +3 -2
  14. ccxt/async_support/coinbaseexchange.py +3 -2
  15. ccxt/async_support/coinbaseinternational.py +3 -2
  16. ccxt/async_support/coinex.py +1 -1
  17. ccxt/async_support/deribit.py +2 -1
  18. ccxt/async_support/derive.py +11 -7
  19. ccxt/async_support/gate.py +3 -0
  20. ccxt/async_support/gemini.py +2 -1
  21. ccxt/async_support/hitbtc.py +1 -1
  22. ccxt/async_support/hyperliquid.py +38 -0
  23. ccxt/async_support/kraken.py +1 -1
  24. ccxt/async_support/krakenfutures.py +4 -0
  25. ccxt/async_support/kucoin.py +1 -1
  26. ccxt/async_support/kuna.py +1 -1
  27. ccxt/async_support/mexc.py +1 -1
  28. ccxt/async_support/ndax.py +1 -1
  29. ccxt/async_support/okcoin.py +4 -0
  30. ccxt/async_support/okx.py +21 -30
  31. ccxt/async_support/paradex.py +65 -7
  32. ccxt/async_support/paymium.py +1 -1
  33. ccxt/async_support/poloniex.py +2 -1
  34. ccxt/async_support/upbit.py +1 -1
  35. ccxt/async_support/whitebit.py +98 -2
  36. ccxt/async_support/woo.py +3 -1
  37. ccxt/async_support/woofipro.py +1 -1
  38. ccxt/async_support/yobit.py +2 -1
  39. ccxt/base/errors.py +6 -0
  40. ccxt/base/exchange.py +9 -2
  41. ccxt/binance.py +1 -1
  42. ccxt/bingx.py +2 -2
  43. ccxt/bitfinex.py +1 -1
  44. ccxt/bitfinex1.py +1 -1
  45. ccxt/bl3p.py +2 -2
  46. ccxt/cex.py +1 -0
  47. ccxt/coinbase.py +3 -2
  48. ccxt/coinbaseexchange.py +3 -2
  49. ccxt/coinbaseinternational.py +3 -2
  50. ccxt/coinex.py +1 -1
  51. ccxt/deribit.py +2 -1
  52. ccxt/derive.py +11 -7
  53. ccxt/gate.py +3 -0
  54. ccxt/gemini.py +2 -1
  55. ccxt/hitbtc.py +1 -1
  56. ccxt/hyperliquid.py +38 -0
  57. ccxt/kraken.py +1 -1
  58. ccxt/krakenfutures.py +4 -0
  59. ccxt/kucoin.py +1 -1
  60. ccxt/kuna.py +1 -1
  61. ccxt/mexc.py +1 -1
  62. ccxt/ndax.py +1 -1
  63. ccxt/okcoin.py +4 -0
  64. ccxt/okx.py +21 -30
  65. ccxt/paradex.py +65 -7
  66. ccxt/paymium.py +1 -1
  67. ccxt/poloniex.py +2 -1
  68. ccxt/pro/__init__.py +1 -1
  69. ccxt/pro/bingx.py +1 -1
  70. ccxt/pro/bitmart.py +15 -7
  71. ccxt/pro/derive.py +2 -2
  72. ccxt/pro/krakenfutures.py +1 -1
  73. ccxt/upbit.py +1 -1
  74. ccxt/whitebit.py +98 -2
  75. ccxt/woo.py +3 -1
  76. ccxt/woofipro.py +1 -1
  77. ccxt/yobit.py +2 -1
  78. {ccxt-4.4.71.dist-info → ccxt-4.4.72.dist-info}/METADATA +4 -4
  79. {ccxt-4.4.71.dist-info → ccxt-4.4.72.dist-info}/RECORD +82 -82
  80. {ccxt-4.4.71.dist-info → ccxt-4.4.72.dist-info}/LICENSE.txt +0 -0
  81. {ccxt-4.4.71.dist-info → ccxt-4.4.72.dist-info}/WHEEL +0 -0
  82. {ccxt-4.4.71.dist-info → ccxt-4.4.72.dist-info}/top_level.txt +0 -0
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.72'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
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/upbit.py CHANGED
@@ -1886,7 +1886,7 @@ class upbit(Exchange, ImplicitAPI):
1886
1886
  #
1887
1887
  return self.parse_deposit_address(response)
1888
1888
 
1889
- def create_deposit_address(self, code: str, params={}):
1889
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1890
1890
  """
1891
1891
 
1892
1892
  https://docs.upbit.com/reference/%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%83%9D%EC%84%B1-%EC%9A%94%EC%B2%AD
ccxt/whitebit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -46,13 +46,16 @@ class whitebit(Exchange, ImplicitAPI):
46
46
  'cancelOrder': True,
47
47
  'cancelOrders': False,
48
48
  'createConvertTrade': True,
49
+ 'createDepositAddress': True,
49
50
  'createMarketBuyOrderWithCost': True,
50
51
  'createMarketOrderWithCost': False,
51
52
  'createMarketSellOrderWithCost': False,
52
53
  'createOrder': True,
54
+ 'createPostOnlyOrder': True,
53
55
  'createStopLimitOrder': True,
54
56
  'createStopMarketOrder': True,
55
57
  'createStopOrder': True,
58
+ 'createTriggerOrder': True,
56
59
  'editOrder': False,
57
60
  'fetchBalance': True,
58
61
  'fetchBorrowRateHistories': False,
@@ -61,7 +64,7 @@ class whitebit(Exchange, ImplicitAPI):
61
64
  'fetchConvertQuote': True,
62
65
  'fetchConvertTrade': False,
63
66
  'fetchConvertTradeHistory': True,
64
- 'fetchCrossBorrowRate': False,
67
+ 'fetchCrossBorrowRate': True,
65
68
  'fetchCrossBorrowRates': False,
66
69
  'fetchCurrencies': True,
67
70
  'fetchDeposit': True,
@@ -1375,6 +1378,10 @@ class whitebit(Exchange, ImplicitAPI):
1375
1378
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1376
1379
  :param dict [params]: extra parameters specific to the exchange API endpoint
1377
1380
  :param float [params.cost]: *market orders only* the cost of the order in units of the base currency
1381
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1382
+ :param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
1383
+ :param str [params.clientOrderId]: a unique id for the order
1384
+ :param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
1378
1385
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1379
1386
  """
1380
1387
  self.load_markets()
@@ -2001,6 +2008,60 @@ class whitebit(Exchange, ImplicitAPI):
2001
2008
  'tag': tag,
2002
2009
  }
2003
2010
 
2011
+ def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2012
+ """
2013
+ create a currency deposit address
2014
+
2015
+ https://docs.whitebit.com/private/http-main-v4/#create-new-address-for-deposit
2016
+
2017
+ :param str code: unified currency code of the currency for the deposit address
2018
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2019
+ :param str [params.network]: the blockchain network to create a deposit address on
2020
+ :param str [params.type]: address type, available for specific currencies
2021
+ :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2022
+ """
2023
+ self.load_markets()
2024
+ currency = self.currency(code)
2025
+ request: dict = {
2026
+ 'ticker': currency['id'],
2027
+ }
2028
+ response = self.v4PrivatePostMainAccountCreateNewAddress(self.extend(request, params))
2029
+ #
2030
+ # {
2031
+ # "account": {
2032
+ # "address": "GDTSOI56XNVAKJNJBLJGRNZIVOCIZJRBIDKTWSCYEYNFAZEMBLN75RMN",
2033
+ # "memo": "48565488244493"
2034
+ # },
2035
+ # "required": {
2036
+ # "maxAmount": "0",
2037
+ # "minAmount": "1",
2038
+ # "fixedFee": "0",
2039
+ # "flexFee": {
2040
+ # "maxFee": "0",
2041
+ # "minFee": "0",
2042
+ # "percent": "0"
2043
+ # }
2044
+ # }
2045
+ # }
2046
+ #
2047
+ data = self.safe_dict(response, 'account', {})
2048
+ return self.parse_deposit_address(data, currency)
2049
+
2050
+ def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
2051
+ #
2052
+ # {
2053
+ # "address": "GDTSOI56XNVAKJNJBLJGRNZIVOCIZJRBIDKTWSCYEYNFAZEMBLN75RMN",
2054
+ # "memo": "48565488244493"
2055
+ # },
2056
+ #
2057
+ return {
2058
+ 'info': depositAddress,
2059
+ 'currency': self.safe_currency_code(None, currency),
2060
+ 'network': None,
2061
+ 'address': self.safe_string(depositAddress, 'address'),
2062
+ 'tag': self.safe_string(depositAddress, 'memo'),
2063
+ }
2064
+
2004
2065
  def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2005
2066
  """
2006
2067
  set the level of leverage for a market
@@ -3069,6 +3130,41 @@ class whitebit(Exchange, ImplicitAPI):
3069
3130
  'takeProfitPrice': self.safe_number(tpsl, 'takeProfit'),
3070
3131
  })
3071
3132
 
3133
+ def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
3134
+ """
3135
+ fetch the rate of interest to borrow a currency for margin trading
3136
+
3137
+ https://docs.whitebit.com/private/http-main-v4/#get-plans
3138
+
3139
+ :param str code: unified currency code
3140
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3141
+ :returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
3142
+ """
3143
+ self.load_markets()
3144
+ currency = self.currency(code)
3145
+ request: dict = {
3146
+ 'ticker': currency['id'],
3147
+ }
3148
+ response = self.v4PrivatePostMainAccountSmartPlans(self.extend(request, params))
3149
+ #
3150
+ #
3151
+ data = self.safe_list(response, 0, [])
3152
+ return self.parse_borrow_rate(data, currency)
3153
+
3154
+ def parse_borrow_rate(self, info, currency: Currency = None):
3155
+ #
3156
+ #
3157
+ currencyId = self.safe_string(info, 'ticker')
3158
+ percent = self.safe_string(info, 'percent')
3159
+ return {
3160
+ 'currency': self.safe_currency_code(currencyId, currency),
3161
+ 'rate': self.parse_number(Precise.string_div(percent, '100')),
3162
+ 'period': self.safe_integer(info, 'duration'),
3163
+ 'timestamp': None,
3164
+ 'datetime': None,
3165
+ 'info': info,
3166
+ }
3167
+
3072
3168
  def is_fiat(self, currency: str) -> bool:
3073
3169
  fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
3074
3170
  return self.in_array(currency, fiatCurrencies)