ccxt 4.2.73__py2.py3-none-any.whl → 4.2.75__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 (65) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/tradeogre.py +16 -0
  3. ccxt/ascendex.py +5 -4
  4. ccxt/async_support/__init__.py +3 -1
  5. ccxt/async_support/ascendex.py +5 -4
  6. ccxt/async_support/base/exchange.py +1 -1
  7. ccxt/async_support/bitget.py +53 -43
  8. ccxt/async_support/bitmart.py +2 -0
  9. ccxt/async_support/bybit.py +84 -29
  10. ccxt/async_support/coinbase.py +4 -4
  11. ccxt/async_support/coinbaseinternational.py +1 -1
  12. ccxt/async_support/coinbasepro.py +2 -2
  13. ccxt/async_support/coinex.py +4 -3
  14. ccxt/async_support/coinlist.py +2 -2
  15. ccxt/async_support/cryptocom.py +2 -2
  16. ccxt/async_support/currencycom.py +2 -2
  17. ccxt/async_support/deribit.py +2 -2
  18. ccxt/async_support/gate.py +1 -0
  19. ccxt/async_support/htx.py +16 -9
  20. ccxt/async_support/huobijp.py +2 -2
  21. ccxt/async_support/hyperliquid.py +2 -1
  22. ccxt/async_support/kraken.py +3 -3
  23. ccxt/async_support/kucoin.py +3 -3
  24. ccxt/async_support/luno.py +2 -2
  25. ccxt/async_support/mexc.py +2 -2
  26. ccxt/async_support/ndax.py +2 -2
  27. ccxt/async_support/novadax.py +2 -2
  28. ccxt/async_support/okx.py +2 -2
  29. ccxt/async_support/tradeogre.py +598 -0
  30. ccxt/async_support/woo.py +2 -2
  31. ccxt/base/exchange.py +3 -3
  32. ccxt/base/types.py +8 -1
  33. ccxt/bitget.py +53 -43
  34. ccxt/bitmart.py +2 -0
  35. ccxt/bybit.py +84 -29
  36. ccxt/coinbase.py +4 -4
  37. ccxt/coinbaseinternational.py +1 -1
  38. ccxt/coinbasepro.py +2 -2
  39. ccxt/coinex.py +4 -3
  40. ccxt/coinlist.py +2 -2
  41. ccxt/cryptocom.py +2 -2
  42. ccxt/currencycom.py +2 -2
  43. ccxt/deribit.py +2 -2
  44. ccxt/gate.py +1 -0
  45. ccxt/htx.py +16 -9
  46. ccxt/huobijp.py +2 -2
  47. ccxt/hyperliquid.py +2 -1
  48. ccxt/kraken.py +3 -3
  49. ccxt/kucoin.py +3 -3
  50. ccxt/luno.py +2 -2
  51. ccxt/mexc.py +2 -2
  52. ccxt/ndax.py +2 -2
  53. ccxt/novadax.py +2 -2
  54. ccxt/okx.py +2 -2
  55. ccxt/pro/__init__.py +1 -1
  56. ccxt/pro/krakenfutures.py +8 -7
  57. ccxt/test/base/test_market.py +1 -1
  58. ccxt/test/test_async.py +16 -12
  59. ccxt/test/test_sync.py +16 -12
  60. ccxt/tradeogre.py +598 -0
  61. ccxt/woo.py +2 -2
  62. {ccxt-4.2.73.dist-info → ccxt-4.2.75.dist-info}/METADATA +11 -10
  63. {ccxt-4.2.73.dist-info → ccxt-4.2.75.dist-info}/RECORD +65 -62
  64. {ccxt-4.2.73.dist-info → ccxt-4.2.75.dist-info}/WHEEL +0 -0
  65. {ccxt-4.2.73.dist-info → ccxt-4.2.75.dist-info}/top_level.txt +0 -0
ccxt/async_support/htx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -968,6 +968,9 @@ class htx(Exchange, ImplicitAPI):
968
968
  },
969
969
  },
970
970
  },
971
+ 'fetchOHLCV': {
972
+ 'useHistoricalEndpointForSpot': True,
973
+ },
971
974
  'withdraw': {
972
975
  'includeFee': False,
973
976
  },
