ccxt 4.2.77__py2.py3-none-any.whl → 4.2.78__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/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.77'
25
+ __version__ = '4.2.78'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.77'
7
+ __version__ = '4.2.78'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.77'
5
+ __version__ = '4.2.78'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -7526,11 +7526,14 @@ class bybit(Exchange, ImplicitAPI):
7526
7526
  tier = info[i]
7527
7527
  marketId = self.safe_string(info, 'symbol')
7528
7528
  market = self.safe_market(marketId)
7529
+ minNotional = self.parse_number('0')
7530
+ if i != 0:
7531
+ minNotional = self.safe_number(info[i - 1], 'riskLimitValue')
7529
7532
  tiers.append({
7530
7533
  'tier': self.safe_integer(tier, 'id'),
7531
7534
  'currency': market['settle'],
7532
- 'minNotional': None,
7533
- 'maxNotional': None,
7535
+ 'minNotional': minNotional,
7536
+ 'maxNotional': self.safe_number(tier, 'riskLimitValue'),
7534
7537
  'maintenanceMarginRate': self.safe_number(tier, 'maintenanceMargin'),
7535
7538
  'maxLeverage': self.safe_number(tier, 'maxLeverage'),
7536
7539
  'info': tier,
@@ -1041,7 +1041,9 @@ class coinbase(Exchange, ImplicitAPI):
1041
1041
  :returns dict[]: an array of objects representing market data
1042
1042
  """
1043
1043
  method = self.safe_string(self.options, 'fetchMarkets', 'fetchMarketsV3')
1044
- return await getattr(self, method)(params)
1044
+ if method == 'fetchMarketsV3':
1045
+ return await self.fetch_markets_v3(params)
1046
+ return await self.fetch_markets_v2(params)
1045
1047
 
1046
1048
  async def fetch_markets_v2(self, params={}):
1047
1049
  response = await self.fetch_currencies_from_cache(params)
@@ -1113,7 +1115,13 @@ class coinbase(Exchange, ImplicitAPI):
1113
1115
  return result
1114
1116
 
1115
1117
  async def fetch_markets_v3(self, params={}):
1116
- response = await self.v3PrivateGetBrokerageProducts(params)
1118
+ promisesUnresolved = [
1119
+ self.v3PrivateGetBrokerageProducts(params),
1120
+ self.v3PrivateGetBrokerageTransactionSummary(params),
1121
+ ]
1122
+ # response = await self.v3PrivateGetBrokerageProducts(params)
1123
+ promises = await asyncio.gather(*promisesUnresolved)
1124
+ response = self.safe_dict(promises, 0, {})
1117
1125
  #
1118
1126
  # [
1119
1127
  # {
@@ -1148,7 +1156,8 @@ class coinbase(Exchange, ImplicitAPI):
1148
1156
  # ...
1149
1157
  # ]
1150
1158
  #
1151
- fees = await self.v3PrivateGetBrokerageTransactionSummary(params)
1159
+ # fees = await self.v3PrivateGetBrokerageTransactionSummary(params)
1160
+ fees = self.safe_dict(promises, 1, {})
1152
1161
  #
1153
1162
  # {
1154
1163
  # "total_volume": 0,
@@ -1832,6 +1841,8 @@ class coinbase(Exchange, ImplicitAPI):
1832
1841
  response = await self.v2PrivateGetAccountsAccountIdTransactions(self.extend(request, params))
1833
1842
  ledger = self.parse_ledger(response['data'], currency, since, limit)
1834
1843
  length = len(ledger)
1844
+ if length == 0:
1845
+ return ledger
1835
1846
  lastIndex = length - 1
1836
1847
  last = self.safe_dict(ledger, lastIndex)
1837
1848
  pagination = self.safe_dict(response, 'pagination', {})
@@ -2165,9 +2176,9 @@ class coinbase(Exchange, ImplicitAPI):
2165
2176
  'fee': fee,
2166
2177
  }
2167
2178
 
2168
- async def find_account_id(self, code):
2179
+ async def find_account_id(self, code, params={}):
2169
2180
  await self.load_markets()
2170
- await self.load_accounts()
2181
+ await self.load_accounts(False, params)
2171
2182
  for i in range(0, len(self.accounts)):
2172
2183
  account = self.accounts[i]
2173
2184
  if account['code'] == code:
@@ -2191,7 +2202,7 @@ class coinbase(Exchange, ImplicitAPI):
2191
2202
  if accountId is None:
2192
2203
  if code is None:
2193
2204
  raise ArgumentsRequired(self.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id(or accountId) parameter OR a currency code argument')
2194
- accountId = await self.find_account_id(code)
2205
+ accountId = await self.find_account_id(code, params)
2195
2206
  if accountId is None:
2196
2207
  raise ExchangeError(self.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code)
2197
2208
  request = {
@@ -3220,7 +3231,7 @@ class coinbase(Exchange, ImplicitAPI):
3220
3231
  if accountId is None:
3221
3232
  if code is None:
3222
3233
  raise ArgumentsRequired(self.id + ' withdraw() requires an account_id(or accountId) parameter OR a currency code argument')
3223
- accountId = await self.find_account_id(code)
3234
+ accountId = await self.find_account_id(code, params)
3224
3235
  if accountId is None:
3225
3236
  raise ExchangeError(self.id + ' withdraw() could not find account id for ' + code)
3226
3237
  request = {
@@ -3437,7 +3448,7 @@ class coinbase(Exchange, ImplicitAPI):
3437
3448
  if accountId is None:
3438
3449
  if code is None:
3439
3450
  raise ArgumentsRequired(self.id + ' deposit() requires an account_id(or accountId) parameter OR a currency code argument')
3440
- accountId = await self.find_account_id(code)
3451
+ accountId = await self.find_account_id(code, params)
3441
3452
  if accountId is None:
3442
3453
  raise ExchangeError(self.id + ' deposit() could not find account id for ' + code)
3443
3454
  request = {
@@ -3502,7 +3513,7 @@ class coinbase(Exchange, ImplicitAPI):
3502
3513
  if accountId is None:
3503
3514
  if code is None:
3504
3515
  raise ArgumentsRequired(self.id + ' fetchDeposit() requires an account_id(or accountId) parameter OR a currency code argument')
3505
- accountId = await self.find_account_id(code)
3516
+ accountId = await self.find_account_id(code, params)
3506
3517
  if accountId is None:
3507
3518
  raise ExchangeError(self.id + ' fetchDeposit() could not find account id for ' + code)
3508
3519
  request = {
@@ -68,6 +68,7 @@ class gate(Exchange, ImplicitAPI):
68
68
  'rebate': 'https://api.gateio.ws/api/v4',
69
69
  'earn': 'https://api.gateio.ws/api/v4',
70
70
  'account': 'https://api.gateio.ws/api/v4',
71
+ 'loan': 'https://api.gateio.ws/api/v4',
71
72
  },
72
73
  },
73
74
  'test': {
ccxt/async_support/htx.py CHANGED
@@ -2849,63 +2849,68 @@ class htx(Exchange, ImplicitAPI):
2849
2849
  # 'from': int((since / str(1000))), spot only
2850
2850
  # 'to': self.seconds(), spot only
2851
2851
  }
2852
- price = self.safe_string(params, 'price')
2853
- params = self.omit(params, 'price')
2852
+ priceType = self.safe_string_n(params, ['priceType', 'price'])
2853
+ params = self.omit(params, ['priceType', 'price'])
2854
+ until = None
2855
+ until, params = self.handle_param_integer(params, 'until')
2856
+ untilSeconds = self.parse_to_int(until / 1000) if (until is not None) else None
2854
2857
  if market['contract']:
2855
2858
  if limit is not None:
2856
- request['size'] = limit # when using limit from and to are ignored
2859
+ request['size'] = limit # when using limit: from & to are ignored
2857
2860
  # https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
2858
2861
  else:
2859
2862
  limit = 2000 # only used for from/to calculation
2860
- if price is None:
2863
+ if priceType is None:
2861
2864
  duration = self.parse_timeframe(timeframe)
2865
+ calcualtedEnd = None
2862
2866
  if since is None:
2863
2867
  now = self.seconds()
2864
2868
  request['from'] = now - duration * (limit - 1)
2865
- request['to'] = now
2869
+ calcualtedEnd = now
2866
2870
  else:
2867
2871
  start = self.parse_to_int(since / 1000)
2868
2872
  request['from'] = start
2869
- request['to'] = self.sum(start, duration * (limit - 1))
2873
+ calcualtedEnd = self.sum(start, duration * (limit - 1))
2874
+ request['to'] = untilSeconds if (untilSeconds is not None) else calcualtedEnd
2870
2875
  response = None
2871
2876
  if market['future']:
2872
2877
  if market['inverse']:
2873
2878
  request['symbol'] = market['id']
2874
- if price == 'mark':
2879
+ if priceType == 'mark':
2875
2880
  response = await self.contractPublicGetIndexMarketHistoryMarkPriceKline(self.extend(request, params))
2876
- elif price == 'index':
2881
+ elif priceType == 'index':
2877
2882
  response = await self.contractPublicGetIndexMarketHistoryIndex(self.extend(request, params))
2878
- elif price == 'premiumIndex':
2879
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2883
+ elif priceType == 'premiumIndex':
2884
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2880
2885
  else:
2881
2886
  response = await self.contractPublicGetMarketHistoryKline(self.extend(request, params))
2882
2887
  elif market['linear']:
2883
2888
  request['contract_code'] = market['id']
2884
- if price == 'mark':
2889
+ if priceType == 'mark':
2885
2890
  response = await self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
2886
- elif price == 'index':
2887
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2888
- elif price == 'premiumIndex':
2891
+ elif priceType == 'index':
2892
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2893
+ elif priceType == 'premiumIndex':
2889
2894
  response = await self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
2890
2895
  else:
2891
2896
  response = await self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
2892
2897
  elif market['swap']:
2893
2898
  request['contract_code'] = market['id']
2894
2899
  if market['inverse']:
2895
- if price == 'mark':
2900
+ if priceType == 'mark':
2896
2901
  response = await self.contractPublicGetIndexMarketHistorySwapMarkPriceKline(self.extend(request, params))
2897
- elif price == 'index':
2898
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2899
- elif price == 'premiumIndex':
2902
+ elif priceType == 'index':
2903
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2904
+ elif priceType == 'premiumIndex':
2900
2905
  response = await self.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(self.extend(request, params))
2901
2906
  else:
2902
2907
  response = await self.contractPublicGetSwapExMarketHistoryKline(self.extend(request, params))
2903
2908
  elif market['linear']:
2904
- if price == 'mark':
2909
+ if priceType == 'mark':
2905
2910
  response = await self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
2906
- elif price == 'index':
2907
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2908
- elif price == 'premiumIndex':
2911
+ elif priceType == 'index':
2912
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2913
+ elif priceType == 'premiumIndex':
2909
2914
  response = await self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
2910
2915
  else:
2911
2916
  response = await self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
@@ -2914,15 +2919,17 @@ class htx(Exchange, ImplicitAPI):
2914
2919
  useHistorical = None
2915
2920
  useHistorical, params = self.handle_option_and_params(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', True)
2916
2921
  if not useHistorical:
2917
- # `limit` only available for the self endpoint
2918
2922
  if limit is not None:
2919
- request['size'] = limit # max 2000
2923
+ request['size'] = min(2000, limit) # max 2000
2920
2924
  response = await self.spotPublicGetMarketHistoryKline(self.extend(request, params))
2921
2925
  else:
2922
- # `since` only available for the self endpoint
2926
+ # "from & to" only available for the self endpoint
2923
2927
  if since is not None:
2924
- # default 150 bars
2925
2928
  request['from'] = self.parse_to_int(since / 1000)
2929
+ if untilSeconds is not None:
2930
+ request['to'] = untilSeconds
2931
+ if limit is not None:
2932
+ request['size'] = min(1000, limit) # max 1000, otherwise default returns 150
2926
2933
  response = await self.spotPublicGetMarketHistoryCandles(self.extend(request, params))
2927
2934
  #
2928
2935
  # {
@@ -2936,7 +2943,7 @@ class htx(Exchange, ImplicitAPI):
2936
2943
  # ]
2937
2944
  # }
2938
2945
  #
2939
- data = self.safe_value(response, 'data', [])
2946
+ data = self.safe_list(response, 'data', [])
2940
2947
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
2941
2948
 
2942
2949
  async def fetch_accounts(self, params={}) -> List[Account]:
@@ -747,8 +747,9 @@ class hyperliquid(Exchange, ImplicitAPI):
747
747
  :param bool [params.postOnly]: True or False whether the order is post-only
748
748
  :param bool [params.reduceOnly]: True or False whether the order is reduce-only
749
749
  :param float [params.triggerPrice]: The price at which a trigger order is triggered at
750
- :param str [params.clientOrderId]: client order id, optional 128 bit hex string
750
+ :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
751
751
  :param str [params.slippage]: the slippage for market order
752
+ :param str [params.vaultAddress]: the vault address for order
752
753
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
753
754
  """
754
755
  await self.load_markets()
@@ -791,7 +792,7 @@ class hyperliquid(Exchange, ImplicitAPI):
791
792
  clientOrderId = self.safe_string_2(orderParams, 'clientOrderId', 'client_id')
792
793
  if clientOrderId is None:
793
794
  raise ArgumentsRequired(self.id + ' createOrders() all orders must have clientOrderId if at least one has a clientOrderId')
794
- params = self.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice'])
795
+ params = self.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce'])
795
796
  nonce = self.milliseconds()
796
797
  orderReq = []
797
798
  for i in range(0, len(orders)):
@@ -905,7 +906,7 @@ class hyperliquid(Exchange, ImplicitAPI):
905
906
  :param str id: order id
906
907
  :param str symbol: unified symbol of the market the order was made in
907
908
  :param dict [params]: extra parameters specific to the exchange API endpoint
908
- :param str [params.clientOrderId]: client order id(default None)
909
+ :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
909
910
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
910
911
  """
911
912
  return await self.cancel_orders([id], symbol, params)
@@ -918,7 +919,7 @@ class hyperliquid(Exchange, ImplicitAPI):
918
919
  :param str[] ids: order ids
919
920
  :param str [symbol]: unified market symbol
920
921
  :param dict [params]: extra parameters specific to the exchange API endpoint
921
- :param string|str[] [params.clientOrderId]: client order ids(default None)
922
+ :param string|str[] [params.clientOrderId]: client order ids,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
922
923
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
923
924
  """
924
925
  self.check_required_credentials()
@@ -993,6 +994,7 @@ class hyperliquid(Exchange, ImplicitAPI):
993
994
  :param bool [params.reduceOnly]: True or False whether the order is reduce-only
994
995
  :param float [params.triggerPrice]: The price at which a trigger order is triggered at
995
996
  :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
997
+ :param str [params.vaultAddress]: the vault address for order
996
998
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
997
999
  """
998
1000
  self.check_required_credentials()
@@ -465,6 +465,56 @@ class kucoin(Exchange, ImplicitAPI):
465
465
  '130202': ExchangeError, # The system is renewing the loan automatically. Please try again later
466
466
  '130203': InsufficientFunds, # Insufficient account balance
467
467
  '130204': BadRequest, # As the total lending amount for platform leverage reaches the platform's maximum position limit, the system suspends the borrowing function of leverage
468
+ '130301': InsufficientFunds, # Insufficient account balance
469
+ '130302': PermissionDenied, # Your relevant permission rights have been restricted, you can contact customer service for processing
470
+ '130303': NotSupported, # The current trading pair does not support isolated positions
471
+ '130304': NotSupported, # The trading function of the current trading pair is not enabled
472
+ '130305': NotSupported, # The current trading pair does not support cross position
473
+ '130306': NotSupported, # The account has not opened leveraged trading
474
+ '130307': NotSupported, # Please reopen the leverage agreement
475
+ '130308': InvalidOrder, # Position renewal freeze
476
+ '130309': InvalidOrder, # Position forced liquidation freeze
477
+ '130310': ExchangeError, # Abnormal leverage account status
478
+ '130311': InvalidOrder, # Failed to place an order, triggering buy limit
479
+ '130312': InvalidOrder, # Trigger global position limit, suspend buying
480
+ '130313': InvalidOrder, # Trigger global position limit, suspend selling
481
+ '130314': InvalidOrder, # Trigger the global position limit and prompt the remaining quantity available for purchase
482
+ '130315': NotSupported, # This feature has been suspended due to country restrictions
483
+ '126000': ExchangeError, # Abnormal margin trading
484
+ '126001': NotSupported, # Users currently do not support high frequency
485
+ '126002': ExchangeError, # There is a risk problem in your account and transactions are temporarily not allowed!
486
+ '126003': InvalidOrder, # The commission amount is less than the minimum transaction amount for a single commission
487
+ '126004': ExchangeError, # Trading pair does not exist or is prohibited
488
+ '126005': PermissionDenied, # This trading pair requires advanced KYC certification before trading
489
+ '126006': ExchangeError, # Trading pair is not available
490
+ '126007': ExchangeError, # Trading pair suspended
491
+ '126009': ExchangeError, # Trading pair is suspended from creating orders
492
+ '126010': ExchangeError, # Trading pair suspended order cancellation
493
+ '126011': ExchangeError, # There are too many orders in the order
494
+ '126013': InsufficientFunds, # Insufficient account balance
495
+ '126015': ExchangeError, # It is prohibited to place orders on self trading pair
496
+ '126021': NotSupported, # This digital asset does not support user participation in your region, thank you for your understanding!
497
+ '126022': InvalidOrder, # The final transaction price of your order will trigger the price protection strategy. To protect the price from deviating too much, please place an order again.
498
+ '126027': InvalidOrder, # Only limit orders are supported
499
+ '126028': InvalidOrder, # Only limit orders are supported before the specified time
500
+ '126029': InvalidOrder, # The maximum order price is: xxx
501
+ '126030': InvalidOrder, # The minimum order price is: xxx
502
+ '126033': InvalidOrder, # Duplicate order
503
+ '126034': InvalidOrder, # Failed to create take profit and stop loss order
504
+ '126036': InvalidOrder, # Failed to create margin order
505
+ '126037': ExchangeError, # Due to country and region restrictions, self function has been suspended!
506
+ '126038': ExchangeError, # Third-party service call failed(internal exception)
507
+ '126039': ExchangeError, # Third-party service call failed, reason: xxx
508
+ '126041': ExchangeError, # clientTimestamp parameter error
509
+ '126042': ExchangeError, # Exceeded maximum position limit
510
+ '126043': OrderNotFound, # Order does not exist
511
+ '126044': InvalidOrder, # clientOid duplicate
512
+ '126045': NotSupported, # This digital asset does not support user participation in your region, thank you for your understanding!
513
+ '126046': NotSupported, # This digital asset does not support your IP region, thank you for your understanding!
514
+ '126047': PermissionDenied, # Please complete identity verification
515
+ '126048': PermissionDenied, # Please complete authentication for the master account
516
+ '135005': ExchangeError, # Margin order query business abnormality
517
+ '135018': ExchangeError, # Margin order query service abnormality
468
518
  '200004': InsufficientFunds,
469
519
  '210014': InvalidOrder, # {"code":"210014","msg":"Exceeds the max. borrowing amount, the remaining amount you can borrow: 0USDT"}
470
520
  '210021': InsufficientFunds, # {"code":"210021","msg":"Balance not enough"}
@@ -486,10 +536,12 @@ class kucoin(Exchange, ImplicitAPI):
486
536
  '400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
487
537
  '400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
488
538
  '400400': BadRequest, # Parameter error
539
+ '400401': AuthenticationError, # User is not logged in
489
540
  '400500': InvalidOrder, # {"code":"400500","msg":"Your located country/region is currently not supported for the trading of self token"}
490
541
  '400600': BadSymbol, # {"code":"400600","msg":"validation.createOrder.symbolNotAvailable"}
491
542
  '400760': InvalidOrder, # {"code":"400760","msg":"order price should be more than XX"}
492
543
  '401000': BadRequest, # {"code":"401000","msg":"The interface has been deprecated"}
544
+ '408000': BadRequest, # Network timeout, please try again later
493
545
  '411100': AccountSuspended,
494
546
  '415000': BadRequest, # {"code":"415000","msg":"Unsupported Media Type"}
495
547
  '400303': PermissionDenied, # {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"}
@@ -266,6 +266,16 @@ class okcoin(Exchange, ImplicitAPI):
266
266
  '50026': ExchangeNotAvailable, # System error, please try again later.
267
267
  '50027': PermissionDenied, # The account is restricted from trading
268
268
  '50028': ExchangeError, # Unable to take the order, please reach out to support center for details
269
+ '50029': ExchangeError, # This instrument({0}) is unavailable at present due to risk management. Please contact customer service for help.
270
+ '50030': PermissionDenied, # No permission to use self API
271
+ '50032': AccountSuspended, # This asset is blocked, allow its trading and try again
272
+ '50033': AccountSuspended, # This instrument is blocked, allow its trading and try again
273
+ '50035': BadRequest, # This endpoint requires that APIKey must be bound to IP
274
+ '50036': BadRequest, # Invalid expTime
275
+ '50037': BadRequest, # Order expired
276
+ '50038': ExchangeError, # This feature is temporarily unavailable in demo trading
277
+ '50039': ExchangeError, # The before parameter is not available for implementing timestamp pagination
278
+ '50041': ExchangeError, # You are not currently on the whitelist, please contact customer service
269
279
  '50044': BadRequest, # Must select one broker type
270
280
  # API Class
271
281
  '50100': ExchangeError, # API frozen, please contact customer service
@@ -309,9 +319,25 @@ class okcoin(Exchange, ImplicitAPI):
309
319
  '51024': AccountSuspended, # Unified accountblocked
310
320
  '51025': ExchangeError, # Order count exceeds the limit
311
321
  '51026': BadSymbol, # Instrument type does not match underlying index
322
+ '51030': InvalidOrder, # Funding fee is being settled.
323
+ '51031': InvalidOrder, # This order price is not within the closing price range
324
+ '51032': InvalidOrder, # Closing all positions at market price.
325
+ '51033': InvalidOrder, # The total amount per order for self pair has reached the upper limit.
326
+ '51037': InvalidOrder, # The current account risk status only supports you to place IOC orders that can reduce the risk of your account.
327
+ '51038': InvalidOrder, # There is already an IOC order under the current risk module that reduces the risk of the account.
328
+ '51044': InvalidOrder, # The order type {0}, {1} is not allowed to set stop loss and take profit
312
329
  '51046': InvalidOrder, # The take profit trigger price must be higher than the order price
313
330
  '51047': InvalidOrder, # The stop loss trigger price must be lower than the order price
314
- '51031': InvalidOrder, # This order price is not within the closing price range
331
+ '51048': InvalidOrder, # The take profit trigger price should be lower than the order price
332
+ '51049': InvalidOrder, # The stop loss trigger price should be higher than the order price
333
+ '51050': InvalidOrder, # The take profit trigger price should be higher than the best ask price
334
+ '51051': InvalidOrder, # The stop loss trigger price should be lower than the best ask price
335
+ '51052': InvalidOrder, # The take profit trigger price should be lower than the best bid price
336
+ '51053': InvalidOrder, # The stop loss trigger price should be higher than the best bid price
337
+ '51054': BadRequest, # Getting information timed out, please try again later
338
+ '51056': InvalidOrder, # Action not allowed
339
+ '51058': InvalidOrder, # No available position for self algo order
340
+ '51059': InvalidOrder, # Strategy for the current state does not support self operation
315
341
  '51100': InvalidOrder, # Trading amount does not meet the min tradable amount
316
342
  '51102': InvalidOrder, # Entered amount exceeds the max pending count
317
343
  '51103': InvalidOrder, # Entered amount exceeds the max pending order count of the underlying asset
ccxt/async_support/okx.py CHANGED
@@ -596,6 +596,7 @@ class okx(Exchange, ImplicitAPI):
596
596
  '50027': PermissionDenied, # The account is restricted from trading
597
597
  '50028': ExchangeError, # Unable to take the order, please reach out to support center for details
598
598
  '50044': BadRequest, # Must select one broker type
599
+ '50061': ExchangeError, # You've reached the maximum order rate limit for self account.
599
600
  '50062': ExchangeError, # This feature is currently unavailable.
600
601
  # API Class
601
602
  '50100': ExchangeError, # API frozen, please contact customer service
@@ -783,6 +784,15 @@ class okx(Exchange, ImplicitAPI):
783
784
  # SPOT/MARGIN error codes 54000-54999
784
785
  '54000': ExchangeError, # Margin transactions unavailable
785
786
  '54001': ExchangeError, # Only Multi-currency margin account can be set to borrow coins automatically
787
+ # Trading bot Error Code from 55100 to 55999
788
+ '55100': InvalidOrder, # Take profit % should be within the range of {parameter1}-{parameter2}
789
+ '55101': InvalidOrder, # Stop loss % should be within the range of {parameter1}-{parameter2}
790
+ '55102': InvalidOrder, # Take profit % should be greater than the current bot’s PnL%
791
+ '55103': InvalidOrder, # Stop loss % should be less than the current bot’s PnL%
792
+ '55104': InvalidOrder, # Only futures grid supports take profit or stop loss based on profit percentage
793
+ '55111': InvalidOrder, # This signal name is in use, please try a new name
794
+ '55112': InvalidOrder, # This signal does not exist
795
+ '55113': InvalidOrder, # Create signal strategies with leverage greater than the maximum leverage of the instruments
786
796
  # FUNDING error codes 58000-58999
787
797
  '58000': ExchangeError, # Account type {0} does not supported when getting the sub-account balance
788
798
  '58001': AuthenticationError, # Incorrect trade password
@@ -4700,6 +4710,14 @@ class okx(Exchange, ImplicitAPI):
4700
4710
  '3': 'pending',
4701
4711
  '4': 'pending',
4702
4712
  '5': 'pending',
4713
+ '6': 'pending',
4714
+ '7': 'pending',
4715
+ '8': 'pending',
4716
+ '9': 'pending',
4717
+ '10': 'pending',
4718
+ '12': 'pending',
4719
+ '15': 'pending',
4720
+ '16': 'pending',
4703
4721
  }
4704
4722
  return self.safe_string(statuses, status, status)
4705
4723
 
ccxt/async_support/woo.py CHANGED
@@ -65,7 +65,7 @@ class woo(Exchange, ImplicitAPI):
65
65
  'fetchBalance': True,
66
66
  'fetchCanceledOrders': False,
67
67
  'fetchClosedOrder': False,
68
- 'fetchClosedOrders': False,
68
+ 'fetchClosedOrders': True,
69
69
  'fetchCurrencies': True,
70
70
  'fetchDepositAddress': True,
71
71
  'fetchDeposits': True,
@@ -84,7 +84,7 @@ class woo(Exchange, ImplicitAPI):
84
84
  'fetchOHLCV': True,
85
85
  'fetchOpenInterestHistory': False,
86
86
  'fetchOpenOrder': False,
87
- 'fetchOpenOrders': False,
87
+ 'fetchOpenOrders': True,
88
88
  'fetchOrder': True,
89
89
  'fetchOrderBook': True,
90
90
  'fetchOrders': True,
@@ -1341,7 +1341,47 @@ class woo(Exchange, ImplicitAPI):
1341
1341
  #
1342
1342
  data = self.safe_value(response, 'data', response)
1343
1343
  orders = self.safe_list(data, 'rows')
1344
- return self.parse_orders(orders, market, since, limit, params)
1344
+ return self.parse_orders(orders, market, since, limit)
1345
+
1346
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1347
+ """
1348
+ fetches information on multiple orders made by the user
1349
+ :see: https://docs.woo.org/#get-orders
1350
+ :see: https://docs.woo.org/#get-algo-orders
1351
+ :param str symbol: unified market symbol of the market orders were made in
1352
+ :param int [since]: the earliest time in ms to fetch orders for
1353
+ :param int [limit]: the maximum number of order structures to retrieve
1354
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1355
+ :param boolean [params.stop]: whether the order is a stop/algo order
1356
+ :param boolean [params.isTriggered]: whether the order has been triggered(False by default)
1357
+ :param str [params.side]: 'buy' or 'sell'
1358
+ :param boolean [params.trailing]: set to True if you want to fetch trailing orders
1359
+ :param boolean [params.paginate]: set to True if you want to fetch orders with pagination
1360
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1361
+ """
1362
+ await self.load_markets()
1363
+ extendedParams = self.extend(params, {'status': 'INCOMPLETE'})
1364
+ return await self.fetch_orders(symbol, since, limit, extendedParams)
1365
+
1366
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1367
+ """
1368
+ fetches information on multiple orders made by the user
1369
+ :see: https://docs.woo.org/#get-orders
1370
+ :see: https://docs.woo.org/#get-algo-orders
1371
+ :param str symbol: unified market symbol of the market orders were made in
1372
+ :param int [since]: the earliest time in ms to fetch orders for
1373
+ :param int [limit]: the maximum number of order structures to retrieve
1374
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1375
+ :param boolean [params.stop]: whether the order is a stop/algo order
1376
+ :param boolean [params.isTriggered]: whether the order has been triggered(False by default)
1377
+ :param str [params.side]: 'buy' or 'sell'
1378
+ :param boolean [params.trailing]: set to True if you want to fetch trailing orders
1379
+ :param boolean [params.paginate]: set to True if you want to fetch orders with pagination
1380
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1381
+ """
1382
+ await self.load_markets()
1383
+ extendedParams = self.extend(params, {'status': 'COMPLETED'})
1384
+ return await self.fetch_orders(symbol, since, limit, extendedParams)
1345
1385
 
1346
1386
  def parse_time_in_force(self, timeInForce):
1347
1387
  timeInForces = {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.77'
7
+ __version__ = '4.2.78'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/bybit.py CHANGED
@@ -7525,11 +7525,14 @@ class bybit(Exchange, ImplicitAPI):
7525
7525
  tier = info[i]
7526
7526
  marketId = self.safe_string(info, 'symbol')
7527
7527
  market = self.safe_market(marketId)
7528
+ minNotional = self.parse_number('0')
7529
+ if i != 0:
7530
+ minNotional = self.safe_number(info[i - 1], 'riskLimitValue')
7528
7531
  tiers.append({
7529
7532
  'tier': self.safe_integer(tier, 'id'),
7530
7533
  'currency': market['settle'],
7531
- 'minNotional': None,
7532
- 'maxNotional': None,
7534
+ 'minNotional': minNotional,
7535
+ 'maxNotional': self.safe_number(tier, 'riskLimitValue'),
7533
7536
  'maintenanceMarginRate': self.safe_number(tier, 'maintenanceMargin'),
7534
7537
  'maxLeverage': self.safe_number(tier, 'maxLeverage'),
7535
7538
  'info': tier,