ccxt 4.3.18__py2.py3-none-any.whl → 4.3.20__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 (195) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bitget.py +3 -0
  3. ccxt/abstract/bybit.py +1 -0
  4. ccxt/abstract/okx.py +1 -0
  5. ccxt/abstract/woofipro.py +119 -0
  6. ccxt/ace.py +1 -1
  7. ccxt/ascendex.py +7 -8
  8. ccxt/async_support/__init__.py +3 -1
  9. ccxt/async_support/ace.py +1 -1
  10. ccxt/async_support/ascendex.py +7 -8
  11. ccxt/async_support/base/exchange.py +25 -2
  12. ccxt/async_support/bigone.py +4 -4
  13. ccxt/async_support/binance.py +9 -9
  14. ccxt/async_support/bingx.py +4 -4
  15. ccxt/async_support/bit2c.py +1 -1
  16. ccxt/async_support/bitbank.py +1 -1
  17. ccxt/async_support/bitbns.py +1 -1
  18. ccxt/async_support/bitfinex.py +28 -4
  19. ccxt/async_support/bitfinex2.py +62 -54
  20. ccxt/async_support/bitflyer.py +1 -1
  21. ccxt/async_support/bitget.py +11 -11
  22. ccxt/async_support/bithumb.py +1 -1
  23. ccxt/async_support/bitmart.py +8 -8
  24. ccxt/async_support/bitmex.py +2 -2
  25. ccxt/async_support/bitopro.py +1 -1
  26. ccxt/async_support/bitrue.py +3 -3
  27. ccxt/async_support/bitso.py +1 -1
  28. ccxt/async_support/bitstamp.py +3 -5
  29. ccxt/async_support/bitteam.py +1 -1
  30. ccxt/async_support/bitvavo.py +1 -1
  31. ccxt/async_support/bl3p.py +1 -1
  32. ccxt/async_support/blockchaincom.py +1 -1
  33. ccxt/async_support/blofin.py +3 -3
  34. ccxt/async_support/btcalpha.py +1 -1
  35. ccxt/async_support/btcbox.py +1 -1
  36. ccxt/async_support/btcmarkets.py +1 -1
  37. ccxt/async_support/btcturk.py +1 -1
  38. ccxt/async_support/bybit.py +44 -17
  39. ccxt/async_support/cex.py +1 -1
  40. ccxt/async_support/coinbase.py +2 -2
  41. ccxt/async_support/coinbasepro.py +1 -1
  42. ccxt/async_support/coincheck.py +1 -1
  43. ccxt/async_support/coinex.py +358 -543
  44. ccxt/async_support/coinlist.py +6 -7
  45. ccxt/async_support/coinmate.py +1 -1
  46. ccxt/async_support/coinmetro.py +1 -1
  47. ccxt/async_support/coinone.py +1 -1
  48. ccxt/async_support/coinsph.py +1 -1
  49. ccxt/async_support/coinspot.py +1 -1
  50. ccxt/async_support/cryptocom.py +1 -1
  51. ccxt/async_support/currencycom.py +2 -2
  52. ccxt/async_support/delta.py +4 -4
  53. ccxt/async_support/deribit.py +8 -8
  54. ccxt/async_support/digifinex.py +5 -5
  55. ccxt/async_support/exmo.py +1 -1
  56. ccxt/async_support/gate.py +5 -5
  57. ccxt/async_support/gemini.py +1 -1
  58. ccxt/async_support/hitbtc.py +3 -3
  59. ccxt/async_support/hollaex.py +4 -4
  60. ccxt/async_support/htx.py +2 -2
  61. ccxt/async_support/huobijp.py +1 -1
  62. ccxt/async_support/idex.py +1 -1
  63. ccxt/async_support/independentreserve.py +1 -1
  64. ccxt/async_support/indodax.py +2 -2
  65. ccxt/async_support/kraken.py +2 -2
  66. ccxt/async_support/krakenfutures.py +3 -3
  67. ccxt/async_support/kucoin.py +3 -3
  68. ccxt/async_support/kucoinfutures.py +3 -3
  69. ccxt/async_support/kuna.py +1 -1
  70. ccxt/async_support/latoken.py +6 -6
  71. ccxt/async_support/lbank.py +1 -1
  72. ccxt/async_support/luno.py +1 -1
  73. ccxt/async_support/lykke.py +1 -1
  74. ccxt/async_support/mercado.py +1 -1
  75. ccxt/async_support/mexc.py +7 -7
  76. ccxt/async_support/ndax.py +1 -1
  77. ccxt/async_support/novadax.py +3 -4
  78. ccxt/async_support/okcoin.py +3 -3
  79. ccxt/async_support/okx.py +27 -10
  80. ccxt/async_support/onetrading.py +1 -1
  81. ccxt/async_support/paymium.py +3 -3
  82. ccxt/async_support/phemex.py +19 -11
  83. ccxt/async_support/poloniex.py +3 -4
  84. ccxt/async_support/poloniexfutures.py +1 -1
  85. ccxt/async_support/probit.py +1 -1
  86. ccxt/async_support/timex.py +1 -1
  87. ccxt/async_support/tokocrypto.py +1 -1
  88. ccxt/async_support/upbit.py +1 -1
  89. ccxt/async_support/wavesexchange.py +3 -3
  90. ccxt/async_support/wazirx.py +1 -1
  91. ccxt/async_support/whitebit.py +2 -2
  92. ccxt/async_support/woo.py +25 -10
  93. ccxt/async_support/woofipro.py +2524 -0
  94. ccxt/async_support/yobit.py +1 -1
  95. ccxt/async_support/zaif.py +1 -1
  96. ccxt/async_support/zonda.py +3 -3
  97. ccxt/base/exchange.py +64 -16
  98. ccxt/base/types.py +20 -0
  99. ccxt/bigone.py +4 -4
  100. ccxt/binance.py +9 -9
  101. ccxt/bingx.py +4 -4
  102. ccxt/bit2c.py +1 -1
  103. ccxt/bitbank.py +1 -1
  104. ccxt/bitbns.py +1 -1
  105. ccxt/bitfinex.py +28 -4
  106. ccxt/bitfinex2.py +62 -54
  107. ccxt/bitflyer.py +1 -1
  108. ccxt/bitget.py +11 -11
  109. ccxt/bithumb.py +1 -1
  110. ccxt/bitmart.py +8 -8
  111. ccxt/bitmex.py +2 -2
  112. ccxt/bitopro.py +1 -1
  113. ccxt/bitrue.py +3 -3
  114. ccxt/bitso.py +1 -1
  115. ccxt/bitstamp.py +3 -5
  116. ccxt/bitteam.py +1 -1
  117. ccxt/bitvavo.py +1 -1
  118. ccxt/bl3p.py +1 -1
  119. ccxt/blockchaincom.py +1 -1
  120. ccxt/blofin.py +3 -3
  121. ccxt/btcalpha.py +1 -1
  122. ccxt/btcbox.py +1 -1
  123. ccxt/btcmarkets.py +1 -1
  124. ccxt/btcturk.py +1 -1
  125. ccxt/bybit.py +44 -17
  126. ccxt/cex.py +1 -1
  127. ccxt/coinbase.py +2 -2
  128. ccxt/coinbasepro.py +1 -1
  129. ccxt/coincheck.py +1 -1
  130. ccxt/coinex.py +358 -543
  131. ccxt/coinlist.py +6 -7
  132. ccxt/coinmate.py +1 -1
  133. ccxt/coinmetro.py +1 -1
  134. ccxt/coinone.py +1 -1
  135. ccxt/coinsph.py +1 -1
  136. ccxt/coinspot.py +1 -1
  137. ccxt/cryptocom.py +1 -1
  138. ccxt/currencycom.py +2 -2
  139. ccxt/delta.py +4 -4
  140. ccxt/deribit.py +8 -8
  141. ccxt/digifinex.py +5 -5
  142. ccxt/exmo.py +1 -1
  143. ccxt/gate.py +5 -5
  144. ccxt/gemini.py +1 -1
  145. ccxt/hitbtc.py +3 -3
  146. ccxt/hollaex.py +4 -4
  147. ccxt/htx.py +2 -2
  148. ccxt/huobijp.py +1 -1
  149. ccxt/idex.py +1 -1
  150. ccxt/independentreserve.py +1 -1
  151. ccxt/indodax.py +2 -2
  152. ccxt/kraken.py +2 -2
  153. ccxt/krakenfutures.py +3 -3
  154. ccxt/kucoin.py +3 -3
  155. ccxt/kucoinfutures.py +3 -3
  156. ccxt/kuna.py +1 -1
  157. ccxt/latoken.py +6 -6
  158. ccxt/lbank.py +1 -1
  159. ccxt/luno.py +1 -1
  160. ccxt/lykke.py +1 -1
  161. ccxt/mercado.py +1 -1
  162. ccxt/mexc.py +7 -7
  163. ccxt/ndax.py +1 -1
  164. ccxt/novadax.py +3 -4
  165. ccxt/okcoin.py +3 -3
  166. ccxt/okx.py +27 -10
  167. ccxt/onetrading.py +1 -1
  168. ccxt/paymium.py +3 -3
  169. ccxt/phemex.py +19 -11
  170. ccxt/poloniex.py +3 -4
  171. ccxt/poloniexfutures.py +1 -1
  172. ccxt/pro/__init__.py +3 -1
  173. ccxt/pro/bitget.py +127 -190
  174. ccxt/pro/coinbaseinternational.py +11 -4
  175. ccxt/pro/htx.py +12 -6
  176. ccxt/pro/okx.py +79 -1
  177. ccxt/pro/woofipro.py +1183 -0
  178. ccxt/probit.py +1 -1
  179. ccxt/test/test_async.py +31 -1
  180. ccxt/test/test_sync.py +31 -1
  181. ccxt/timex.py +1 -1
  182. ccxt/tokocrypto.py +1 -1
  183. ccxt/upbit.py +1 -1
  184. ccxt/wavesexchange.py +3 -3
  185. ccxt/wazirx.py +1 -1
  186. ccxt/whitebit.py +2 -2
  187. ccxt/woo.py +25 -10
  188. ccxt/woofipro.py +2524 -0
  189. ccxt/yobit.py +1 -1
  190. ccxt/zaif.py +1 -1
  191. ccxt/zonda.py +3 -3
  192. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/METADATA +8 -6
  193. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/RECORD +195 -191
  194. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/WHEEL +0 -0
  195. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/top_level.txt +0 -0
@@ -509,7 +509,7 @@ class luno(Exchange, ImplicitAPI):
509
509
  """
510
510
  return await self.fetch_orders_by_state('COMPLETE', symbol, since, limit, params)
511
511
 
512
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
512
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
513
513
  # {
514
514
  # "pair":"XBTAUD",
515
515
  # "timestamp":1642201439301,
@@ -357,7 +357,7 @@ class lykke(Exchange, ImplicitAPI):
357
357
  })
358
358
  return result
359
359
 
360
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
360
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
361
361
  #
362
362
  # fetchTickers
363
363
  #
@@ -268,7 +268,7 @@ class mercado(Exchange, ImplicitAPI):
268
268
  response = await self.publicGetCoinOrderbook(self.extend(request, params))
269
269
  return self.parse_order_book(response, market['symbol'])
270
270
 
271
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
271
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
272
272
  #
273
273
  # {
274
274
  # "high":"103.96000000",
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, TransferEntries
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -1947,7 +1947,7 @@ class mexc(Exchange, ImplicitAPI):
1947
1947
  # when it's single symbol request, the returned structure is different(singular object) for both spot & swap, thus we need to wrap inside array
1948
1948
  return self.parse_ticker(ticker, market)
1949
1949
 
1950
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1950
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1951
1951
  marketId = self.safe_string(ticker, 'symbol')
1952
1952
  market = self.safe_market(marketId, market)
1953
1953
  timestamp = None
@@ -4661,7 +4661,7 @@ class mexc(Exchange, ImplicitAPI):
4661
4661
  'lastUpdateTimestamp': None,
4662
4662
  })
4663
4663
 
4664
- async def fetch_transfer(self, id: str, since: Int = None, limit: Int = None, params={}):
4664
+ async def fetch_transfer(self, id: str, code: Str = None, params={}) -> TransferEntry:
4665
4665
  marketType, query = self.handle_market_type_and_params('fetchTransfer', None, params)
4666
4666
  await self.load_markets()
4667
4667
  if marketType == 'spot':
@@ -4688,7 +4688,7 @@ class mexc(Exchange, ImplicitAPI):
4688
4688
  raise BadRequest(self.id + ' fetchTransfer() is not supported for ' + marketType)
4689
4689
  return None
4690
4690
 
4691
- async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
4691
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
4692
4692
  """
4693
4693
  fetch a history of internal transfers made on an account
4694
4694
  :param str code: unified currency code of the currency transferred
@@ -4819,7 +4819,7 @@ class mexc(Exchange, ImplicitAPI):
4819
4819
  'toAccount': toAccount,
4820
4820
  })
4821
4821
 
4822
- def parse_transfer(self, transfer, currency: Currency = None):
4822
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
4823
4823
  #
4824
4824
  # spot: fetchTransfer
4825
4825
  #
@@ -4883,7 +4883,7 @@ class mexc(Exchange, ImplicitAPI):
4883
4883
  }
4884
4884
  return self.safe_string(statuses, status, status)
4885
4885
 
4886
- def parse_transfer_status(self, status):
4886
+ def parse_transfer_status(self, status: Str) -> Str:
4887
4887
  statuses = {
4888
4888
  'SUCCESS': 'ok',
4889
4889
  'FAILED': 'failed',
@@ -5181,7 +5181,7 @@ class mexc(Exchange, ImplicitAPI):
5181
5181
  data = self.safe_list(response, 'data', [])
5182
5182
  return self.parse_leverage(data, market)
5183
5183
 
5184
- def parse_leverage(self, leverage, market=None) -> Leverage:
5184
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
5185
5185
  marginMode = None
5186
5186
  longLeverage = None
5187
5187
  shortLeverage = None
@@ -596,7 +596,7 @@ class ndax(Exchange, ImplicitAPI):
596
596
  #
597
597
  return self.parse_order_book(response, symbol)
598
598
 
599
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
599
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
600
600
  #
601
601
  # fetchTicker
602
602
  #
@@ -330,7 +330,7 @@ class novadax(Exchange, ImplicitAPI):
330
330
  'info': market,
331
331
  }
332
332
 
333
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
333
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
334
334
  #
335
335
  # fetchTicker, fetchTickers
336
336
  #
@@ -1128,7 +1128,7 @@ class novadax(Exchange, ImplicitAPI):
1128
1128
  transfer['amount'] = amount
1129
1129
  return transfer
1130
1130
 
1131
- def parse_transfer(self, transfer, currency: Currency = None):
1131
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
1132
1132
  #
1133
1133
  # {
1134
1134
  # "code":"A10000",
@@ -1143,7 +1143,6 @@ class novadax(Exchange, ImplicitAPI):
1143
1143
  'info': transfer,
1144
1144
  'id': id,
1145
1145
  'amount': None,
1146
- 'code': currencyCode, # kept here for backward-compatibility, but will be removed soon
1147
1146
  'currency': currencyCode,
1148
1147
  'fromAccount': None,
1149
1148
  'toAccount': None,
@@ -1152,7 +1151,7 @@ class novadax(Exchange, ImplicitAPI):
1152
1151
  'status': status,
1153
1152
  }
1154
1153
 
1155
- def parse_transfer_status(self, status):
1154
+ def parse_transfer_status(self, status: Str) -> Str:
1156
1155
  statuses = {
1157
1156
  'SUCCESS': 'pending',
1158
1157
  }
@@ -859,7 +859,7 @@ class okcoin(Exchange, ImplicitAPI):
859
859
  timestamp = self.safe_integer(first, 'ts')
860
860
  return self.parse_order_book(first, symbol, timestamp)
861
861
 
862
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
862
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
863
863
  #
864
864
  # {
865
865
  # "instType": "SPOT",
@@ -2227,7 +2227,7 @@ class okcoin(Exchange, ImplicitAPI):
2227
2227
  rawTransfer = self.safe_dict(data, 0, {})
2228
2228
  return self.parse_transfer(rawTransfer, currency)
2229
2229
 
2230
- def parse_transfer(self, transfer, currency: Currency = None):
2230
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2231
2231
  #
2232
2232
  # transfer
2233
2233
  #
@@ -2303,7 +2303,7 @@ class okcoin(Exchange, ImplicitAPI):
2303
2303
  'status': self.parse_transfer_status(self.safe_string(transfer, 'state')),
2304
2304
  }
2305
2305
 
2306
- def parse_transfer_status(self, status):
2306
+ def parse_transfer_status(self, status: Str) -> Str:
2307
2307
  statuses = {
2308
2308
  'success': 'ok',
2309
2309
  }
ccxt/async_support/okx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
11
11
  from typing import List
12
12
  from typing import Any
13
13
  from ccxt.base.errors import ExchangeError
@@ -505,6 +505,7 @@ class okx(Exchange, ImplicitAPI):
505
505
  'tradingBot/grid/compute-margin-balance': 1,
506
506
  'tradingBot/grid/margin-balance': 1,
507
507
  'tradingBot/grid/min-investment': 1,
508
+ 'tradingBot/grid/adjust-investment': 1,
508
509
  'tradingBot/signal/create-signal': 1,
509
510
  'tradingBot/signal/order-algo': 1,
510
511
  'tradingBot/signal/stop-order-algo': 1,
@@ -1759,7 +1760,7 @@ class okx(Exchange, ImplicitAPI):
1759
1760
  timestamp = self.safe_integer(first, 'ts')
1760
1761
  return self.parse_order_book(first, symbol, timestamp)
1761
1762
 
1762
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1763
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1763
1764
  #
1764
1765
  # {
1765
1766
  # "instType": "SPOT",
@@ -4979,7 +4980,7 @@ class okx(Exchange, ImplicitAPI):
4979
4980
  data = self.safe_list(response, 'data', [])
4980
4981
  return self.parse_leverage(data, market)
4981
4982
 
4982
- def parse_leverage(self, leverage, market=None) -> Leverage:
4983
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
4983
4984
  marketId = None
4984
4985
  marginMode = None
4985
4986
  longLeverage = None
@@ -5386,7 +5387,7 @@ class okx(Exchange, ImplicitAPI):
5386
5387
  rawTransfer = self.safe_dict(data, 0, {})
5387
5388
  return self.parse_transfer(rawTransfer, currency)
5388
5389
 
5389
- def parse_transfer(self, transfer, currency: Currency = None):
5390
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
5390
5391
  #
5391
5392
  # transfer
5392
5393
  #
@@ -5462,13 +5463,13 @@ class okx(Exchange, ImplicitAPI):
5462
5463
  'status': self.parse_transfer_status(self.safe_string(transfer, 'state')),
5463
5464
  }
5464
5465
 
5465
- def parse_transfer_status(self, status):
5466
+ def parse_transfer_status(self, status: Str) -> Str:
5466
5467
  statuses = {
5467
5468
  'success': 'ok',
5468
5469
  }
5469
5470
  return self.safe_string(statuses, status, status)
5470
5471
 
5471
- async def fetch_transfer(self, id: str, code: Str = None, params={}):
5472
+ async def fetch_transfer(self, id: str, code: Str = None, params={}) -> TransferEntry:
5472
5473
  await self.load_markets()
5473
5474
  request = {
5474
5475
  'transId': id,
@@ -5499,7 +5500,7 @@ class okx(Exchange, ImplicitAPI):
5499
5500
  transfer = self.safe_dict(data, 0)
5500
5501
  return self.parse_transfer(transfer)
5501
5502
 
5502
- async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5503
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
5503
5504
  """
5504
5505
  fetch a history of internal transfers made on an account
5505
5506
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
@@ -5618,6 +5619,22 @@ class okx(Exchange, ImplicitAPI):
5618
5619
  # "nextFundingRate": "0.00017",
5619
5620
  # "nextFundingTime": "1634284800000"
5620
5621
  # }
5622
+ # ws
5623
+ # {
5624
+ # "fundingRate":"0.0001875391284828",
5625
+ # "fundingTime":"1700726400000",
5626
+ # "instId":"BTC-USD-SWAP",
5627
+ # "instType":"SWAP",
5628
+ # "method": "next_period",
5629
+ # "maxFundingRate":"0.00375",
5630
+ # "minFundingRate":"-0.00375",
5631
+ # "nextFundingRate":"0.0002608059239328",
5632
+ # "nextFundingTime":"1700755200000",
5633
+ # "premium": "0.0001233824646391",
5634
+ # "settFundingRate":"0.0001699799259033",
5635
+ # "settState":"settled",
5636
+ # "ts":"1700724675402"
5637
+ # }
5621
5638
  #
5622
5639
  # in the response above nextFundingRate is actually two funding rates from now
5623
5640
  #
@@ -7032,7 +7049,7 @@ class okx(Exchange, ImplicitAPI):
7032
7049
  return self.parse_greeks(entry, market)
7033
7050
  return None
7034
7051
 
7035
- def parse_greeks(self, greeks, market: Market = None):
7052
+ def parse_greeks(self, greeks: dict, market: Market = None) -> Greeks:
7036
7053
  #
7037
7054
  # {
7038
7055
  # "askVol": "0",
@@ -7230,7 +7247,7 @@ class okx(Exchange, ImplicitAPI):
7230
7247
  result = self.safe_list(response, 'data', [])
7231
7248
  return self.parse_option_chain(result, None, 'instId')
7232
7249
 
7233
- def parse_option(self, chain, currency: Currency = None, market: Market = None):
7250
+ def parse_option(self, chain: dict, currency: Currency = None, market: Market = None) -> Option:
7234
7251
  #
7235
7252
  # {
7236
7253
  # "instType": "OPTION",
@@ -7465,7 +7482,7 @@ class okx(Exchange, ImplicitAPI):
7465
7482
  rows = self.safe_list(response, 'data', [])
7466
7483
  return self.parse_conversions(rows, code, 'baseCcy', 'quoteCcy', since, limit)
7467
7484
 
7468
- def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
7485
+ def parse_conversion(self, conversion: dict, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
7469
7486
  #
7470
7487
  # fetchConvertQuote
7471
7488
  #
@@ -561,7 +561,7 @@ class onetrading(Exchange, ImplicitAPI):
561
561
  'taker': takerFees,
562
562
  }
563
563
 
564
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
564
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
565
565
  #
566
566
  # fetchTicker, fetchTickers
567
567
  #
@@ -158,7 +158,7 @@ class paymium(Exchange, ImplicitAPI):
158
158
  response = await self.publicGetDataCurrencyDepth(self.extend(request, params))
159
159
  return self.parse_order_book(response, market['symbol'], None, 'bids', 'asks', 'price', 'amount')
160
160
 
161
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
161
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
162
162
  #
163
163
  # {
164
164
  # "high":"33740.82",
@@ -467,7 +467,7 @@ class paymium(Exchange, ImplicitAPI):
467
467
  #
468
468
  return self.parse_transfer(response, currency)
469
469
 
470
- def parse_transfer(self, transfer, currency: Currency = None):
470
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
471
471
  #
472
472
  # {
473
473
  # "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
@@ -518,7 +518,7 @@ class paymium(Exchange, ImplicitAPI):
518
518
  'status': self.parse_transfer_status(status),
519
519
  }
520
520
 
521
- def parse_transfer_status(self, status):
521
+ def parse_transfer_status(self, status: Str) -> Str:
522
522
  statuses = {
523
523
  'executed': 'ok',
524
524
  # what are the other statuses?
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.phemex import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, TransferEntries
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1270,7 +1270,7 @@ class phemex(Exchange, ImplicitAPI):
1270
1270
  rows = self.safe_list(data, 'rows', [])
1271
1271
  return self.parse_ohlcvs(rows, market, timeframe, since, userLimit)
1272
1272
 
1273
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1273
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1274
1274
  #
1275
1275
  # spot
1276
1276
  #
@@ -2347,12 +2347,14 @@ class phemex(Exchange, ImplicitAPI):
2347
2347
  """
2348
2348
  create a trade order
2349
2349
  :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
2350
+ :see: https://phemex-docs.github.io/#place-order-http-put-prefered-3
2350
2351
  :param str symbol: unified symbol of the market to create an order in
2351
2352
  :param str type: 'market' or 'limit'
2352
2353
  :param str side: 'buy' or 'sell'
2353
2354
  :param float amount: how much of currency you want to trade in units of base currency
2354
2355
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2355
2356
  :param dict [params]: extra parameters specific to the exchange API endpoint
2357
+ :param float [params.trigger]: trigger price for conditional orders
2356
2358
  :param dict [params.takeProfit]: *swap only* *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered(perpetual swap markets only)
2357
2359
  :param float [params.takeProfit.triggerPrice]: take profit trigger price
2358
2360
  :param dict [params.stopLoss]: *swap only* *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered(perpetual swap markets only)
@@ -2363,7 +2365,7 @@ class phemex(Exchange, ImplicitAPI):
2363
2365
  market = self.market(symbol)
2364
2366
  requestSide = self.capitalize(side)
2365
2367
  type = self.capitalize(type)
2366
- reduceOnly = self.safe_value(params, 'reduceOnly')
2368
+ reduceOnly = self.safe_bool(params, 'reduceOnly')
2367
2369
  request = {
2368
2370
  # common
2369
2371
  'symbol': market['id'],
@@ -2404,18 +2406,24 @@ class phemex(Exchange, ImplicitAPI):
2404
2406
  else:
2405
2407
  request['clOrdID'] = clientOrderId
2406
2408
  params = self.omit(params, ['clOrdID', 'clientOrderId'])
2407
- stopPrice = self.safe_string_n(params, ['stopPx', 'stopPrice', 'triggerPrice'])
2408
- if stopPrice is not None:
2409
+ triggerPrice = self.safe_string_n(params, ['stopPx', 'stopPrice', 'triggerPrice'])
2410
+ if triggerPrice is not None:
2409
2411
  if market['settle'] == 'USDT':
2410
- request['stopPxRp'] = self.price_to_precision(symbol, stopPrice)
2412
+ request['stopPxRp'] = self.price_to_precision(symbol, triggerPrice)
2411
2413
  else:
2412
- request['stopPxEp'] = self.to_ep(stopPrice, market)
2414
+ request['stopPxEp'] = self.to_ep(triggerPrice, market)
2413
2415
  params = self.omit(params, ['stopPx', 'stopPrice', 'stopLoss', 'takeProfit', 'triggerPrice'])
2414
2416
  if market['spot']:
2415
2417
  qtyType = self.safe_value(params, 'qtyType', 'ByBase')
2416
2418
  if (type == 'Market') or (type == 'Stop') or (type == 'MarketIfTouched'):
2417
2419
  if price is not None:
2418
2420
  qtyType = 'ByQuote'
2421
+ if triggerPrice is not None:
2422
+ if type == 'Limit':
2423
+ request['ordType'] = 'StopLimit'
2424
+ elif type == 'Market':
2425
+ request['ordType'] = 'Stop'
2426
+ request['trigger'] = 'ByLastPrice'
2419
2427
  request['qtyType'] = qtyType
2420
2428
  if qtyType == 'ByQuote':
2421
2429
  cost = self.safe_number(params, 'cost')
@@ -2446,7 +2454,7 @@ class phemex(Exchange, ImplicitAPI):
2446
2454
  request['orderQtyRq'] = amount
2447
2455
  else:
2448
2456
  request['orderQty'] = self.parse_to_int(amount)
2449
- if stopPrice is not None:
2457
+ if triggerPrice is not None:
2450
2458
  triggerType = self.safe_string(params, 'triggerType', 'ByMarkPrice')
2451
2459
  request['triggerType'] = triggerType
2452
2460
  if stopLossDefined or takeProfitDefined:
@@ -4139,7 +4147,7 @@ class phemex(Exchange, ImplicitAPI):
4139
4147
  transfer['currency'] = code
4140
4148
  return transfer
4141
4149
 
4142
- async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
4150
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
4143
4151
  """
4144
4152
  fetch a history of internal transfers made on an account
4145
4153
  :param str code: unified currency code of the currency transferred
@@ -4184,7 +4192,7 @@ class phemex(Exchange, ImplicitAPI):
4184
4192
  transfers = self.safe_list(data, 'rows', [])
4185
4193
  return self.parse_transfers(transfers, currency, since, limit)
4186
4194
 
4187
- def parse_transfer(self, transfer, currency: Currency = None):
4195
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
4188
4196
  #
4189
4197
  # transfer
4190
4198
  #
@@ -4238,7 +4246,7 @@ class phemex(Exchange, ImplicitAPI):
4238
4246
  'status': self.parse_transfer_status(status),
4239
4247
  }
4240
4248
 
4241
- def parse_transfer_status(self, status):
4249
+ def parse_transfer_status(self, status: Str) -> Str:
4242
4250
  statuses = {
4243
4251
  '3': 'rejected', # 'Rejected',
4244
4252
  '6': 'canceled', # 'Got error and wait for recovery',
@@ -580,7 +580,7 @@ class poloniex(Exchange, ImplicitAPI):
580
580
  response = await self.publicGetTimestamp(params)
581
581
  return self.safe_integer(response, 'serverTime')
582
582
 
583
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
583
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
584
584
  #
585
585
  # {
586
586
  # "symbol" : "BTC_USDT",
@@ -1752,12 +1752,11 @@ class poloniex(Exchange, ImplicitAPI):
1752
1752
  """
1753
1753
  await self.load_markets()
1754
1754
  currency = self.currency(code)
1755
- amount = self.currency_to_precision(code, amount)
1756
1755
  accountsByType = self.safe_value(self.options, 'accountsByType', {})
1757
1756
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
1758
1757
  toId = self.safe_string(accountsByType, toAccount, fromAccount)
1759
1758
  request = {
1760
- 'amount': amount,
1759
+ 'amount': self.currency_to_precision(code, amount),
1761
1760
  'currency': currency['id'],
1762
1761
  'fromAccount': fromId,
1763
1762
  'toAccount': toId,
@@ -1770,7 +1769,7 @@ class poloniex(Exchange, ImplicitAPI):
1770
1769
  #
1771
1770
  return self.parse_transfer(response, currency)
1772
1771
 
1773
- def parse_transfer(self, transfer, currency: Currency = None):
1772
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
1774
1773
  #
1775
1774
  # {
1776
1775
  # "transferId" : "168041074"
@@ -356,7 +356,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
356
356
  'info': market,
357
357
  }
358
358
 
359
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
359
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
360
360
  #
361
361
  # {
362
362
  # "symbol": "BTCUSDTPERP", # Market of the symbol
@@ -659,7 +659,7 @@ class probit(Exchange, ImplicitAPI):
659
659
  raise BadResponse(self.id + ' fetchTicker() returned an empty response')
660
660
  return self.parse_ticker(ticker, market)
661
661
 
662
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
662
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
663
663
  #
664
664
  # {
665
665
  # "last":"0.022902",
@@ -1304,7 +1304,7 @@ class timex(Exchange, ImplicitAPI):
1304
1304
  'networks': {},
1305
1305
  }
1306
1306
 
1307
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1307
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1308
1308
  #
1309
1309
  # {
1310
1310
  # "ask": 0.017,
@@ -1088,7 +1088,7 @@ class tokocrypto(Exchange, ImplicitAPI):
1088
1088
  #
1089
1089
  return self.parse_trades(response, market, since, limit)
1090
1090
 
1091
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1091
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1092
1092
  #
1093
1093
  # {
1094
1094
  # "symbol": "ETHBTC",
@@ -599,7 +599,7 @@ class upbit(Exchange, ImplicitAPI):
599
599
  orderbooks = await self.fetch_order_books([symbol], limit, params)
600
600
  return self.safe_value(orderbooks, symbol)
601
601
 
602
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
602
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
603
603
  #
604
604
  # { market: "BTC-ETH",
605
605
  # "trade_date": "20181122",
@@ -753,7 +753,7 @@ class wavesexchange(Exchange, ImplicitAPI):
753
753
  return self.options['accessToken']
754
754
  return None
755
755
 
756
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
756
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
757
757
  #
758
758
  # {
759
759
  # "symbol": "WAVES/BTC",
@@ -1185,7 +1185,7 @@ class wavesexchange(Exchange, ImplicitAPI):
1185
1185
  amountPrecision = self.number_to_string(self.to_precision(amount, self.number_to_string(self.markets[symbol]['precision']['amount'])))
1186
1186
  return self.parse_to_int(float(amountPrecision))
1187
1187
 
1188
- def currency_to_precision(self, code, amount, networkCode=None):
1188
+ def custom_currency_to_precision(self, code, amount, networkCode=None):
1189
1189
  amountPrecision = self.number_to_string(self.to_precision(amount, self.currencies[code]['precision']))
1190
1190
  return self.parse_to_int(float(amountPrecision))
1191
1191
 
@@ -2374,7 +2374,7 @@ class wavesexchange(Exchange, ImplicitAPI):
2374
2374
  feeAssetId = 'WAVES'
2375
2375
  type = 4 # transfer
2376
2376
  version = 2
2377
- amountInteger = self.currency_to_precision(code, amount)
2377
+ amountInteger = self.custom_currency_to_precision(code, amount)
2378
2378
  currency = self.currency(code)
2379
2379
  timestamp = self.milliseconds()
2380
2380
  byteArray = [
@@ -564,7 +564,7 @@ class wazirx(Exchange, ImplicitAPI):
564
564
  #
565
565
  return self.safe_integer(response, 'serverTime')
566
566
 
567
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
567
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
568
568
  #
569
569
  # {
570
570
  # "symbol":"btcinr",
@@ -754,7 +754,7 @@ class whitebit(Exchange, ImplicitAPI):
754
754
  ticker = self.safe_dict(response, 'result', {})
755
755
  return self.parse_ticker(ticker, market)
756
756
 
757
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
757
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
758
758
  #
759
759
  # FetchTicker(v1)
760
760
  #
@@ -1794,7 +1794,7 @@ class whitebit(Exchange, ImplicitAPI):
1794
1794
  #
1795
1795
  return self.parse_transfer(response, currency)
1796
1796
 
1797
- def parse_transfer(self, transfer, currency: Currency = None):
1797
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
1798
1798
  #
1799
1799
  # []
1800
1800
  #