ccxt 3.0.86__py2.py3-none-any.whl → 3.0.87__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 (227) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ace.py +2 -1
  3. ccxt/alpaca.py +2 -1
  4. ccxt/ascendex.py +2 -1
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +2 -1
  7. ccxt/async_support/alpaca.py +2 -1
  8. ccxt/async_support/ascendex.py +2 -1
  9. ccxt/async_support/base/exchange.py +6 -6
  10. ccxt/async_support/bequant.py +2 -1
  11. ccxt/async_support/bigone.py +2 -1
  12. ccxt/async_support/binance.py +4 -3
  13. ccxt/async_support/binancecoinm.py +2 -1
  14. ccxt/async_support/binanceus.py +2 -1
  15. ccxt/async_support/binanceusdm.py +2 -1
  16. ccxt/async_support/bit2c.py +2 -1
  17. ccxt/async_support/bitbank.py +2 -1
  18. ccxt/async_support/bitbay.py +2 -1
  19. ccxt/async_support/bitbns.py +2 -1
  20. ccxt/async_support/bitcoincom.py +2 -1
  21. ccxt/async_support/bitfinex.py +2 -1
  22. ccxt/async_support/bitfinex2.py +2 -1
  23. ccxt/async_support/bitflyer.py +2 -1
  24. ccxt/async_support/bitforex.py +2 -1
  25. ccxt/async_support/bitget.py +19 -3
  26. ccxt/async_support/bithumb.py +2 -1
  27. ccxt/async_support/bitmart.py +2 -1
  28. ccxt/async_support/bitmex.py +3 -2
  29. ccxt/async_support/bitopro.py +2 -1
  30. ccxt/async_support/bitpanda.py +2 -1
  31. ccxt/async_support/bitrue.py +3 -2
  32. ccxt/async_support/bitso.py +2 -1
  33. ccxt/async_support/bitstamp.py +2 -1
  34. ccxt/async_support/bitstamp1.py +2 -1
  35. ccxt/async_support/bittrex.py +2 -1
  36. ccxt/async_support/bitvavo.py +3 -2
  37. ccxt/async_support/bkex.py +2 -1
  38. ccxt/async_support/bl3p.py +2 -1
  39. ccxt/async_support/blockchaincom.py +2 -1
  40. ccxt/async_support/btcalpha.py +2 -1
  41. ccxt/async_support/btcbox.py +4 -3
  42. ccxt/async_support/btcex.py +2 -1
  43. ccxt/async_support/btcmarkets.py +2 -1
  44. ccxt/async_support/btctradeua.py +2 -1
  45. ccxt/async_support/btcturk.py +2 -1
  46. ccxt/async_support/bybit.py +2 -1
  47. ccxt/async_support/cex.py +2 -1
  48. ccxt/async_support/coinbase.py +2 -1
  49. ccxt/async_support/coinbaseprime.py +2 -1
  50. ccxt/async_support/coinbasepro.py +4 -3
  51. ccxt/async_support/coincheck.py +2 -1
  52. ccxt/async_support/coinex.py +3 -2
  53. ccxt/async_support/coinfalcon.py +2 -1
  54. ccxt/async_support/coinmate.py +2 -1
  55. ccxt/async_support/coinone.py +2 -1
  56. ccxt/async_support/coinsph.py +3 -2
  57. ccxt/async_support/coinspot.py +2 -1
  58. ccxt/async_support/cryptocom.py +2 -1
  59. ccxt/async_support/currencycom.py +2 -1
  60. ccxt/async_support/delta.py +2 -1
  61. ccxt/async_support/deribit.py +2 -1
  62. ccxt/async_support/digifinex.py +4 -3
  63. ccxt/async_support/exmo.py +2 -1
  64. ccxt/async_support/fmfwio.py +2 -1
  65. ccxt/async_support/gate.py +2 -1
  66. ccxt/async_support/gateio.py +2 -1
  67. ccxt/async_support/gemini.py +2 -1
  68. ccxt/async_support/hitbtc.py +2 -1
  69. ccxt/async_support/hitbtc3.py +2 -1
  70. ccxt/async_support/hollaex.py +2 -1
  71. ccxt/async_support/huobi.py +2 -1
  72. ccxt/async_support/huobijp.py +2 -1
  73. ccxt/async_support/huobipro.py +2 -1
  74. ccxt/async_support/idex.py +3 -2
  75. ccxt/async_support/independentreserve.py +2 -1
  76. ccxt/async_support/indodax.py +2 -1
  77. ccxt/async_support/kraken.py +2 -1
  78. ccxt/async_support/krakenfutures.py +2 -1
  79. ccxt/async_support/kucoin.py +3 -2
  80. ccxt/async_support/kucoinfutures.py +147 -8
  81. ccxt/async_support/kuna.py +2 -1
  82. ccxt/async_support/latoken.py +2 -1
  83. ccxt/async_support/lbank.py +2 -1
  84. ccxt/async_support/lbank2.py +2 -1
  85. ccxt/async_support/luno.py +2 -1
  86. ccxt/async_support/lykke.py +2 -1
  87. ccxt/async_support/mercado.py +2 -1
  88. ccxt/async_support/mexc.py +4 -1
  89. ccxt/async_support/mexc3.py +2 -1
  90. ccxt/async_support/ndax.py +2 -1
  91. ccxt/async_support/novadax.py +2 -1
  92. ccxt/async_support/oceanex.py +2 -1
  93. ccxt/async_support/okcoin.py +2 -1
  94. ccxt/async_support/okex.py +2 -1
  95. ccxt/async_support/okex5.py +2 -1
  96. ccxt/async_support/okx.py +5 -1
  97. ccxt/async_support/paymium.py +2 -1
  98. ccxt/async_support/phemex.py +2 -1
  99. ccxt/async_support/poloniex.py +3 -1
  100. ccxt/async_support/poloniexfutures.py +2 -1
  101. ccxt/async_support/probit.py +2 -1
  102. ccxt/async_support/stex.py +3 -2
  103. ccxt/async_support/tidex.py +2 -1
  104. ccxt/async_support/timex.py +2 -1
  105. ccxt/async_support/tokocrypto.py +3 -2
  106. ccxt/async_support/upbit.py +2 -1
  107. ccxt/async_support/wavesexchange.py +2 -1
  108. ccxt/async_support/wazirx.py +2 -1
  109. ccxt/async_support/whitebit.py +2 -1
  110. ccxt/async_support/woo.py +2 -1
  111. ccxt/async_support/xt.py +2 -1
  112. ccxt/async_support/yobit.py +2 -1
  113. ccxt/async_support/zaif.py +2 -1
  114. ccxt/async_support/zonda.py +2 -1
  115. ccxt/base/exchange.py +6 -74
  116. ccxt/base/types.py +24 -0
  117. ccxt/bequant.py +2 -1
  118. ccxt/bigone.py +2 -1
  119. ccxt/binance.py +4 -3
  120. ccxt/binancecoinm.py +2 -1
  121. ccxt/binanceus.py +2 -1
  122. ccxt/binanceusdm.py +2 -1
  123. ccxt/bit2c.py +2 -1
  124. ccxt/bitbank.py +2 -1
  125. ccxt/bitbay.py +2 -1
  126. ccxt/bitbns.py +2 -1
  127. ccxt/bitcoincom.py +2 -1
  128. ccxt/bitfinex.py +2 -1
  129. ccxt/bitfinex2.py +2 -1
  130. ccxt/bitflyer.py +2 -1
  131. ccxt/bitforex.py +2 -1
  132. ccxt/bitget.py +19 -3
  133. ccxt/bithumb.py +2 -1
  134. ccxt/bitmart.py +2 -1
  135. ccxt/bitmex.py +3 -2
  136. ccxt/bitopro.py +2 -1
  137. ccxt/bitpanda.py +2 -1
  138. ccxt/bitrue.py +3 -2
  139. ccxt/bitso.py +2 -1
  140. ccxt/bitstamp.py +2 -1
  141. ccxt/bitstamp1.py +2 -1
  142. ccxt/bittrex.py +2 -1
  143. ccxt/bitvavo.py +3 -2
  144. ccxt/bkex.py +2 -1
  145. ccxt/bl3p.py +2 -1
  146. ccxt/blockchaincom.py +2 -1
  147. ccxt/btcalpha.py +2 -1
  148. ccxt/btcbox.py +4 -3
  149. ccxt/btcex.py +2 -1
  150. ccxt/btcmarkets.py +2 -1
  151. ccxt/btctradeua.py +2 -1
  152. ccxt/btcturk.py +2 -1
  153. ccxt/bybit.py +2 -1
  154. ccxt/cex.py +2 -1
  155. ccxt/coinbase.py +2 -1
  156. ccxt/coinbaseprime.py +2 -1
  157. ccxt/coinbasepro.py +4 -3
  158. ccxt/coincheck.py +2 -1
  159. ccxt/coinex.py +3 -2
  160. ccxt/coinfalcon.py +2 -1
  161. ccxt/coinmate.py +2 -1
  162. ccxt/coinone.py +2 -1
  163. ccxt/coinsph.py +3 -2
  164. ccxt/coinspot.py +2 -1
  165. ccxt/cryptocom.py +2 -1
  166. ccxt/currencycom.py +2 -1
  167. ccxt/delta.py +2 -1
  168. ccxt/deribit.py +2 -1
  169. ccxt/digifinex.py +4 -3
  170. ccxt/exmo.py +2 -1
  171. ccxt/fmfwio.py +2 -1
  172. ccxt/gate.py +2 -1
  173. ccxt/gateio.py +2 -1
  174. ccxt/gemini.py +2 -1
  175. ccxt/hitbtc.py +2 -1
  176. ccxt/hitbtc3.py +2 -1
  177. ccxt/hollaex.py +2 -1
  178. ccxt/huobi.py +2 -1
  179. ccxt/huobijp.py +2 -1
  180. ccxt/huobipro.py +2 -1
  181. ccxt/idex.py +3 -2
  182. ccxt/independentreserve.py +2 -1
  183. ccxt/indodax.py +2 -1
  184. ccxt/kraken.py +2 -1
  185. ccxt/krakenfutures.py +2 -1
  186. ccxt/kucoin.py +3 -2
  187. ccxt/kucoinfutures.py +147 -8
  188. ccxt/kuna.py +2 -1
  189. ccxt/latoken.py +2 -1
  190. ccxt/lbank.py +2 -1
  191. ccxt/lbank2.py +2 -1
  192. ccxt/luno.py +2 -1
  193. ccxt/lykke.py +2 -1
  194. ccxt/mercado.py +2 -1
  195. ccxt/mexc.py +4 -1
  196. ccxt/mexc3.py +2 -1
  197. ccxt/ndax.py +2 -1
  198. ccxt/novadax.py +2 -1
  199. ccxt/oceanex.py +2 -1
  200. ccxt/okcoin.py +2 -1
  201. ccxt/okex.py +2 -1
  202. ccxt/okex5.py +2 -1
  203. ccxt/okx.py +5 -1
  204. ccxt/paymium.py +2 -1
  205. ccxt/phemex.py +2 -1
  206. ccxt/poloniex.py +3 -1
  207. ccxt/poloniexfutures.py +2 -1
  208. ccxt/pro/__init__.py +1 -1
  209. ccxt/probit.py +2 -1
  210. ccxt/stex.py +3 -2
  211. ccxt/tidex.py +2 -1
  212. ccxt/timex.py +2 -1
  213. ccxt/tokocrypto.py +3 -2
  214. ccxt/upbit.py +2 -1
  215. ccxt/wavesexchange.py +2 -1
  216. ccxt/wazirx.py +2 -1
  217. ccxt/whitebit.py +2 -1
  218. ccxt/woo.py +2 -1
  219. ccxt/xt.py +2 -1
  220. ccxt/yobit.py +2 -1
  221. ccxt/zaif.py +2 -1
  222. ccxt/zonda.py +2 -1
  223. {ccxt-3.0.86.dist-info → ccxt-3.0.87.dist-info}/METADATA +4 -4
  224. ccxt-3.0.87.dist-info/RECORD +355 -0
  225. ccxt-3.0.86.dist-info/RECORD +0 -355
  226. {ccxt-3.0.86.dist-info → ccxt-3.0.87.dist-info}/WHEEL +0 -0
  227. {ccxt-3.0.86.dist-info → ccxt-3.0.87.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,10 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.okx import okx
7
+ from ccxt.abstract.okex import ImplicitAPI
7
8
 
8
9
 
9
- class okex(okx):
10
+ class okex(okx, ImplicitAPI):
10
11
 
11
12
  def describe(self):
12
13
  return self.deep_extend(super(okex, self).describe(), {
@@ -4,9 +4,10 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.okex import okex
7
+ from ccxt.abstract.okex5 import ImplicitAPI
7
8
 
8
9
 
9
- class okex5(okex):
10
+ class okex5(okex, ImplicitAPI):
10
11
 
11
12
  def describe(self):
12
13
  return self.deep_extend(super(okex5, self).describe(), {
ccxt/async_support/okx.py CHANGED
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.okx import ImplicitAPI
7
8
  import asyncio
8
9
  import hashlib
9
10
  from ccxt.base.types import OrderSide
@@ -33,7 +34,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
33
34
  from ccxt.base.precise import Precise
34
35
 
35
36
 
36
- class okx(Exchange):
37
+ class okx(Exchange, ImplicitAPI):
37
38
 
38
39
  def describe(self):
39
40
  return self.deep_extend(super(okx, self).describe(), {
@@ -272,6 +273,7 @@ class okx(Exchange):
272
273
  'trade/orders-algo-history': 1,
273
274
  'trade/order-algo': 1,
274
275
  'account/subaccount/balances': 10,
276
+ 'account/subaccount/interest-limits': 4,
275
277
  'asset/subaccount/bills': 5 / 3,
276
278
  'users/subaccount/list': 10,
277
279
  'users/subaccount/apikey': 10,
@@ -332,6 +334,7 @@ class okx(Exchange):
332
334
  'account/quick-margin-borrow-repay': 4,
333
335
  'account/activate-option': 4,
334
336
  'account/set-auto-loan': 4,
337
+ 'account/subaccount/set-loan-allocation': 4,
335
338
  'asset/transfer': 10,
336
339
  'asset/withdrawal': 5 / 3,
337
340
  'asset/withdrawal-lightning': 5,
@@ -343,6 +346,7 @@ class okx(Exchange):
343
346
  'trade/cancel-batch-orders': 1 / 15,
344
347
  'trade/amend-order': 1 / 3,
345
348
  'trade/amend-batch-orders': 1 / 3,
349
+ 'trade/amend-algos': 1,
346
350
  'trade/close-position': 1,
347
351
  'trade/order-algo': 1,
348
352
  'trade/cancel-algos': 1,
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.paymium import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -12,7 +13,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
12
13
  from ccxt.base.precise import Precise
13
14
 
14
15
 
15
- class paymium(Exchange):
16
+ class paymium(Exchange, ImplicitAPI):
16
17
 
17
18
  def describe(self):
18
19
  return self.deep_extend(super(paymium, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.phemex import ImplicitAPI
7
8
  import hashlib
8
9
  import numbers
9
10
  from ccxt.base.types import OrderSide
@@ -28,7 +29,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
28
29
  from ccxt.base.precise import Precise
29
30
 
30
31
 
31
- class phemex(Exchange):
32
+ class phemex(Exchange, ImplicitAPI):
32
33
 
33
34
  def describe(self):
34
35
  return self.deep_extend(super(phemex, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.poloniex import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -27,7 +28,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
27
28
  from ccxt.base.precise import Precise
28
29
 
29
30
 
30
- class poloniex(Exchange):
31
+ class poloniex(Exchange, ImplicitAPI):
31
32
 
32
33
  def describe(self):
33
34
  return self.deep_extend(super(poloniex, self).describe(), {
@@ -686,6 +687,7 @@ class poloniex(Exchange):
686
687
  'withdraw': None,
687
688
  'fee': fee,
688
689
  'precision': None,
690
+ 'networks': {},
689
691
  'limits': {
690
692
  'amount': {
691
693
  'min': None,
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.poloniexfutures import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -22,7 +23,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class poloniexfutures(Exchange):
26
+ class poloniexfutures(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(poloniexfutures, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.probit import ImplicitAPI
7
8
  import math
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -25,7 +26,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
25
26
  from ccxt.base.precise import Precise
26
27
 
27
28
 
28
- class probit(Exchange):
29
+ class probit(Exchange, ImplicitAPI):
29
30
 
30
31
  def describe(self):
31
32
  return self.deep_extend(super(probit, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.stex import ImplicitAPI
7
8
  from ccxt.base.types import OrderSide
8
9
  from typing import Optional
9
10
  from typing import List
@@ -22,7 +23,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class stex(Exchange):
26
+ class stex(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(stex, self).describe(), {
@@ -448,7 +449,7 @@ class stex(Exchange):
448
449
  minPrice = Precise.string_max(minBuyPrice, minSellPrice)
449
450
  buyFee = Precise.string_div(self.safe_string(market, 'buy_fee_percent'), '100')
450
451
  sellFee = Precise.string_div(self.safe_string(market, 'sell_fee_percent'), '100')
451
- fee = Precise.string_max(buyFee, sellFee)
452
+ fee = self.parse_number(Precise.string_max(buyFee, sellFee))
452
453
  result.append({
453
454
  'id': id,
454
455
  'numericId': numericId,
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.tidex import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -21,7 +22,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
21
22
  from ccxt.base.precise import Precise
22
23
 
23
24
 
24
- class tidex(Exchange):
25
+ class tidex(Exchange, ImplicitAPI):
25
26
 
26
27
  def describe(self):
27
28
  return self.deep_extend(super(tidex, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.timex import ImplicitAPI
7
8
  from ccxt.base.types import OrderSide
8
9
  from typing import Optional
9
10
  from typing import List
@@ -22,7 +23,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class timex(Exchange):
26
+ class timex(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(timex, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.tokocrypto import ImplicitAPI
7
8
  import hashlib
8
9
  import json
9
10
  from ccxt.base.types import OrderSide
@@ -35,7 +36,7 @@ from ccxt.base.decimal_to_precision import DECIMAL_PLACES
35
36
  from ccxt.base.precise import Precise
36
37
 
37
38
 
38
- class tokocrypto(Exchange):
39
+ class tokocrypto(Exchange, ImplicitAPI):
39
40
 
40
41
  def describe(self):
41
42
  return self.deep_extend(super(tokocrypto, self).describe(), {
@@ -2312,7 +2313,7 @@ class tokocrypto(Exchange):
2312
2313
  raise ExchangeError(self.id + ' ' + body)
2313
2314
  return None
2314
2315
 
2315
- def calculate_rate_limiter_cost(self, api, method, path, params, config={}, context={}):
2316
+ def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
2316
2317
  if ('noCoin' in config) and not ('coin' in params):
2317
2318
  return config['noCoin']
2318
2319
  elif ('noSymbol' in config) and not ('symbol' in params):
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.upbit import ImplicitAPI
7
8
  from ccxt.base.types import OrderSide
8
9
  from typing import Optional
9
10
  from typing import List
@@ -19,7 +20,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
19
20
  from ccxt.base.precise import Precise
20
21
 
21
22
 
22
- class upbit(Exchange):
23
+ class upbit(Exchange, ImplicitAPI):
23
24
 
24
25
  def describe(self):
25
26
  return self.deep_extend(super(upbit, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.wavesexchange import ImplicitAPI
7
8
  import math
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -22,7 +23,7 @@ from ccxt.base.errors import AuthenticationError
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class wavesexchange(Exchange):
26
+ class wavesexchange(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(wavesexchange, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.wazirx import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -20,7 +21,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
20
21
  from ccxt.base.precise import Precise
21
22
 
22
23
 
23
- class wazirx(Exchange):
24
+ class wazirx(Exchange, ImplicitAPI):
24
25
 
25
26
  def describe(self):
26
27
  return self.deep_extend(super(wazirx, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.whitebit import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -24,7 +25,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
24
25
  from ccxt.base.precise import Precise
25
26
 
26
27
 
27
- class whitebit(Exchange):
28
+ class whitebit(Exchange, ImplicitAPI):
28
29
 
29
30
  def describe(self):
30
31
  return self.deep_extend(super(whitebit, self).describe(), {
ccxt/async_support/woo.py CHANGED
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.woo import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -18,7 +19,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
18
19
  from ccxt.base.precise import Precise
19
20
 
20
21
 
21
- class woo(Exchange):
22
+ class woo(Exchange, ImplicitAPI):
22
23
 
23
24
  def describe(self):
24
25
  return self.deep_extend(super(woo, self).describe(), {
ccxt/async_support/xt.py CHANGED
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.xt import ImplicitAPI
7
8
  import asyncio
8
9
  import hashlib
9
10
  from typing import Optional
@@ -22,7 +23,7 @@ from ccxt.base.decimal_to_precision import DECIMAL_PLACES
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class xt(Exchange):
26
+ class xt(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(xt, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.yobit import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -22,7 +23,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
22
23
  from ccxt.base.precise import Precise
23
24
 
24
25
 
25
- class yobit(Exchange):
26
+ class yobit(Exchange, ImplicitAPI):
26
27
 
27
28
  def describe(self):
28
29
  return self.deep_extend(super(yobit, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.zaif import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -13,7 +14,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
13
14
  from ccxt.base.precise import Precise
14
15
 
15
16
 
16
- class zaif(Exchange):
17
+ class zaif(Exchange, ImplicitAPI):
17
18
 
18
19
  def describe(self):
19
20
  return self.deep_extend(super(zaif, self).describe(), {
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.zonda import ImplicitAPI
7
8
  import hashlib
8
9
  from ccxt.base.types import OrderSide
9
10
  from typing import Optional
@@ -24,7 +25,7 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
24
25
  from ccxt.base.precise import Precise
25
26
 
26
27
 
27
- class zonda(Exchange):
28
+ class zonda(Exchange, ImplicitAPI):
28
29
 
29
30
  def describe(self):
30
31
  return self.deep_extend(super(zonda, self).describe(), {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '3.0.86'
7
+ __version__ = '3.0.87'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -408,9 +408,6 @@ class Exchange(object):
408
408
  else:
409
409
  setattr(self, key, settings[key])
410
410
 
411
- if self.api:
412
- self.define_rest_api(self.api, 'request')
413
-
414
411
  if self.markets:
415
412
  self.set_markets(self.markets)
416
413
 
@@ -467,71 +464,6 @@ class Exchange(object):
467
464
  self.urls['api'] = self.urls['apiBackup']
468
465
  del self.urls['apiBackup']
469
466
 
470
- def define_rest_api_endpoint(self, method_name, uppercase_method, lowercase_method, camelcase_method, path, paths, config={}):
471
- cls = type(self)
472
- entry = getattr(cls, method_name) # returns a function (instead of a bound method)
473
- delimiters = re.compile('[^a-zA-Z0-9]')
474
- split_path = delimiters.split(path)
475
- lowercase_path = [x.strip().lower() for x in split_path]
476
- camelcase_suffix = ''.join([Exchange.capitalize(x) for x in split_path])
477
- underscore_suffix = '_'.join([x for x in lowercase_path if len(x)])
478
- camelcase_prefix = ''
479
- underscore_prefix = ''
480
- if len(paths):
481
- camelcase_prefix = paths[0]
482
- underscore_prefix = paths[0]
483
- if len(paths) > 1:
484
- camelcase_prefix += ''.join([Exchange.capitalize(x) for x in paths[1:]])
485
- underscore_prefix += '_' + '_'.join([x.strip() for p in paths[1:] for x in delimiters.split(p)])
486
- api_argument = paths
487
- else:
488
- api_argument = paths[0]
489
- camelcase = camelcase_prefix + camelcase_method + Exchange.capitalize(camelcase_suffix)
490
- underscore = underscore_prefix + '_' + lowercase_method + '_' + underscore_suffix.lower()
491
-
492
- def partialer():
493
- outer_kwargs = {'path': path, 'api': api_argument, 'method': uppercase_method, 'config': config}
494
-
495
- @functools.wraps(entry)
496
- def inner(_self, params=None, context=None):
497
- """
498
- Inner is called when a generated method (publicGetX) is called.
499
- _self is a reference to self created by function.__get__(exchange, type(exchange))
500
- https://en.wikipedia.org/wiki/Closure_(computer_programming) equivalent to functools.partial
501
- """
502
- inner_kwargs = dict(outer_kwargs) # avoid mutation
503
- if params is not None:
504
- inner_kwargs['params'] = params
505
- if context is not None:
506
- inner_kwargs['context'] = params
507
- return entry(_self, **inner_kwargs)
508
- return inner
509
- to_bind = partialer()
510
- setattr(cls, camelcase, to_bind)
511
- setattr(cls, underscore, to_bind)
512
-
513
- def define_rest_api(self, api, method_name, paths=[]):
514
- for key, value in api.items():
515
- uppercase_method = key.upper()
516
- lowercase_method = key.lower()
517
- camelcase_method = lowercase_method.capitalize()
518
- if isinstance(value, list):
519
- for path in value:
520
- self.define_rest_api_endpoint(method_name, uppercase_method, lowercase_method, camelcase_method, path, paths)
521
- # the options HTTP method conflicts with the 'options' API url path
522
- # elif re.search(r'^(?:get|post|put|delete|options|head|patch)$', key, re.IGNORECASE) is not None:
523
- elif re.search(r'^(?:get|post|put|delete|head|patch)$', key, re.IGNORECASE) is not None:
524
- for [endpoint, config] in value.items():
525
- path = endpoint.strip()
526
- if isinstance(config, dict):
527
- self.define_rest_api_endpoint(method_name, uppercase_method, lowercase_method, camelcase_method, path, paths, config)
528
- elif isinstance(config, Number):
529
- self.define_rest_api_endpoint(method_name, uppercase_method, lowercase_method, camelcase_method, path, paths, {'cost': config})
530
- else:
531
- raise NotSupported(self.id + ' define_rest_api() API format not supported, API leafs must strings, objects or numbers')
532
- else:
533
- self.define_rest_api(value, method_name, paths + [key])
534
-
535
467
  def throttle(self, cost=None):
536
468
  now = float(self.milliseconds())
537
469
  elapsed = now - self.lastRestRequestTimestamp
@@ -2870,16 +2802,16 @@ class Exchange(object):
2870
2802
  results.append(objects[i])
2871
2803
  return self.index_by(results, key) if indexed else results
2872
2804
 
2873
- def fetch2(self, path, api: Any = 'public', method='GET', params={}, headers: Optional[Any] = None, body: Optional[Any] = None, config={}, context={}):
2805
+ def fetch2(self, path, api: Any = 'public', method='GET', params={}, headers: Optional[Any] = None, body: Optional[Any] = None, config={}):
2874
2806
  if self.enableRateLimit:
2875
- cost = self.calculate_rate_limiter_cost(api, method, path, params, config, context)
2807
+ cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
2876
2808
  self.throttle(cost)
2877
2809
  self.lastRestRequestTimestamp = self.milliseconds()
2878
2810
  request = self.sign(path, api, method, params, headers, body)
2879
2811
  return self.fetch(request['url'], request['method'], request['headers'], request['body'])
2880
2812
 
2881
- def request(self, path, api: Any = 'public', method='GET', params={}, headers: Optional[Any] = None, body: Optional[Any] = None, config={}, context={}):
2882
- return self.fetch2(path, api, method, params, headers, body, config, context)
2813
+ def request(self, path, api: Any = 'public', method='GET', params={}, headers: Optional[Any] = None, body: Optional[Any] = None, config={}):
2814
+ return self.fetch2(path, api, method, params, headers, body, config)
2883
2815
 
2884
2816
  def load_accounts(self, reload=False, params={}):
2885
2817
  if reload:
@@ -3207,7 +3139,7 @@ class Exchange(object):
3207
3139
  # raise NotSupported(self.id + ' handleErrors() not implemented yet')
3208
3140
  return None
3209
3141
 
3210
- def calculate_rate_limiter_cost(self, api, method, path, params, config={}, context={}):
3142
+ def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
3211
3143
  return self.safe_value(config, 'cost', 1)
3212
3144
 
3213
3145
  def fetch_ticker(self, symbol: str, params={}):
ccxt/base/types.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import sys
2
+ import types
2
3
  from typing import Union
3
4
 
4
5
  if sys.version_info.minor > 7:
@@ -12,6 +13,29 @@ OrderSide = Literal['buy', 'sell']
12
13
  OrderType = Literal['limit', 'market']
13
14
 
14
15
 
16
+ class Entry:
17
+ def __init__(self, path, api, method, config):
18
+ self.name = None
19
+ self.path = path
20
+ self.api = api
21
+ self.method = method
22
+ self.config = config
23
+
24
+ def unbound_method(_self, params={}):
25
+ return _self.request(self.path, self.api, self.method, params, config=self.config)
26
+
27
+ self.unbound_method = unbound_method
28
+
29
+ def __get__(self, instance, owner):
30
+ if instance is None:
31
+ return self.unbound_method
32
+ else:
33
+ return types.MethodType(self.unbound_method, instance)
34
+
35
+ def __set_name__(self, owner, name):
36
+ self.name = name
37
+
38
+
15
39
  class Balance(TypedDict):
16
40
  free: Union[None, str, float]
17
41
  used: Union[None, str, float]
ccxt/bequant.py CHANGED
@@ -4,9 +4,10 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.hitbtc import hitbtc
7
+ from ccxt.abstract.bequant import ImplicitAPI
7
8
 
8
9
 
9
- class bequant(hitbtc):
10
+ class bequant(hitbtc, ImplicitAPI):
10
11
 
11
12
  def describe(self):
12
13
  return self.deep_extend(super(bequant, self).describe(), {
ccxt/bigone.py CHANGED
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
+ from ccxt.abstract.bigone import ImplicitAPI
7
8
  from ccxt.base.types import OrderSide
8
9
  from typing import Optional
9
10
  from typing import List
@@ -19,7 +20,7 @@ from ccxt.base.errors import AuthenticationError
19
20
  from ccxt.base.decimal_to_precision import TICK_SIZE
20
21
 
21
22
 
22
- class bigone(Exchange):
23
+ class bigone(Exchange, ImplicitAPI):
23
24
 
24
25
  def describe(self):
25
26
  return self.deep_extend(super(bigone, self).describe(), {
ccxt/binance.py CHANGED
@@ -4,6 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
+ from ccxt.abstract.binance import ImplicitAPI
7
8
  import hashlib
8
9
  import json
9
10
  from ccxt.base.types import OrderSide
@@ -35,7 +36,7 @@ from ccxt.base.decimal_to_precision import DECIMAL_PLACES
35
36
  from ccxt.base.precise import Precise
36
37
 
37
38
 
38
- class binance(Exchange):
39
+ class binance(Exchange, ImplicitAPI):
39
40
 
40
41
  def describe(self):
41
42
  return self.deep_extend(super(binance, self).describe(), {
@@ -7124,7 +7125,7 @@ class binance(Exchange):
7124
7125
  raise ExchangeError(self.id + ' ' + body)
7125
7126
  return None
7126
7127
 
7127
- def calculate_rate_limiter_cost(self, api, method, path, params, config={}, context={}):
7128
+ def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
7128
7129
  if ('noCoin' in config) and not ('coin' in params):
7129
7130
  return config['noCoin']
7130
7131
  elif ('noSymbol' in config) and not ('symbol' in params):
@@ -7141,7 +7142,7 @@ class binance(Exchange):
7141
7142
  return self.safe_value(config, 'cost', 1)
7142
7143
 
7143
7144
  def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}):
7144
- response = self.fetch2(path, api, method, params, headers, body, config, context)
7145
+ response = self.fetch2(path, api, method, params, headers, body, config)
7145
7146
  # a workaround for {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
7146
7147
  if (api == 'private') or (api == 'wapi'):
7147
7148
  self.options['hasAlreadyAuthenticatedSuccessfully'] = True
ccxt/binancecoinm.py CHANGED
@@ -4,9 +4,10 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.binance import binance
7
+ from ccxt.abstract.binancecoinm import ImplicitAPI
7
8
 
8
9
 
9
- class binancecoinm(binance):
10
+ class binancecoinm(binance, ImplicitAPI):
10
11
 
11
12
  def describe(self):
12
13
  return self.deep_extend(super(binancecoinm, self).describe(), {
ccxt/binanceus.py CHANGED
@@ -4,9 +4,10 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.binance import binance
7
+ from ccxt.abstract.binanceus import ImplicitAPI
7
8
 
8
9
 
9
- class binanceus(binance):
10
+ class binanceus(binance, ImplicitAPI):
10
11
 
11
12
  def describe(self):
12
13
  return self.deep_extend(super(binanceus, self).describe(), {