ccxt 4.1.54__py2.py3-none-any.whl → 4.1.56__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 (251) hide show
  1. ccxt/__init__.py +2 -2
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/bitbank.py +1 -0
  7. ccxt/abstract/coinbase.py +2 -0
  8. ccxt/abstract/htx.py +3 -0
  9. ccxt/abstract/huobi.py +3 -0
  10. ccxt/abstract/huobipro.py +3 -0
  11. ccxt/abstract/okex.py +3 -1
  12. ccxt/abstract/okex5.py +3 -1
  13. ccxt/abstract/okx.py +3 -1
  14. ccxt/ace.py +23 -23
  15. ccxt/alpaca.py +8 -8
  16. ccxt/ascendex.py +26 -26
  17. ccxt/async_support/__init__.py +2 -2
  18. ccxt/async_support/ace.py +23 -23
  19. ccxt/async_support/alpaca.py +8 -8
  20. ccxt/async_support/ascendex.py +26 -26
  21. ccxt/async_support/base/exchange.py +4 -2216
  22. ccxt/async_support/bigone.py +21 -24
  23. ccxt/async_support/binance.py +61 -54
  24. ccxt/async_support/bingx.py +28 -28
  25. ccxt/async_support/bit2c.py +9 -9
  26. ccxt/async_support/bitbank.py +11 -10
  27. ccxt/async_support/bitbns.py +11 -11
  28. ccxt/async_support/bitfinex.py +15 -15
  29. ccxt/async_support/bitfinex2.py +22 -22
  30. ccxt/async_support/bitflyer.py +13 -13
  31. ccxt/async_support/bitforex.py +10 -10
  32. ccxt/async_support/bitget.py +44 -44
  33. ccxt/async_support/bithumb.py +9 -9
  34. ccxt/async_support/bitmart.py +85 -104
  35. ccxt/async_support/bitmex.py +27 -27
  36. ccxt/async_support/bitopro.py +18 -18
  37. ccxt/async_support/bitpanda.py +18 -18
  38. ccxt/async_support/bitrue.py +14 -14
  39. ccxt/async_support/bitso.py +17 -17
  40. ccxt/async_support/bitstamp.py +17 -17
  41. ccxt/async_support/bittrex.py +22 -24
  42. ccxt/async_support/bitvavo.py +15 -15
  43. ccxt/async_support/bl3p.py +4 -4
  44. ccxt/async_support/blockchaincom.py +17 -17
  45. ccxt/async_support/btcalpha.py +14 -14
  46. ccxt/async_support/btcbox.py +9 -9
  47. ccxt/async_support/btcmarkets.py +17 -17
  48. ccxt/async_support/btcturk.py +9 -9
  49. ccxt/async_support/bybit.py +46 -46
  50. ccxt/async_support/cex.py +10 -10
  51. ccxt/async_support/coinbase.py +69 -25
  52. ccxt/async_support/coinbasepro.py +19 -19
  53. ccxt/async_support/coincheck.py +10 -10
  54. ccxt/async_support/coinex.py +57 -66
  55. ccxt/async_support/coinlist.py +22 -22
  56. ccxt/async_support/coinmate.py +10 -10
  57. ccxt/async_support/coinone.py +10 -10
  58. ccxt/async_support/coinsph.py +17 -17
  59. ccxt/async_support/coinspot.py +5 -5
  60. ccxt/async_support/cryptocom.py +27 -27
  61. ccxt/async_support/currencycom.py +18 -18
  62. ccxt/async_support/delta.py +21 -21
  63. ccxt/async_support/deribit.py +24 -24
  64. ccxt/async_support/digifinex.py +35 -35
  65. ccxt/async_support/exmo.py +19 -19
  66. ccxt/async_support/gate.py +38 -38
  67. ccxt/async_support/gemini.py +11 -11
  68. ccxt/async_support/hitbtc.py +27 -27
  69. ccxt/async_support/hollaex.py +19 -19
  70. ccxt/async_support/htx.py +47 -44
  71. ccxt/async_support/huobijp.py +22 -22
  72. ccxt/async_support/idex.py +20 -20
  73. ccxt/async_support/independentreserve.py +9 -9
  74. ccxt/async_support/indodax.py +10 -10
  75. ccxt/async_support/kraken.py +25 -25
  76. ccxt/async_support/krakenfutures.py +17 -17
  77. ccxt/async_support/kucoin.py +27 -27
  78. ccxt/async_support/kucoinfutures.py +20 -20
  79. ccxt/async_support/kuna.py +19 -19
  80. ccxt/async_support/latoken.py +14 -14
  81. ccxt/async_support/lbank.py +18 -18
  82. ccxt/async_support/luno.py +14 -14
  83. ccxt/async_support/lykke.py +12 -12
  84. ccxt/async_support/mercado.py +11 -11
  85. ccxt/async_support/mexc.py +36 -36
  86. ccxt/async_support/ndax.py +18 -18
  87. ccxt/async_support/novadax.py +17 -17
  88. ccxt/async_support/oceanex.py +12 -12
  89. ccxt/async_support/okcoin.py +19 -19
  90. ccxt/async_support/okx.py +48 -45
  91. ccxt/async_support/p2b.py +6 -6
  92. ccxt/async_support/paymium.py +6 -6
  93. ccxt/async_support/phemex.py +57 -57
  94. ccxt/async_support/poloniex.py +31 -30
  95. ccxt/async_support/poloniexfutures.py +16 -16
  96. ccxt/async_support/probit.py +22 -22
  97. ccxt/async_support/tidex.py +15 -15
  98. ccxt/async_support/timex.py +20 -20
  99. ccxt/async_support/tokocrypto.py +16 -16
  100. ccxt/async_support/upbit.py +15 -15
  101. ccxt/async_support/wavesexchange.py +12 -12
  102. ccxt/async_support/wazirx.py +13 -13
  103. ccxt/async_support/whitebit.py +26 -26
  104. ccxt/async_support/woo.py +47 -47
  105. ccxt/async_support/yobit.py +8 -8
  106. ccxt/async_support/zaif.py +10 -10
  107. ccxt/async_support/zonda.py +16 -16
  108. ccxt/base/errors.py +17 -16
  109. ccxt/base/exchange.py +57 -97
  110. ccxt/base/types.py +138 -139
  111. ccxt/bigone.py +21 -24
  112. ccxt/binance.py +61 -54
  113. ccxt/bingx.py +28 -28
  114. ccxt/bit2c.py +9 -9
  115. ccxt/bitbank.py +11 -10
  116. ccxt/bitbns.py +11 -11
  117. ccxt/bitfinex.py +15 -15
  118. ccxt/bitfinex2.py +22 -22
  119. ccxt/bitflyer.py +13 -13
  120. ccxt/bitforex.py +10 -10
  121. ccxt/bitget.py +44 -44
  122. ccxt/bithumb.py +9 -9
  123. ccxt/bitmart.py +85 -104
  124. ccxt/bitmex.py +27 -27
  125. ccxt/bitopro.py +18 -18
  126. ccxt/bitpanda.py +18 -18
  127. ccxt/bitrue.py +14 -14
  128. ccxt/bitso.py +17 -17
  129. ccxt/bitstamp.py +17 -17
  130. ccxt/bittrex.py +22 -24
  131. ccxt/bitvavo.py +15 -15
  132. ccxt/bl3p.py +4 -4
  133. ccxt/blockchaincom.py +17 -17
  134. ccxt/btcalpha.py +14 -14
  135. ccxt/btcbox.py +9 -9
  136. ccxt/btcmarkets.py +17 -17
  137. ccxt/btcturk.py +9 -9
  138. ccxt/bybit.py +46 -46
  139. ccxt/cex.py +10 -10
  140. ccxt/coinbase.py +69 -25
  141. ccxt/coinbasepro.py +19 -19
  142. ccxt/coincheck.py +10 -10
  143. ccxt/coinex.py +57 -66
  144. ccxt/coinlist.py +22 -22
  145. ccxt/coinmate.py +10 -10
  146. ccxt/coinone.py +10 -10
  147. ccxt/coinsph.py +17 -17
  148. ccxt/coinspot.py +5 -5
  149. ccxt/cryptocom.py +27 -27
  150. ccxt/currencycom.py +18 -18
  151. ccxt/delta.py +21 -21
  152. ccxt/deribit.py +24 -24
  153. ccxt/digifinex.py +35 -35
  154. ccxt/exmo.py +19 -19
  155. ccxt/gate.py +38 -38
  156. ccxt/gemini.py +11 -11
  157. ccxt/hitbtc.py +27 -27
  158. ccxt/hollaex.py +19 -19
  159. ccxt/htx.py +47 -44
  160. ccxt/huobijp.py +22 -22
  161. ccxt/idex.py +20 -20
  162. ccxt/independentreserve.py +9 -9
  163. ccxt/indodax.py +10 -10
  164. ccxt/kraken.py +25 -25
  165. ccxt/krakenfutures.py +17 -17
  166. ccxt/kucoin.py +27 -27
  167. ccxt/kucoinfutures.py +20 -20
  168. ccxt/kuna.py +19 -19
  169. ccxt/latoken.py +14 -14
  170. ccxt/lbank.py +18 -18
  171. ccxt/luno.py +14 -14
  172. ccxt/lykke.py +12 -12
  173. ccxt/mercado.py +11 -11
  174. ccxt/mexc.py +36 -36
  175. ccxt/ndax.py +18 -18
  176. ccxt/novadax.py +17 -17
  177. ccxt/oceanex.py +12 -12
  178. ccxt/okcoin.py +19 -19
  179. ccxt/okx.py +48 -45
  180. ccxt/p2b.py +6 -6
  181. ccxt/paymium.py +6 -6
  182. ccxt/phemex.py +57 -57
  183. ccxt/poloniex.py +31 -30
  184. ccxt/poloniexfutures.py +16 -16
  185. ccxt/pro/__init__.py +1 -1
  186. ccxt/pro/alpaca.py +3 -3
  187. ccxt/pro/ascendex.py +2 -2
  188. ccxt/pro/binance.py +9 -9
  189. ccxt/pro/bingx.py +3 -3
  190. ccxt/pro/bitfinex.py +3 -3
  191. ccxt/pro/bitfinex2.py +3 -3
  192. ccxt/pro/bitget.py +3 -3
  193. ccxt/pro/bitmart.py +2 -2
  194. ccxt/pro/bitmex.py +3 -3
  195. ccxt/pro/bitpanda.py +3 -3
  196. ccxt/pro/bitrue.py +2 -2
  197. ccxt/pro/bitstamp.py +2 -2
  198. ccxt/pro/bittrex.py +3 -3
  199. ccxt/pro/bitvavo.py +3 -3
  200. ccxt/pro/blockchaincom.py +2 -2
  201. ccxt/pro/bybit.py +4 -4
  202. ccxt/pro/cex.py +3 -3
  203. ccxt/pro/coinbasepro.py +3 -3
  204. ccxt/pro/coinex.py +2 -2
  205. ccxt/pro/cryptocom.py +5 -5
  206. ccxt/pro/deribit.py +3 -3
  207. ccxt/pro/exmo.py +2 -2
  208. ccxt/pro/gate.py +3 -3
  209. ccxt/pro/gemini.py +2 -2
  210. ccxt/pro/hitbtc.py +4 -4
  211. ccxt/pro/hollaex.py +3 -3
  212. ccxt/pro/htx.py +3 -3
  213. ccxt/pro/idex.py +3 -3
  214. ccxt/pro/kraken.py +7 -7
  215. ccxt/pro/krakenfutures.py +4 -4
  216. ccxt/pro/kucoin.py +3 -3
  217. ccxt/pro/kucoinfutures.py +3 -3
  218. ccxt/pro/mexc.py +3 -3
  219. ccxt/pro/okcoin.py +2 -2
  220. ccxt/pro/okx.py +6 -6
  221. ccxt/pro/phemex.py +3 -3
  222. ccxt/pro/poloniex.py +3 -3
  223. ccxt/pro/poloniexfutures.py +3 -3
  224. ccxt/pro/probit.py +3 -3
  225. ccxt/pro/wazirx.py +3 -3
  226. ccxt/pro/whitebit.py +3 -3
  227. ccxt/pro/woo.py +2 -2
  228. ccxt/probit.py +22 -22
  229. ccxt/test/base/test_shared_methods.py +3 -3
  230. ccxt/test/test_async.py +543 -535
  231. ccxt/test/test_sync.py +542 -534
  232. ccxt/tidex.py +15 -15
  233. ccxt/timex.py +20 -20
  234. ccxt/tokocrypto.py +16 -16
  235. ccxt/upbit.py +15 -15
  236. ccxt/wavesexchange.py +12 -12
  237. ccxt/wazirx.py +13 -13
  238. ccxt/whitebit.py +26 -26
  239. ccxt/woo.py +47 -47
  240. ccxt/yobit.py +8 -8
  241. ccxt/zaif.py +10 -10
  242. ccxt/zonda.py +16 -16
  243. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/METADATA +10 -8
  244. ccxt-4.1.56.dist-info/RECORD +449 -0
  245. ccxt/async_support/bitstamp1.py +0 -402
  246. ccxt/async_support/lbank2.py +0 -2620
  247. ccxt/bitstamp1.py +0 -402
  248. ccxt/lbank2.py +0 -2619
  249. ccxt-4.1.54.dist-info/RECORD +0 -453
  250. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/WHEEL +0 -0
  251. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/top_level.txt +0 -0
ccxt/coinbase.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, Order, OrderBook, OrderSide, OrderType, String, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -56,6 +56,7 @@ class coinbase(Exchange, ImplicitAPI):
56
56
  'createStopLimitOrder': True,
57
57
  'createStopMarketOrder': False,
58
58
  'createStopOrder': True,
59
+ 'editOrder': True,
59
60
  'fetchAccounts': True,
60
61
  'fetchBalance': True,
61
62
  'fetchBidsAsks': True,
@@ -207,6 +208,8 @@ class coinbase(Exchange, ImplicitAPI):
207
208
  'post': [
208
209
  'brokerage/orders',
209
210
  'brokerage/orders/batch_cancel',
211
+ 'brokerage/orders/edit',
212
+ 'brokerage/orders/edit_preview',
210
213
  ],
211
214
  },
212
215
  },
@@ -585,7 +588,7 @@ class coinbase(Exchange, ImplicitAPI):
585
588
  'info': response,
586
589
  }
587
590
 
588
- def fetch_my_sells(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
591
+ def fetch_my_sells(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
589
592
  """
590
593
  fetch sells
591
594
  :param str symbol: not used by coinbase fetchMySells()
@@ -601,7 +604,7 @@ class coinbase(Exchange, ImplicitAPI):
601
604
  sells = self.v2PrivateGetAccountsAccountIdSells(self.extend(request, query))
602
605
  return self.parse_trades(sells['data'], None, since, limit)
603
606
 
604
- def fetch_my_buys(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
607
+ def fetch_my_buys(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
605
608
  """
606
609
  fetch buys
607
610
  :param str symbol: not used by coinbase fetchMyBuys()
@@ -617,14 +620,14 @@ class coinbase(Exchange, ImplicitAPI):
617
620
  buys = self.v2PrivateGetAccountsAccountIdBuys(self.extend(request, query))
618
621
  return self.parse_trades(buys['data'], None, since, limit)
619
622
 
620
- def fetch_transactions_with_method(self, method, code: String = None, since: Int = None, limit: Int = None, params={}):
623
+ def fetch_transactions_with_method(self, method, code: Str = None, since: Int = None, limit: Int = None, params={}):
621
624
  request = self.prepare_account_request_with_currency_code(code, limit, params)
622
625
  self.load_markets()
623
626
  query = self.omit(params, ['account_id', 'accountId'])
624
627
  response = getattr(self, method)(self.extend(request, query))
625
628
  return self.parse_transactions(response['data'], None, since, limit)
626
629
 
627
- def fetch_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
630
+ def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
628
631
  """
629
632
  fetch all withdrawals made from an account
630
633
  :param str code: unified currency code
@@ -636,7 +639,7 @@ class coinbase(Exchange, ImplicitAPI):
636
639
  # fiat only, for crypto transactions use fetchLedger
637
640
  return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params)
638
641
 
639
- def fetch_deposits(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
642
+ def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
640
643
  """
641
644
  fetch all deposits made to an account
642
645
  :param str code: unified currency code
@@ -656,7 +659,7 @@ class coinbase(Exchange, ImplicitAPI):
656
659
  }
657
660
  return self.safe_string(statuses, status, status)
658
661
 
659
- def parse_transaction(self, transaction, market=None):
662
+ def parse_transaction(self, transaction, currency: Currency = None):
660
663
  #
661
664
  # fiat deposit
662
665
  #
@@ -728,7 +731,7 @@ class coinbase(Exchange, ImplicitAPI):
728
731
  type = self.safe_string(transaction, 'resource')
729
732
  amount = self.safe_number(subtotalObject, 'amount')
730
733
  currencyId = self.safe_string(subtotalObject, 'currency')
731
- currency = self.safe_currency_code(currencyId)
734
+ code = self.safe_currency_code(currencyId, currency)
732
735
  feeCost = self.safe_number(feeObject, 'amount')
733
736
  feeCurrencyId = self.safe_string(feeObject, 'currency')
734
737
  feeCurrency = self.safe_currency_code(feeCurrencyId)
@@ -755,13 +758,13 @@ class coinbase(Exchange, ImplicitAPI):
755
758
  'tagFrom': None,
756
759
  'type': type,
757
760
  'amount': amount,
758
- 'currency': currency,
761
+ 'currency': code,
759
762
  'status': status,
760
763
  'updated': updated,
761
764
  'fee': fee,
762
765
  }
763
766
 
764
- def parse_trade(self, trade, market=None) -> Trade:
767
+ def parse_trade(self, trade, market: Market = None) -> Trade:
765
768
  #
766
769
  # fetchMyBuys, fetchMySells
767
770
  #
@@ -1338,7 +1341,7 @@ class coinbase(Exchange, ImplicitAPI):
1338
1341
  ticker['ask'] = self.safe_number(response, 'best_ask')
1339
1342
  return ticker
1340
1343
 
1341
- def parse_ticker(self, ticker, market=None) -> Ticker:
1344
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1342
1345
  #
1343
1346
  # fetchTickerV2
1344
1347
  #
@@ -1534,7 +1537,7 @@ class coinbase(Exchange, ImplicitAPI):
1534
1537
  #
1535
1538
  return self.parse_balance(response, params)
1536
1539
 
1537
- def fetch_ledger(self, code: String = None, since: Int = None, limit: Int = None, params={}):
1540
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1538
1541
  """
1539
1542
  fetch the history of changes, actions done by the user or operations that altered balance of the user
1540
1543
  :param str code: unified currency code, default is None
@@ -1575,7 +1578,7 @@ class coinbase(Exchange, ImplicitAPI):
1575
1578
  }
1576
1579
  return self.safe_string(types, type, type)
1577
1580
 
1578
- def parse_ledger_entry(self, item, currency=None):
1581
+ def parse_ledger_entry(self, item, currency: Currency = None):
1579
1582
  #
1580
1583
  # crypto deposit transaction
1581
1584
  #
@@ -1899,7 +1902,7 @@ class coinbase(Exchange, ImplicitAPI):
1899
1902
  request['limit'] = limit
1900
1903
  return request
1901
1904
 
1902
- def prepare_account_request_with_currency_code(self, code: String = None, limit: Int = None, params={}):
1905
+ def prepare_account_request_with_currency_code(self, code: Str = None, limit: Int = None, params={}):
1903
1906
  accountId = self.safe_string_2(params, 'account_id', 'accountId')
1904
1907
  if accountId is None:
1905
1908
  if code is None:
@@ -2063,7 +2066,7 @@ class coinbase(Exchange, ImplicitAPI):
2063
2066
  data = self.safe_value(response, 'success_response', {})
2064
2067
  return self.parse_order(data, market)
2065
2068
 
2066
- def parse_order(self, order, market=None) -> Order:
2069
+ def parse_order(self, order, market: Market = None) -> Order:
2067
2070
  #
2068
2071
  # createOrder
2069
2072
  #
@@ -2210,7 +2213,7 @@ class coinbase(Exchange, ImplicitAPI):
2210
2213
  }
2211
2214
  return self.safe_string(timeInForces, timeInForce, timeInForce)
2212
2215
 
2213
- def cancel_order(self, id: str, symbol: String = None, params={}):
2216
+ def cancel_order(self, id: str, symbol: Str = None, params={}):
2214
2217
  """
2215
2218
  cancels an open order
2216
2219
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_cancelorders
@@ -2223,7 +2226,7 @@ class coinbase(Exchange, ImplicitAPI):
2223
2226
  orders = self.cancel_orders([id], symbol, params)
2224
2227
  return self.safe_value(orders, 0, {})
2225
2228
 
2226
- def cancel_orders(self, ids, symbol: String = None, params={}):
2229
+ def cancel_orders(self, ids, symbol: Str = None, params={}):
2227
2230
  """
2228
2231
  cancel multiple orders
2229
2232
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_cancelorders
@@ -2258,7 +2261,48 @@ class coinbase(Exchange, ImplicitAPI):
2258
2261
  raise BadRequest(self.id + ' cancelOrders() has failed, check your arguments and parameters')
2259
2262
  return self.parse_orders(orders, market)
2260
2263
 
2261
- def fetch_order(self, id: str, symbol: String = None, params={}):
2264
+ def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
2265
+ """
2266
+ edit a trade order
2267
+ :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_editorder
2268
+ :param str id: cancel order id
2269
+ :param str symbol: unified symbol of the market to create an order in
2270
+ :param str type: 'market' or 'limit'
2271
+ :param str side: 'buy' or 'sell'
2272
+ :param float amount: how much of currency you want to trade in units of base currency
2273
+ :param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
2274
+ :param dict [params]: extra parameters specific to the coinbase api endpoint
2275
+ :param boolean [params.preview]: default to False, wether to use the test/preview endpoint or not
2276
+ :returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
2277
+ """
2278
+ self.load_markets()
2279
+ market = self.market(symbol)
2280
+ request = {
2281
+ 'order_id': id,
2282
+ }
2283
+ if amount is not None:
2284
+ request['size'] = self.amount_to_precision(symbol, amount)
2285
+ if price is not None:
2286
+ request['price'] = self.price_to_precision(symbol, price)
2287
+ preview = self.safe_value_2(params, 'preview', 'test', False)
2288
+ response = None
2289
+ if preview:
2290
+ params = self.omit(params, ['preview', 'test'])
2291
+ response = self.v3PrivatePostBrokerageOrdersEditPreview(self.extend(request, params))
2292
+ else:
2293
+ response = self.v3PrivatePostBrokerageOrdersEdit(self.extend(request, params))
2294
+ #
2295
+ # {
2296
+ # "success": True,
2297
+ # "errors": {
2298
+ # "edit_failure_reason": "UNKNOWN_EDIT_ORDER_FAILURE_REASON",
2299
+ # "preview_failure_reason": "UNKNOWN_PREVIEW_FAILURE_REASON"
2300
+ # }
2301
+ # }
2302
+ #
2303
+ return self.parse_order(response, market)
2304
+
2305
+ def fetch_order(self, id: str, symbol: Str = None, params={}):
2262
2306
  """
2263
2307
  fetches information on an order made by the user
2264
2308
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorder
@@ -2317,7 +2361,7 @@ class coinbase(Exchange, ImplicitAPI):
2317
2361
  order = self.safe_value(response, 'order', {})
2318
2362
  return self.parse_order(order, market)
2319
2363
 
2320
- def fetch_orders(self, symbol: String = None, since: Int = None, limit=100, params={}) -> List[Order]:
2364
+ def fetch_orders(self, symbol: Str = None, since: Int = None, limit=100, params={}) -> List[Order]:
2321
2365
  """
2322
2366
  fetches information on multiple orders made by the user
2323
2367
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders
@@ -2399,7 +2443,7 @@ class coinbase(Exchange, ImplicitAPI):
2399
2443
  orders[0] = first
2400
2444
  return self.parse_orders(orders, market, since, limit)
2401
2445
 
2402
- def fetch_orders_by_status(self, status, symbol: String = None, since: Int = None, limit: Int = None, params={}):
2446
+ def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2403
2447
  self.load_markets()
2404
2448
  market = None
2405
2449
  if symbol is not None:
@@ -2469,7 +2513,7 @@ class coinbase(Exchange, ImplicitAPI):
2469
2513
  orders[0] = first
2470
2514
  return self.parse_orders(orders, market, since, limit)
2471
2515
 
2472
- def fetch_open_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2516
+ def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2473
2517
  """
2474
2518
  fetches information on all currently open orders
2475
2519
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders
@@ -2488,7 +2532,7 @@ class coinbase(Exchange, ImplicitAPI):
2488
2532
  return self.fetch_paginated_call_cursor('fetchOpenOrders', symbol, since, limit, params, 'cursor', 'cursor', None, 100)
2489
2533
  return self.fetch_orders_by_status('OPEN', symbol, since, limit, params)
2490
2534
 
2491
- def fetch_closed_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2535
+ def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2492
2536
  """
2493
2537
  fetches information on multiple closed orders made by the user
2494
2538
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders
@@ -2507,7 +2551,7 @@ class coinbase(Exchange, ImplicitAPI):
2507
2551
  return self.fetch_paginated_call_cursor('fetchClosedOrders', symbol, since, limit, params, 'cursor', 'cursor', None, 100)
2508
2552
  return self.fetch_orders_by_status('FILLED', symbol, since, limit, params)
2509
2553
 
2510
- def fetch_canceled_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
2554
+ def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2511
2555
  """
2512
2556
  fetches information on multiple canceled orders made by the user
2513
2557
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders
@@ -2576,7 +2620,7 @@ class coinbase(Exchange, ImplicitAPI):
2576
2620
  candles = self.safe_value(response, 'candles', [])
2577
2621
  return self.parse_ohlcvs(candles, market, timeframe, since, limit)
2578
2622
 
2579
- def parse_ohlcv(self, ohlcv, market=None) -> list:
2623
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
2580
2624
  #
2581
2625
  # [
2582
2626
  # {
@@ -2635,7 +2679,7 @@ class coinbase(Exchange, ImplicitAPI):
2635
2679
  trades = self.safe_value(response, 'trades', [])
2636
2680
  return self.parse_trades(trades, market, since, limit)
2637
2681
 
2638
- def fetch_my_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
2682
+ def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2639
2683
  """
2640
2684
  fetch all trades made by the user
2641
2685
  :see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getfills
ccxt/coinbasepro.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbasepro import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, Order, OrderBook, OrderSide, OrderType, String, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -531,7 +531,7 @@ class coinbasepro(Exchange, ImplicitAPI):
531
531
  orderbook['nonce'] = self.safe_integer(response, 'sequence')
532
532
  return orderbook
533
533
 
534
- def parse_ticker(self, ticker, market=None) -> Ticker:
534
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
535
535
  #
536
536
  # fetchTickers
537
537
  #
@@ -693,7 +693,7 @@ class coinbasepro(Exchange, ImplicitAPI):
693
693
  #
694
694
  return self.parse_ticker(response, market)
695
695
 
696
- def parse_trade(self, trade, market=None) -> Trade:
696
+ def parse_trade(self, trade, market: Market = None) -> Trade:
697
697
  #
698
698
  # {
699
699
  # "type": "match",
@@ -762,7 +762,7 @@ class coinbasepro(Exchange, ImplicitAPI):
762
762
  'cost': cost,
763
763
  }, market)
764
764
 
765
- def fetch_my_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
765
+ def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
766
766
  """
767
767
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfills
768
768
  fetch all trades made by the user
@@ -856,7 +856,7 @@ class coinbasepro(Exchange, ImplicitAPI):
856
856
  }
857
857
  return result
858
858
 
859
- def parse_ohlcv(self, ohlcv, market=None) -> list:
859
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
860
860
  #
861
861
  # [
862
862
  # 1591514160,
@@ -956,7 +956,7 @@ class coinbasepro(Exchange, ImplicitAPI):
956
956
  }
957
957
  return self.safe_string(statuses, status, status)
958
958
 
959
- def parse_order(self, order, market=None) -> Order:
959
+ def parse_order(self, order, market: Market = None) -> Order:
960
960
  #
961
961
  # createOrder
962
962
  #
@@ -1029,7 +1029,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1029
1029
  'trades': None,
1030
1030
  }, market)
1031
1031
 
1032
- def fetch_order(self, id: str, symbol: String = None, params={}):
1032
+ def fetch_order(self, id: str, symbol: Str = None, params={}):
1033
1033
  """
1034
1034
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder
1035
1035
  fetches information on an order made by the user
@@ -1051,7 +1051,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1051
1051
  response = getattr(self, method)(self.extend(request, params))
1052
1052
  return self.parse_order(response)
1053
1053
 
1054
- def fetch_order_trades(self, id: str, symbol: String = None, since: Int = None, limit: Int = None, params={}):
1054
+ def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1055
1055
  """
1056
1056
  fetch all the trades made from a single order
1057
1057
  :param str id: order id
@@ -1071,7 +1071,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1071
1071
  response = self.privateGetFills(self.extend(request, params))
1072
1072
  return self.parse_trades(response, market, since, limit)
1073
1073
 
1074
- def fetch_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1074
+ def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1075
1075
  """
1076
1076
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1077
1077
  fetches information on multiple orders made by the user
@@ -1087,7 +1087,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1087
1087
  }
1088
1088
  return self.fetch_open_orders(symbol, since, limit, self.extend(request, params))
1089
1089
 
1090
- def fetch_open_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1090
+ def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1091
1091
  """
1092
1092
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1093
1093
  fetch all unfilled currently open orders
@@ -1120,7 +1120,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1120
1120
  response = self.privateGetOrders(self.extend(request, params))
1121
1121
  return self.parse_orders(response, market, since, limit)
1122
1122
 
1123
- def fetch_closed_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1123
+ def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1124
1124
  """
1125
1125
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1126
1126
  fetches information on multiple closed orders made by the user
@@ -1219,7 +1219,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1219
1219
  #
1220
1220
  return self.parse_order(response, market)
1221
1221
 
1222
- def cancel_order(self, id: str, symbol: String = None, params={}):
1222
+ def cancel_order(self, id: str, symbol: Str = None, params={}):
1223
1223
  """
1224
1224
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorder
1225
1225
  cancels an open order
@@ -1247,7 +1247,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1247
1247
  request['product_id'] = market['symbol'] # the request will be more performant if you include it
1248
1248
  return getattr(self, method)(self.extend(request, params))
1249
1249
 
1250
- def cancel_all_orders(self, symbol: String = None, params={}):
1250
+ def cancel_all_orders(self, symbol: Str = None, params={}):
1251
1251
  """
1252
1252
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorders
1253
1253
  cancel all open orders
@@ -1344,7 +1344,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1344
1344
  }
1345
1345
  return self.safe_string(types, type, type)
1346
1346
 
1347
- def parse_ledger_entry(self, item, currency=None):
1347
+ def parse_ledger_entry(self, item, currency: Currency = None):
1348
1348
  # {
1349
1349
  # "id": "12087495079",
1350
1350
  # "amount": "-0.0100000000000000",
@@ -1414,7 +1414,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1414
1414
  'info': item,
1415
1415
  }
1416
1416
 
1417
- def fetch_ledger(self, code: String = None, since: Int = None, limit: Int = None, params={}):
1417
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1418
1418
  """
1419
1419
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1420
1420
  fetch the history of changes, actions done by the user or operations that altered balance of the user
@@ -1457,7 +1457,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1457
1457
  response[i]['currency'] = code
1458
1458
  return self.parse_ledger(response, currency, since, limit)
1459
1459
 
1460
- def fetch_deposits_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1460
+ def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1461
1461
  """
1462
1462
  fetch history of deposits and withdrawals
1463
1463
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
@@ -1554,7 +1554,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1554
1554
  response[i]['currency'] = code
1555
1555
  return self.parse_transactions(response, currency, since, limit)
1556
1556
 
1557
- def fetch_deposits(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1557
+ def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1558
1558
  """
1559
1559
  fetch all deposits made to an account
1560
1560
  :param str code: unified currency code
@@ -1565,7 +1565,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1565
1565
  """
1566
1566
  return self.fetch_deposits_withdrawals(code, since, limit, self.extend({'type': 'deposit'}, params))
1567
1567
 
1568
- def fetch_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1568
+ def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1569
1569
  """
1570
1570
  fetch all withdrawals made from an account
1571
1571
  :param str code: unified currency code
@@ -1589,7 +1589,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1589
1589
  else:
1590
1590
  return 'pending'
1591
1591
 
1592
- def parse_transaction(self, transaction, currency=None) -> Transaction:
1592
+ def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1593
1593
  #
1594
1594
  # privateGetTransfers
1595
1595
  #
ccxt/coincheck.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coincheck import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, Order, OrderBook, OrderSide, OrderType, String, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, 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 BadSymbol
@@ -192,7 +192,7 @@ class coincheck(Exchange, ImplicitAPI):
192
192
  response = self.privateGetAccountsBalance(params)
193
193
  return self.parse_balance(response)
194
194
 
195
- def fetch_open_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
195
+ def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
196
196
  """
197
197
  fetch all unfilled currently open orders
198
198
  :param str symbol: unified market symbol
@@ -214,7 +214,7 @@ class coincheck(Exchange, ImplicitAPI):
214
214
  result.append(self.extend(parsedOrders[i], {'status': 'open'}))
215
215
  return result
216
216
 
217
- def parse_order(self, order, market=None) -> Order:
217
+ def parse_order(self, order, market: Market = None) -> Order:
218
218
  #
219
219
  # fetchOpenOrders
220
220
  #
@@ -279,7 +279,7 @@ class coincheck(Exchange, ImplicitAPI):
279
279
  response = self.publicGetOrderBooks(self.extend(request, params))
280
280
  return self.parse_order_book(response, market['symbol'])
281
281
 
282
- def parse_ticker(self, ticker, market=None) -> Ticker:
282
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
283
283
  #
284
284
  # {
285
285
  # "last":4192632.0,
@@ -345,7 +345,7 @@ class coincheck(Exchange, ImplicitAPI):
345
345
  #
346
346
  return self.parse_ticker(ticker, market)
347
347
 
348
- def parse_trade(self, trade, market=None) -> Trade:
348
+ def parse_trade(self, trade, market: Market = None) -> Trade:
349
349
  #
350
350
  # fetchTrades(public)
351
351
  #
@@ -423,7 +423,7 @@ class coincheck(Exchange, ImplicitAPI):
423
423
  'fee': fee,
424
424
  }, market)
425
425
 
426
- def fetch_my_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
426
+ def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
427
427
  """
428
428
  fetch all trades made by the user
429
429
  :param str symbol: unified market symbol
@@ -568,7 +568,7 @@ class coincheck(Exchange, ImplicitAPI):
568
568
  'info': response,
569
569
  }, market)
570
570
 
571
- def cancel_order(self, id: str, symbol: String = None, params={}):
571
+ def cancel_order(self, id: str, symbol: Str = None, params={}):
572
572
  """
573
573
  cancels an open order
574
574
  :param str id: order id
@@ -581,7 +581,7 @@ class coincheck(Exchange, ImplicitAPI):
581
581
  }
582
582
  return self.privateDeleteExchangeOrdersId(self.extend(request, params))
583
583
 
584
- def fetch_deposits(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
584
+ def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
585
585
  """
586
586
  fetch all deposits made to an account
587
587
  :param str code: unified currency code
@@ -625,7 +625,7 @@ class coincheck(Exchange, ImplicitAPI):
625
625
  data = self.safe_value(response, 'deposits', [])
626
626
  return self.parse_transactions(data, currency, since, limit, {'type': 'deposit'})
627
627
 
628
- def fetch_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
628
+ def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
629
629
  """
630
630
  fetch all withdrawals made from an account
631
631
  :param str code: unified currency code
@@ -679,7 +679,7 @@ class coincheck(Exchange, ImplicitAPI):
679
679
  }
680
680
  return self.safe_string(statuses, status, status)
681
681
 
682
- def parse_transaction(self, transaction, currency=None) -> Transaction:
682
+ def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
683
683
  #
684
684
  # fetchDeposits
685
685
  #