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/coinbase.py CHANGED
@@ -1040,7 +1040,9 @@ class coinbase(Exchange, ImplicitAPI):
1040
1040
  :returns dict[]: an array of objects representing market data
1041
1041
  """
1042
1042
  method = self.safe_string(self.options, 'fetchMarkets', 'fetchMarketsV3')
1043
- return getattr(self, method)(params)
1043
+ if method == 'fetchMarketsV3':
1044
+ return self.fetch_markets_v3(params)
1045
+ return self.fetch_markets_v2(params)
1044
1046
 
1045
1047
  def fetch_markets_v2(self, params={}):
1046
1048
  response = self.fetch_currencies_from_cache(params)
@@ -1112,7 +1114,13 @@ class coinbase(Exchange, ImplicitAPI):
1112
1114
  return result
1113
1115
 
1114
1116
  def fetch_markets_v3(self, params={}):
1115
- response = self.v3PrivateGetBrokerageProducts(params)
1117
+ promisesUnresolved = [
1118
+ self.v3PrivateGetBrokerageProducts(params),
1119
+ self.v3PrivateGetBrokerageTransactionSummary(params),
1120
+ ]
1121
+ # response = self.v3PrivateGetBrokerageProducts(params)
1122
+ promises = promisesUnresolved
1123
+ response = self.safe_dict(promises, 0, {})
1116
1124
  #
1117
1125
  # [
1118
1126
  # {
@@ -1147,7 +1155,8 @@ class coinbase(Exchange, ImplicitAPI):
1147
1155
  # ...
1148
1156
  # ]
1149
1157
  #
1150
- fees = self.v3PrivateGetBrokerageTransactionSummary(params)
1158
+ # fees = self.v3PrivateGetBrokerageTransactionSummary(params)
1159
+ fees = self.safe_dict(promises, 1, {})
1151
1160
  #
1152
1161
  # {
1153
1162
  # "total_volume": 0,
@@ -1831,6 +1840,8 @@ class coinbase(Exchange, ImplicitAPI):
1831
1840
  response = self.v2PrivateGetAccountsAccountIdTransactions(self.extend(request, params))
1832
1841
  ledger = self.parse_ledger(response['data'], currency, since, limit)
1833
1842
  length = len(ledger)
1843
+ if length == 0:
1844
+ return ledger
1834
1845
  lastIndex = length - 1
1835
1846
  last = self.safe_dict(ledger, lastIndex)
1836
1847
  pagination = self.safe_dict(response, 'pagination', {})
@@ -2164,9 +2175,9 @@ class coinbase(Exchange, ImplicitAPI):
2164
2175
  'fee': fee,
2165
2176
  }
2166
2177
 
2167
- def find_account_id(self, code):
2178
+ def find_account_id(self, code, params={}):
2168
2179
  self.load_markets()
2169
- self.load_accounts()
2180
+ self.load_accounts(False, params)
2170
2181
  for i in range(0, len(self.accounts)):
2171
2182
  account = self.accounts[i]
2172
2183
  if account['code'] == code:
@@ -2190,7 +2201,7 @@ class coinbase(Exchange, ImplicitAPI):
2190
2201
  if accountId is None:
2191
2202
  if code is None:
2192
2203
  raise ArgumentsRequired(self.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id(or accountId) parameter OR a currency code argument')
2193
- accountId = self.find_account_id(code)
2204
+ accountId = self.find_account_id(code, params)
2194
2205
  if accountId is None:
2195
2206
  raise ExchangeError(self.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code)
2196
2207
  request = {
@@ -3219,7 +3230,7 @@ class coinbase(Exchange, ImplicitAPI):
3219
3230
  if accountId is None:
3220
3231
  if code is None:
3221
3232
  raise ArgumentsRequired(self.id + ' withdraw() requires an account_id(or accountId) parameter OR a currency code argument')
3222
- accountId = self.find_account_id(code)
3233
+ accountId = self.find_account_id(code, params)
3223
3234
  if accountId is None:
3224
3235
  raise ExchangeError(self.id + ' withdraw() could not find account id for ' + code)
3225
3236
  request = {
@@ -3436,7 +3447,7 @@ class coinbase(Exchange, ImplicitAPI):
3436
3447
  if accountId is None:
3437
3448
  if code is None:
3438
3449
  raise ArgumentsRequired(self.id + ' deposit() requires an account_id(or accountId) parameter OR a currency code argument')
3439
- accountId = self.find_account_id(code)
3450
+ accountId = self.find_account_id(code, params)
3440
3451
  if accountId is None:
3441
3452
  raise ExchangeError(self.id + ' deposit() could not find account id for ' + code)
3442
3453
  request = {
@@ -3501,7 +3512,7 @@ class coinbase(Exchange, ImplicitAPI):
3501
3512
  if accountId is None:
3502
3513
  if code is None:
3503
3514
  raise ArgumentsRequired(self.id + ' fetchDeposit() requires an account_id(or accountId) parameter OR a currency code argument')
3504
- accountId = self.find_account_id(code)
3515
+ accountId = self.find_account_id(code, params)
3505
3516
  if accountId is None:
3506
3517
  raise ExchangeError(self.id + ' fetchDeposit() could not find account id for ' + code)
3507
3518
  request = {
ccxt/gate.py CHANGED
@@ -67,6 +67,7 @@ class gate(Exchange, ImplicitAPI):
67
67
  'rebate': 'https://api.gateio.ws/api/v4',
68
68
  'earn': 'https://api.gateio.ws/api/v4',
69
69
  'account': 'https://api.gateio.ws/api/v4',
70
+ 'loan': 'https://api.gateio.ws/api/v4',
70
71
  },
71
72
  },
72
73
  'test': {
ccxt/htx.py CHANGED
@@ -2848,63 +2848,68 @@ class htx(Exchange, ImplicitAPI):
2848
2848
  # 'from': int((since / str(1000))), spot only
2849
2849
  # 'to': self.seconds(), spot only
2850
2850
  }
2851
- price = self.safe_string(params, 'price')
2852
- params = self.omit(params, 'price')
2851
+ priceType = self.safe_string_n(params, ['priceType', 'price'])
2852
+ params = self.omit(params, ['priceType', 'price'])
2853
+ until = None
2854
+ until, params = self.handle_param_integer(params, 'until')
2855
+ untilSeconds = self.parse_to_int(until / 1000) if (until is not None) else None
2853
2856
  if market['contract']:
2854
2857
  if limit is not None:
2855
- request['size'] = limit # when using limit from and to are ignored
2858
+ request['size'] = limit # when using limit: from & to are ignored
2856
2859
  # https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
2857
2860
  else:
2858
2861
  limit = 2000 # only used for from/to calculation
2859
- if price is None:
2862
+ if priceType is None:
2860
2863
  duration = self.parse_timeframe(timeframe)
2864
+ calcualtedEnd = None
2861
2865
  if since is None:
2862
2866
  now = self.seconds()
2863
2867
  request['from'] = now - duration * (limit - 1)
2864
- request['to'] = now
2868
+ calcualtedEnd = now
2865
2869
  else:
2866
2870
  start = self.parse_to_int(since / 1000)
2867
2871
  request['from'] = start
2868
- request['to'] = self.sum(start, duration * (limit - 1))
2872
+ calcualtedEnd = self.sum(start, duration * (limit - 1))
2873
+ request['to'] = untilSeconds if (untilSeconds is not None) else calcualtedEnd
2869
2874
  response = None
2870
2875
  if market['future']:
2871
2876
  if market['inverse']:
2872
2877
  request['symbol'] = market['id']
2873
- if price == 'mark':
2878
+ if priceType == 'mark':
2874
2879
  response = self.contractPublicGetIndexMarketHistoryMarkPriceKline(self.extend(request, params))
2875
- elif price == 'index':
2880
+ elif priceType == 'index':
2876
2881
  response = self.contractPublicGetIndexMarketHistoryIndex(self.extend(request, params))
2877
- elif price == 'premiumIndex':
2878
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2882
+ elif priceType == 'premiumIndex':
2883
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2879
2884
  else:
2880
2885
  response = self.contractPublicGetMarketHistoryKline(self.extend(request, params))
2881
2886
  elif market['linear']:
2882
2887
  request['contract_code'] = market['id']
2883
- if price == 'mark':
2888
+ if priceType == 'mark':
2884
2889
  response = self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
2885
- elif price == 'index':
2886
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2887
- elif price == 'premiumIndex':
2890
+ elif priceType == 'index':
2891
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2892
+ elif priceType == 'premiumIndex':
2888
2893
  response = self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
2889
2894
  else:
2890
2895
  response = self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
2891
2896
  elif market['swap']:
2892
2897
  request['contract_code'] = market['id']
2893
2898
  if market['inverse']:
2894
- if price == 'mark':
2899
+ if priceType == 'mark':
2895
2900
  response = self.contractPublicGetIndexMarketHistorySwapMarkPriceKline(self.extend(request, params))
2896
- elif price == 'index':
2897
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2898
- elif price == 'premiumIndex':
2901
+ elif priceType == 'index':
2902
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2903
+ elif priceType == 'premiumIndex':
2899
2904
  response = self.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(self.extend(request, params))
2900
2905
  else:
2901
2906
  response = self.contractPublicGetSwapExMarketHistoryKline(self.extend(request, params))
2902
2907
  elif market['linear']:
2903
- if price == 'mark':
2908
+ if priceType == 'mark':
2904
2909
  response = self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
2905
- elif price == 'index':
2906
- raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
2907
- elif price == 'premiumIndex':
2910
+ elif priceType == 'index':
2911
+ raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data')
2912
+ elif priceType == 'premiumIndex':
2908
2913
  response = self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
2909
2914
  else:
2910
2915
  response = self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
@@ -2913,15 +2918,17 @@ class htx(Exchange, ImplicitAPI):
2913
2918
  useHistorical = None
2914
2919
  useHistorical, params = self.handle_option_and_params(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', True)
2915
2920
  if not useHistorical:
2916
- # `limit` only available for the self endpoint
2917
2921
  if limit is not None:
2918
- request['size'] = limit # max 2000
2922
+ request['size'] = min(2000, limit) # max 2000
2919
2923
  response = self.spotPublicGetMarketHistoryKline(self.extend(request, params))
2920
2924
  else:
2921
- # `since` only available for the self endpoint
2925
+ # "from & to" only available for the self endpoint
2922
2926
  if since is not None:
2923
- # default 150 bars
2924
2927
  request['from'] = self.parse_to_int(since / 1000)
2928
+ if untilSeconds is not None:
2929
+ request['to'] = untilSeconds
2930
+ if limit is not None:
2931
+ request['size'] = min(1000, limit) # max 1000, otherwise default returns 150
2925
2932
  response = self.spotPublicGetMarketHistoryCandles(self.extend(request, params))
2926
2933
  #
2927
2934
  # {
@@ -2935,7 +2942,7 @@ class htx(Exchange, ImplicitAPI):
2935
2942
  # ]
2936
2943
  # }
2937
2944
  #
2938
- data = self.safe_value(response, 'data', [])
2945
+ data = self.safe_list(response, 'data', [])
2939
2946
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
2940
2947
 
2941
2948
  def fetch_accounts(self, params={}) -> List[Account]:
ccxt/hyperliquid.py CHANGED
@@ -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
  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 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()
ccxt/kucoin.py CHANGED
@@ -464,6 +464,56 @@ class kucoin(Exchange, ImplicitAPI):
464
464
  '130202': ExchangeError, # The system is renewing the loan automatically. Please try again later
465
465
  '130203': InsufficientFunds, # Insufficient account balance
466
466
  '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
467
+ '130301': InsufficientFunds, # Insufficient account balance
468
+ '130302': PermissionDenied, # Your relevant permission rights have been restricted, you can contact customer service for processing
469
+ '130303': NotSupported, # The current trading pair does not support isolated positions
470
+ '130304': NotSupported, # The trading function of the current trading pair is not enabled
471
+ '130305': NotSupported, # The current trading pair does not support cross position
472
+ '130306': NotSupported, # The account has not opened leveraged trading
473
+ '130307': NotSupported, # Please reopen the leverage agreement
474
+ '130308': InvalidOrder, # Position renewal freeze
475
+ '130309': InvalidOrder, # Position forced liquidation freeze
476
+ '130310': ExchangeError, # Abnormal leverage account status
477
+ '130311': InvalidOrder, # Failed to place an order, triggering buy limit
478
+ '130312': InvalidOrder, # Trigger global position limit, suspend buying
479
+ '130313': InvalidOrder, # Trigger global position limit, suspend selling
480
+ '130314': InvalidOrder, # Trigger the global position limit and prompt the remaining quantity available for purchase
481
+ '130315': NotSupported, # This feature has been suspended due to country restrictions
482
+ '126000': ExchangeError, # Abnormal margin trading
483
+ '126001': NotSupported, # Users currently do not support high frequency
484
+ '126002': ExchangeError, # There is a risk problem in your account and transactions are temporarily not allowed!
485
+ '126003': InvalidOrder, # The commission amount is less than the minimum transaction amount for a single commission
486
+ '126004': ExchangeError, # Trading pair does not exist or is prohibited
487
+ '126005': PermissionDenied, # This trading pair requires advanced KYC certification before trading
488
+ '126006': ExchangeError, # Trading pair is not available
489
+ '126007': ExchangeError, # Trading pair suspended
490
+ '126009': ExchangeError, # Trading pair is suspended from creating orders
491
+ '126010': ExchangeError, # Trading pair suspended order cancellation
492
+ '126011': ExchangeError, # There are too many orders in the order
493
+ '126013': InsufficientFunds, # Insufficient account balance
494
+ '126015': ExchangeError, # It is prohibited to place orders on self trading pair
495
+ '126021': NotSupported, # This digital asset does not support user participation in your region, thank you for your understanding!
496
+ '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.
497
+ '126027': InvalidOrder, # Only limit orders are supported
498
+ '126028': InvalidOrder, # Only limit orders are supported before the specified time
499
+ '126029': InvalidOrder, # The maximum order price is: xxx
500
+ '126030': InvalidOrder, # The minimum order price is: xxx
501
+ '126033': InvalidOrder, # Duplicate order
502
+ '126034': InvalidOrder, # Failed to create take profit and stop loss order
503
+ '126036': InvalidOrder, # Failed to create margin order
504
+ '126037': ExchangeError, # Due to country and region restrictions, self function has been suspended!
505
+ '126038': ExchangeError, # Third-party service call failed(internal exception)
506
+ '126039': ExchangeError, # Third-party service call failed, reason: xxx
507
+ '126041': ExchangeError, # clientTimestamp parameter error
508
+ '126042': ExchangeError, # Exceeded maximum position limit
509
+ '126043': OrderNotFound, # Order does not exist
510
+ '126044': InvalidOrder, # clientOid duplicate
511
+ '126045': NotSupported, # This digital asset does not support user participation in your region, thank you for your understanding!
512
+ '126046': NotSupported, # This digital asset does not support your IP region, thank you for your understanding!
513
+ '126047': PermissionDenied, # Please complete identity verification
514
+ '126048': PermissionDenied, # Please complete authentication for the master account
515
+ '135005': ExchangeError, # Margin order query business abnormality
516
+ '135018': ExchangeError, # Margin order query service abnormality
467
517
  '200004': InsufficientFunds,
468
518
  '210014': InvalidOrder, # {"code":"210014","msg":"Exceeds the max. borrowing amount, the remaining amount you can borrow: 0USDT"}
469
519
  '210021': InsufficientFunds, # {"code":"210021","msg":"Balance not enough"}
@@ -485,10 +535,12 @@ class kucoin(Exchange, ImplicitAPI):
485
535
  '400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
486
536
  '400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
487
537
  '400400': BadRequest, # Parameter error
538
+ '400401': AuthenticationError, # User is not logged in
488
539
  '400500': InvalidOrder, # {"code":"400500","msg":"Your located country/region is currently not supported for the trading of self token"}
489
540
  '400600': BadSymbol, # {"code":"400600","msg":"validation.createOrder.symbolNotAvailable"}
490
541
  '400760': InvalidOrder, # {"code":"400760","msg":"order price should be more than XX"}
491
542
  '401000': BadRequest, # {"code":"401000","msg":"The interface has been deprecated"}
543
+ '408000': BadRequest, # Network timeout, please try again later
492
544
  '411100': AccountSuspended,
493
545
  '415000': BadRequest, # {"code":"415000","msg":"Unsupported Media Type"}
494
546
  '400303': PermissionDenied, # {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"}
ccxt/okcoin.py CHANGED
@@ -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/okx.py CHANGED
@@ -595,6 +595,7 @@ class okx(Exchange, ImplicitAPI):
595
595
  '50027': PermissionDenied, # The account is restricted from trading
596
596
  '50028': ExchangeError, # Unable to take the order, please reach out to support center for details
597
597
  '50044': BadRequest, # Must select one broker type
598
+ '50061': ExchangeError, # You've reached the maximum order rate limit for self account.
598
599
  '50062': ExchangeError, # This feature is currently unavailable.
599
600
  # API Class
600
601
  '50100': ExchangeError, # API frozen, please contact customer service
@@ -782,6 +783,15 @@ class okx(Exchange, ImplicitAPI):
782
783
  # SPOT/MARGIN error codes 54000-54999
783
784
  '54000': ExchangeError, # Margin transactions unavailable
784
785
  '54001': ExchangeError, # Only Multi-currency margin account can be set to borrow coins automatically
786
+ # Trading bot Error Code from 55100 to 55999
787
+ '55100': InvalidOrder, # Take profit % should be within the range of {parameter1}-{parameter2}
788
+ '55101': InvalidOrder, # Stop loss % should be within the range of {parameter1}-{parameter2}
789
+ '55102': InvalidOrder, # Take profit % should be greater than the current bot’s PnL%
790
+ '55103': InvalidOrder, # Stop loss % should be less than the current bot’s PnL%
791
+ '55104': InvalidOrder, # Only futures grid supports take profit or stop loss based on profit percentage
792
+ '55111': InvalidOrder, # This signal name is in use, please try a new name
793
+ '55112': InvalidOrder, # This signal does not exist
794
+ '55113': InvalidOrder, # Create signal strategies with leverage greater than the maximum leverage of the instruments
785
795
  # FUNDING error codes 58000-58999
786
796
  '58000': ExchangeError, # Account type {0} does not supported when getting the sub-account balance
787
797
  '58001': AuthenticationError, # Incorrect trade password
@@ -4699,6 +4709,14 @@ class okx(Exchange, ImplicitAPI):
4699
4709
  '3': 'pending',
4700
4710
  '4': 'pending',
4701
4711
  '5': 'pending',
4712
+ '6': 'pending',
4713
+ '7': 'pending',
4714
+ '8': 'pending',
4715
+ '9': 'pending',
4716
+ '10': 'pending',
4717
+ '12': 'pending',
4718
+ '15': 'pending',
4719
+ '16': 'pending',
4702
4720
  }
4703
4721
  return self.safe_string(statuses, status, status)
4704
4722
 
ccxt/pro/__init__.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/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
+ 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
+ self.load_markets()
1363
+ extendedParams = self.extend(params, {'status': 'INCOMPLETE'})
1364
+ return self.fetch_orders(symbol, since, limit, extendedParams)
1365
+
1366
+ 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
+ self.load_markets()
1383
+ extendedParams = self.extend(params, {'status': 'COMPLETED'})
1384
+ return self.fetch_orders(symbol, since, limit, extendedParams)
1345
1385
 
1346
1386
  def parse_time_in_force(self, timeInForce):
1347
1387
  timeInForces = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.2.77
3
+ Version: 4.2.78
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -262,13 +262,13 @@ console.log(version, Object.keys(exchanges));
262
262
 
263
263
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
264
264
 
265
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.77/dist/ccxt.browser.js
266
- * unpkg: https://unpkg.com/ccxt@4.2.77/dist/ccxt.browser.js
265
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.78/dist/ccxt.browser.js
266
+ * unpkg: https://unpkg.com/ccxt@4.2.78/dist/ccxt.browser.js
267
267
 
268
268
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
269
269
 
270
270
  ```HTML
271
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.77/dist/ccxt.browser.js"></script>
271
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.78/dist/ccxt.browser.js"></script>
272
272
  ```
273
273
 
274
274
  Creates a global `ccxt` object: