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.
- ccxt/__init__.py +2 -2
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/bitbank.py +1 -0
- ccxt/abstract/coinbase.py +2 -0
- ccxt/abstract/htx.py +3 -0
- ccxt/abstract/huobi.py +3 -0
- ccxt/abstract/huobipro.py +3 -0
- ccxt/abstract/okex.py +3 -1
- ccxt/abstract/okex5.py +3 -1
- ccxt/abstract/okx.py +3 -1
- ccxt/ace.py +23 -23
- ccxt/alpaca.py +8 -8
- ccxt/ascendex.py +26 -26
- ccxt/async_support/__init__.py +2 -2
- ccxt/async_support/ace.py +23 -23
- ccxt/async_support/alpaca.py +8 -8
- ccxt/async_support/ascendex.py +26 -26
- ccxt/async_support/base/exchange.py +4 -2216
- ccxt/async_support/bigone.py +21 -24
- ccxt/async_support/binance.py +61 -54
- ccxt/async_support/bingx.py +28 -28
- ccxt/async_support/bit2c.py +9 -9
- ccxt/async_support/bitbank.py +11 -10
- ccxt/async_support/bitbns.py +11 -11
- ccxt/async_support/bitfinex.py +15 -15
- ccxt/async_support/bitfinex2.py +22 -22
- ccxt/async_support/bitflyer.py +13 -13
- ccxt/async_support/bitforex.py +10 -10
- ccxt/async_support/bitget.py +44 -44
- ccxt/async_support/bithumb.py +9 -9
- ccxt/async_support/bitmart.py +85 -104
- ccxt/async_support/bitmex.py +27 -27
- ccxt/async_support/bitopro.py +18 -18
- ccxt/async_support/bitpanda.py +18 -18
- ccxt/async_support/bitrue.py +14 -14
- ccxt/async_support/bitso.py +17 -17
- ccxt/async_support/bitstamp.py +17 -17
- ccxt/async_support/bittrex.py +22 -24
- ccxt/async_support/bitvavo.py +15 -15
- ccxt/async_support/bl3p.py +4 -4
- ccxt/async_support/blockchaincom.py +17 -17
- ccxt/async_support/btcalpha.py +14 -14
- ccxt/async_support/btcbox.py +9 -9
- ccxt/async_support/btcmarkets.py +17 -17
- ccxt/async_support/btcturk.py +9 -9
- ccxt/async_support/bybit.py +46 -46
- ccxt/async_support/cex.py +10 -10
- ccxt/async_support/coinbase.py +69 -25
- ccxt/async_support/coinbasepro.py +19 -19
- ccxt/async_support/coincheck.py +10 -10
- ccxt/async_support/coinex.py +57 -66
- ccxt/async_support/coinlist.py +22 -22
- ccxt/async_support/coinmate.py +10 -10
- ccxt/async_support/coinone.py +10 -10
- ccxt/async_support/coinsph.py +17 -17
- ccxt/async_support/coinspot.py +5 -5
- ccxt/async_support/cryptocom.py +27 -27
- ccxt/async_support/currencycom.py +18 -18
- ccxt/async_support/delta.py +21 -21
- ccxt/async_support/deribit.py +24 -24
- ccxt/async_support/digifinex.py +35 -35
- ccxt/async_support/exmo.py +19 -19
- ccxt/async_support/gate.py +38 -38
- ccxt/async_support/gemini.py +11 -11
- ccxt/async_support/hitbtc.py +27 -27
- ccxt/async_support/hollaex.py +19 -19
- ccxt/async_support/htx.py +47 -44
- ccxt/async_support/huobijp.py +22 -22
- ccxt/async_support/idex.py +20 -20
- ccxt/async_support/independentreserve.py +9 -9
- ccxt/async_support/indodax.py +10 -10
- ccxt/async_support/kraken.py +25 -25
- ccxt/async_support/krakenfutures.py +17 -17
- ccxt/async_support/kucoin.py +27 -27
- ccxt/async_support/kucoinfutures.py +20 -20
- ccxt/async_support/kuna.py +19 -19
- ccxt/async_support/latoken.py +14 -14
- ccxt/async_support/lbank.py +18 -18
- ccxt/async_support/luno.py +14 -14
- ccxt/async_support/lykke.py +12 -12
- ccxt/async_support/mercado.py +11 -11
- ccxt/async_support/mexc.py +36 -36
- ccxt/async_support/ndax.py +18 -18
- ccxt/async_support/novadax.py +17 -17
- ccxt/async_support/oceanex.py +12 -12
- ccxt/async_support/okcoin.py +19 -19
- ccxt/async_support/okx.py +48 -45
- ccxt/async_support/p2b.py +6 -6
- ccxt/async_support/paymium.py +6 -6
- ccxt/async_support/phemex.py +57 -57
- ccxt/async_support/poloniex.py +31 -30
- ccxt/async_support/poloniexfutures.py +16 -16
- ccxt/async_support/probit.py +22 -22
- ccxt/async_support/tidex.py +15 -15
- ccxt/async_support/timex.py +20 -20
- ccxt/async_support/tokocrypto.py +16 -16
- ccxt/async_support/upbit.py +15 -15
- ccxt/async_support/wavesexchange.py +12 -12
- ccxt/async_support/wazirx.py +13 -13
- ccxt/async_support/whitebit.py +26 -26
- ccxt/async_support/woo.py +47 -47
- ccxt/async_support/yobit.py +8 -8
- ccxt/async_support/zaif.py +10 -10
- ccxt/async_support/zonda.py +16 -16
- ccxt/base/errors.py +17 -16
- ccxt/base/exchange.py +57 -97
- ccxt/base/types.py +138 -139
- ccxt/bigone.py +21 -24
- ccxt/binance.py +61 -54
- ccxt/bingx.py +28 -28
- ccxt/bit2c.py +9 -9
- ccxt/bitbank.py +11 -10
- ccxt/bitbns.py +11 -11
- ccxt/bitfinex.py +15 -15
- ccxt/bitfinex2.py +22 -22
- ccxt/bitflyer.py +13 -13
- ccxt/bitforex.py +10 -10
- ccxt/bitget.py +44 -44
- ccxt/bithumb.py +9 -9
- ccxt/bitmart.py +85 -104
- ccxt/bitmex.py +27 -27
- ccxt/bitopro.py +18 -18
- ccxt/bitpanda.py +18 -18
- ccxt/bitrue.py +14 -14
- ccxt/bitso.py +17 -17
- ccxt/bitstamp.py +17 -17
- ccxt/bittrex.py +22 -24
- ccxt/bitvavo.py +15 -15
- ccxt/bl3p.py +4 -4
- ccxt/blockchaincom.py +17 -17
- ccxt/btcalpha.py +14 -14
- ccxt/btcbox.py +9 -9
- ccxt/btcmarkets.py +17 -17
- ccxt/btcturk.py +9 -9
- ccxt/bybit.py +46 -46
- ccxt/cex.py +10 -10
- ccxt/coinbase.py +69 -25
- ccxt/coinbasepro.py +19 -19
- ccxt/coincheck.py +10 -10
- ccxt/coinex.py +57 -66
- ccxt/coinlist.py +22 -22
- ccxt/coinmate.py +10 -10
- ccxt/coinone.py +10 -10
- ccxt/coinsph.py +17 -17
- ccxt/coinspot.py +5 -5
- ccxt/cryptocom.py +27 -27
- ccxt/currencycom.py +18 -18
- ccxt/delta.py +21 -21
- ccxt/deribit.py +24 -24
- ccxt/digifinex.py +35 -35
- ccxt/exmo.py +19 -19
- ccxt/gate.py +38 -38
- ccxt/gemini.py +11 -11
- ccxt/hitbtc.py +27 -27
- ccxt/hollaex.py +19 -19
- ccxt/htx.py +47 -44
- ccxt/huobijp.py +22 -22
- ccxt/idex.py +20 -20
- ccxt/independentreserve.py +9 -9
- ccxt/indodax.py +10 -10
- ccxt/kraken.py +25 -25
- ccxt/krakenfutures.py +17 -17
- ccxt/kucoin.py +27 -27
- ccxt/kucoinfutures.py +20 -20
- ccxt/kuna.py +19 -19
- ccxt/latoken.py +14 -14
- ccxt/lbank.py +18 -18
- ccxt/luno.py +14 -14
- ccxt/lykke.py +12 -12
- ccxt/mercado.py +11 -11
- ccxt/mexc.py +36 -36
- ccxt/ndax.py +18 -18
- ccxt/novadax.py +17 -17
- ccxt/oceanex.py +12 -12
- ccxt/okcoin.py +19 -19
- ccxt/okx.py +48 -45
- ccxt/p2b.py +6 -6
- ccxt/paymium.py +6 -6
- ccxt/phemex.py +57 -57
- ccxt/poloniex.py +31 -30
- ccxt/poloniexfutures.py +16 -16
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +3 -3
- ccxt/pro/ascendex.py +2 -2
- ccxt/pro/binance.py +9 -9
- ccxt/pro/bingx.py +3 -3
- ccxt/pro/bitfinex.py +3 -3
- ccxt/pro/bitfinex2.py +3 -3
- ccxt/pro/bitget.py +3 -3
- ccxt/pro/bitmart.py +2 -2
- ccxt/pro/bitmex.py +3 -3
- ccxt/pro/bitpanda.py +3 -3
- ccxt/pro/bitrue.py +2 -2
- ccxt/pro/bitstamp.py +2 -2
- ccxt/pro/bittrex.py +3 -3
- ccxt/pro/bitvavo.py +3 -3
- ccxt/pro/blockchaincom.py +2 -2
- ccxt/pro/bybit.py +4 -4
- ccxt/pro/cex.py +3 -3
- ccxt/pro/coinbasepro.py +3 -3
- ccxt/pro/coinex.py +2 -2
- ccxt/pro/cryptocom.py +5 -5
- ccxt/pro/deribit.py +3 -3
- ccxt/pro/exmo.py +2 -2
- ccxt/pro/gate.py +3 -3
- ccxt/pro/gemini.py +2 -2
- ccxt/pro/hitbtc.py +4 -4
- ccxt/pro/hollaex.py +3 -3
- ccxt/pro/htx.py +3 -3
- ccxt/pro/idex.py +3 -3
- ccxt/pro/kraken.py +7 -7
- ccxt/pro/krakenfutures.py +4 -4
- ccxt/pro/kucoin.py +3 -3
- ccxt/pro/kucoinfutures.py +3 -3
- ccxt/pro/mexc.py +3 -3
- ccxt/pro/okcoin.py +2 -2
- ccxt/pro/okx.py +6 -6
- ccxt/pro/phemex.py +3 -3
- ccxt/pro/poloniex.py +3 -3
- ccxt/pro/poloniexfutures.py +3 -3
- ccxt/pro/probit.py +3 -3
- ccxt/pro/wazirx.py +3 -3
- ccxt/pro/whitebit.py +3 -3
- ccxt/pro/woo.py +2 -2
- ccxt/probit.py +22 -22
- ccxt/test/base/test_shared_methods.py +3 -3
- ccxt/test/test_async.py +543 -535
- ccxt/test/test_sync.py +542 -534
- ccxt/tidex.py +15 -15
- ccxt/timex.py +20 -20
- ccxt/tokocrypto.py +16 -16
- ccxt/upbit.py +15 -15
- ccxt/wavesexchange.py +12 -12
- ccxt/wazirx.py +13 -13
- ccxt/whitebit.py +26 -26
- ccxt/woo.py +47 -47
- ccxt/yobit.py +8 -8
- ccxt/zaif.py +10 -10
- ccxt/zonda.py +16 -16
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/METADATA +10 -8
- ccxt-4.1.56.dist-info/RECORD +449 -0
- ccxt/async_support/bitstamp1.py +0 -402
- ccxt/async_support/lbank2.py +0 -2620
- ccxt/bitstamp1.py +0 -402
- ccxt/lbank2.py +0 -2619
- ccxt-4.1.54.dist-info/RECORD +0 -453
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/WHEEL +0 -0
- {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/top_level.txt +0 -0
ccxt/async_support/coinbase.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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,
|
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
|
-
async def fetch_my_sells(self, symbol:
|
591
|
+
async 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 = await self.v2PrivateGetAccountsAccountIdSells(self.extend(request, query))
|
602
605
|
return self.parse_trades(sells['data'], None, since, limit)
|
603
606
|
|
604
|
-
async def fetch_my_buys(self, symbol:
|
607
|
+
async 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 = await self.v2PrivateGetAccountsAccountIdBuys(self.extend(request, query))
|
618
621
|
return self.parse_trades(buys['data'], None, since, limit)
|
619
622
|
|
620
|
-
async def fetch_transactions_with_method(self, method, code:
|
623
|
+
async def fetch_transactions_with_method(self, method, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
621
624
|
request = await self.prepare_account_request_with_currency_code(code, limit, params)
|
622
625
|
await self.load_markets()
|
623
626
|
query = self.omit(params, ['account_id', 'accountId'])
|
624
627
|
response = await getattr(self, method)(self.extend(request, query))
|
625
628
|
return self.parse_transactions(response['data'], None, since, limit)
|
626
629
|
|
627
|
-
async def fetch_withdrawals(self, code:
|
630
|
+
async 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 await self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params)
|
638
641
|
|
639
|
-
async def fetch_deposits(self, code:
|
642
|
+
async 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,
|
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
|
-
|
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':
|
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
|
-
async def fetch_ledger(self, code:
|
1540
|
+
async 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
|
-
async def prepare_account_request_with_currency_code(self, code:
|
1905
|
+
async 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
|
-
async def cancel_order(self, id: str, symbol:
|
2216
|
+
async 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 = await self.cancel_orders([id], symbol, params)
|
2224
2227
|
return self.safe_value(orders, 0, {})
|
2225
2228
|
|
2226
|
-
async def cancel_orders(self, ids, symbol:
|
2229
|
+
async 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
|
-
async def
|
2264
|
+
async 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
|
+
await 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 = await self.v3PrivatePostBrokerageOrdersEditPreview(self.extend(request, params))
|
2292
|
+
else:
|
2293
|
+
response = await 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
|
+
async 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
|
-
async def fetch_orders(self, symbol:
|
2364
|
+
async 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
|
-
async def fetch_orders_by_status(self, status, symbol:
|
2446
|
+
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2403
2447
|
await 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
|
-
async def fetch_open_orders(self, symbol:
|
2516
|
+
async 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 await self.fetch_paginated_call_cursor('fetchOpenOrders', symbol, since, limit, params, 'cursor', 'cursor', None, 100)
|
2489
2533
|
return await self.fetch_orders_by_status('OPEN', symbol, since, limit, params)
|
2490
2534
|
|
2491
|
-
async def fetch_closed_orders(self, symbol:
|
2535
|
+
async 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 await self.fetch_paginated_call_cursor('fetchClosedOrders', symbol, since, limit, params, 'cursor', 'cursor', None, 100)
|
2508
2552
|
return await self.fetch_orders_by_status('FILLED', symbol, since, limit, params)
|
2509
2553
|
|
2510
|
-
async def fetch_canceled_orders(self, symbol:
|
2554
|
+
async 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
|
-
async def fetch_my_trades(self, symbol:
|
2682
|
+
async 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
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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,
|
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
|
-
async def fetch_my_trades(self, symbol:
|
765
|
+
async 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
|
-
async def fetch_order(self, id: str, symbol:
|
1032
|
+
async 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 = await getattr(self, method)(self.extend(request, params))
|
1052
1052
|
return self.parse_order(response)
|
1053
1053
|
|
1054
|
-
async def fetch_order_trades(self, id: str, symbol:
|
1054
|
+
async 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 = await self.privateGetFills(self.extend(request, params))
|
1072
1072
|
return self.parse_trades(response, market, since, limit)
|
1073
1073
|
|
1074
|
-
async def fetch_orders(self, symbol:
|
1074
|
+
async 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 await self.fetch_open_orders(symbol, since, limit, self.extend(request, params))
|
1089
1089
|
|
1090
|
-
async def fetch_open_orders(self, symbol:
|
1090
|
+
async 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 = await self.privateGetOrders(self.extend(request, params))
|
1121
1121
|
return self.parse_orders(response, market, since, limit)
|
1122
1122
|
|
1123
|
-
async def fetch_closed_orders(self, symbol:
|
1123
|
+
async 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
|
-
async def cancel_order(self, id: str, symbol:
|
1222
|
+
async 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 await getattr(self, method)(self.extend(request, params))
|
1249
1249
|
|
1250
|
-
async def cancel_all_orders(self, symbol:
|
1250
|
+
async 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
|
-
async def fetch_ledger(self, code:
|
1417
|
+
async 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
|
-
async def fetch_deposits_withdrawals(self, code:
|
1460
|
+
async 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
|
-
async def fetch_deposits(self, code:
|
1557
|
+
async 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 await self.fetch_deposits_withdrawals(code, since, limit, self.extend({'type': 'deposit'}, params))
|
1567
1567
|
|
1568
|
-
async def fetch_withdrawals(self, code:
|
1568
|
+
async 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/async_support/coincheck.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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,
|
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 = await self.privateGetAccountsBalance(params)
|
193
193
|
return self.parse_balance(response)
|
194
194
|
|
195
|
-
async def fetch_open_orders(self, symbol:
|
195
|
+
async 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 = await 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
|
-
async def fetch_my_trades(self, symbol:
|
426
|
+
async 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
|
-
async def cancel_order(self, id: str, symbol:
|
571
|
+
async 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 await self.privateDeleteExchangeOrdersId(self.extend(request, params))
|
583
583
|
|
584
|
-
async def fetch_deposits(self, code:
|
584
|
+
async 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
|
-
async def fetch_withdrawals(self, code:
|
628
|
+
async 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
|
#
|