@@ -2829,6 +2832,7 @@ class htx(Exchange, ImplicitAPI):
2829
2832
  :param int [limit]: the maximum amount of candles to fetch
2830
2833
  :param dict [params]: extra parameters specific to the exchange API endpoint
2831
2834
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2835
+ :param str [params.useHistoricalEndpointForSpot]: True/false - whether use the historical candles endpoint for spot markets or default klines endpoint
2832
2836
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
2833
2837
  """
2834
2838
  await self.load_markets()
@@ -2906,16 +2910,19 @@ class htx(Exchange, ImplicitAPI):
2906
2910
  else:
2907
2911
  response = await self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
2908
2912
  else:
2909
- if since is not None:
2910
- request['from'] = self.parse_to_int(since / 1000)
2911
- if limit is not None:
2912
- request['size'] = limit # max 2000
2913
2913
  request['symbol'] = market['id']
2914
- if timeframe == '1M' or timeframe == '1y':
2915
- # for some reason 1M and 1Y does not work with the regular endpoint
2916
- # https://github.com/ccxt/ccxt/issues/18006
2914
+ useHistorical = None
2915
+ useHistorical, params = self.handle_option_and_params(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', True)
2916
+ if not useHistorical:
2917
+ # `limit` only available for the self endpoint
2918
+ if limit is not None:
2919
+ request['size'] = limit # max 2000
2917
2920
  response = await self.spotPublicGetMarketHistoryKline(self.extend(request, params))
2918
2921
  else:
2922
+ # `since` only available for the self endpoint
2923
+ if since is not None:
2924
+ # default 150 bars
2925
+ request['from'] = self.parse_to_int(since / 1000)
2919
2926
  response = await self.spotPublicGetMarketHistoryCandles(self.extend(request, params))
2920
2927
  #
2921
2928
  # {
@@ -2932,7 +2939,7 @@ class htx(Exchange, ImplicitAPI):
2932
2939
  data = self.safe_value(response, 'data', [])
2933
2940
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
2934
2941
 
2935
- async def fetch_accounts(self, params={}):
2942
+ async def fetch_accounts(self, params={}) -> List[Account]:
2936
2943
  """
2937
2944
  fetch all the accounts associated with a profile
2938
2945
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.huobijp import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -944,7 +944,7 @@ class huobijp(Exchange, ImplicitAPI):
944
944
  data = self.safe_value(response, 'data', [])
945
945
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
946
946
 
947
- async def fetch_accounts(self, params={}):
947
+ async def fetch_accounts(self, params={}) -> List[Account]:
948
948
  """
949
949
  fetch all the accounts associated with a profile
950
950
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -368,7 +368,7 @@ class hyperliquid(Exchange, ImplicitAPI):
368
368
  'optionType': None,
369
369
  'precision': {
370
370
  'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'szDecimals'))), # decimal places
371
- 'price': self.parse_number('5'), # significant digits
371
+ 'price': 5, # significant digits
372
372
  },
373
373
  'limits': {
374
374
  'leverage': {
@@ -824,6 +824,7 @@ class hyperliquid(Exchange, ImplicitAPI):
824
824
  if price is None:
825
825
  raise ArgumentsRequired(self.id + ' market orders require price to calculate the max slippage price. Default slippage can be set in options(default is 5%).')
826
826
  px = Precise.string_mul(price, Precise.string_add('1', slippage)) if (isBuy) else Precise.string_mul(price, Precise.string_sub('1', slippage))
827
+ px = self.price_to_precision(symbol, px) # round after adding slippage
827
828
  else:
828
829
  px = self.price_to_precision(symbol, price)
829
830
  sz = self.amount_to_precision(symbol, amount)
@@ -2586,7 +2586,7 @@ class kraken(Exchange, ImplicitAPI):
2586
2586
  # todo unify parsePosition/parsePositions
2587
2587
  return result
2588
2588
 
2589
- def parse_account(self, account):
2589
+ def parse_account_type(self, account):
2590
2590
  accountByType = {
2591
2591
  'spot': 'Spot Wallet',
2592
2592
  'swap': 'Futures Wallet',
@@ -2618,8 +2618,8 @@ class kraken(Exchange, ImplicitAPI):
2618
2618
  """
2619
2619
  await self.load_markets()
2620
2620
  currency = self.currency(code)
2621
- fromAccount = self.parse_account(fromAccount)
2622
- toAccount = self.parse_account(toAccount)
2621
+ fromAccount = self.parse_account_type(fromAccount)
2622
+ toAccount = self.parse_account_type(toAccount)
2623
2623
  request = {
2624
2624
  'amount': self.currency_to_precision(code, amount),
2625
2625
  'from': fromAccount,
@@ -9,7 +9,7 @@ import asyncio
9
9
  import hashlib
10
10
  import math
11
11
  import json
12
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
12
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
13
13
  from typing import List
14
14
  from ccxt.base.errors import ExchangeError
15
15
  from ccxt.base.errors import PermissionDenied
@@ -480,7 +480,7 @@ class kucoin(Exchange, ImplicitAPI):
480
480
  '400006': AuthenticationError,
481
481
  '400007': AuthenticationError,
482
482
  '400008': NotSupported,
483
- '400100': BadRequest,
483
+ '400100': InsufficientFunds, # {"msg":"account.available.amount","code":"400100"}
484
484
  '400200': InvalidOrder, # {"code":"400200","msg":"Forbidden to place an order"}
485
485
  '400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
486
486
  '400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
@@ -1227,7 +1227,7 @@ class kucoin(Exchange, ImplicitAPI):
1227
1227
  }
1228
1228
  return result
1229
1229
 
1230
- async def fetch_accounts(self, params={}):
1230
+ async def fetch_accounts(self, params={}) -> List[Account]:
1231
1231
  """
1232
1232
  fetch all the accounts associated with a profile
1233
1233
  :see: https://docs.kucoin.com/#list-accounts
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.luno import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
8
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import ArgumentsRequired
@@ -268,7 +268,7 @@ class luno(Exchange, ImplicitAPI):
268
268
  })
269
269
  return result
270
270
 
271
- async def fetch_accounts(self, params={}):
271
+ async def fetch_accounts(self, params={}) -> List[Account]:
272
272
  """
273
273
  fetch all the accounts associated with a profile
274
274
  :see: https://www.luno.com/en/developers/api#tag/Accounts/operation/getBalances
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, IndexType, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currency, IndexType, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -3319,7 +3319,7 @@ class mexc(Exchange, ImplicitAPI):
3319
3319
  return self.safe_value(response, 'data')
3320
3320
  return None
3321
3321
 
3322
- async def fetch_accounts(self, params={}):
3322
+ async def fetch_accounts(self, params={}) -> List[Account]:
3323
3323
  """
3324
3324
  fetch all the accounts associated with a profile
3325
3325
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.ndax import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
10
+ from ccxt.base.types import Account, Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import BadSymbol
@@ -962,7 +962,7 @@ class ndax(Exchange, ImplicitAPI):
962
962
  #
963
963
  return self.parse_trades(response, market, since, limit)
964
964
 
965
- async def fetch_accounts(self, params={}):
965
+ async def fetch_accounts(self, params={}) -> List[Account]:
966
966
  """
967
967
  fetch all the accounts associated with a profile
968
968
  :see: https://apidoc.ndax.io/#getuseraccounts
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.novadax import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -1185,7 +1185,7 @@ class novadax(Exchange, ImplicitAPI):
1185
1185
  #
1186
1186
  return self.parse_transaction(response, currency)
1187
1187
 
1188
- async def fetch_accounts(self, params={}):
1188
+ async def fetch_accounts(self, params={}) -> List[Account]:
1189
1189
  """
1190
1190
  fetch all the accounts associated with a profile
1191
1191
  :see: https://doc.novadax.com/en-US/#get-sub-account-list
ccxt/async_support/okx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currency, Greeks, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -1276,7 +1276,7 @@ class okx(Exchange, ImplicitAPI):
1276
1276
  first = self.safe_value(data, 0, {})
1277
1277
  return self.safe_integer(first, 'ts')
1278
1278
 
1279
- async def fetch_accounts(self, params={}):
1279
+ async def fetch_accounts(self, params={}) -> List[Account]:
1280
1280
  """
1281
1281
  fetch all the accounts associated with a profile
1282
1282
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration