ccxt 4.3.59__py2.py3-none-any.whl → 4.3.60__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
@@ -4147,10 +4147,8 @@ class bybit(Exchange, ImplicitAPI):
4147
4147
  """
4148
4148
  cancel multiple orders for multiple symbols
4149
4149
  :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
4150
+ :param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
4152
4151
  :param dict [params]: extra parameters specific to the exchange API endpoint
4153
- :param str[] [params.clientOrderIds]: client order ids
4154
4152
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4155
4153
  """
4156
4154
  self.load_markets()
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
@@ -1260,7 +1260,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1260
1260
  cancel multiple orders for multiple symbols
1261
1261
  :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
1262
1262
  :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
1263
+ :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
1264
  :param dict [params]: extra parameters specific to the exchange API endpoint
1265
1265
  :param str [params.vaultAddress]: the vault address
1266
1266
  :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/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.60'
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,14 @@ 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
+ options = self.safe_dict(self.options, 'watchMyTrades')
924
+ defaultMethod = self.safe_string(params, 'method', '/spotMarket/tradeOrders')
925
+ topic = defaultMethod if (defaultMethod is not None) else self.safe_string(options, 'method')
920
926
  request: dict = {
921
927
  'privateChannel': True,
922
928
  }
@@ -971,6 +977,8 @@ class kucoin(ccxt.async_support.kucoin):
971
977
  client.resolve(self.myTrades, symbolSpecificMessageHash)
972
978
 
973
979
  def parse_ws_trade(self, trade, market=None):
980
+ #
981
+ # /spotMarket/tradeOrders
974
982
  #
975
983
  # {
976
984
  # "symbol": "KCS-USDT",
@@ -993,6 +1001,22 @@ class kucoin(ccxt.async_support.kucoin):
993
1001
  # "ts": 1670329987311000000
994
1002
  # }
995
1003
  #
1004
+ # /spot/tradeFills
1005
+ #
1006
+ # {
1007
+ # "fee": 0.00262148,
1008
+ # "feeCurrency": "USDT",
1009
+ # "feeRate": 0.001,
1010
+ # "orderId": "62417436b29df8000183df2f",
1011
+ # "orderType": "market",
1012
+ # "price": 131.074,
1013
+ # "side": "sell",
1014
+ # "size": 0.02,
1015
+ # "symbol": "LTC-USDT",
1016
+ # "time": "1648456758734571745",
1017
+ # "tradeId": "624174362e113d2f467b3043"
1018
+ # }
1019
+ #
996
1020
  marketId = self.safe_string(trade, 'symbol')
997
1021
  market = self.safe_market(marketId, market, '-')
998
1022
  symbol = market['symbol']
@@ -1002,7 +1026,10 @@ class kucoin(ccxt.async_support.kucoin):
1002
1026
  price = self.safe_string(trade, 'matchPrice')
1003
1027
  amount = self.safe_string(trade, 'matchSize')
1004
1028
  order = self.safe_string(trade, 'orderId')
1005
- timestamp = self.safe_integer_product(trade, 'ts', 0.000001)
1029
+ timestamp = self.safe_integer_product_2(trade, 'ts', 'time', 0.000001)
1030
+ feeCurrency = market['quote']
1031
+ feeRate = self.safe_string(trade, 'feeRate')
1032
+ feeCost = self.safe_string(trade, 'fee')
1006
1033
  return self.safe_trade({
1007
1034
  'info': trade,
1008
1035
  'timestamp': timestamp,
@@ -1016,7 +1043,11 @@ class kucoin(ccxt.async_support.kucoin):
1016
1043
  'price': price,
1017
1044
  'amount': amount,
1018
1045
  'cost': None,
1019
- 'fee': None,
1046
+ 'fee': {
1047
+ 'cost': feeCost,
1048
+ 'rate': feeRate,
1049
+ 'currency': feeCurrency,
1050
+ },
1020
1051
  }, market)
1021
1052
 
1022
1053
  async def watch_balance(self, params={}) -> Balances:
@@ -1119,6 +1150,7 @@ class kucoin(ccxt.async_support.kucoin):
1119
1150
  'account.balance': self.handle_balance,
1120
1151
  'orderChange': self.handle_order,
1121
1152
  'stopOrder': self.handle_order,
1153
+ '/spot/tradeFills': self.handle_my_trade,
1122
1154
  }
1123
1155
  method = self.safe_value(methods, subject)
1124
1156
  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/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.60
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.60/dist/ccxt.browser.min.js
272
+ * unpkg: https://unpkg.com/ccxt@4.3.60/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.60/dist/ccxt.browser.min.js"></script>
278
278
  ```
279
279
 
280
280
  Creates a global `ccxt` object: