ccxt 4.2.47__py2.py3-none-any.whl → 4.2.49__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitstamp.py +8 -0
  3. ccxt/abstract/indodax.py +9 -8
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/base/exchange.py +1 -1
  6. ccxt/async_support/binance.py +9 -4
  7. ccxt/async_support/bitmart.py +24 -2
  8. ccxt/async_support/bitstamp.py +8 -0
  9. ccxt/async_support/btcalpha.py +4 -0
  10. ccxt/async_support/btcmarkets.py +4 -0
  11. ccxt/async_support/btcturk.py +4 -0
  12. ccxt/async_support/bybit.py +132 -6
  13. ccxt/async_support/idex.py +48 -1
  14. ccxt/async_support/independentreserve.py +47 -1
  15. ccxt/async_support/indodax.py +115 -19
  16. ccxt/async_support/latoken.py +16 -0
  17. ccxt/async_support/luno.py +18 -0
  18. ccxt/async_support/lykke.py +19 -0
  19. ccxt/async_support/ndax.py +18 -0
  20. ccxt/async_support/okx.py +32 -5
  21. ccxt/async_support/upbit.py +92 -17
  22. ccxt/base/exchange.py +2 -2
  23. ccxt/binance.py +9 -4
  24. ccxt/bitmart.py +24 -2
  25. ccxt/bitstamp.py +8 -0
  26. ccxt/btcalpha.py +4 -0
  27. ccxt/btcmarkets.py +4 -0
  28. ccxt/btcturk.py +4 -0
  29. ccxt/bybit.py +132 -6
  30. ccxt/idex.py +48 -1
  31. ccxt/independentreserve.py +47 -1
  32. ccxt/indodax.py +115 -19
  33. ccxt/latoken.py +16 -0
  34. ccxt/luno.py +18 -0
  35. ccxt/lykke.py +19 -0
  36. ccxt/ndax.py +18 -0
  37. ccxt/okx.py +32 -5
  38. ccxt/pro/__init__.py +1 -1
  39. ccxt/pro/ascendex.py +19 -7
  40. ccxt/pro/bitget.py +24 -7
  41. ccxt/pro/bitstamp.py +1 -1
  42. ccxt/pro/hitbtc.py +6 -11
  43. ccxt/pro/mexc.py +2 -1
  44. ccxt/test/test_async.py +10 -10
  45. ccxt/test/test_sync.py +10 -10
  46. ccxt/upbit.py +92 -17
  47. {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/METADATA +4 -4
  48. {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/RECORD +50 -50
  49. {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/WHEEL +0 -0
  50. {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/top_level.txt +0 -0
@@ -48,6 +48,7 @@ class upbit(Exchange, ImplicitAPI):
48
48
  'fetchBalance': True,
49
49
  'fetchCanceledOrders': True,
50
50
  'fetchClosedOrders': True,
51
+ 'fetchDeposit': True,
51
52
  'fetchDepositAddress': True,
52
53
  'fetchDepositAddresses': True,
53
54
  'fetchDeposits': True,
@@ -75,6 +76,7 @@ class upbit(Exchange, ImplicitAPI):
75
76
  'fetchTradingFee': True,
76
77
  'fetchTradingFees': False,
77
78
  'fetchTransactions': False,
79
+ 'fetchWithdrawal': True,
78
80
  'fetchWithdrawals': True,
79
81
  'transfer': False,
80
82
  'withdraw': True,
@@ -988,6 +990,7 @@ class upbit(Exchange, ImplicitAPI):
988
990
  """
989
991
  create a trade order
990
992
  :see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
993
+ :see: https://global-docs.upbit.com/reference/order
991
994
  :param str symbol: unified symbol of the market to create an order in
992
995
  :param str type: 'market' or 'limit'
993
996
  :param str side: 'buy' or 'sell'
@@ -995,6 +998,7 @@ class upbit(Exchange, ImplicitAPI):
995
998
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
996
999
  :param dict [params]: extra parameters specific to the exchange API endpoint
997
1000
  :param float [params.cost]: for market buy orders, the quote quantity that can be used alternative for the amount
1001
+ :param str [params.timeInForce]: 'IOC' or 'FOK'
998
1002
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
999
1003
  """
1000
1004
  await self.load_markets()
@@ -1039,6 +1043,11 @@ class upbit(Exchange, ImplicitAPI):
1039
1043
  clientOrderId = self.safe_string_2(params, 'clientOrderId', 'identifier')
1040
1044
  if clientOrderId is not None:
1041
1045
  request['identifier'] = clientOrderId
1046
+ if type != 'market':
1047
+ timeInForce = self.safe_string_lower_2(params, 'timeInForce', 'time_in_force')
1048
+ params = self.omit(params, 'timeInForce')
1049
+ if timeInForce is not None:
1050
+ request['time_in_force'] = timeInForce
1042
1051
  params = self.omit(params, ['clientOrderId', 'identifier'])
1043
1052
  response = await self.privatePostOrders(self.extend(request, params))
1044
1053
  #
@@ -1138,6 +1147,42 @@ class upbit(Exchange, ImplicitAPI):
1138
1147
  #
1139
1148
  return self.parse_transactions(response, currency, since, limit)
1140
1149
 
1150
+ async def fetch_deposit(self, id: str, code: Str = None, params={}):
1151
+ """
1152
+ fetch information on a deposit
1153
+ :see: https://global-docs.upbit.com/reference/individual-deposit-inquiry
1154
+ :param str id: the unique id for the deposit
1155
+ :param str [code]: unified currency code of the currency deposited
1156
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1157
+ :param str [params.txid]: withdrawal transaction id, the id argument is reserved for uuid
1158
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1159
+ """
1160
+ await self.load_markets()
1161
+ request = {
1162
+ 'uuid': id,
1163
+ }
1164
+ currency = None
1165
+ if code is not None:
1166
+ currency = self.currency(code)
1167
+ request['currency'] = currency['id']
1168
+ response = await self.privateGetDeposit(self.extend(request, params))
1169
+ #
1170
+ # {
1171
+ # "type": "deposit",
1172
+ # "uuid": "7f54527e-2eee-4268-860e-fd8b9d7fe3c7",
1173
+ # "currency": "ADA",
1174
+ # "net_type": "ADA",
1175
+ # "txid": "99795bbfeca91eaa071068bb659b33eeb65d8aaff2551fdf7c78f345d188952b",
1176
+ # "state": "ACCEPTED",
1177
+ # "created_at": "2023-12-12T04:58:41Z",
1178
+ # "done_at": "2023-12-12T05:31:50Z",
1179
+ # "amount": "35.72344",
1180
+ # "fee": "0.0",
1181
+ # "transaction_type": "default"
1182
+ # }
1183
+ #
1184
+ return self.parse_transaction(response, currency)
1185
+
1141
1186
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1142
1187
  """
1143
1188
  :see: https://docs.upbit.com/reference/%EC%A0%84%EC%B2%B4-%EC%B6%9C%EA%B8%88-%EC%A1%B0%ED%9A%8C
@@ -1178,13 +1223,49 @@ class upbit(Exchange, ImplicitAPI):
1178
1223
  #
1179
1224
  return self.parse_transactions(response, currency, since, limit)
1180
1225
 
1226
+ async def fetch_withdrawal(self, id: str, code: Str = None, params={}):
1227
+ """
1228
+ fetch data on a currency withdrawal via the withdrawal id
1229
+ :see: https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
1230
+ :param str id: the unique id for the withdrawal
1231
+ :param str [code]: unified currency code of the currency withdrawn
1232
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1233
+ :param str [params.txid]: withdrawal transaction id, the id argument is reserved for uuid
1234
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1235
+ """
1236
+ await self.load_markets()
1237
+ request = {
1238
+ 'uuid': id,
1239
+ }
1240
+ currency = None
1241
+ if code is not None:
1242
+ currency = self.currency(code)
1243
+ request['currency'] = currency['id']
1244
+ response = await self.privateGetWithdraw(self.extend(request, params))
1245
+ #
1246
+ # {
1247
+ # "type": "withdraw",
1248
+ # "uuid": "95ef274b-23a6-4de4-95b0-5cbef4ca658f",
1249
+ # "currency": "ADA",
1250
+ # "net_type": "ADA",
1251
+ # "txid": "b1528f149297a71671b86636f731f8fdb0ff53da0f1d8c19093d59df96f34583",
1252
+ # "state": "DONE",
1253
+ # "created_at": "2023-12-14T02:46:52Z",
1254
+ # "done_at": "2023-12-14T03:10:11Z",
1255
+ # "amount": "35.22344",
1256
+ # "fee": "0.5",
1257
+ # "transaction_type": "default"
1258
+ # }
1259
+ #
1260
+ return self.parse_transaction(response, currency)
1261
+
1181
1262
  def parse_transaction_status(self, status):
1182
1263
  statuses = {
1183
1264
  'submitting': 'pending', # 처리 중
1184
1265
  'submitted': 'pending', # 처리 완료
1185
1266
  'almost_accepted': 'pending', # 출금대기중
1186
1267
  'rejected': 'failed', # 거부
1187
- 'accepted': 'pending', # 승인됨
1268
+ 'accepted': 'ok', # 승인됨
1188
1269
  'processing': 'pending', # 처리 중
1189
1270
  'done': 'ok', # 완료
1190
1271
  'canceled': 'canceled', # 취소됨
@@ -1193,7 +1274,7 @@ class upbit(Exchange, ImplicitAPI):
1193
1274
 
1194
1275
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1195
1276
  #
1196
- # fetchDeposits
1277
+ # fetchDeposits, fetchDeposit
1197
1278
  #
1198
1279
  # {
1199
1280
  # "type": "deposit",
@@ -1207,7 +1288,7 @@ class upbit(Exchange, ImplicitAPI):
1207
1288
  # "fee": "0.0"
1208
1289
  # }
1209
1290
  #
1210
- # fetchWithdrawals
1291
+ # fetchWithdrawals, fetchWithdrawal
1211
1292
  #
1212
1293
  # {
1213
1294
  # "type": "withdraw",
@@ -1222,26 +1303,20 @@ class upbit(Exchange, ImplicitAPI):
1222
1303
  # "krw_amount": "80420.0"
1223
1304
  # }
1224
1305
  #
1225
- id = self.safe_string(transaction, 'uuid')
1226
- amount = self.safe_number(transaction, 'amount')
1227
1306
  address = None # not present in the data structure received from the exchange
1228
1307
  tag = None # not present in the data structure received from the exchange
1229
- txid = self.safe_string(transaction, 'txid')
1230
1308
  updatedRaw = self.safe_string(transaction, 'done_at')
1231
- updated = self.parse8601(updatedRaw)
1232
1309
  timestamp = self.parse8601(self.safe_string(transaction, 'created_at', updatedRaw))
1233
1310
  type = self.safe_string(transaction, 'type')
1234
1311
  if type == 'withdraw':
1235
1312
  type = 'withdrawal'
1236
1313
  currencyId = self.safe_string(transaction, 'currency')
1237
- code = self.safe_currency_code(currencyId)
1238
- status = self.parse_transaction_status(self.safe_string_lower(transaction, 'state'))
1239
- feeCost = self.safe_number(transaction, 'fee')
1314
+ code = self.safe_currency_code(currencyId, currency)
1240
1315
  return {
1241
1316
  'info': transaction,
1242
- 'id': id,
1317
+ 'id': self.safe_string(transaction, 'uuid'),
1243
1318
  'currency': code,
1244
- 'amount': amount,
1319
+ 'amount': self.safe_number(transaction, 'amount'),
1245
1320
  'network': None,
1246
1321
  'address': address,
1247
1322
  'addressTo': None,
@@ -1249,17 +1324,17 @@ class upbit(Exchange, ImplicitAPI):
1249
1324
  'tag': tag,
1250
1325
  'tagTo': None,
1251
1326
  'tagFrom': None,
1252
- 'status': status,
1327
+ 'status': self.parse_transaction_status(self.safe_string_lower(transaction, 'state')),
1253
1328
  'type': type,
1254
- 'updated': updated,
1255
- 'txid': txid,
1329
+ 'updated': self.parse8601(updatedRaw),
1330
+ 'txid': self.safe_string(transaction, 'txid'),
1256
1331
  'timestamp': timestamp,
1257
1332
  'datetime': self.iso8601(timestamp),
1258
1333
  'internal': None,
1259
1334
  'comment': None,
1260
1335
  'fee': {
1261
1336
  'currency': code,
1262
- 'cost': feeCost,
1337
+ 'cost': self.safe_number(transaction, 'fee'),
1263
1338
  },
1264
1339
  }
1265
1340
 
@@ -1705,7 +1780,7 @@ class upbit(Exchange, ImplicitAPI):
1705
1780
  url += '?' + self.urlencode(query)
1706
1781
  if api == 'private':
1707
1782
  self.check_required_credentials()
1708
- nonce = self.nonce()
1783
+ nonce = self.uuid()
1709
1784
  request = {
1710
1785
  'access_key': self.apiKey,
1711
1786
  'nonce': nonce,
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.47'
7
+ __version__ = '4.2.49'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -884,7 +884,7 @@ class Exchange(object):
884
884
  if isinstance(key, str):
885
885
  if key in dictionary_or_list and dictionary_or_list[key] is not None and dictionary_or_list[key] != '':
886
886
  return dictionary_or_list[key]
887
- else:
887
+ elif key is not None:
888
888
  if (key < len(dictionary_or_list)) and (dictionary_or_list[key] is not None) and (dictionary_or_list[key] != ''):
889
889
  return dictionary_or_list[key]
890
890
  return None
ccxt/binance.py CHANGED
@@ -2985,7 +2985,7 @@ class binance(Exchange, ImplicitAPI):
2985
2985
  fees = self.fees
2986
2986
  linear = None
2987
2987
  inverse = None
2988
- strike = self.safe_integer(market, 'strikePrice')
2988
+ strike = self.safe_string(market, 'strikePrice')
2989
2989
  symbol = base + '/' + quote
2990
2990
  if contract:
2991
2991
  if swap:
@@ -2993,7 +2993,7 @@ class binance(Exchange, ImplicitAPI):
2993
2993
  elif future:
2994
2994
  symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry)
2995
2995
  elif option:
2996
- symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' + self.number_to_string(strike) + '-' + self.safe_string(optionParts, 3)
2996
+ symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' + strike + '-' + self.safe_string(optionParts, 3)
2997
2997
  contractSize = self.safe_number_2(market, 'contractSize', 'unit', self.parse_number('1'))
2998
2998
  linear = settle == quote
2999
2999
  inverse = settle == base
@@ -3017,6 +3017,9 @@ class binance(Exchange, ImplicitAPI):
3017
3017
  elif option:
3018
3018
  unifiedType = 'option'
3019
3019
  active = None
3020
+ parsedStrike = None
3021
+ if strike is not None:
3022
+ parsedStrike = self.parse_to_numeric(strike)
3020
3023
  entry = {
3021
3024
  'id': id,
3022
3025
  'lowercaseId': lowercaseId,
@@ -3042,7 +3045,7 @@ class binance(Exchange, ImplicitAPI):
3042
3045
  'contractSize': contractSize,
3043
3046
  'expiry': expiry,
3044
3047
  'expiryDatetime': self.iso8601(expiry),
3045
- 'strike': strike,
3048
+ 'strike': parsedStrike,
3046
3049
  'optionType': self.safe_string_lower(market, 'side'),
3047
3050
  'precision': {
3048
3051
  'amount': self.safe_integer_2(market, 'quantityPrecision', 'quantityScale'),
@@ -5513,12 +5516,14 @@ class binance(Exchange, ImplicitAPI):
5513
5516
  trailingDelta = self.safe_string(params, 'trailingDelta')
5514
5517
  trailingTriggerPrice = self.safe_string_2(params, 'trailingTriggerPrice', 'activationPrice', self.number_to_string(price))
5515
5518
  trailingPercent = self.safe_string_2(params, 'trailingPercent', 'callbackRate')
5519
+ priceMatch = self.safe_string(params, 'priceMatch')
5516
5520
  isTrailingPercentOrder = trailingPercent is not None
5517
5521
  isStopLoss = stopLossPrice is not None or trailingDelta is not None
5518
5522
  isTakeProfit = takeProfitPrice is not None
5519
5523
  isTriggerOrder = triggerPrice is not None
5520
5524
  isConditional = isTriggerOrder or isTrailingPercentOrder or isStopLoss or isTakeProfit
5521
5525
  isPortfolioMarginConditional = (isPortfolioMargin and isConditional)
5526
+ isPriceMatch = priceMatch is not None
5522
5527
  uppercaseType = type.upper()
5523
5528
  stopPrice = None
5524
5529
  if isTrailingPercentOrder:
@@ -5655,7 +5660,7 @@ class binance(Exchange, ImplicitAPI):
5655
5660
  request['quantity'] = self.parse_to_numeric(amount)
5656
5661
  else:
5657
5662
  request['quantity'] = self.amount_to_precision(symbol, amount)
5658
- if priceIsRequired:
5663
+ if priceIsRequired and not isPriceMatch:
5659
5664
  if price is None:
5660
5665
  raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
5661
5666
  request['price'] = self.price_to_precision(symbol, price)
ccxt/bitmart.py CHANGED
@@ -1121,7 +1121,7 @@ class bitmart(Exchange, ImplicitAPI):
1121
1121
 
1122
1122
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1123
1123
  #
1124
- # spot
1124
+ # spot(REST)
1125
1125
  #
1126
1126
  # {
1127
1127
  # "symbol": "SOLAR_USDT",
@@ -1141,6 +1141,17 @@ class bitmart(Exchange, ImplicitAPI):
1141
1141
  # "timestamp": 1667403439367
1142
1142
  # }
1143
1143
  #
1144
+ # spot(WS)
1145
+ # {
1146
+ # "symbol":"BTC_USDT",
1147
+ # "last_price":"146.24",
1148
+ # "open_24h":"147.17",
1149
+ # "high_24h":"147.48",
1150
+ # "low_24h":"143.88",
1151
+ # "base_volume_24h":"117387.58", # NOT base, but quote currencynot !!
1152
+ # "s_t": 1610936002
1153
+ # }
1154
+ #
1144
1155
  # swap
1145
1156
  #
1146
1157
  # {
@@ -1157,6 +1168,9 @@ class bitmart(Exchange, ImplicitAPI):
1157
1168
  # }
1158
1169
  #
1159
1170
  timestamp = self.safe_integer(ticker, 'timestamp')
1171
+ if timestamp is None:
1172
+ # ticker from WS has a different field(in seconds)
1173
+ timestamp = self.safe_integer_product(ticker, 's_t', 1000)
1160
1174
  marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
1161
1175
  market = self.safe_market(marketId, market)
1162
1176
  symbol = market['symbol']
@@ -1171,7 +1185,15 @@ class bitmart(Exchange, ImplicitAPI):
1171
1185
  percentage = '0'
1172
1186
  baseVolume = self.safe_string(ticker, 'base_volume_24h')
1173
1187
  quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
1174
- quoteVolume = self.safe_string(ticker, 'volume_24h', quoteVolume)
1188
+ if quoteVolume is None:
1189
+ if baseVolume is None:
1190
+ # self is swap
1191
+ quoteVolume = self.safe_string(ticker, 'volume_24h', quoteVolume)
1192
+ else:
1193
+ # self is a ticker from websockets
1194
+ # contrary to name and documentation, base_volume_24h is actually the quote volume
1195
+ quoteVolume = baseVolume
1196
+ baseVolume = None
1175
1197
  average = self.safe_string_2(ticker, 'avg_price', 'index_price')
1176
1198
  high = self.safe_string_2(ticker, 'high_24h', 'high_price')
1177
1199
  low = self.safe_string_2(ticker, 'low_24h', 'low_price')
ccxt/bitstamp.py CHANGED
@@ -361,6 +361,14 @@ class bitstamp(Exchange, ImplicitAPI):
361
361
  'eurcv_address/': 1,
362
362
  'pyusd_withdrawal/': 1,
363
363
  'pyusd_address/': 1,
364
+ 'lmwr_withdrawal/': 1,
365
+ 'lmwr_address/': 1,
366
+ 'pepe_withdrawal/': 1,
367
+ 'pepe_address/': 1,
368
+ 'blur_withdrawal/': 1,
369
+ 'blur_address/': 1,
370
+ 'vext_withdrawal/': 1,
371
+ 'vext_address/': 1,
364
372
  },
365
373
  },
366
374
  },
ccxt/btcalpha.py CHANGED
@@ -36,6 +36,7 @@ class btcalpha(Exchange, ImplicitAPI):
36
36
  'cancelOrder': True,
37
37
  'closeAllPositions': False,
38
38
  'closePosition': False,
39
+ 'createDepositAddress': False,
39
40
  'createOrder': True,
40
41
  'createReduceOnlyOrder': False,
41
42
  'createStopLimitOrder': False,
@@ -48,6 +49,9 @@ class btcalpha(Exchange, ImplicitAPI):
48
49
  'fetchCrossBorrowRate': False,
49
50
  'fetchCrossBorrowRates': False,
50
51
  'fetchDeposit': False,
52
+ 'fetchDepositAddress': False,
53
+ 'fetchDepositAddresses': False,
54
+ 'fetchDepositAddressesByNetwork': False,
51
55
  'fetchDeposits': True,
52
56
  'fetchFundingHistory': False,
53
57
  'fetchFundingRate': False,
ccxt/btcmarkets.py CHANGED
@@ -40,6 +40,7 @@ class btcmarkets(Exchange, ImplicitAPI):
40
40
  'cancelOrders': True,
41
41
  'closeAllPositions': False,
42
42
  'closePosition': False,
43
+ 'createDepositAddress': False,
43
44
  'createOrder': True,
44
45
  'createReduceOnlyOrder': False,
45
46
  'fetchBalance': True,
@@ -48,6 +49,9 @@ class btcmarkets(Exchange, ImplicitAPI):
48
49
  'fetchClosedOrders': 'emulated',
49
50
  'fetchCrossBorrowRate': False,
50
51
  'fetchCrossBorrowRates': False,
52
+ 'fetchDepositAddress': False,
53
+ 'fetchDepositAddresses': False,
54
+ 'fetchDepositAddressesByNetwork': False,
51
55
  'fetchDeposits': True,
52
56
  'fetchDepositsWithdrawals': True,
53
57
  'fetchFundingHistory': False,
ccxt/btcturk.py CHANGED
@@ -37,6 +37,7 @@ class btcturk(Exchange, ImplicitAPI):
37
37
  'cancelOrder': True,
38
38
  'closeAllPositions': False,
39
39
  'closePosition': False,
40
+ 'createDepositAddress': False,
40
41
  'createOrder': True,
41
42
  'createReduceOnlyOrder': False,
42
43
  'fetchBalance': True,
@@ -44,6 +45,9 @@ class btcturk(Exchange, ImplicitAPI):
44
45
  'fetchBorrowRateHistory': False,
45
46
  'fetchCrossBorrowRate': False,
46
47
  'fetchCrossBorrowRates': False,
48
+ 'fetchDepositAddress': False,
49
+ 'fetchDepositAddresses': False,
50
+ 'fetchDepositAddressesByNetwork': False,
47
51
  'fetchFundingHistory': False,
48
52
  'fetchFundingRate': False,
49
53
  'fetchFundingRateHistory': False,
ccxt/bybit.py CHANGED
@@ -95,6 +95,7 @@ class bybit(Exchange, ImplicitAPI):
95
95
  'fetchMarketLeverageTiers': True,
96
96
  'fetchMarkets': True,
97
97
  'fetchMarkOHLCV': True,
98
+ 'fetchMyLiquidations': True,
98
99
  'fetchMySettlementHistory': True,
99
100
  'fetchMyTrades': True,
100
101
  'fetchOHLCV': True,
@@ -4262,7 +4263,7 @@ class bybit(Exchange, ImplicitAPI):
4262
4263
  paginate = False
4263
4264
  paginate, params = self.handle_option_and_params(params, 'fetchOrders', 'paginate')
4264
4265
  if paginate:
4265
- return self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 50)
4266
+ return self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
4266
4267
  enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
4267
4268
  isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4268
4269
  request = {}
@@ -4422,7 +4423,7 @@ class bybit(Exchange, ImplicitAPI):
4422
4423
  paginate = False
4423
4424
  paginate, params = self.handle_option_and_params(params, 'fetchCanceledAndClosedOrders', 'paginate')
4424
4425
  if paginate:
4425
- return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 50)
4426
+ return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
4426
4427
  enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
4427
4428
  isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4428
4429
  request = {}
@@ -4766,7 +4767,7 @@ class bybit(Exchange, ImplicitAPI):
4766
4767
  paginate = False
4767
4768
  paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
4768
4769
  if paginate:
4769
- return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 100)
4770
+ return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
4770
4771
  enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
4771
4772
  isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4772
4773
  request = {}
@@ -4956,7 +4957,7 @@ class bybit(Exchange, ImplicitAPI):
4956
4957
  paginate = False
4957
4958
  paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
4958
4959
  if paginate:
4959
- return self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 50)
4960
+ return self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
4960
4961
  request = {
4961
4962
  # 'coin': currency['id'],
4962
4963
  # 'limit': 20, # max 50
@@ -5018,7 +5019,7 @@ class bybit(Exchange, ImplicitAPI):
5018
5019
  paginate = False
5019
5020
  paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
5020
5021
  if paginate:
5021
- return self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 50)
5022
+ return self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
5022
5023
  request = {
5023
5024
  # 'coin': currency['id'],
5024
5025
  # 'limit': 20, # max 50
@@ -6419,7 +6420,7 @@ class bybit(Exchange, ImplicitAPI):
6419
6420
  paginate = False
6420
6421
  paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate')
6421
6422
  if paginate:
6422
- return self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', None, 50)
6423
+ return self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
6423
6424
  currency = None
6424
6425
  request = {}
6425
6426
  if code is not None:
@@ -7212,6 +7213,131 @@ class bybit(Exchange, ImplicitAPI):
7212
7213
  'info': greeks,
7213
7214
  }
7214
7215
 
7216
+ def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7217
+ """
7218
+ retrieves the users liquidated positions
7219
+ :see: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
7220
+ :param str [symbol]: unified CCXT market symbol
7221
+ :param int [since]: the earliest time in ms to fetch liquidations for
7222
+ :param int [limit]: the maximum number of liquidation structures to retrieve
7223
+ :param dict [params]: exchange specific parameters for the exchange API endpoint
7224
+ :param str [params.type]: market type, ['swap', 'option', 'spot']
7225
+ :param str [params.subType]: market subType, ['linear', 'inverse']
7226
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
7227
+ :returns dict: an array of `liquidation structures <https://docs.ccxt.com/#/?id=liquidation-structure>`
7228
+ """
7229
+ self.load_markets()
7230
+ paginate = False
7231
+ paginate, params = self.handle_option_and_params(params, 'fetchMyLiquidations', 'paginate')
7232
+ if paginate:
7233
+ return self.fetch_paginated_call_cursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
7234
+ request = {
7235
+ 'execType': 'BustTrade',
7236
+ }
7237
+ market = None
7238
+ if symbol is not None:
7239
+ market = self.market(symbol)
7240
+ request['symbol'] = market['id']
7241
+ type = None
7242
+ type, params = self.get_bybit_type('fetchMyLiquidations', market, params)
7243
+ request['category'] = type
7244
+ if limit is not None:
7245
+ request['limit'] = limit
7246
+ if since is not None:
7247
+ request['startTime'] = since
7248
+ request, params = self.handle_until_option('endTime', request, params)
7249
+ response = self.privateGetV5ExecutionList(self.extend(request, params))
7250
+ #
7251
+ # {
7252
+ # "retCode": 0,
7253
+ # "retMsg": "OK",
7254
+ # "result": {
7255
+ # "nextPageCursor": "132766%3A2%2C132766%3A2",
7256
+ # "category": "linear",
7257
+ # "list": [
7258
+ # {
7259
+ # "symbol": "ETHPERP",
7260
+ # "orderType": "Market",
7261
+ # "underlyingPrice": "",
7262
+ # "orderLinkId": "",
7263
+ # "side": "Buy",
7264
+ # "indexPrice": "",
7265
+ # "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
7266
+ # "stopOrderType": "UNKNOWN",
7267
+ # "leavesQty": "0",
7268
+ # "execTime": "1672282722429",
7269
+ # "isMaker": False,
7270
+ # "execFee": "0.071409",
7271
+ # "feeRate": "0.0006",
7272
+ # "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
7273
+ # "tradeIv": "",
7274
+ # "blockTradeId": "",
7275
+ # "markPrice": "1183.54",
7276
+ # "execPrice": "1190.15",
7277
+ # "markIv": "",
7278
+ # "orderQty": "0.1",
7279
+ # "orderPrice": "1236.9",
7280
+ # "execValue": "119.015",
7281
+ # "execType": "Trade",
7282
+ # "execQty": "0.1"
7283
+ # }
7284
+ # ]
7285
+ # },
7286
+ # "retExtInfo": {},
7287
+ # "time": 1672283754510
7288
+ # }
7289
+ #
7290
+ liquidations = self.add_pagination_cursor_to_result(response)
7291
+ return self.parse_liquidations(liquidations, market, since, limit)
7292
+
7293
+ def parse_liquidation(self, liquidation, market: Market = None):
7294
+ #
7295
+ # {
7296
+ # "symbol": "ETHPERP",
7297
+ # "orderType": "Market",
7298
+ # "underlyingPrice": "",
7299
+ # "orderLinkId": "",
7300
+ # "side": "Buy",
7301
+ # "indexPrice": "",
7302
+ # "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
7303
+ # "stopOrderType": "UNKNOWN",
7304
+ # "leavesQty": "0",
7305
+ # "execTime": "1672282722429",
7306
+ # "isMaker": False,
7307
+ # "execFee": "0.071409",
7308
+ # "feeRate": "0.0006",
7309
+ # "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
7310
+ # "tradeIv": "",
7311
+ # "blockTradeId": "",
7312
+ # "markPrice": "1183.54",
7313
+ # "execPrice": "1190.15",
7314
+ # "markIv": "",
7315
+ # "orderQty": "0.1",
7316
+ # "orderPrice": "1236.9",
7317
+ # "execValue": "119.015",
7318
+ # "execType": "Trade",
7319
+ # "execQty": "0.1"
7320
+ # }
7321
+ #
7322
+ marketId = self.safe_string(liquidation, 'symbol')
7323
+ timestamp = self.safe_integer(liquidation, 'execTime')
7324
+ contractsString = self.safe_string(liquidation, 'execQty')
7325
+ contractSizeString = self.safe_string(market, 'contractSize')
7326
+ priceString = self.safe_string(liquidation, 'execPrice')
7327
+ baseValueString = Precise.string_mul(contractsString, contractSizeString)
7328
+ quoteValueString = Precise.string_mul(baseValueString, priceString)
7329
+ return self.safe_liquidation({
7330
+ 'info': liquidation,
7331
+ 'symbol': self.safe_symbol(marketId, market),
7332
+ 'contracts': self.parse_number(contractsString),
7333
+ 'contractSize': self.parse_number(contractSizeString),
7334
+ 'price': self.parse_number(priceString),
7335
+ 'baseValue': self.parse_number(baseValueString),
7336
+ 'quoteValue': self.parse_number(quoteValueString),
7337
+ 'timestamp': timestamp,
7338
+ 'datetime': self.iso8601(timestamp),
7339
+ })
7340
+
7215
7341
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
7216
7342
  url = self.implode_hostname(self.urls['api'][api]) + '/' + path
7217
7343
  if api == 'public':