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

Files changed (141) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +4 -0
  3. ccxt/abstract/coinbase.py +1 -0
  4. ccxt/abstract/coinbasepro.py +1 -0
  5. ccxt/abstract/okx.py +1 -0
  6. ccxt/ascendex.py +31 -27
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/ascendex.py +31 -27
  9. ccxt/async_support/base/exchange.py +19 -7
  10. ccxt/async_support/bigone.py +2 -2
  11. ccxt/async_support/binance.py +478 -188
  12. ccxt/async_support/bingx.py +250 -28
  13. ccxt/async_support/bitfinex.py +3 -3
  14. ccxt/async_support/bitfinex2.py +2 -2
  15. ccxt/async_support/bitget.py +16 -7
  16. ccxt/async_support/bitmart.py +2 -2
  17. ccxt/async_support/bitmex.py +2 -2
  18. ccxt/async_support/bitrue.py +2 -2
  19. ccxt/async_support/bitso.py +19 -3
  20. ccxt/async_support/bitstamp.py +25 -3
  21. ccxt/async_support/bitvavo.py +1 -1
  22. ccxt/async_support/bl3p.py +6 -0
  23. ccxt/async_support/blockchaincom.py +21 -0
  24. ccxt/async_support/blofin.py +2 -2
  25. ccxt/async_support/btcalpha.py +9 -0
  26. ccxt/async_support/btcbox.py +9 -0
  27. ccxt/async_support/btcmarkets.py +19 -0
  28. ccxt/async_support/bybit.py +9 -7
  29. ccxt/async_support/cex.py +1 -1
  30. ccxt/async_support/coinbase.py +20 -9
  31. ccxt/async_support/coinbasepro.py +1 -0
  32. ccxt/async_support/coinex.py +4 -4
  33. ccxt/async_support/coinlist.py +11 -9
  34. ccxt/async_support/coinmetro.py +2 -1
  35. ccxt/async_support/coinone.py +1 -1
  36. ccxt/async_support/delta.py +2 -2
  37. ccxt/async_support/deribit.py +3 -3
  38. ccxt/async_support/digifinex.py +3 -3
  39. ccxt/async_support/exmo.py +2 -2
  40. ccxt/async_support/gate.py +6 -6
  41. ccxt/async_support/hitbtc.py +2 -2
  42. ccxt/async_support/hollaex.py +1 -1
  43. ccxt/async_support/htx.py +3 -3
  44. ccxt/async_support/huobijp.py +1 -1
  45. ccxt/async_support/kraken.py +2 -2
  46. ccxt/async_support/krakenfutures.py +117 -16
  47. ccxt/async_support/kucoin.py +5 -5
  48. ccxt/async_support/kucoinfutures.py +2 -2
  49. ccxt/async_support/latoken.py +1 -1
  50. ccxt/async_support/lbank.py +2 -2
  51. ccxt/async_support/luno.py +2 -2
  52. ccxt/async_support/mexc.py +5 -5
  53. ccxt/async_support/ndax.py +1 -1
  54. ccxt/async_support/novadax.py +1 -1
  55. ccxt/async_support/okcoin.py +2 -2
  56. ccxt/async_support/okx.py +18 -21
  57. ccxt/async_support/paymium.py +2 -2
  58. ccxt/async_support/phemex.py +5 -4
  59. ccxt/async_support/poloniex.py +2 -2
  60. ccxt/async_support/poloniexfutures.py +10 -6
  61. ccxt/async_support/probit.py +1 -1
  62. ccxt/async_support/timex.py +1 -1
  63. ccxt/async_support/upbit.py +1 -1
  64. ccxt/async_support/wavesexchange.py +1 -1
  65. ccxt/async_support/whitebit.py +2 -2
  66. ccxt/async_support/woo.py +4 -4
  67. ccxt/async_support/zonda.py +3 -3
  68. ccxt/base/exchange.py +37 -25
  69. ccxt/bigone.py +2 -2
  70. ccxt/binance.py +478 -188
  71. ccxt/bingx.py +250 -28
  72. ccxt/bitfinex.py +3 -3
  73. ccxt/bitfinex2.py +2 -2
  74. ccxt/bitget.py +16 -7
  75. ccxt/bitmart.py +2 -2
  76. ccxt/bitmex.py +2 -2
  77. ccxt/bitrue.py +2 -2
  78. ccxt/bitso.py +19 -3
  79. ccxt/bitstamp.py +25 -3
  80. ccxt/bitvavo.py +1 -1
  81. ccxt/bl3p.py +6 -0
  82. ccxt/blockchaincom.py +21 -0
  83. ccxt/blofin.py +2 -2
  84. ccxt/btcalpha.py +9 -0
  85. ccxt/btcbox.py +9 -0
  86. ccxt/btcmarkets.py +19 -0
  87. ccxt/bybit.py +9 -7
  88. ccxt/cex.py +1 -1
  89. ccxt/coinbase.py +20 -9
  90. ccxt/coinbasepro.py +1 -0
  91. ccxt/coinex.py +4 -4
  92. ccxt/coinlist.py +11 -9
  93. ccxt/coinmetro.py +2 -1
  94. ccxt/coinone.py +1 -1
  95. ccxt/delta.py +2 -2
  96. ccxt/deribit.py +3 -3
  97. ccxt/digifinex.py +3 -3
  98. ccxt/exmo.py +2 -2
  99. ccxt/gate.py +6 -6
  100. ccxt/hitbtc.py +2 -2
  101. ccxt/hollaex.py +1 -1
  102. ccxt/htx.py +3 -3
  103. ccxt/huobijp.py +1 -1
  104. ccxt/kraken.py +2 -2
  105. ccxt/krakenfutures.py +117 -16
  106. ccxt/kucoin.py +5 -5
  107. ccxt/kucoinfutures.py +2 -2
  108. ccxt/latoken.py +1 -1
  109. ccxt/lbank.py +2 -2
  110. ccxt/luno.py +2 -2
  111. ccxt/mexc.py +5 -5
  112. ccxt/ndax.py +1 -1
  113. ccxt/novadax.py +1 -1
  114. ccxt/okcoin.py +2 -2
  115. ccxt/okx.py +18 -21
  116. ccxt/paymium.py +2 -2
  117. ccxt/phemex.py +5 -4
  118. ccxt/poloniex.py +2 -2
  119. ccxt/poloniexfutures.py +10 -6
  120. ccxt/pro/__init__.py +1 -1
  121. ccxt/pro/bitmart.py +129 -46
  122. ccxt/pro/bitvavo.py +1 -1
  123. ccxt/pro/bybit.py +6 -6
  124. ccxt/pro/cex.py +2 -2
  125. ccxt/pro/coinbase.py +2 -2
  126. ccxt/pro/coinex.py +1 -1
  127. ccxt/pro/lbank.py +1 -1
  128. ccxt/pro/mexc.py +1 -1
  129. ccxt/probit.py +1 -1
  130. ccxt/test/test_async.py +3 -1
  131. ccxt/test/test_sync.py +3 -1
  132. ccxt/timex.py +1 -1
  133. ccxt/upbit.py +1 -1
  134. ccxt/wavesexchange.py +1 -1
  135. ccxt/whitebit.py +2 -2
  136. ccxt/woo.py +4 -4
  137. ccxt/zonda.py +3 -3
  138. {ccxt-4.2.38.dist-info → ccxt-4.2.40.dist-info}/METADATA +4 -4
  139. {ccxt-4.2.38.dist-info → ccxt-4.2.40.dist-info}/RECORD +141 -141
  140. {ccxt-4.2.38.dist-info → ccxt-4.2.40.dist-info}/WHEEL +0 -0
  141. {ccxt-4.2.38.dist-info → ccxt-4.2.40.dist-info}/top_level.txt +0 -0
ccxt/hitbtc.py CHANGED
@@ -2075,7 +2075,7 @@ class hitbtc(Exchange, ImplicitAPI):
2075
2075
  raise NotSupported(self.id + ' cancelOrder() not support self market type')
2076
2076
  return self.parse_order(response, market)
2077
2077
 
2078
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
2078
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
2079
2079
  self.load_markets()
2080
2080
  market = None
2081
2081
  request = {
@@ -2400,7 +2400,7 @@ class hitbtc(Exchange, ImplicitAPI):
2400
2400
  filteredMargin = self.filter_by_symbol(marginModes, symbol)
2401
2401
  return self.safe_value(filteredMargin, 0)
2402
2402
 
2403
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
2403
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2404
2404
  """
2405
2405
  transfer currency internally between wallets on the same account
2406
2406
  :see: https://api.hitbtc.com/#transfer-between-wallet-and-exchange
ccxt/hollaex.py CHANGED
@@ -1277,7 +1277,7 @@ class hollaex(Exchange, ImplicitAPI):
1277
1277
  'info': depositAddress,
1278
1278
  }
1279
1279
 
1280
- def fetch_deposit_addresses(self, codes=None, params={}):
1280
+ def fetch_deposit_addresses(self, codes: List[str] = None, params={}):
1281
1281
  """
1282
1282
  fetch deposit addresses for multiple currencies and chain types
1283
1283
  :param str[]|None codes: list of unified currency codes, default is None
ccxt/htx.py CHANGED
@@ -4752,7 +4752,7 @@ class htx(Exchange, ImplicitAPI):
4752
4752
  'trades': trades,
4753
4753
  }, market)
4754
4754
 
4755
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
4755
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
4756
4756
  """
4757
4757
  create a market buy order by providing the symbol and cost
4758
4758
  :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4ee16-7773-11ed-9966-0242ac110003
@@ -6022,7 +6022,7 @@ class htx(Exchange, ImplicitAPI):
6022
6022
  'status': None,
6023
6023
  }
6024
6024
 
6025
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
6025
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
6026
6026
  """
6027
6027
  transfer currency internally between wallets on the same account
6028
6028
  :see: https://huobiapi.github.io/docs/dm/v1/en/#transfer-margin-between-spot-account-and-future-account
@@ -8356,7 +8356,7 @@ class htx(Exchange, ImplicitAPI):
8356
8356
  'datetime': self.iso8601(timestamp),
8357
8357
  })
8358
8358
 
8359
- def set_position_mode(self, hedged, symbol: Str = None, params={}):
8359
+ def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
8360
8360
  """
8361
8361
  set hedged to True or False
8362
8362
  :see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-switch-position-mode
ccxt/huobijp.py CHANGED
@@ -1305,7 +1305,7 @@ class huobijp(Exchange, ImplicitAPI):
1305
1305
  'trades': None,
1306
1306
  }, market)
1307
1307
 
1308
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1308
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1309
1309
  """
1310
1310
  create a market buy order by providing the symbol and cost
1311
1311
  :param str symbol: unified symbol of the market to create an order in
ccxt/kraken.py CHANGED
@@ -1669,7 +1669,7 @@ class kraken(Exchange, ImplicitAPI):
1669
1669
  params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset'])
1670
1670
  return [request, params]
1671
1671
 
1672
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
1672
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
1673
1673
  """
1674
1674
  edit a trade order
1675
1675
  :see: https://docs.kraken.com/rest/#tag/Trading/operation/editOrder
@@ -2597,7 +2597,7 @@ class kraken(Exchange, ImplicitAPI):
2597
2597
  """
2598
2598
  return self.transfer(code, amount, 'spot', 'swap', params)
2599
2599
 
2600
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
2600
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2601
2601
  """
2602
2602
  :see: https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer
2603
2603
  transfers currencies between sub-accounts(only spot->swap direction is supported)
ccxt/krakenfutures.py CHANGED
@@ -54,7 +54,8 @@ class krakenfutures(Exchange, ImplicitAPI):
54
54
  'fetchBalance': True,
55
55
  'fetchBorrowRateHistories': False,
56
56
  'fetchBorrowRateHistory': False,
57
- 'fetchClosedOrders': None, # https://support.kraken.com/hc/en-us/articles/360058243651-Historical-orders
57
+ 'fetchCanceledOrders': True,
58
+ 'fetchClosedOrders': True, # https://support.kraken.com/hc/en-us/articles/360058243651-Historical-orders
58
59
  'fetchCrossBorrowRate': False,
59
60
  'fetchCrossBorrowRates': False,
60
61
  'fetchDepositAddress': False,
@@ -784,32 +785,27 @@ class krakenfutures(Exchange, ImplicitAPI):
784
785
  if id is None:
785
786
  id = self.safe_string(trade, 'executionId')
786
787
  order = self.safe_string(trade, 'order_id')
787
- symbolId = self.safe_string(trade, 'symbol')
788
+ marketId = self.safe_string(trade, 'symbol')
788
789
  side = self.safe_string(trade, 'side')
789
790
  type = None
790
791
  priorEdit = self.safe_value(trade, 'orderPriorEdit')
791
792
  priorExecution = self.safe_value(trade, 'orderPriorExecution')
792
793
  if priorExecution is not None:
793
794
  order = self.safe_string(priorExecution, 'orderId')
794
- symbolId = self.safe_string(priorExecution, 'symbol')
795
+ marketId = self.safe_string(priorExecution, 'symbol')
795
796
  side = self.safe_string(priorExecution, 'side')
796
797
  type = self.safe_string(priorExecution, 'type')
797
798
  elif priorEdit is not None:
798
799
  order = self.safe_string(priorEdit, 'orderId')
799
- symbolId = self.safe_string(priorEdit, 'symbol')
800
+ marketId = self.safe_string(priorEdit, 'symbol')
800
801
  side = self.safe_string(priorEdit, 'type')
801
802
  type = self.safe_string(priorEdit, 'type')
802
803
  if type is not None:
803
804
  type = self.parse_order_type(type)
804
- symbol = None
805
- if symbolId is not None:
806
- market = self.safe_value(self.markets_by_id, symbolId)
807
- if market is None:
808
- symbol = symbolId
809
- symbol = self.safe_string(market, 'symbol', symbol)
805
+ market = self.safe_market(marketId, market)
810
806
  cost = None
807
+ linear = self.safe_bool(market, 'linear')
811
808
  if (amount is not None) and (price is not None) and (market is not None):
812
- linear = self.safe_value(market, 'linear')
813
809
  if linear:
814
810
  cost = Precise.string_mul(amount, price) # in quote
815
811
  else:
@@ -826,15 +822,15 @@ class krakenfutures(Exchange, ImplicitAPI):
826
822
  return self.safe_trade({
827
823
  'info': trade,
828
824
  'id': id,
825
+ 'symbol': self.safe_string(market, 'symbol'),
829
826
  'timestamp': timestamp,
830
827
  'datetime': self.iso8601(timestamp),
831
- 'symbol': symbol,
832
828
  'order': order,
833
829
  'type': type,
834
830
  'side': side,
835
831
  'takerOrMaker': takerOrMaker,
836
832
  'price': price,
837
- 'amount': amount,
833
+ 'amount': amount if linear else None,
838
834
  'cost': cost,
839
835
  'fee': None,
840
836
  })
@@ -994,7 +990,7 @@ class krakenfutures(Exchange, ImplicitAPI):
994
990
  data = self.safe_value(response, 'batchStatus', [])
995
991
  return self.parse_orders(data)
996
992
 
997
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
993
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
998
994
  """
999
995
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
1000
996
  Edit an open order on the exchange
@@ -1130,6 +1126,84 @@ class krakenfutures(Exchange, ImplicitAPI):
1130
1126
  orders = self.safe_value(response, 'openOrders', [])
1131
1127
  return self.parse_orders(orders, market, since, limit)
1132
1128
 
1129
+ def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1130
+ """
1131
+ :see: https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1132
+ Gets all closed orders, including trigger orders, for an account from the exchange api
1133
+ :param str symbol: Unified market symbol
1134
+ :param int [since]: Timestamp(ms) of earliest order.
1135
+ :param int [limit]: How many orders to return.
1136
+ :param dict [params]: Exchange specific parameters
1137
+ :returns: An array of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1138
+ """
1139
+ self.load_markets()
1140
+ market = None
1141
+ if symbol is not None:
1142
+ market = self.market(symbol)
1143
+ request = {}
1144
+ if limit is not None:
1145
+ request['count'] = limit
1146
+ if since is not None:
1147
+ request['from'] = since
1148
+ response = self.historyGetOrders(self.extend(request, params))
1149
+ allOrders = self.safe_list(response, 'elements', [])
1150
+ closedOrders = []
1151
+ for i in range(0, len(allOrders)):
1152
+ order = allOrders[i]
1153
+ event = self.safe_dict(order, 'event', {})
1154
+ orderPlaced = self.safe_dict(event, 'OrderPlaced')
1155
+ if orderPlaced is not None:
1156
+ innerOrder = self.safe_dict(orderPlaced, 'order', {})
1157
+ filled = self.safe_string(innerOrder, 'filled')
1158
+ if filled != '0':
1159
+ innerOrder['status'] = 'closed' # status not available in the response
1160
+ closedOrders.append(innerOrder)
1161
+ return self.parse_orders(closedOrders, market, since, limit)
1162
+
1163
+ def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1164
+ """
1165
+ :see: https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1166
+ Gets all canceled orders, including trigger orders, for an account from the exchange api
1167
+ :param str symbol: Unified market symbol
1168
+ :param int [since]: Timestamp(ms) of earliest order.
1169
+ :param int [limit]: How many orders to return.
1170
+ :param dict [params]: Exchange specific parameters
1171
+ :returns: An array of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1172
+ """
1173
+ self.load_markets()
1174
+ market = None
1175
+ if symbol is not None:
1176
+ market = self.market(symbol)
1177
+ request = {}
1178
+ if limit is not None:
1179
+ request['count'] = limit
1180
+ if since is not None:
1181
+ request['from'] = since
1182
+ response = self.historyGetOrders(self.extend(request, params))
1183
+ allOrders = self.safe_list(response, 'elements', [])
1184
+ canceledAndRejected = []
1185
+ for i in range(0, len(allOrders)):
1186
+ order = allOrders[i]
1187
+ event = self.safe_dict(order, 'event', {})
1188
+ orderPlaced = self.safe_dict(event, 'OrderPlaced')
1189
+ if orderPlaced is not None:
1190
+ innerOrder = self.safe_dict(orderPlaced, 'order', {})
1191
+ filled = self.safe_string(innerOrder, 'filled')
1192
+ if filled == '0':
1193
+ innerOrder['status'] = 'canceled' # status not available in the response
1194
+ canceledAndRejected.append(innerOrder)
1195
+ orderCanceled = self.safe_dict(event, 'OrderCancelled')
1196
+ if orderCanceled is not None:
1197
+ innerOrder = self.safe_dict(orderCanceled, 'order', {})
1198
+ innerOrder['status'] = 'canceled' # status not available in the response
1199
+ canceledAndRejected.append(innerOrder)
1200
+ orderRejected = self.safe_dict(event, 'OrderRejected')
1201
+ if orderRejected is not None:
1202
+ innerOrder = self.safe_dict(orderRejected, 'order', {})
1203
+ innerOrder['status'] = 'rejected' # status not available in the response
1204
+ canceledAndRejected.append(innerOrder)
1205
+ return self.parse_orders(canceledAndRejected, market, since, limit)
1206
+
1133
1207
  def parse_order_type(self, orderType):
1134
1208
  map = {
1135
1209
  'lmt': 'limit',
@@ -1372,6 +1446,32 @@ class krakenfutures(Exchange, ImplicitAPI):
1372
1446
  # "status": "requiredArgumentMissing",
1373
1447
  # "orderEvents": []
1374
1448
  # }
1449
+ # closed orders
1450
+ # {
1451
+ # uid: '2f00cd63-e61d-44f8-8569-adabde885941',
1452
+ # timestamp: '1707258274849',
1453
+ # event: {
1454
+ # OrderPlaced: {
1455
+ # order: {
1456
+ # uid: '85805e01-9eed-4395-8360-ed1a228237c9',
1457
+ # accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
1458
+ # tradeable: 'PF_LTCUSD',
1459
+ # direction: 'Buy',
1460
+ # quantity: '0',
1461
+ # filled: '0.1',
1462
+ # timestamp: '1707258274849',
1463
+ # limitPrice: '69.2200000000',
1464
+ # orderType: 'IoC',
1465
+ # clientId: '',
1466
+ # reduceOnly: False,
1467
+ # lastUpdateTimestamp: '1707258274849'
1468
+ # },
1469
+ # reason: 'new_user_order',
1470
+ # reducedQuantity: '',
1471
+ # algoId: ''
1472
+ # }
1473
+ # }
1474
+ # }
1375
1475
  #
1376
1476
  orderEvents = self.safe_value(order, 'orderEvents', [])
1377
1477
  errorStatus = self.safe_string(order, 'status')
@@ -1424,7 +1524,8 @@ class krakenfutures(Exchange, ImplicitAPI):
1424
1524
  remaining = self.safe_string(details, 'unfilledSize')
1425
1525
  average = None
1426
1526
  filled2 = '0.0'
1427
- if len(trades):
1527
+ tradesLength = len(trades)
1528
+ if tradesLength > 0:
1428
1529
  vwapSum = '0.0'
1429
1530
  for i in range(0, len(trades)):
1430
1531
  trade = trades[i]
@@ -2137,7 +2238,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2137
2238
  """
2138
2239
  return self.transfer(code, amount, 'future', 'spot', params)
2139
2240
 
2140
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
2241
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2141
2242
  """
2142
2243
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2143
2244
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
ccxt/kucoin.py CHANGED
@@ -1902,7 +1902,7 @@ class kucoin(Exchange, ImplicitAPI):
1902
1902
  data = self.safe_value(response, 'data', {})
1903
1903
  return self.parse_order(data, market)
1904
1904
 
1905
- def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost, params={}):
1905
+ def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
1906
1906
  """
1907
1907
  create a market order by providing the symbol, side and cost
1908
1908
  :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
@@ -1916,7 +1916,7 @@ class kucoin(Exchange, ImplicitAPI):
1916
1916
  params['cost'] = cost
1917
1917
  return self.create_order(symbol, 'market', side, cost, None, params)
1918
1918
 
1919
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1919
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1920
1920
  """
1921
1921
  create a market buy order by providing the symbol and cost
1922
1922
  :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
@@ -1928,7 +1928,7 @@ class kucoin(Exchange, ImplicitAPI):
1928
1928
  self.load_markets()
1929
1929
  return self.create_market_order_with_cost(symbol, 'buy', cost, params)
1930
1930
 
1931
- def create_market_sell_order_with_cost(self, symbol: str, cost, params={}):
1931
+ def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
1932
1932
  """
1933
1933
  create a market sell order by providing the symbol and cost
1934
1934
  :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
@@ -2073,7 +2073,7 @@ class kucoin(Exchange, ImplicitAPI):
2073
2073
  request['postOnly'] = True
2074
2074
  return self.extend(request, params)
2075
2075
 
2076
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
2076
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
2077
2077
  """
2078
2078
  edit an order, kucoin currently only supports the modification of HF orders
2079
2079
  :see: https://docs.kucoin.com/spot-hf/#modify-order
@@ -3372,7 +3372,7 @@ class kucoin(Exchange, ImplicitAPI):
3372
3372
  returnType = result if isolated else self.safe_balance(result)
3373
3373
  return returnType
3374
3374
 
3375
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
3375
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
3376
3376
  """
3377
3377
  transfer currency internally between wallets on the same account
3378
3378
  :see: https://docs.kucoin.com/#inner-transfer
ccxt/kucoinfutures.py CHANGED
@@ -1544,7 +1544,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1544
1544
  return self.fetch_paginated_call_dynamic('fetchClosedOrders', symbol, since, limit, params)
1545
1545
  return self.fetch_orders_by_status('done', symbol, since, limit, params)
1546
1546
 
1547
- def fetch_order(self, id=None, symbol: Str = None, params={}):
1547
+ def fetch_order(self, id: str = None, symbol: Str = None, params={}):
1548
1548
  """
1549
1549
  fetches information on an order made by the user
1550
1550
  :see: https://docs.kucoin.com/futures/#get-details-of-a-single-order
@@ -1842,7 +1842,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1842
1842
  #
1843
1843
  return self.parse_balance(response)
1844
1844
 
1845
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
1845
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
1846
1846
  """
1847
1847
  transfer currency internally between wallets on the same account
1848
1848
  :param str code: unified currency code
ccxt/latoken.py CHANGED
@@ -1493,7 +1493,7 @@ class latoken(Exchange, ImplicitAPI):
1493
1493
  transfers = self.safe_value(response, 'content', [])
1494
1494
  return self.parse_transfers(transfers, currency, since, limit)
1495
1495
 
1496
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
1496
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
1497
1497
  """
1498
1498
  transfer currency internally between wallets on the same account
1499
1499
  :param str code: unified currency code
ccxt/lbank.py CHANGED
@@ -1227,7 +1227,7 @@ class lbank(Exchange, ImplicitAPI):
1227
1227
  result[symbol] = fee
1228
1228
  return result
1229
1229
 
1230
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1230
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1231
1231
  """
1232
1232
  create a market buy order by providing the symbol and cost
1233
1233
  :see: https://www.lbank.com/en-US/docs/index.html#place-order
@@ -2163,7 +2163,7 @@ class lbank(Exchange, ImplicitAPI):
2163
2163
  withdraws = self.safe_value(data, 'withdraws', [])
2164
2164
  return self.parse_transactions(withdraws, currency, since, limit)
2165
2165
 
2166
- def fetch_transaction_fees(self, codes=None, params={}):
2166
+ def fetch_transaction_fees(self, codes: List[str] = None, params={}):
2167
2167
  """
2168
2168
  * @deprecated
2169
2169
  please use fetchDepositWithdrawFees instead
ccxt/luno.py CHANGED
@@ -694,7 +694,7 @@ class luno(Exchange, ImplicitAPI):
694
694
  trades = self.safe_value(response, 'trades', [])
695
695
  return self.parse_trades(trades, market, since, limit)
696
696
 
697
- def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
697
+ def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
698
698
  """
699
699
  :see: https://www.luno.com/en/developers/api#tag/Market/operation/GetCandles
700
700
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
@@ -712,7 +712,7 @@ class luno(Exchange, ImplicitAPI):
712
712
  'pair': market['id'],
713
713
  }
714
714
  if since is not None:
715
- request['since'] = int(since)
715
+ request['since'] = self.parse_to_int(since)
716
716
  else:
717
717
  duration = 1000 * 1000 * self.parse_timeframe(timeframe)
718
718
  request['since'] = self.milliseconds() - duration
ccxt/mexc.py CHANGED
@@ -1043,7 +1043,7 @@ class mexc(Exchange, ImplicitAPI):
1043
1043
 
1044
1044
  def fetch_markets(self, params={}):
1045
1045
  """
1046
- retrieves data on all markets for mexc3
1046
+ retrieves data on all markets for mexc
1047
1047
  :param dict [params]: extra parameters specific to the exchange API endpoint
1048
1048
  :returns dict[]: an array of objects representing market data
1049
1049
  """
@@ -2002,7 +2002,7 @@ class mexc(Exchange, ImplicitAPI):
2002
2002
  tickers = [tickers]
2003
2003
  return self.parse_tickers(tickers, symbols)
2004
2004
 
2005
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
2005
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
2006
2006
  """
2007
2007
  create a market buy order by providing the symbol and cost
2008
2008
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
@@ -4583,7 +4583,7 @@ class mexc(Exchange, ImplicitAPI):
4583
4583
  #
4584
4584
  return self.parse_transfers(resultList, currency, since, limit)
4585
4585
 
4586
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
4586
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
4587
4587
  """
4588
4588
  transfer currency internally between wallets on the same account
4589
4589
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#user-universal-transfer
@@ -4744,7 +4744,7 @@ class mexc(Exchange, ImplicitAPI):
4744
4744
  #
4745
4745
  return self.parse_transaction(response, currency)
4746
4746
 
4747
- def set_position_mode(self, hedged, symbol: Str = None, params={}):
4747
+ def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
4748
4748
  request = {
4749
4749
  'positionMode': 1 if hedged else 2, # 1 Hedge, 2 One-way, before changing position mode make sure that there are no active orders, planned orders, or open positions, the risk limit level will be reset to 1
4750
4750
  }
@@ -4772,7 +4772,7 @@ class mexc(Exchange, ImplicitAPI):
4772
4772
  'hedged': (positionMode == 1),
4773
4773
  }
4774
4774
 
4775
- def fetch_transaction_fees(self, codes=None, params={}):
4775
+ def fetch_transaction_fees(self, codes: List[str] = None, params={}):
4776
4776
  """
4777
4777
  fetch deposit and withdrawal fees
4778
4778
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
ccxt/ndax.py CHANGED
@@ -1337,7 +1337,7 @@ class ndax(Exchange, ImplicitAPI):
1337
1337
  #
1338
1338
  return self.parse_order(response, market)
1339
1339
 
1340
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
1340
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
1341
1341
  omsId = self.safe_integer(self.options, 'omsId', 1)
1342
1342
  self.load_markets()
1343
1343
  self.load_accounts()
ccxt/novadax.py CHANGED
@@ -1083,7 +1083,7 @@ class novadax(Exchange, ImplicitAPI):
1083
1083
  'trades': None,
1084
1084
  }, market)
1085
1085
 
1086
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
1086
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
1087
1087
  """
1088
1088
  transfer currency internally between wallets on the same account
1089
1089
  :see: https://doc.novadax.com/en-US/#get-sub-account-transfer
ccxt/okcoin.py CHANGED
@@ -1244,7 +1244,7 @@ class okcoin(Exchange, ImplicitAPI):
1244
1244
  result[code] = account
1245
1245
  return self.safe_balance(result)
1246
1246
 
1247
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1247
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1248
1248
  """
1249
1249
  create a market buy order by providing the symbol and cost
1250
1250
  :see: https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-order
@@ -2143,7 +2143,7 @@ class okcoin(Exchange, ImplicitAPI):
2143
2143
  parsed = self.parse_deposit_addresses(filtered, [currency['code']], False)
2144
2144
  return self.index_by(parsed, 'network')
2145
2145
 
2146
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
2146
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2147
2147
  """
2148
2148
  :see: https://www.okcoin.com/docs-v5/en/#rest-api-funding-funds-transfer
2149
2149
  transfer currency internally between wallets on the same account
ccxt/okx.py CHANGED
@@ -303,6 +303,7 @@ class okx(Exchange, ImplicitAPI):
303
303
  'trade/easy-convert-history': 20,
304
304
  'trade/one-click-repay-currency-list': 20,
305
305
  'trade/one-click-repay-history': 20,
306
+ 'trade/account-rate-limit': 1,
306
307
  # asset
307
308
  'asset/currencies': 5 / 3,
308
309
  'asset/balances': 5 / 3,
@@ -1122,7 +1123,7 @@ class okx(Exchange, ImplicitAPI):
1122
1123
  reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
1123
1124
  return reconstructedDate
1124
1125
 
1125
- def create_expired_option_market(self, symbol):
1126
+ def create_expired_option_market(self, symbol: str):
1126
1127
  # support expired option contracts
1127
1128
  quote = 'USD'
1128
1129
  optionParts = symbol.split('-')
@@ -1616,7 +1617,7 @@ class okx(Exchange, ImplicitAPI):
1616
1617
  if (networkId is not None) and (networkId.find('-') >= 0):
1617
1618
  parts = networkId.split('-')
1618
1619
  chainPart = self.safe_string(parts, 1, networkId)
1619
- networkCode = self.safe_network(chainPart)
1620
+ networkCode = self.network_id_to_code(chainPart, currency['code'])
1620
1621
  precision = self.parse_precision(self.safe_string(chain, 'wdTickSz'))
1621
1622
  if maxPrecision is None:
1622
1623
  maxPrecision = precision
@@ -2445,7 +2446,7 @@ class okx(Exchange, ImplicitAPI):
2445
2446
  #
2446
2447
  return self.parse_balance_by_type(marketType, response)
2447
2448
 
2448
- def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
2449
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
2449
2450
  """
2450
2451
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2451
2452
  create a market buy order by providing the symbol and cost
@@ -2462,7 +2463,7 @@ class okx(Exchange, ImplicitAPI):
2462
2463
  params['tgtCcy'] = 'quote_ccy'
2463
2464
  return self.create_order(symbol, 'market', 'buy', cost, None, params)
2464
2465
 
2465
- def create_market_sell_order_with_cost(self, symbol: str, cost, params={}):
2466
+ def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
2466
2467
  """
2467
2468
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2468
2469
  create a market buy order by providing the symbol and cost
@@ -2858,7 +2859,7 @@ class okx(Exchange, ImplicitAPI):
2858
2859
  params = self.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit'])
2859
2860
  return self.extend(request, params)
2860
2861
 
2861
- def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
2862
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float = None, price: float = None, params={}):
2862
2863
  """
2863
2864
  edit a trade order
2864
2865
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
@@ -3421,7 +3422,6 @@ class okx(Exchange, ImplicitAPI):
3421
3422
  :param int [since]: the earliest time in ms to fetch open orders for
3422
3423
  :param int [limit]: the maximum number of open orders structures to retrieve
3423
3424
  :param dict [params]: extra parameters specific to the exchange API endpoint
3424
- :param int [params.till]: Timestamp in ms of the latest time to retrieve orders for
3425
3425
  :param bool [params.stop]: True if fetching trigger or conditional orders
3426
3426
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3427
3427
  :param str [params.algoId]: Algo ID "'433845797218942976'"
@@ -3461,10 +3461,8 @@ class okx(Exchange, ImplicitAPI):
3461
3461
  method = 'privateGetTradeOrdersAlgoPending'
3462
3462
  if trailing:
3463
3463
  request['ordType'] = 'move_order_stop'
3464
- elif stop or (ordType in algoOrderTypes):
3465
- if stop:
3466
- if ordType is None:
3467
- raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"')
3464
+ elif stop and (ordType is None):
3465
+ request['ordType'] = 'trigger'
3468
3466
  query = self.omit(params, ['method', 'stop', 'trigger', 'trailing'])
3469
3467
  response = None
3470
3468
  if method == 'privateGetTradeOrdersAlgoPending':
@@ -3752,7 +3750,7 @@ class okx(Exchange, ImplicitAPI):
3752
3750
  :param int [since]: the earliest time in ms to fetch orders for
3753
3751
  :param int [limit]: the maximum number of order structures to retrieve
3754
3752
  :param dict [params]: extra parameters specific to the exchange API endpoint
3755
- :param bool [params.stop]: True if fetching trigger or conditional orders
3753
+ :param bool [params.trigger]: True if fetching trigger or conditional orders
3756
3754
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3757
3755
  :param str [params.algoId]: Algo ID "'433845797218942976'"
3758
3756
  :param int [params.until]: timestamp in ms to fetch orders for
@@ -3787,22 +3785,21 @@ class okx(Exchange, ImplicitAPI):
3787
3785
  request['instType'] = self.convert_to_instrument_type(type)
3788
3786
  if limit is not None:
3789
3787
  request['limit'] = limit # default 100, max 100
3790
- options = self.safe_value(self.options, 'fetchClosedOrders', {})
3791
- algoOrderTypes = self.safe_value(self.options, 'algoOrderTypes', {})
3788
+ options = self.safe_dict(self.options, 'fetchClosedOrders', {})
3789
+ algoOrderTypes = self.safe_dict(self.options, 'algoOrderTypes', {})
3792
3790
  defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersHistory')
3793
3791
  method = self.safe_string(params, 'method', defaultMethod)
3794
3792
  ordType = self.safe_string(params, 'ordType')
3795
- stop = self.safe_value_2(params, 'stop', 'trigger')
3793
+ stop = self.safe_bool_2(params, 'stop', 'trigger')
3796
3794
  trailing = self.safe_bool(params, 'trailing', False)
3797
3795
  if trailing or stop or (ordType in algoOrderTypes):
3798
3796
  method = 'privateGetTradeOrdersAlgoHistory'
3799
3797
  request['state'] = 'effective'
3800
3798
  if trailing:
3801
3799
  request['ordType'] = 'move_order_stop'
3802
- elif stop or (ordType in algoOrderTypes):
3803
- if stop:
3804
- if ordType is None:
3805
- raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"')
3800
+ elif stop:
3801
+ if ordType is None:
3802
+ request['ordType'] = 'trigger'
3806
3803
  else:
3807
3804
  if since is not None:
3808
3805
  request['begin'] = since
@@ -5117,7 +5114,7 @@ class okx(Exchange, ImplicitAPI):
5117
5114
  'takeProfitPrice': None,
5118
5115
  })
5119
5116
 
5120
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
5117
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
5121
5118
  """
5122
5119
  transfer currency internally between wallets on the same account
5123
5120
  :see: https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer
@@ -5675,7 +5672,7 @@ class okx(Exchange, ImplicitAPI):
5675
5672
  #
5676
5673
  return response
5677
5674
 
5678
- def set_position_mode(self, hedged, symbol: Str = None, params={}):
5675
+ def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
5679
5676
  """
5680
5677
  set hedged to True or False for a market
5681
5678
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
@@ -5706,7 +5703,7 @@ class okx(Exchange, ImplicitAPI):
5706
5703
  #
5707
5704
  return response
5708
5705
 
5709
- def set_margin_mode(self, marginMode, symbol: Str = None, params={}):
5706
+ def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
5710
5707
  """
5711
5708
  set margin mode to 'cross' or 'isolated'
5712
5709
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
ccxt/paymium.py CHANGED
@@ -325,7 +325,7 @@ class paymium(Exchange, ImplicitAPI):
325
325
  #
326
326
  return self.parse_deposit_address(response)
327
327
 
328
- def fetch_deposit_addresses(self, codes=None, params={}):
328
+ def fetch_deposit_addresses(self, codes: List[str] = None, params={}):
329
329
  """
330
330
  fetch deposit addresses for multiple currencies and chain types
331
331
  :see: https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses/get
@@ -409,7 +409,7 @@ class paymium(Exchange, ImplicitAPI):
409
409
  }
410
410
  return self.privateDeleteUserOrdersUuidCancel(self.extend(request, params))
411
411
 
412
- def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
412
+ def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
413
413
  """
414
414
  transfer currency internally between wallets on the same account
415
415
  :see: https://paymium.github.io/api-documentation/#tag/Transfer/paths/~1user~1email_transfers/post