ccxt 4.3.62__py2.py3-none-any.whl → 4.3.64__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 (74) hide show
  1. ccxt/__init__.py +2 -1
  2. ccxt/abstract/binance.py +5 -5
  3. ccxt/abstract/binancecoinm.py +5 -5
  4. ccxt/abstract/binanceus.py +5 -5
  5. ccxt/abstract/binanceusdm.py +5 -5
  6. ccxt/abstract/cryptocom.py +11 -0
  7. ccxt/abstract/kucoin.py +1 -0
  8. ccxt/abstract/kucoinfutures.py +1 -0
  9. ccxt/abstract/woo.py +3 -0
  10. ccxt/ace.py +33 -15
  11. ccxt/alpaca.py +1 -0
  12. ccxt/async_support/__init__.py +2 -1
  13. ccxt/async_support/ace.py +33 -15
  14. ccxt/async_support/alpaca.py +1 -0
  15. ccxt/async_support/base/exchange.py +4 -4
  16. ccxt/async_support/binance.py +6 -9
  17. ccxt/async_support/bingx.py +534 -152
  18. ccxt/async_support/bitfinex.py +1 -1
  19. ccxt/async_support/bitfinex2.py +1 -1
  20. ccxt/async_support/coinbaseinternational.py +1 -1
  21. ccxt/async_support/cryptocom.py +17 -2
  22. ccxt/async_support/independentreserve.py +103 -1
  23. ccxt/async_support/kucoin.py +2 -0
  24. ccxt/async_support/mercado.py +5 -1
  25. ccxt/async_support/whitebit.py +1 -1
  26. ccxt/async_support/woo.py +321 -81
  27. ccxt/async_support/xt.py +3 -3
  28. ccxt/async_support/yobit.py +1 -1
  29. ccxt/async_support/zonda.py +1 -1
  30. ccxt/base/errors.py +8 -1
  31. ccxt/base/exchange.py +11 -5
  32. ccxt/binance.py +6 -9
  33. ccxt/bingx.py +534 -152
  34. ccxt/bitfinex.py +1 -1
  35. ccxt/bitfinex2.py +1 -1
  36. ccxt/coinbaseinternational.py +1 -1
  37. ccxt/cryptocom.py +17 -2
  38. ccxt/independentreserve.py +103 -1
  39. ccxt/kucoin.py +2 -0
  40. ccxt/mercado.py +5 -1
  41. ccxt/pro/__init__.py +1 -1
  42. ccxt/pro/binance.py +56 -35
  43. ccxt/pro/bitfinex2.py +6 -4
  44. ccxt/pro/bitget.py +5 -2
  45. ccxt/pro/bitmart.py +3 -3
  46. ccxt/pro/bitvavo.py +1 -1
  47. ccxt/pro/bybit.py +41 -18
  48. ccxt/pro/cryptocom.py +7 -2
  49. ccxt/pro/gate.py +7 -4
  50. ccxt/pro/gemini.py +4 -2
  51. ccxt/pro/htx.py +5 -1
  52. ccxt/pro/independentreserve.py +6 -4
  53. ccxt/pro/kraken.py +79 -6
  54. ccxt/pro/okx.py +5 -5
  55. ccxt/pro/onetrading.py +3 -2
  56. ccxt/pro/oxfun.py +1 -1
  57. ccxt/pro/poloniexfutures.py +5 -2
  58. ccxt/pro/vertex.py +3 -2
  59. ccxt/pro/woo.py +2 -1
  60. ccxt/pro/woofipro.py +3 -2
  61. ccxt/test/tests_async.py +3 -3
  62. ccxt/test/tests_helpers.py +1 -1
  63. ccxt/test/tests_init.py +3 -3
  64. ccxt/test/tests_sync.py +3 -3
  65. ccxt/whitebit.py +1 -1
  66. ccxt/woo.py +321 -81
  67. ccxt/xt.py +3 -3
  68. ccxt/yobit.py +1 -1
  69. ccxt/zonda.py +1 -1
  70. {ccxt-4.3.62.dist-info → ccxt-4.3.64.dist-info}/METADATA +4 -4
  71. {ccxt-4.3.62.dist-info → ccxt-4.3.64.dist-info}/RECORD +74 -74
  72. {ccxt-4.3.62.dist-info → ccxt-4.3.64.dist-info}/LICENSE.txt +0 -0
  73. {ccxt-4.3.62.dist-info → ccxt-4.3.64.dist-info}/WHEEL +0 -0
  74. {ccxt-4.3.62.dist-info → ccxt-4.3.64.dist-info}/top_level.txt +0 -0
@@ -1556,7 +1556,7 @@ class bitfinex(Exchange, ImplicitAPI):
1556
1556
  # ]
1557
1557
  #
1558
1558
  response = self.safe_value(responses, 0, {})
1559
- id = self.safe_number(response, 'withdrawal_id')
1559
+ id = self.safe_integer(response, 'withdrawal_id')
1560
1560
  message = self.safe_string(response, 'message')
1561
1561
  errorMessage = self.find_broadly_matched_key(self.exceptions['broad'], message)
1562
1562
  if id == 0:
@@ -2237,7 +2237,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2237
2237
  if feeCost is not None:
2238
2238
  feeCost = Precise.string_abs(feeCost)
2239
2239
  amount = self.safe_number(data, 5)
2240
- id = self.safe_string(data, 0)
2240
+ id = self.safe_integer(data, 0)
2241
2241
  status = 'ok'
2242
2242
  if id == 0:
2243
2243
  id = None
@@ -571,7 +571,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
571
571
  }
572
572
  return await self.v1PrivatePostPortfoliosMargin(self.extend(request, params))
573
573
 
574
- async def fetch_deposits_withdrawals(self, code: str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
574
+ async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
575
575
  """
576
576
  fetch history of deposits and withdrawals
577
577
  :see: https://docs.cloud.coinbase.com/intx/reference/gettransfers
@@ -176,6 +176,9 @@ class cryptocom(Exchange, ImplicitAPI):
176
176
  'public/get-expired-settlement-price': 10 / 3,
177
177
  'public/get-insurance': 1,
178
178
  },
179
+ 'post': {
180
+ 'public/staking/get-conversion-rate': 2,
181
+ },
179
182
  },
180
183
  'private': {
181
184
  'post': {
@@ -205,6 +208,16 @@ class cryptocom(Exchange, ImplicitAPI):
205
208
  'private/get-accounts': 10 / 3,
206
209
  'private/get-withdrawal-history': 10 / 3,
207
210
  'private/get-deposit-history': 10 / 3,
211
+ 'private/staking/stake': 2,
212
+ 'private/staking/unstake': 2,
213
+ 'private/staking/get-staking-position': 2,
214
+ 'private/staking/get-staking-instruments': 2,
215
+ 'private/staking/get-open-stake': 2,
216
+ 'private/staking/get-stake-history': 2,
217
+ 'private/staking/get-reward-history': 2,
218
+ 'private/staking/convert': 2,
219
+ 'private/staking/get-open-convert': 2,
220
+ 'private/staking/get-convert-history': 2,
208
221
  },
209
222
  },
210
223
  },
@@ -799,15 +812,17 @@ class cryptocom(Exchange, ImplicitAPI):
799
812
  'timeframe': self.safe_string(self.timeframes, timeframe, timeframe),
800
813
  }
801
814
  if limit is not None:
815
+ if limit > 300:
816
+ limit = 300
802
817
  request['count'] = limit
803
818
  now = self.microseconds()
804
819
  duration = self.parse_timeframe(timeframe)
805
820
  until = self.safe_integer(params, 'until', now)
806
821
  params = self.omit(params, ['until'])
807
822
  if since is not None:
808
- request['start_ts'] = since
823
+ request['start_ts'] = since - duration * 1000
809
824
  if limit is not None:
810
- request['end_ts'] = self.sum(since, duration * (limit + 1) * 1000) - 1
825
+ request['end_ts'] = self.sum(since, duration * limit * 1000)
811
826
  else:
812
827
  request['end_ts'] = until
813
828
  else:
@@ -6,8 +6,9 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.independentreserve import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction
10
10
  from typing import List
11
+ from ccxt.base.errors import BadRequest
11
12
  from ccxt.base.decimal_to_precision import TICK_SIZE
12
13
  from ccxt.base.precise import Precise
13
14
 
@@ -79,6 +80,7 @@ class independentreserve(Exchange, ImplicitAPI):
79
80
  'setLeverage': False,
80
81
  'setMarginMode': False,
81
82
  'setPositionMode': False,
83
+ 'withdraw': True,
82
84
  },
83
85
  'urls': {
84
86
  'logo': 'https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg',
@@ -752,6 +754,106 @@ class independentreserve(Exchange, ImplicitAPI):
752
754
  'network': None,
753
755
  }
754
756
 
757
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
758
+ """
759
+ make a withdrawal
760
+ :see: https://www.independentreserve.com/features/api#WithdrawDigitalCurrency
761
+ :param str code: unified currency code
762
+ :param float amount: the amount to withdraw
763
+ :param str address: the address to withdraw to
764
+ :param str tag:
765
+ :param dict [params]: extra parameters specific to the exchange API endpoint
766
+ *
767
+ * EXCHANGE SPECIFIC PARAMETERS
768
+ :param dict [params.comment]: withdrawal comment, should not exceed 500 characters
769
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
770
+ """
771
+ tag, params = self.handle_withdraw_tag_and_params(tag, params)
772
+ await self.load_markets()
773
+ currency = self.currency(code)
774
+ request: dict = {
775
+ 'primaryCurrencyCode': currency['id'],
776
+ 'withdrawalAddress': address,
777
+ 'amount': self.currency_to_precision(code, amount),
778
+ }
779
+ if tag is not None:
780
+ request['destinationTag'] = tag
781
+ networkCode = None
782
+ networkCode, params = self.handle_network_code_and_params(params)
783
+ if networkCode is not None:
784
+ raise BadRequest(self.id + ' withdraw() does not accept params["networkCode"]')
785
+ response = await self.privatePostWithdrawDigitalCurrency(self.extend(request, params))
786
+ #
787
+ # {
788
+ # "TransactionGuid": "dc932e19-562b-4c50-821e-a73fd048b93b",
789
+ # "PrimaryCurrencyCode": "Bch",
790
+ # "CreatedTimestampUtc": "2020-04-01T05:26:30.5093622+00:00",
791
+ # "Amount": {
792
+ # "Total": 0.1231,
793
+ # "Fee": 0.0001
794
+ # },
795
+ # "Destination": {
796
+ # "Address": "bc1qhpqxkjpvgkckw530yfmxyr53c94q8f4273a7ez",
797
+ # "Tag": null
798
+ # },
799
+ # "Status": "Pending",
800
+ # "Transaction": null
801
+ # }
802
+ #
803
+ return self.parse_transaction(response, currency)
804
+
805
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
806
+ #
807
+ # {
808
+ # "TransactionGuid": "dc932e19-562b-4c50-821e-a73fd048b93b",
809
+ # "PrimaryCurrencyCode": "Bch",
810
+ # "CreatedTimestampUtc": "2020-04-01T05:26:30.5093622+00:00",
811
+ # "Amount": {
812
+ # "Total": 0.1231,
813
+ # "Fee": 0.0001
814
+ # },
815
+ # "Destination": {
816
+ # "Address": "bc1qhpqxkjpvgkckw530yfmxyr53c94q8f4273a7ez",
817
+ # "Tag": null
818
+ # },
819
+ # "Status": "Pending",
820
+ # "Transaction": null
821
+ # }
822
+ #
823
+ amount = self.safe_dict(transaction, 'Amount')
824
+ destination = self.safe_dict(transaction, 'Destination')
825
+ currencyId = self.safe_string(transaction, 'PrimaryCurrencyCode')
826
+ datetime = self.safe_string(transaction, 'CreatedTimestampUtc')
827
+ address = self.safe_string(destination, 'Address')
828
+ tag = self.safe_string(destination, 'Tag')
829
+ code = self.safe_currency_code(currencyId, currency)
830
+ return {
831
+ 'info': transaction,
832
+ 'id': self.safe_string(transaction, 'TransactionGuid'),
833
+ 'txid': None,
834
+ 'type': 'withdraw',
835
+ 'currency': code,
836
+ 'network': None,
837
+ 'amount': self.safe_number(amount, 'Total'),
838
+ 'status': self.safe_string(transaction, 'Status'),
839
+ 'timestamp': self.parse8601(datetime),
840
+ 'datetime': datetime,
841
+ 'address': address,
842
+ 'addressFrom': None,
843
+ 'addressTo': address,
844
+ 'tag': tag,
845
+ 'tagFrom': None,
846
+ 'tagTo': tag,
847
+ 'updated': None,
848
+ 'comment': None,
849
+ 'fee': {
850
+ 'currency': code,
851
+ 'cost': self.safe_number(amount, 'Fee'),
852
+ 'rate': None,
853
+ },
854
+ 'internal': False,
855
+ }
856
+
755
857
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
756
858
  url = self.urls['api'][api] + '/' + path
757
859
  if api == 'public':
@@ -179,6 +179,7 @@ class kucoin(Exchange, ImplicitAPI):
179
179
  'status': 4.5, # 3PW
180
180
  # margin trading
181
181
  'mark-price/{symbol}/current': 3, # 2PW
182
+ 'mark-price/all-symbols': 3,
182
183
  'margin/config': 25, # 25SW
183
184
  },
184
185
  'post': {
@@ -664,6 +665,7 @@ class kucoin(Exchange, ImplicitAPI):
664
665
  'currencies': 'v3',
665
666
  'currencies/{currency}': 'v3',
666
667
  'symbols': 'v2',
668
+ 'mark-price/all-symbols': 'v3',
667
669
  },
668
670
  },
669
671
  'private': {
@@ -12,6 +12,7 @@ from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
13
13
  from ccxt.base.errors import InvalidOrder
14
14
  from ccxt.base.decimal_to_precision import TICK_SIZE
15
+ from ccxt.base.precise import Precise
15
16
 
16
17
 
17
18
  class mercado(Exchange, ImplicitAPI):
@@ -444,7 +445,10 @@ class mercado(Exchange, ImplicitAPI):
444
445
  if side == 'buy':
445
446
  if price is None:
446
447
  raise InvalidOrder(self.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost(amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount')
447
- request['cost'] = self.price_to_precision(market['symbol'], amount * price)
448
+ amountString = self.number_to_string(amount)
449
+ priceString = self.number_to_string(price)
450
+ cost = self.parse_to_numeric(Precise.string_mul(amountString, priceString))
451
+ request['cost'] = self.price_to_precision(market['symbol'], cost)
448
452
  else:
449
453
  request['quantity'] = self.amount_to_precision(market['symbol'], amount)
450
454
  response = await getattr(self, method)(self.extend(request, params))
@@ -2404,7 +2404,7 @@ class whitebit(Exchange, ImplicitAPI):
2404
2404
  records = self.safe_list(response, 'records')
2405
2405
  return self.parse_transactions(records, currency, since, limit)
2406
2406
 
2407
- def is_fiat(self, currency):
2407
+ def is_fiat(self, currency: str):
2408
2408
  fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
2409
2409
  return self.in_array(currency, fiatCurrencies)
2410
2410