ccxt 4.3.59__py2.py3-none-any.whl → 4.3.61__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/bitfinex.py CHANGED
@@ -1111,17 +1111,51 @@ class bitfinex(Exchange, ImplicitAPI):
1111
1111
  request: dict = {
1112
1112
  'order_id': int(id),
1113
1113
  }
1114
- return self.privatePostOrderCancel(self.extend(request, params))
1114
+ response = self.privatePostOrderCancel(self.extend(request, params))
1115
+ #
1116
+ # {
1117
+ # id: '161236928925',
1118
+ # cid: '1720172026812',
1119
+ # cid_date: '2024-07-05',
1120
+ # gid: null,
1121
+ # symbol: 'adaust',
1122
+ # exchange: 'bitfinex',
1123
+ # price: '0.33',
1124
+ # avg_execution_price: '0.0',
1125
+ # side: 'buy',
1126
+ # type: 'exchange limit',
1127
+ # timestamp: '1720172026.813',
1128
+ # is_live: True,
1129
+ # is_cancelled: False,
1130
+ # is_hidden: False,
1131
+ # oco_order: null,
1132
+ # was_forced: False,
1133
+ # original_amount: '10.0',
1134
+ # remaining_amount: '10.0',
1135
+ # executed_amount: '0.0',
1136
+ # src: 'api',
1137
+ # meta: {}
1138
+ # }
1139
+ #
1140
+ return self.parse_order(response)
1115
1141
 
1116
1142
  def cancel_all_orders(self, symbol: Str = None, params={}):
1117
1143
  """
1118
1144
  cancel all open orders
1119
1145
  :see: https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders
1120
- :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
1146
+ :param str symbol: not used by bitfinex cancelAllOrders
1121
1147
  :param dict [params]: extra parameters specific to the exchange API endpoint
1122
1148
  :returns dict: response from exchange
1123
1149
  """
1124
- return self.privatePostOrderCancelAll(params)
1150
+ response = self.privatePostOrderCancelAll(params)
1151
+ #
1152
+ # {result: 'Submitting 1 order cancellations.'}
1153
+ #
1154
+ return [
1155
+ self.safe_order({
1156
+ 'info': response,
1157
+ }),
1158
+ ]
1125
1159
 
1126
1160
  def parse_order(self, order: dict, market: Market = None) -> Order:
1127
1161
  #
@@ -1560,7 +1594,7 @@ class bitfinex(Exchange, ImplicitAPI):
1560
1594
  return response
1561
1595
 
1562
1596
  def nonce(self):
1563
- return self.milliseconds()
1597
+ return self.microseconds()
1564
1598
 
1565
1599
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
1566
1600
  request = '/' + self.implode_params(path, params)
ccxt/bitso.py CHANGED
@@ -105,7 +105,10 @@ class bitso(Exchange, ImplicitAPI):
105
105
  'urls': {
106
106
  'logo': 'https://user-images.githubusercontent.com/51840849/87295554-11f98280-c50e-11ea-80d6-15b3bafa8cbf.jpg',
107
107
  'api': {
108
- 'rest': 'https://api.bitso.com',
108
+ 'rest': 'https://bitso.com/api',
109
+ },
110
+ 'test': {
111
+ 'rest': 'https://stage.bitso.com/api',
109
112
  },
110
113
  'www': 'https://bitso.com',
111
114
  'doc': 'https://bitso.com/api_info',
ccxt/bybit.py CHANGED
@@ -4051,6 +4051,10 @@ class bybit(Exchange, ImplicitAPI):
4051
4051
  raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
4052
4052
  self.load_markets()
4053
4053
  market = self.market(symbol)
4054
+ types = self.is_unified_enabled()
4055
+ enableUnifiedAccount = types[1]
4056
+ if not enableUnifiedAccount:
4057
+ raise NotSupported(self.id + ' cancelOrders() supports UTA accounts only')
4054
4058
  category = None
4055
4059
  category, params = self.get_bybit_type('cancelOrders', market, params)
4056
4060
  if category == 'inverse':
@@ -4147,13 +4151,15 @@ class bybit(Exchange, ImplicitAPI):
4147
4151
  """
4148
4152
  cancel multiple orders for multiple symbols
4149
4153
  :see: https://bybit-exchange.github.io/docs/v5/order/batch-cancel
4150
- :param str[] ids: order ids
4151
- :param str symbol: unified symbol of the market the order was made in
4154
+ :param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
4152
4155
  :param dict [params]: extra parameters specific to the exchange API endpoint
4153
- :param str[] [params.clientOrderIds]: client order ids
4154
4156
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4155
4157
  """
4156
4158
  self.load_markets()
4159
+ types = self.is_unified_enabled()
4160
+ enableUnifiedAccount = types[1]
4161
+ if not enableUnifiedAccount:
4162
+ raise NotSupported(self.id + ' cancelOrdersForSymbols() supports UTA accounts only')
4157
4163
  ordersRequests = []
4158
4164
  category = None
4159
4165
  for i in range(0, len(orders)):
ccxt/cryptocom.py CHANGED
@@ -798,13 +798,19 @@ class cryptocom(Exchange, ImplicitAPI):
798
798
  'instrument_name': market['id'],
799
799
  'timeframe': self.safe_string(self.timeframes, timeframe, timeframe),
800
800
  }
801
- if since is not None:
802
- request['start_ts'] = since
803
801
  if limit is not None:
804
802
  request['count'] = limit
805
- until = self.safe_integer(params, 'until')
803
+ now = self.microseconds()
804
+ duration = self.parse_timeframe(timeframe)
805
+ until = self.safe_integer(params, 'until', now)
806
806
  params = self.omit(params, ['until'])
807
- if until is not None:
807
+ if since is not None:
808
+ request['start_ts'] = since
809
+ if limit is not None:
810
+ request['end_ts'] = self.sum(since, duration * (limit + 1) * 1000) - 1
811
+ else:
812
+ request['end_ts'] = until
813
+ else:
808
814
  request['end_ts'] = until
809
815
  response = self.v1PublicGetPublicGetCandlestick(self.extend(request, params))
810
816
  #
@@ -1362,7 +1368,7 @@ class cryptocom(Exchange, ImplicitAPI):
1362
1368
  """
1363
1369
  cancel multiple orders for multiple symbols
1364
1370
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1365
- :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
1371
+ :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
1366
1372
  :param dict [params]: extra parameters specific to the exchange API endpoint
1367
1373
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1368
1374
  """
ccxt/gate.py CHANGED
@@ -4779,8 +4779,7 @@ class gate(Exchange, ImplicitAPI):
4779
4779
  """
4780
4780
  cancel multiple orders for multiple symbols
4781
4781
  :see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
4782
- :param str[] ids: order ids
4783
- :param str symbol: unified symbol of the market the order was made in
4782
+ :param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
4784
4783
  :param dict [params]: extra parameters specific to the exchange API endpoint
4785
4784
  :param str[] [params.clientOrderIds]: client order ids
4786
4785
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/hyperliquid.py CHANGED
@@ -255,8 +255,16 @@ class hyperliquid(Exchange, ImplicitAPI):
255
255
  'withdraw': None,
256
256
  'networks': None,
257
257
  'fee': None,
258
- # 'fees': fees,
259
- 'limits': None,
258
+ 'limits': {
259
+ 'amount': {
260
+ 'min': None,
261
+ 'max': None,
262
+ },
263
+ 'withdraw': {
264
+ 'min': None,
265
+ 'max': None,
266
+ },
267
+ },
260
268
  }
261
269
  return result
262
270
 
@@ -1260,7 +1268,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1260
1268
  cancel multiple orders for multiple symbols
1261
1269
  :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
1262
1270
  :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
1263
- :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
1271
+ :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
1264
1272
  :param dict [params]: extra parameters specific to the exchange API endpoint
1265
1273
  :param str [params.vaultAddress]: the vault address
1266
1274
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/kraken.py CHANGED
@@ -1030,7 +1030,7 @@ class kraken(Exchange, ImplicitAPI):
1030
1030
  amount = Precise.string_abs(amount)
1031
1031
  else:
1032
1032
  direction = 'in'
1033
- timestamp = self.safe_timestamp(item, 'time')
1033
+ timestamp = self.safe_integer_product(item, 'time', 1000)
1034
1034
  return {
1035
1035
  'info': item,
1036
1036
  'id': id,
ccxt/mexc.py CHANGED
@@ -4905,9 +4905,10 @@ class mexc(Exchange, ImplicitAPI):
4905
4905
  :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
4906
4906
  """
4907
4907
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
4908
- networks = self.safe_value(self.options, 'networks', {})
4908
+ networks = self.safe_dict(self.options, 'networks', {})
4909
4909
  network = self.safe_string_2(params, 'network', 'netWork') # self line allows the user to specify either ERC20 or ETH
4910
4910
  network = self.safe_string(networks, network, network) # handle ETH > ERC-20 alias
4911
+ network = self.network_code_to_id(network)
4911
4912
  self.check_address(address)
4912
4913
  self.load_markets()
4913
4914
  currency = self.currency(code)
ccxt/okx.py CHANGED
@@ -949,6 +949,15 @@ class okx(Exchange, ImplicitAPI):
949
949
  '70010': BadRequest, # Timestamp parameters need to be in Unix timestamp format in milliseconds.
950
950
  '70013': BadRequest, # endTs needs to be bigger than or equal to beginTs.
951
951
  '70016': BadRequest, # Please specify your instrument settings for at least one instType.
952
+ '1009': BadRequest, # Request message exceeds the maximum frame length
953
+ '4001': AuthenticationError, # Login Failed
954
+ '4002': BadRequest, # Invalid Request
955
+ '4003': RateLimitExceeded, # APIKey subscription amount exceeds the limit 100
956
+ '4004': NetworkError, # No data received in 30s
957
+ '4005': ExchangeNotAvailable, # Buffer is full, cannot write data
958
+ '4006': BadRequest, # Abnormal disconnection
959
+ '4007': AuthenticationError, # API key has been updated or deleted. Please reconnect.
960
+ '4008': RateLimitExceeded, # The number of subscribed channels exceeds the maximum limit.
952
961
  },
953
962
  'broad': {
954
963
  'Internal Server Error': ExchangeNotAvailable, # {"code":500,"data":{},"detailMsg":"","error_code":"500","error_message":"Internal Server Error","msg":"Internal Server Error"}
@@ -3143,7 +3152,7 @@ class okx(Exchange, ImplicitAPI):
3143
3152
  cancel multiple orders for multiple symbols
3144
3153
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
3145
3154
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
3146
- :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
3155
+ :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
3147
3156
  :param dict [params]: extra parameters specific to the exchange API endpoint
3148
3157
  :param boolean [params.trigger]: whether the order is a stop/trigger order
3149
3158
  :param boolean [params.trailing]: set to True if you want to cancel trailing orders
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.59'
7
+ __version__ = '4.3.61'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/cex.py CHANGED
@@ -961,7 +961,7 @@ class cex(ccxt.async_support.cex):
961
961
  # }
962
962
  #
963
963
  data = self.safe_value(message, 'data', {})
964
- incrementalId = self.safe_number(data, 'id')
964
+ incrementalId = self.safe_integer(data, 'id')
965
965
  pair = self.safe_string(data, 'pair', '')
966
966
  symbol = self.pair_to_symbol(pair)
967
967
  storedOrderBook = self.safe_value(self.orderbooks, symbol)
ccxt/pro/kucoin.py CHANGED
@@ -47,6 +47,9 @@ class kucoin(ccxt.async_support.kucoin):
47
47
  'snapshotMaxRetries': 3,
48
48
  'method': '/market/level2', # '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50'
49
49
  },
50
+ 'watchMyTrades': {
51
+ 'method': '/spotMarket/tradeOrders', # or '/spot/tradeFills'
52
+ },
50
53
  },
51
54
  'streaming': {
52
55
  # kucoin does not support built-in ws protocol-level ping-pong
@@ -912,11 +915,13 @@ class kucoin(ccxt.async_support.kucoin):
912
915
  :param int [since]: the earliest time in ms to fetch trades for
913
916
  :param int [limit]: the maximum number of trade structures to retrieve
914
917
  :param dict [params]: extra parameters specific to the exchange API endpoint
918
+ :param str [params.method]: '/spotMarket/tradeOrders' or '/spot/tradeFills' default is '/spotMarket/tradeOrders'
915
919
  :returns dict[]: a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
916
920
  """
917
921
  await self.load_markets()
918
922
  url = await self.negotiate(True)
919
- topic = '/spotMarket/tradeOrders'
923
+ topic: Str = None
924
+ topic, params = self.handle_option_and_params(params, 'watchMyTrades', 'method', '/spotMarket/tradeOrders')
920
925
  request: dict = {
921
926
  'privateChannel': True,
922
927
  }
@@ -971,6 +976,8 @@ class kucoin(ccxt.async_support.kucoin):
971
976
  client.resolve(self.myTrades, symbolSpecificMessageHash)
972
977
 
973
978
  def parse_ws_trade(self, trade, market=None):
979
+ #
980
+ # /spotMarket/tradeOrders
974
981
  #
975
982
  # {
976
983
  # "symbol": "KCS-USDT",
@@ -993,6 +1000,22 @@ class kucoin(ccxt.async_support.kucoin):
993
1000
  # "ts": 1670329987311000000
994
1001
  # }
995
1002
  #
1003
+ # /spot/tradeFills
1004
+ #
1005
+ # {
1006
+ # "fee": 0.00262148,
1007
+ # "feeCurrency": "USDT",
1008
+ # "feeRate": 0.001,
1009
+ # "orderId": "62417436b29df8000183df2f",
1010
+ # "orderType": "market",
1011
+ # "price": 131.074,
1012
+ # "side": "sell",
1013
+ # "size": 0.02,
1014
+ # "symbol": "LTC-USDT",
1015
+ # "time": "1648456758734571745",
1016
+ # "tradeId": "624174362e113d2f467b3043"
1017
+ # }
1018
+ #
996
1019
  marketId = self.safe_string(trade, 'symbol')
997
1020
  market = self.safe_market(marketId, market, '-')
998
1021
  symbol = market['symbol']
@@ -1002,7 +1025,10 @@ class kucoin(ccxt.async_support.kucoin):
1002
1025
  price = self.safe_string(trade, 'matchPrice')
1003
1026
  amount = self.safe_string(trade, 'matchSize')
1004
1027
  order = self.safe_string(trade, 'orderId')
1005
- timestamp = self.safe_integer_product(trade, 'ts', 0.000001)
1028
+ timestamp = self.safe_integer_product_2(trade, 'ts', 'time', 0.000001)
1029
+ feeCurrency = market['quote']
1030
+ feeRate = self.safe_string(trade, 'feeRate')
1031
+ feeCost = self.safe_string(trade, 'fee')
1006
1032
  return self.safe_trade({
1007
1033
  'info': trade,
1008
1034
  'timestamp': timestamp,
@@ -1016,7 +1042,11 @@ class kucoin(ccxt.async_support.kucoin):
1016
1042
  'price': price,
1017
1043
  'amount': amount,
1018
1044
  'cost': None,
1019
- 'fee': None,
1045
+ 'fee': {
1046
+ 'cost': feeCost,
1047
+ 'rate': feeRate,
1048
+ 'currency': feeCurrency,
1049
+ },
1020
1050
  }, market)
1021
1051
 
1022
1052
  async def watch_balance(self, params={}) -> Balances:
@@ -1119,6 +1149,7 @@ class kucoin(ccxt.async_support.kucoin):
1119
1149
  'account.balance': self.handle_balance,
1120
1150
  'orderChange': self.handle_order,
1121
1151
  'stopOrder': self.handle_order,
1152
+ '/spot/tradeFills': self.handle_my_trade,
1122
1153
  }
1123
1154
  method = self.safe_value(methods, subject)
1124
1155
  if method is not None:
ccxt/pro/phemex.py CHANGED
@@ -45,7 +45,7 @@ class phemex(ccxt.async_support.phemex):
45
45
  'OHLCVLimit': 1000,
46
46
  },
47
47
  'streaming': {
48
- 'keepAlive': 10000,
48
+ 'keepAlive': 9000,
49
49
  },
50
50
  })
51
51
 
ccxt/pro/xt.py CHANGED
@@ -230,7 +230,10 @@ class xt(ccxt.async_support.xt):
230
230
  await self.load_markets()
231
231
  market = self.market(symbol)
232
232
  name = 'kline@' + market['id'] + ',' + timeframe
233
- return await self.subscribe(name, 'public', 'watchOHLCV', market, None, params)
233
+ ohlcv = await self.subscribe(name, 'public', 'watchOHLCV', market, None, params)
234
+ if self.newUpdates:
235
+ limit = ohlcv.getLimit(symbol, limit)
236
+ return self.filter_by_since_limit(ohlcv, since, limit, 0, True)
234
237
 
235
238
  async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
236
239
  """
ccxt/timex.py CHANGED
@@ -843,7 +843,8 @@ class timex(Exchange, ImplicitAPI):
843
843
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
844
844
  """
845
845
  self.load_markets()
846
- return self.cancel_orders([id], symbol, params)
846
+ orders = self.cancel_orders([id], symbol, params)
847
+ return self.safe_dict(orders, 0)
847
848
 
848
849
  def cancel_orders(self, ids, symbol: Str = None, params={}):
849
850
  """
@@ -883,7 +884,20 @@ class timex(Exchange, ImplicitAPI):
883
884
  # ],
884
885
  # "unchangedOrders": ["string"],
885
886
  # }
886
- return response
887
+ #
888
+ changedOrders = self.safe_list(response, 'changedOrders', [])
889
+ unchangedOrders = self.safe_list(response, 'unchangedOrders', [])
890
+ orders = []
891
+ for i in range(0, len(changedOrders)):
892
+ newOrder = self.safe_dict(changedOrders[i], 'newOrder')
893
+ orders.append(self.parse_order(newOrder))
894
+ for i in range(0, len(unchangedOrders)):
895
+ orders.append(self.safe_order({
896
+ 'info': unchangedOrders[i],
897
+ 'id': unchangedOrders[i],
898
+ 'status': 'unchanged',
899
+ }))
900
+ return orders
887
901
 
888
902
  def fetch_order(self, id: str, symbol: Str = None, params={}):
889
903
  """
ccxt/vertex.py CHANGED
@@ -400,7 +400,16 @@ class vertex(Exchange, ImplicitAPI):
400
400
  'withdraw': self.safe_bool(data, 'can_withdraw'),
401
401
  'networks': None,
402
402
  'fee': None,
403
- 'limits': None,
403
+ 'limits': {
404
+ 'amount': {
405
+ 'min': None,
406
+ 'max': None,
407
+ },
408
+ 'withdraw': {
409
+ 'min': None,
410
+ 'max': None,
411
+ },
412
+ },
404
413
  }
405
414
  return result
406
415
 
ccxt/xt.py CHANGED
@@ -835,7 +835,7 @@ class xt(Exchange, ImplicitAPI):
835
835
  'name': self.safe_string(entry, 'fullName'),
836
836
  'active': active,
837
837
  'fee': self.parse_number(minWithdrawFeeString),
838
- 'precision': None,
838
+ 'precision': minPrecision,
839
839
  'deposit': deposit,
840
840
  'withdraw': withdraw,
841
841
  'networks': networks,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.3.59
3
+ Version: 4.3.61
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
@@ -268,13 +268,13 @@ console.log(version, Object.keys(exchanges));
268
268
 
269
269
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
270
270
 
271
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.59/dist/ccxt.browser.min.js
272
- * unpkg: https://unpkg.com/ccxt@4.3.59/dist/ccxt.browser.min.js
271
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.61/dist/ccxt.browser.min.js
272
+ * unpkg: https://unpkg.com/ccxt@4.3.61/dist/ccxt.browser.min.js
273
273
 
274
274
  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.
275
275
 
276
276
  ```HTML
277
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.59/dist/ccxt.browser.min.js"></script>
277
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.61/dist/ccxt.browser.min.js"></script>
278
278
  ```
279
279
 
280
280
  Creates a global `ccxt` object: