ccxt 4.4.57__py2.py3-none-any.whl → 4.4.59__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 (310) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/xt.py +1 -0
  3. ccxt/ace.py +2 -2
  4. ccxt/alpaca.py +4 -4
  5. ccxt/ascendex.py +5 -3
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/ace.py +2 -2
  8. ccxt/async_support/alpaca.py +4 -4
  9. ccxt/async_support/ascendex.py +5 -3
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/bequant.py +2 -1
  12. ccxt/async_support/bigone.py +5 -5
  13. ccxt/async_support/binance.py +22 -6
  14. ccxt/async_support/binancecoinm.py +2 -1
  15. ccxt/async_support/binanceus.py +2 -1
  16. ccxt/async_support/binanceusdm.py +2 -1
  17. ccxt/async_support/bingx.py +3 -3
  18. ccxt/async_support/bit2c.py +9 -9
  19. ccxt/async_support/bitbank.py +2 -2
  20. ccxt/async_support/bitbns.py +2 -2
  21. ccxt/async_support/bitcoincom.py +2 -1
  22. ccxt/async_support/bitfinex.py +2 -2
  23. ccxt/async_support/bitfinex1.py +2 -2
  24. ccxt/async_support/bitflyer.py +2 -2
  25. ccxt/async_support/bitget.py +8 -3
  26. ccxt/async_support/bithumb.py +2 -2
  27. ccxt/async_support/bitmart.py +150 -89
  28. ccxt/async_support/bitmex.py +2 -2
  29. ccxt/async_support/bitopro.py +2 -2
  30. ccxt/async_support/bitpanda.py +2 -1
  31. ccxt/async_support/bitrue.py +3 -3
  32. ccxt/async_support/bitso.py +2 -2
  33. ccxt/async_support/bitstamp.py +2 -2
  34. ccxt/async_support/bitteam.py +2 -2
  35. ccxt/async_support/bitvavo.py +3 -3
  36. ccxt/async_support/bl3p.py +2 -2
  37. ccxt/async_support/blockchaincom.py +2 -2
  38. ccxt/async_support/blofin.py +3 -4
  39. ccxt/async_support/btcalpha.py +2 -2
  40. ccxt/async_support/btcbox.py +2 -2
  41. ccxt/async_support/btcmarkets.py +3 -3
  42. ccxt/async_support/btcturk.py +2 -2
  43. ccxt/async_support/bybit.py +17 -6
  44. ccxt/async_support/cex.py +3 -3
  45. ccxt/async_support/coinbase.py +12 -5
  46. ccxt/async_support/coinbaseadvanced.py +2 -1
  47. ccxt/async_support/coinbaseexchange.py +3 -3
  48. ccxt/async_support/coinbaseinternational.py +3 -4
  49. ccxt/async_support/coincatch.py +3 -3
  50. ccxt/async_support/coincheck.py +2 -2
  51. ccxt/async_support/coinex.py +3 -3
  52. ccxt/async_support/coinlist.py +3 -3
  53. ccxt/async_support/coinmate.py +2 -2
  54. ccxt/async_support/coinmetro.py +2 -2
  55. ccxt/async_support/coinone.py +2 -2
  56. ccxt/async_support/coinsph.py +3 -3
  57. ccxt/async_support/coinspot.py +2 -2
  58. ccxt/async_support/cryptocom.py +2 -2
  59. ccxt/async_support/currencycom.py +3 -3
  60. ccxt/async_support/defx.py +3 -3
  61. ccxt/async_support/delta.py +3 -3
  62. ccxt/async_support/deribit.py +3 -3
  63. ccxt/async_support/digifinex.py +3 -3
  64. ccxt/async_support/ellipx.py +1 -1
  65. ccxt/async_support/exmo.py +2 -2
  66. ccxt/async_support/fmfwio.py +2 -1
  67. ccxt/async_support/gate.py +3 -3
  68. ccxt/async_support/gateio.py +2 -1
  69. ccxt/async_support/gemini.py +2 -2
  70. ccxt/async_support/hashkey.py +2 -2
  71. ccxt/async_support/hitbtc.py +3 -3
  72. ccxt/async_support/hollaex.py +2 -2
  73. ccxt/async_support/htx.py +3 -3
  74. ccxt/async_support/huobi.py +2 -1
  75. ccxt/async_support/huobijp.py +3 -3
  76. ccxt/async_support/hyperliquid.py +91 -6
  77. ccxt/async_support/idex.py +3 -3
  78. ccxt/async_support/independentreserve.py +2 -2
  79. ccxt/async_support/indodax.py +3 -3
  80. ccxt/async_support/kraken.py +3 -3
  81. ccxt/async_support/krakenfutures.py +2 -2
  82. ccxt/async_support/kucoin.py +3 -3
  83. ccxt/async_support/kucoinfutures.py +3 -3
  84. ccxt/async_support/kuna.py +3 -3
  85. ccxt/async_support/latoken.py +3 -3
  86. ccxt/async_support/lbank.py +3 -3
  87. ccxt/async_support/luno.py +2 -2
  88. ccxt/async_support/mercado.py +2 -2
  89. ccxt/async_support/mexc.py +3 -3
  90. ccxt/async_support/myokx.py +2 -1
  91. ccxt/async_support/ndax.py +2 -2
  92. ccxt/async_support/novadax.py +3 -3
  93. ccxt/async_support/oceanex.py +3 -3
  94. ccxt/async_support/okcoin.py +3 -3
  95. ccxt/async_support/okx.py +3 -4
  96. ccxt/async_support/onetrading.py +3 -3
  97. ccxt/async_support/oxfun.py +2 -2
  98. ccxt/async_support/p2b.py +2 -2
  99. ccxt/async_support/paradex.py +3 -3
  100. ccxt/async_support/paymium.py +2 -2
  101. ccxt/async_support/phemex.py +2 -2
  102. ccxt/async_support/poloniex.py +3 -3
  103. ccxt/async_support/poloniexfutures.py +3 -3
  104. ccxt/async_support/probit.py +3 -3
  105. ccxt/async_support/timex.py +15 -5
  106. ccxt/async_support/tokocrypto.py +3 -3
  107. ccxt/async_support/tradeogre.py +2 -2
  108. ccxt/async_support/upbit.py +2 -2
  109. ccxt/async_support/vertex.py +5 -5
  110. ccxt/async_support/wavesexchange.py +2 -3
  111. ccxt/async_support/whitebit.py +5 -4
  112. ccxt/async_support/woo.py +3 -4
  113. ccxt/async_support/woofipro.py +3 -4
  114. ccxt/async_support/xt.py +57 -4
  115. ccxt/async_support/yobit.py +2 -2
  116. ccxt/async_support/zaif.py +2 -2
  117. ccxt/async_support/zonda.py +2 -2
  118. ccxt/base/exchange.py +5 -4
  119. ccxt/bequant.py +2 -1
  120. ccxt/bigone.py +5 -5
  121. ccxt/binance.py +22 -6
  122. ccxt/binancecoinm.py +2 -1
  123. ccxt/binanceus.py +2 -1
  124. ccxt/binanceusdm.py +2 -1
  125. ccxt/bingx.py +3 -3
  126. ccxt/bit2c.py +9 -9
  127. ccxt/bitbank.py +2 -2
  128. ccxt/bitbns.py +2 -2
  129. ccxt/bitcoincom.py +2 -1
  130. ccxt/bitfinex.py +2 -2
  131. ccxt/bitfinex1.py +2 -2
  132. ccxt/bitflyer.py +2 -2
  133. ccxt/bitget.py +8 -3
  134. ccxt/bithumb.py +2 -2
  135. ccxt/bitmart.py +150 -89
  136. ccxt/bitmex.py +2 -2
  137. ccxt/bitopro.py +2 -2
  138. ccxt/bitpanda.py +2 -1
  139. ccxt/bitrue.py +3 -3
  140. ccxt/bitso.py +2 -2
  141. ccxt/bitstamp.py +2 -2
  142. ccxt/bitteam.py +2 -2
  143. ccxt/bitvavo.py +3 -3
  144. ccxt/bl3p.py +2 -2
  145. ccxt/blockchaincom.py +2 -2
  146. ccxt/blofin.py +3 -4
  147. ccxt/btcalpha.py +2 -2
  148. ccxt/btcbox.py +2 -2
  149. ccxt/btcmarkets.py +3 -3
  150. ccxt/btcturk.py +2 -2
  151. ccxt/bybit.py +17 -6
  152. ccxt/cex.py +3 -3
  153. ccxt/coinbase.py +12 -5
  154. ccxt/coinbaseadvanced.py +2 -1
  155. ccxt/coinbaseexchange.py +3 -3
  156. ccxt/coinbaseinternational.py +3 -4
  157. ccxt/coincatch.py +3 -3
  158. ccxt/coincheck.py +2 -2
  159. ccxt/coinex.py +3 -3
  160. ccxt/coinlist.py +3 -3
  161. ccxt/coinmate.py +2 -2
  162. ccxt/coinmetro.py +2 -2
  163. ccxt/coinone.py +2 -2
  164. ccxt/coinsph.py +3 -3
  165. ccxt/coinspot.py +2 -2
  166. ccxt/cryptocom.py +2 -2
  167. ccxt/currencycom.py +3 -3
  168. ccxt/defx.py +3 -3
  169. ccxt/delta.py +3 -3
  170. ccxt/deribit.py +3 -3
  171. ccxt/digifinex.py +3 -3
  172. ccxt/ellipx.py +1 -1
  173. ccxt/exmo.py +2 -2
  174. ccxt/fmfwio.py +2 -1
  175. ccxt/gate.py +3 -3
  176. ccxt/gateio.py +2 -1
  177. ccxt/gemini.py +2 -2
  178. ccxt/hashkey.py +2 -2
  179. ccxt/hitbtc.py +3 -3
  180. ccxt/hollaex.py +2 -2
  181. ccxt/htx.py +3 -3
  182. ccxt/huobi.py +2 -1
  183. ccxt/huobijp.py +3 -3
  184. ccxt/hyperliquid.py +91 -6
  185. ccxt/idex.py +3 -3
  186. ccxt/independentreserve.py +2 -2
  187. ccxt/indodax.py +3 -3
  188. ccxt/kraken.py +3 -3
  189. ccxt/krakenfutures.py +2 -2
  190. ccxt/kucoin.py +3 -3
  191. ccxt/kucoinfutures.py +3 -3
  192. ccxt/kuna.py +3 -3
  193. ccxt/latoken.py +3 -3
  194. ccxt/lbank.py +3 -3
  195. ccxt/luno.py +2 -2
  196. ccxt/mercado.py +2 -2
  197. ccxt/mexc.py +3 -3
  198. ccxt/myokx.py +2 -1
  199. ccxt/ndax.py +2 -2
  200. ccxt/novadax.py +3 -3
  201. ccxt/oceanex.py +3 -3
  202. ccxt/okcoin.py +3 -3
  203. ccxt/okx.py +3 -4
  204. ccxt/onetrading.py +3 -3
  205. ccxt/oxfun.py +2 -2
  206. ccxt/p2b.py +2 -2
  207. ccxt/paradex.py +3 -3
  208. ccxt/paymium.py +2 -2
  209. ccxt/phemex.py +2 -2
  210. ccxt/poloniex.py +3 -3
  211. ccxt/poloniexfutures.py +3 -3
  212. ccxt/pro/__init__.py +1 -3
  213. ccxt/pro/alpaca.py +2 -2
  214. ccxt/pro/ascendex.py +2 -2
  215. ccxt/pro/bequant.py +2 -1
  216. ccxt/pro/binance.py +2 -3
  217. ccxt/pro/binancecoinm.py +2 -1
  218. ccxt/pro/binanceus.py +3 -2
  219. ccxt/pro/binanceusdm.py +2 -1
  220. ccxt/pro/bingx.py +2 -2
  221. ccxt/pro/bitcoincom.py +2 -1
  222. ccxt/pro/bitfinex.py +2 -2
  223. ccxt/pro/bitfinex1.py +2 -2
  224. ccxt/pro/bitget.py +2 -3
  225. ccxt/pro/bithumb.py +2 -2
  226. ccxt/pro/bitmart.py +2 -2
  227. ccxt/pro/bitmex.py +2 -2
  228. ccxt/pro/bitopro.py +2 -2
  229. ccxt/pro/bitpanda.py +2 -1
  230. ccxt/pro/bitrue.py +2 -2
  231. ccxt/pro/bitstamp.py +2 -2
  232. ccxt/pro/bitvavo.py +2 -2
  233. ccxt/pro/blockchaincom.py +2 -2
  234. ccxt/pro/blofin.py +1 -1
  235. ccxt/pro/bybit.py +6 -4
  236. ccxt/pro/cex.py +2 -2
  237. ccxt/pro/coinbase.py +2 -2
  238. ccxt/pro/coinbaseadvanced.py +2 -1
  239. ccxt/pro/coinbaseexchange.py +2 -2
  240. ccxt/pro/coinbaseinternational.py +2 -2
  241. ccxt/pro/coincatch.py +2 -3
  242. ccxt/pro/coincheck.py +2 -2
  243. ccxt/pro/coinex.py +2 -2
  244. ccxt/pro/coinone.py +2 -2
  245. ccxt/pro/cryptocom.py +2 -3
  246. ccxt/pro/currencycom.py +2 -2
  247. ccxt/pro/defx.py +2 -3
  248. ccxt/pro/deribit.py +2 -2
  249. ccxt/pro/exmo.py +2 -2
  250. ccxt/pro/gate.py +2 -3
  251. ccxt/pro/gateio.py +2 -1
  252. ccxt/pro/gemini.py +2 -2
  253. ccxt/pro/hashkey.py +2 -2
  254. ccxt/pro/hitbtc.py +2 -2
  255. ccxt/pro/hollaex.py +2 -2
  256. ccxt/pro/htx.py +2 -2
  257. ccxt/pro/huobi.py +2 -1
  258. ccxt/pro/huobijp.py +2 -2
  259. ccxt/pro/hyperliquid.py +2 -3
  260. ccxt/pro/idex.py +2 -2
  261. ccxt/pro/independentreserve.py +2 -2
  262. ccxt/pro/kraken.py +2 -2
  263. ccxt/pro/krakenfutures.py +2 -2
  264. ccxt/pro/kucoin.py +2 -3
  265. ccxt/pro/kucoinfutures.py +2 -3
  266. ccxt/pro/lbank.py +2 -2
  267. ccxt/pro/luno.py +2 -2
  268. ccxt/pro/mexc.py +5 -3
  269. ccxt/pro/myokx.py +2 -1
  270. ccxt/pro/ndax.py +2 -2
  271. ccxt/pro/okcoin.py +2 -2
  272. ccxt/pro/okx.py +2 -3
  273. ccxt/pro/onetrading.py +2 -2
  274. ccxt/pro/oxfun.py +2 -2
  275. ccxt/pro/p2b.py +2 -2
  276. ccxt/pro/paradex.py +2 -2
  277. ccxt/pro/phemex.py +2 -2
  278. ccxt/pro/poloniex.py +2 -2
  279. ccxt/pro/poloniexfutures.py +2 -2
  280. ccxt/pro/probit.py +2 -2
  281. ccxt/pro/upbit.py +2 -2
  282. ccxt/pro/vertex.py +2 -2
  283. ccxt/pro/wazirx.py +2 -2
  284. ccxt/pro/whitebit.py +2 -2
  285. ccxt/pro/woo.py +2 -2
  286. ccxt/pro/woofipro.py +2 -2
  287. ccxt/pro/xt.py +2 -2
  288. ccxt/probit.py +3 -3
  289. ccxt/test/tests_init.py +2 -2
  290. ccxt/timex.py +15 -5
  291. ccxt/tokocrypto.py +3 -3
  292. ccxt/tradeogre.py +2 -2
  293. ccxt/upbit.py +2 -2
  294. ccxt/vertex.py +5 -5
  295. ccxt/wavesexchange.py +2 -3
  296. ccxt/whitebit.py +5 -4
  297. ccxt/woo.py +3 -4
  298. ccxt/woofipro.py +3 -4
  299. ccxt/xt.py +57 -4
  300. ccxt/yobit.py +2 -2
  301. ccxt/zaif.py +2 -2
  302. ccxt/zonda.py +2 -2
  303. {ccxt-4.4.57.dist-info → ccxt-4.4.59.dist-info}/METADATA +30 -33
  304. {ccxt-4.4.57.dist-info → ccxt-4.4.59.dist-info}/RECORD +307 -310
  305. ccxt/abstract/wazirx.py +0 -30
  306. ccxt/async_support/wazirx.py +0 -1336
  307. ccxt/wazirx.py +0 -1336
  308. {ccxt-4.4.57.dist-info → ccxt-4.4.59.dist-info}/LICENSE.txt +0 -0
  309. {ccxt-4.4.57.dist-info → ccxt-4.4.59.dist-info}/WHEEL +0 -0
  310. {ccxt-4.4.57.dist-info → ccxt-4.4.59.dist-info}/top_level.txt +0 -0
ccxt/timex.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.timex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
8
+ from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -24,7 +24,7 @@ from ccxt.base.precise import Precise
24
24
 
25
25
  class timex(Exchange, ImplicitAPI):
26
26
 
27
- def describe(self):
27
+ def describe(self) -> Any:
28
28
  return self.deep_extend(super(timex, self).describe(), {
29
29
  'id': 'timex',
30
30
  'name': 'TimeX',
@@ -354,7 +354,7 @@ class timex(Exchange, ImplicitAPI):
354
354
  },
355
355
  })
356
356
 
357
- def fetch_time(self, params={}):
357
+ def fetch_time(self, params={}) -> Int:
358
358
  """
359
359
  fetches the current integer timestamp in milliseconds from the exchange server
360
360
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -729,6 +729,7 @@ class timex(Exchange, ImplicitAPI):
729
729
  :param int [since]: timestamp in ms of the earliest candle to fetch
730
730
  :param int [limit]: the maximum amount of candles to fetch
731
731
  :param dict [params]: extra parameters specific to the exchange API endpoint
732
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
732
733
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
733
734
  """
734
735
  self.load_markets()
@@ -739,15 +740,24 @@ class timex(Exchange, ImplicitAPI):
739
740
  }
740
741
  # if since and limit are not specified
741
742
  duration = self.parse_timeframe(timeframe)
743
+ until = self.safe_integer(params, 'until')
742
744
  if limit is None:
743
745
  limit = 1000 # exchange provides tens of thousands of data, but we set generous default value
744
746
  if since is not None:
745
747
  request['from'] = self.iso8601(since)
746
- request['till'] = self.iso8601(self.sum(since, self.sum(limit, 1) * duration * 1000))
748
+ if until is None:
749
+ request['till'] = self.iso8601(self.sum(since, self.sum(limit, 1) * duration * 1000))
750
+ else:
751
+ request['till'] = self.iso8601(until)
752
+ elif until is not None:
753
+ request['till'] = self.iso8601(until)
754
+ fromTimestamp = until - self.sum(limit, 1) * duration * 1000
755
+ request['from'] = self.iso8601(fromTimestamp)
747
756
  else:
748
757
  now = self.milliseconds()
749
758
  request['till'] = self.iso8601(now)
750
- request['from'] = self.iso8601(now - limit * duration * 1000 - 1)
759
+ request['from'] = self.iso8601(now - self.sum(limit, 1) * duration * 1000 - 1)
760
+ params = self.omit(params, 'until')
751
761
  response = self.publicGetCandles(self.extend(request, params))
752
762
  #
753
763
  # [
ccxt/tokocrypto.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.tokocrypto import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -37,7 +37,7 @@ from ccxt.base.precise import Precise
37
37
 
38
38
  class tokocrypto(Exchange, ImplicitAPI):
39
39
 
40
- def describe(self):
40
+ def describe(self) -> Any:
41
41
  return self.deep_extend(super(tokocrypto, self).describe(), {
42
42
  'id': 'tokocrypto',
43
43
  'name': 'Tokocrypto',
@@ -702,7 +702,7 @@ class tokocrypto(Exchange, ImplicitAPI):
702
702
  def nonce(self):
703
703
  return self.milliseconds() - self.options['timeDifference']
704
704
 
705
- def fetch_time(self, params={}):
705
+ def fetch_time(self, params={}) -> Int:
706
706
  """
707
707
 
708
708
  https://www.tokocrypto.com/apidocs/#check-server-time
ccxt/tradeogre.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.tradeogre import ImplicitAPI
8
- from ccxt.base.types import IndexType, Int, Market, Num, Order, OrderSide, OrderType, Str, Ticker
8
+ from ccxt.base.types import Any, IndexType, Int, Market, Num, Order, OrderSide, OrderType, Str, Ticker
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -17,7 +17,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
17
17
 
18
18
  class tradeogre(Exchange, ImplicitAPI):
19
19
 
20
- def describe(self):
20
+ def describe(self) -> Any:
21
21
  return self.deep_extend(super(tradeogre, self).describe(), {
22
22
  'id': 'tradeogre',
23
23
  'name': 'tradeogre',
ccxt/upbit.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.upbit import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, OrderBooks, Trade, TradingFeeInterface, Transaction
8
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, OrderBooks, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -22,7 +22,7 @@ from ccxt.base.precise import Precise
22
22
 
23
23
  class upbit(Exchange, ImplicitAPI):
24
24
 
25
- def describe(self):
25
+ def describe(self) -> Any:
26
26
  return self.deep_extend(super(upbit, self).describe(), {
27
27
  'id': 'upbit',
28
28
  'name': 'Upbit',
ccxt/vertex.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.vertex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Any, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -22,7 +22,7 @@ from ccxt.base.precise import Precise
22
22
 
23
23
  class vertex(Exchange, ImplicitAPI):
24
24
 
25
- def describe(self):
25
+ def describe(self) -> Any:
26
26
  return self.deep_extend(super(vertex, self).describe(), {
27
27
  'id': 'vertex',
28
28
  'name': 'Vertex',
@@ -622,7 +622,7 @@ class vertex(Exchange, ImplicitAPI):
622
622
  result.append(self.parse_market(rawMarket))
623
623
  return result
624
624
 
625
- def fetch_time(self, params={}):
625
+ def fetch_time(self, params={}) -> Int:
626
626
  """
627
627
  fetches the current integer timestamp in milliseconds from the exchange server
628
628
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -630,7 +630,7 @@ class vertex(Exchange, ImplicitAPI):
630
630
  """
631
631
  response = self.v1GatewayGetTime(params)
632
632
  # 1717481623452
633
- return self.parse_number(response)
633
+ return self.parse_to_int(response)
634
634
 
635
635
  def fetch_status(self, params={}):
636
636
  """
@@ -1523,7 +1523,7 @@ class vertex(Exchange, ImplicitAPI):
1523
1523
  marketId = base + '/' + quote
1524
1524
  if base.find('PERP') > 0:
1525
1525
  marketId = marketId.replace('-PERP', '') + ':USDC'
1526
- market = self.market(marketId)
1526
+ market = self.safe_market(marketId, market)
1527
1527
  last = self.safe_string(ticker, 'last_price')
1528
1528
  return self.safe_ticker({
1529
1529
  'symbol': market['symbol'],
ccxt/wavesexchange.py CHANGED
@@ -6,9 +6,8 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.wavesexchange import ImplicitAPI
8
8
  import json
9
- from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
- from typing import Any
12
11
  from ccxt.base.errors import ExchangeError
13
12
  from ccxt.base.errors import AuthenticationError
14
13
  from ccxt.base.errors import AccountSuspended
@@ -26,7 +25,7 @@ from ccxt.base.precise import Precise
26
25
 
27
26
  class wavesexchange(Exchange, ImplicitAPI):
28
27
 
29
- def describe(self):
28
+ def describe(self) -> Any:
30
29
  return self.deep_extend(super(wavesexchange, self).describe(), {
31
30
  'id': 'wavesexchange',
32
31
  'name': 'Waves.Exchange',
ccxt/whitebit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, BorrowInterest, Bool, Currencies, Currency, DepositAddress, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Currencies, Currency, DepositAddress, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -26,7 +26,7 @@ from ccxt.base.precise import Precise
26
26
 
27
27
  class whitebit(Exchange, ImplicitAPI):
28
28
 
29
- def describe(self):
29
+ def describe(self) -> Any:
30
30
  return self.deep_extend(super(whitebit, self).describe(), {
31
31
  'id': 'whitebit',
32
32
  'name': 'WhiteBit',
@@ -1291,7 +1291,7 @@ class whitebit(Exchange, ImplicitAPI):
1291
1291
  'info': response,
1292
1292
  }
1293
1293
 
1294
- def fetch_time(self, params={}):
1294
+ def fetch_time(self, params={}) -> Int:
1295
1295
  """
1296
1296
  fetches the current integer timestamp in milliseconds from the exchange server
1297
1297
 
@@ -2626,12 +2626,13 @@ class whitebit(Exchange, ImplicitAPI):
2626
2626
  # For cases where we have a meaningful status
2627
2627
  # {"response":null,"status":422,"errors":{"orderId":["Finished order id 435453454535 not found on your account"]},"notification":null,"warning":"Finished order id 435453454535 not found on your account","_token":null}
2628
2628
  status = self.safe_string(response, 'status')
2629
+ errors = self.safe_value(response, 'errors')
2629
2630
  # {"code":10,"message":"Unauthorized request."}
2630
2631
  message = self.safe_string(response, 'message')
2631
2632
  # For these cases where we have a generic code variable error key
2632
2633
  # {"code":0,"message":"Validation failed","errors":{"amount":["Amount must be greater than 0"]}}
2633
2634
  codeNew = self.safe_integer(response, 'code')
2634
- hasErrorStatus = status is not None and status != '200'
2635
+ hasErrorStatus = status is not None and status != '200' and errors is not None
2635
2636
  if hasErrorStatus or codeNew is not None:
2636
2637
  feedback = self.id + ' ' + body
2637
2638
  errorInfo = message
ccxt/woo.py CHANGED
@@ -6,9 +6,8 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Any, Balances, Bool, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
- from typing import Any
12
11
  from ccxt.base.errors import ExchangeError
13
12
  from ccxt.base.errors import AuthenticationError
14
13
  from ccxt.base.errors import ArgumentsRequired
@@ -24,7 +23,7 @@ from ccxt.base.precise import Precise
24
23
 
25
24
  class woo(Exchange, ImplicitAPI):
26
25
 
27
- def describe(self):
26
+ def describe(self) -> Any:
28
27
  return self.deep_extend(super(woo, self).describe(), {
29
28
  'id': 'woo',
30
29
  'name': 'WOO X',
@@ -484,7 +483,7 @@ class woo(Exchange, ImplicitAPI):
484
483
  'info': response,
485
484
  }
486
485
 
487
- def fetch_time(self, params={}):
486
+ def fetch_time(self, params={}) -> Int:
488
487
  """
489
488
  fetches the current integer timestamp in milliseconds from the exchange server
490
489
 
ccxt/woofipro.py CHANGED
@@ -5,9 +5,8 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.woofipro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
9
9
  from typing import List
10
- from typing import Any
11
10
  from ccxt.base.errors import ExchangeError
12
11
  from ccxt.base.errors import AuthenticationError
13
12
  from ccxt.base.errors import ArgumentsRequired
@@ -23,7 +22,7 @@ from ccxt.base.precise import Precise
23
22
 
24
23
  class woofipro(Exchange, ImplicitAPI):
25
24
 
26
- def describe(self):
25
+ def describe(self) -> Any:
27
26
  return self.deep_extend(super(woofipro, self).describe(), {
28
27
  'id': 'woofipro',
29
28
  'name': 'WOOFI PRO',
@@ -471,7 +470,7 @@ class woofipro(Exchange, ImplicitAPI):
471
470
  'info': response,
472
471
  }
473
472
 
474
- def fetch_time(self, params={}):
473
+ def fetch_time(self, params={}) -> Int:
475
474
  """
476
475
  fetches the current integer timestamp in milliseconds from the exchange server
477
476
 
ccxt/xt.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.xt import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, FundingRate, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, FundingRate, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -27,7 +27,7 @@ from ccxt.base.precise import Precise
27
27
 
28
28
  class xt(Exchange, ImplicitAPI):
29
29
 
30
- def describe(self):
30
+ def describe(self) -> Any:
31
31
  return self.deep_extend(super(xt, self).describe(), {
32
32
  'id': 'xt',
33
33
  'name': 'XT',
@@ -128,7 +128,7 @@ class xt(Exchange, ImplicitAPI):
128
128
  'repayMargin': False,
129
129
  'setLeverage': True,
130
130
  'setMargin': False,
131
- 'setMarginMode': False,
131
+ 'setMarginMode': True,
132
132
  'setPositionMode': False,
133
133
  'signIn': False,
134
134
  'transfer': True,
@@ -286,6 +286,7 @@ class xt(Exchange, ImplicitAPI):
286
286
  'future/user/v1/position/margin': 1,
287
287
  'future/user/v1/user/collection/add': 1,
288
288
  'future/user/v1/user/collection/cancel': 1,
289
+ 'future/user/v1/position/change-type': 1,
289
290
  },
290
291
  },
291
292
  'inverse': {
@@ -531,10 +532,12 @@ class xt(Exchange, ImplicitAPI):
531
532
  'TRANSFER_012': PermissionDenied, # Currency transfer prohibited
532
533
  'symbol_not_support_trading_via_api': BadSymbol, # {"returnCode":1,"msgInfo":"failure","error":{"code":"symbol_not_support_trading_via_api","msg":"The symbol does not support trading via API"},"result":null}
533
534
  'open_order_min_nominal_value_limit': InvalidOrder, # {"returnCode":1,"msgInfo":"failure","error":{"code":"open_order_min_nominal_value_limit","msg":"Exceeds the minimum notional value of a single order"},"result":null}
535
+ 'insufficient_balance': InsufficientFunds,
534
536
  },
535
537
  'broad': {
536
538
  'The symbol does not support trading via API': BadSymbol, # {"returnCode":1,"msgInfo":"failure","error":{"code":"symbol_not_support_trading_via_api","msg":"The symbol does not support trading via API"},"result":null}
537
539
  'Exceeds the minimum notional value of a single order': InvalidOrder, # {"returnCode":1,"msgInfo":"failure","error":{"code":"open_order_min_nominal_value_limit","msg":"Exceeds the minimum notional value of a single order"},"result":null}
540
+ 'insufficient balance': InsufficientFunds,
538
541
  },
539
542
  },
540
543
  'timeframes': {
@@ -809,7 +812,7 @@ class xt(Exchange, ImplicitAPI):
809
812
  def nonce(self):
810
813
  return self.milliseconds() - self.options['timeDifference']
811
814
 
812
- def fetch_time(self, params={}):
815
+ def fetch_time(self, params={}) -> Int:
813
816
  """
814
817
  fetches the current integer timestamp in milliseconds from the xt server
815
818
 
@@ -4616,6 +4619,53 @@ class xt(Exchange, ImplicitAPI):
4616
4619
  'status': None,
4617
4620
  }
4618
4621
 
4622
+ def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
4623
+ """
4624
+ set margin mode to 'cross' or 'isolated'
4625
+
4626
+ https://doc.xt.com/#futures_userchangePositionType
4627
+
4628
+ :param str marginMode: 'cross' or 'isolated'
4629
+ :param str [symbol]: required
4630
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4631
+ :param str [params.positionSide]: *required* "long" or "short"
4632
+ :returns dict: response from the exchange
4633
+ """
4634
+ if symbol is None:
4635
+ raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol argument')
4636
+ self.load_markets()
4637
+ market = self.market(symbol)
4638
+ if market['spot']:
4639
+ raise BadSymbol(self.id + ' setMarginMode() supports contract markets only')
4640
+ marginMode = marginMode.lower()
4641
+ if marginMode != 'isolated' and marginMode != 'cross':
4642
+ raise BadRequest(self.id + ' setMarginMode() marginMode argument should be isolated or cross')
4643
+ if marginMode == 'cross':
4644
+ marginMode = 'CROSSED'
4645
+ else:
4646
+ marginMode = 'ISOLATED'
4647
+ posSide = self.safe_string_upper(params, 'positionSide')
4648
+ if posSide is None:
4649
+ raise ArgumentsRequired(self.id + ' setMarginMode() requires a positionSide parameter, either "LONG" or "SHORT"')
4650
+ request: dict = {
4651
+ 'positionType': marginMode,
4652
+ 'positionSide': posSide,
4653
+ 'symbol': market['id'],
4654
+ }
4655
+ response = self.privateLinearPostFutureUserV1PositionChangeType(self.extend(request, params))
4656
+ #
4657
+ # {
4658
+ # "error": {
4659
+ # "code": "",
4660
+ # "msg": ""
4661
+ # },
4662
+ # "msgInfo": "",
4663
+ # "result": {},
4664
+ # "returnCode": 0
4665
+ # }
4666
+ #
4667
+ return response # unify return type
4668
+
4619
4669
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4620
4670
  #
4621
4671
  # spot: error
@@ -4666,6 +4716,9 @@ class xt(Exchange, ImplicitAPI):
4666
4716
  # "result": {}
4667
4717
  # }
4668
4718
  #
4719
+ # {"returnCode":1,"msgInfo":"failure","error":{"code":"insufficient_balance","msg":"insufficient balance","args":[]},"result":null}
4720
+ #
4721
+ #
4669
4722
  status = self.safe_string_upper_2(response, 'msgInfo', 'mc')
4670
4723
  if status is not None and status != 'SUCCESS':
4671
4724
  feedback = self.id + ' ' + body
ccxt/yobit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.yobit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, OrderBooks, Trade, TradingFees, Transaction
9
+ from ccxt.base.types import Any, Balances, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, OrderBooks, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -24,7 +24,7 @@ from ccxt.base.precise import Precise
24
24
 
25
25
  class yobit(Exchange, ImplicitAPI):
26
26
 
27
- def describe(self):
27
+ def describe(self) -> Any:
28
28
  return self.deep_extend(super(yobit, self).describe(), {
29
29
  'id': 'yobit',
30
30
  'name': 'YoBit',
ccxt/zaif.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.zaif import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Any, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import BadRequest
@@ -16,7 +16,7 @@ from ccxt.base.precise import Precise
16
16
 
17
17
  class zaif(Exchange, ImplicitAPI):
18
18
 
19
- def describe(self):
19
+ def describe(self) -> Any:
20
20
  return self.deep_extend(super(zaif, self).describe(), {
21
21
  'id': 'zaif',
22
22
  'name': 'Zaif',
ccxt/zonda.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.zonda import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -27,7 +27,7 @@ from ccxt.base.precise import Precise
27
27
 
28
28
  class zonda(Exchange, ImplicitAPI):
29
29
 
30
- def describe(self):
30
+ def describe(self) -> Any:
31
31
  return self.deep_extend(super(zonda, self).describe(), {
32
32
  'id': 'zonda',
33
33
  'name': 'Zonda',