ccxt 4.4.35__py2.py3-none-any.whl → 4.4.37__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.
- ccxt/__init__.py +5 -3
- ccxt/abstract/bitfinex.py +136 -65
- ccxt/abstract/bitfinex1.py +69 -0
- ccxt/abstract/bitopro.py +1 -0
- ccxt/abstract/bybit.py +15 -0
- ccxt/abstract/defx.py +69 -0
- ccxt/abstract/deribit.py +1 -0
- ccxt/abstract/gate.py +14 -0
- ccxt/abstract/gateio.py +14 -0
- ccxt/async_support/__init__.py +5 -3
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bitfinex.py +3005 -1084
- ccxt/async_support/bitfinex1.py +1704 -0
- ccxt/async_support/bitfinex2.py +18 -13
- ccxt/async_support/bitmex.py +103 -1
- ccxt/async_support/bitopro.py +21 -4
- ccxt/async_support/bitso.py +2 -1
- ccxt/async_support/bybit.py +21 -1
- ccxt/async_support/coinbase.py +86 -0
- ccxt/async_support/defx.py +1981 -0
- ccxt/async_support/deribit.py +27 -12
- ccxt/async_support/gate.py +15 -1
- ccxt/async_support/htx.py +11 -2
- ccxt/async_support/hyperliquid.py +124 -14
- ccxt/async_support/kraken.py +39 -41
- ccxt/async_support/paradex.py +2 -2
- ccxt/base/exchange.py +6 -2
- ccxt/bitfinex.py +3005 -1084
- ccxt/bitfinex1.py +1703 -0
- ccxt/bitfinex2.py +18 -13
- ccxt/bitmex.py +103 -1
- ccxt/bitopro.py +21 -4
- ccxt/bitso.py +2 -1
- ccxt/bybit.py +21 -1
- ccxt/coinbase.py +86 -0
- ccxt/defx.py +1980 -0
- ccxt/deribit.py +27 -12
- ccxt/gate.py +15 -1
- ccxt/htx.py +11 -2
- ccxt/hyperliquid.py +124 -14
- ccxt/kraken.py +39 -41
- ccxt/paradex.py +2 -2
- ccxt/pro/__init__.py +5 -3
- ccxt/pro/bitfinex.py +725 -274
- ccxt/pro/bitfinex1.py +635 -0
- ccxt/pro/defx.py +832 -0
- ccxt/pro/probit.py +1 -0
- ccxt/test/tests_async.py +15 -1
- ccxt/test/tests_sync.py +15 -1
- {ccxt-4.4.35.dist-info → ccxt-4.4.37.dist-info}/METADATA +11 -10
- {ccxt-4.4.35.dist-info → ccxt-4.4.37.dist-info}/RECORD +54 -47
- ccxt/abstract/bitfinex2.py +0 -140
- {ccxt-4.4.35.dist-info → ccxt-4.4.37.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.35.dist-info → ccxt-4.4.37.dist-info}/WHEEL +0 -0
- {ccxt-4.4.35.dist-info → ccxt-4.4.37.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitfinex2.py
CHANGED
@@ -16,7 +16,6 @@ from ccxt.base.errors import ArgumentsRequired
|
|
16
16
|
from ccxt.base.errors import BadRequest
|
17
17
|
from ccxt.base.errors import BadSymbol
|
18
18
|
from ccxt.base.errors import InsufficientFunds
|
19
|
-
from ccxt.base.errors import InvalidAddress
|
20
19
|
from ccxt.base.errors import InvalidOrder
|
21
20
|
from ccxt.base.errors import OrderNotFound
|
22
21
|
from ccxt.base.errors import NotSupported
|
@@ -433,12 +432,10 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
433
432
|
'temporarily_unavailable': ExchangeNotAvailable,
|
434
433
|
},
|
435
434
|
'broad': {
|
436
|
-
'address': InvalidAddress,
|
437
435
|
'available balance is only': InsufficientFunds,
|
438
436
|
'not enough exchange balance': InsufficientFunds,
|
439
437
|
'Order not found': OrderNotFound,
|
440
438
|
'symbol: invalid': BadSymbol,
|
441
|
-
'Invalid order': InvalidOrder,
|
442
439
|
},
|
443
440
|
},
|
444
441
|
'commonCurrencies': {
|
@@ -782,7 +779,10 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
782
779
|
name = self.safe_string(label, 1)
|
783
780
|
pool = self.safe_value(indexed['pool'], id, [])
|
784
781
|
rawType = self.safe_string(pool, 1)
|
785
|
-
|
782
|
+
isCryptoCoin = (rawType is not None) or (id in indexed['explorer']) # "hacky" solution
|
783
|
+
type = None
|
784
|
+
if isCryptoCoin:
|
785
|
+
type = 'crypto'
|
786
786
|
feeValues = self.safe_value(indexed['fees'], id, [])
|
787
787
|
fees = self.safe_value(feeValues, 1, [])
|
788
788
|
fee = self.safe_number(fees, 1)
|
@@ -1681,7 +1681,8 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
1681
1681
|
raise ExchangeError(self.id + ' ' + response[6] + ': ' + errorText + '(#' + errorCode + ')')
|
1682
1682
|
orders = self.safe_list(response, 4, [])
|
1683
1683
|
order = self.safe_list(orders, 0)
|
1684
|
-
|
1684
|
+
newOrder = {'result': order}
|
1685
|
+
return self.parse_order(newOrder, market)
|
1685
1686
|
|
1686
1687
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
1687
1688
|
"""
|
@@ -1777,6 +1778,9 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
1777
1778
|
await self.load_markets()
|
1778
1779
|
cid = self.safe_value_2(params, 'cid', 'clientOrderId') # client order id
|
1779
1780
|
request = None
|
1781
|
+
market = None
|
1782
|
+
if symbol is not None:
|
1783
|
+
market = self.market(symbol)
|
1780
1784
|
if cid is not None:
|
1781
1785
|
cidDate = self.safe_value(params, 'cidDate') # client order id date
|
1782
1786
|
if cidDate is None:
|
@@ -1792,8 +1796,8 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
1792
1796
|
}
|
1793
1797
|
response = await self.privatePostAuthWOrderCancel(self.extend(request, params))
|
1794
1798
|
order = self.safe_value(response, 4)
|
1795
|
-
|
1796
|
-
return self.parse_order(
|
1799
|
+
newOrder = {'result': order}
|
1800
|
+
return self.parse_order(newOrder, market)
|
1797
1801
|
|
1798
1802
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
1799
1803
|
"""
|
@@ -2294,6 +2298,8 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2294
2298
|
status = 'failed'
|
2295
2299
|
tag = self.safe_string(data, 3)
|
2296
2300
|
type = 'withdrawal'
|
2301
|
+
networkId = self.safe_string(data, 2)
|
2302
|
+
network = self.network_id_to_code(networkId.upper()) # withdraw returns in lowercase
|
2297
2303
|
elif transactionLength == 22:
|
2298
2304
|
id = self.safe_string(transaction, 0)
|
2299
2305
|
currencyId = self.safe_string(transaction, 1)
|
@@ -2590,10 +2596,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2590
2596
|
text = self.safe_string(response, 7)
|
2591
2597
|
if text != 'success':
|
2592
2598
|
self.throw_broadly_matched_exception(self.exceptions['broad'], text, text)
|
2593
|
-
|
2594
|
-
return self.extend(transaction, {
|
2595
|
-
'address': address,
|
2596
|
-
})
|
2599
|
+
return self.parse_transaction(response, currency)
|
2597
2600
|
|
2598
2601
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2599
2602
|
"""
|
@@ -3502,7 +3505,8 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
3502
3505
|
# ]
|
3503
3506
|
#
|
3504
3507
|
order = self.safe_list(response, 0)
|
3505
|
-
|
3508
|
+
newOrder = {'result': order}
|
3509
|
+
return self.parse_order(newOrder, market)
|
3506
3510
|
|
3507
3511
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3508
3512
|
"""
|
@@ -3617,4 +3621,5 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
3617
3621
|
errorText = response[7]
|
3618
3622
|
raise ExchangeError(self.id + ' ' + response[6] + ': ' + errorText + '(#' + errorCode + ')')
|
3619
3623
|
order = self.safe_list(response, 4, [])
|
3620
|
-
|
3624
|
+
newOrder = {'result': order}
|
3625
|
+
return self.parse_order(newOrder, market)
|
ccxt/async_support/bitmex.py
CHANGED
@@ -286,6 +286,108 @@ class bitmex(Exchange, ImplicitAPI):
|
|
286
286
|
'SOL': 'sol',
|
287
287
|
'ADA': 'ada',
|
288
288
|
},
|
289
|
+
'features': {
|
290
|
+
'default': {
|
291
|
+
'sandbox': True,
|
292
|
+
'createOrder': {
|
293
|
+
'marginMode': True,
|
294
|
+
'triggerPrice': True,
|
295
|
+
'triggerPriceType': {
|
296
|
+
'last': True,
|
297
|
+
'mark': True,
|
298
|
+
},
|
299
|
+
'triggerDirection': True,
|
300
|
+
'stopLossPrice': False,
|
301
|
+
'takeProfitPrice': False,
|
302
|
+
'attachedStopLossTakeProfit': None,
|
303
|
+
'timeInForce': {
|
304
|
+
'IOC': True,
|
305
|
+
'FOK': True,
|
306
|
+
'PO': True,
|
307
|
+
'GTD': False,
|
308
|
+
},
|
309
|
+
'hedged': False,
|
310
|
+
'trailing': True,
|
311
|
+
'marketBuyRequiresPrice': False,
|
312
|
+
'marketBuyByCost': False,
|
313
|
+
# exchange-supported features
|
314
|
+
# 'selfTradePrevention': True,
|
315
|
+
# 'twap': False,
|
316
|
+
# 'iceberg': False,
|
317
|
+
# 'oco': False,
|
318
|
+
},
|
319
|
+
'createOrders': None,
|
320
|
+
'fetchMyTrades': {
|
321
|
+
'marginMode': False,
|
322
|
+
'limit': 500,
|
323
|
+
'daysBack': None,
|
324
|
+
'untilDays': 1000000,
|
325
|
+
},
|
326
|
+
'fetchOrder': {
|
327
|
+
'marginMode': False,
|
328
|
+
'trigger': False,
|
329
|
+
'trailing': False,
|
330
|
+
},
|
331
|
+
'fetchOpenOrders': {
|
332
|
+
'marginMode': False,
|
333
|
+
'limit': 500,
|
334
|
+
'trigger': False,
|
335
|
+
'trailing': False,
|
336
|
+
},
|
337
|
+
'fetchOrders': {
|
338
|
+
'marginMode': False,
|
339
|
+
'limit': 500,
|
340
|
+
'daysBack': None,
|
341
|
+
'untilDays': 1000000,
|
342
|
+
'trigger': False,
|
343
|
+
'trailing': False,
|
344
|
+
},
|
345
|
+
'fetchClosedOrders': {
|
346
|
+
'marginMode': False,
|
347
|
+
'limit': 500,
|
348
|
+
'daysBackClosed': None,
|
349
|
+
'daysBackCanceled': None,
|
350
|
+
'untilDays': 1000000,
|
351
|
+
'trigger': False,
|
352
|
+
'trailing': False,
|
353
|
+
},
|
354
|
+
'fetchOHLCV': {
|
355
|
+
'limit': 10000,
|
356
|
+
},
|
357
|
+
},
|
358
|
+
'spot': {
|
359
|
+
'extends': 'default',
|
360
|
+
'createOrder': {
|
361
|
+
'triggerPriceType': {
|
362
|
+
'index': False,
|
363
|
+
},
|
364
|
+
},
|
365
|
+
},
|
366
|
+
'forDeriv': {
|
367
|
+
'extends': 'default',
|
368
|
+
'createOrder': {
|
369
|
+
'triggerPriceType': {
|
370
|
+
'index': True,
|
371
|
+
},
|
372
|
+
},
|
373
|
+
},
|
374
|
+
'swap': {
|
375
|
+
'linear': {
|
376
|
+
'extends': 'forDeriv',
|
377
|
+
},
|
378
|
+
'inverse': {
|
379
|
+
'extends': 'forDeriv',
|
380
|
+
},
|
381
|
+
},
|
382
|
+
'future': {
|
383
|
+
'linear': {
|
384
|
+
'extends': 'forDeriv',
|
385
|
+
},
|
386
|
+
'inverse': {
|
387
|
+
'extends': 'forDeriv',
|
388
|
+
},
|
389
|
+
},
|
390
|
+
},
|
289
391
|
},
|
290
392
|
'commonCurrencies': {
|
291
393
|
'USDt': 'USDT',
|
@@ -991,7 +1093,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
991
1093
|
if since is not None:
|
992
1094
|
request['startTime'] = self.iso8601(since)
|
993
1095
|
if limit is not None:
|
994
|
-
request['count'] = limit
|
1096
|
+
request['count'] = min(500, limit)
|
995
1097
|
until = self.safe_integer_2(params, 'until', 'endTime')
|
996
1098
|
if until is not None:
|
997
1099
|
params = self.omit(params, ['until'])
|
ccxt/async_support/bitopro.py
CHANGED
@@ -153,6 +153,7 @@ class bitopro(Exchange, ImplicitAPI):
|
|
153
153
|
'wallet/withdraw/{currency}/id/{id}': 1,
|
154
154
|
'wallet/depositHistory/{currency}': 1,
|
155
155
|
'wallet/withdrawHistory/{currency}': 1,
|
156
|
+
'orders/open': 1,
|
156
157
|
},
|
157
158
|
'post': {
|
158
159
|
'orders/{pair}': 1 / 2, # 1200/m => 20/s => 10/20 = 1/2
|
@@ -1248,10 +1249,26 @@ class bitopro(Exchange, ImplicitAPI):
|
|
1248
1249
|
return self.parse_orders(orders, market, since, limit)
|
1249
1250
|
|
1250
1251
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1252
|
+
"""
|
1253
|
+
fetch all unfilled currently open orders
|
1254
|
+
|
1255
|
+
https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_open_orders_data.md
|
1256
|
+
|
1257
|
+
:param str symbol: unified market symbol
|
1258
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
1259
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
1260
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1261
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1262
|
+
"""
|
1263
|
+
await self.load_markets()
|
1264
|
+
request: dict = {}
|
1265
|
+
market = None
|
1266
|
+
if symbol is not None:
|
1267
|
+
market = self.market(symbol)
|
1268
|
+
request['pair'] = market['id']
|
1269
|
+
response = await self.privateGetOrdersOpen(self.extend(request, params))
|
1270
|
+
orders = self.safe_list(response, 'data', [])
|
1271
|
+
return self.parse_orders(orders, market, since, limit)
|
1255
1272
|
|
1256
1273
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1257
1274
|
"""
|
ccxt/async_support/bitso.py
CHANGED
@@ -1683,6 +1683,7 @@ class bitso(Exchange, ImplicitAPI):
|
|
1683
1683
|
if api == 'private':
|
1684
1684
|
self.check_required_credentials()
|
1685
1685
|
nonce = str(self.nonce())
|
1686
|
+
endpoint = '/api' + endpoint
|
1686
1687
|
request = ''.join([nonce, method, endpoint])
|
1687
1688
|
if method != 'GET' and method != 'DELETE':
|
1688
1689
|
if query:
|
@@ -1692,7 +1693,7 @@ class bitso(Exchange, ImplicitAPI):
|
|
1692
1693
|
auth = self.apiKey + ':' + nonce + ':' + signature
|
1693
1694
|
headers = {
|
1694
1695
|
'Authorization': 'Bitso ' + auth,
|
1695
|
-
'Content-Type': 'application/json',
|
1696
|
+
# 'Content-Type': 'application/json',
|
1696
1697
|
}
|
1697
1698
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
1698
1699
|
|
ccxt/async_support/bybit.py
CHANGED
@@ -258,6 +258,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
258
258
|
'v5/spot-cross-margin-trade/data': 5,
|
259
259
|
'v5/spot-cross-margin-trade/pledge-token': 5,
|
260
260
|
'v5/spot-cross-margin-trade/borrow-token': 5,
|
261
|
+
# crypto loan
|
262
|
+
'v5/crypto-loan/collateral-data': 5,
|
263
|
+
'v5/crypto-loan/loanable-data': 5,
|
261
264
|
# institutional lending
|
262
265
|
'v5/ins-loan/product-infos': 5,
|
263
266
|
'v5/ins-loan/ensure-tokens-convert': 5,
|
@@ -385,6 +388,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
385
388
|
'v5/user/aff-customer-info': 5,
|
386
389
|
'v5/user/del-submember': 5,
|
387
390
|
'v5/user/submembers': 5,
|
391
|
+
# affilate
|
392
|
+
'v5/affiliate/aff-user-list': 5,
|
388
393
|
# spot leverage token
|
389
394
|
'v5/spot-lever-token/order-record': 1, # 50/s => cost = 50 / 50 = 1
|
390
395
|
# spot margin trade
|
@@ -394,6 +399,13 @@ class bybit(Exchange, ImplicitAPI):
|
|
394
399
|
'v5/spot-cross-margin-trade/account': 1, # 50/s => cost = 50 / 50 = 1
|
395
400
|
'v5/spot-cross-margin-trade/orders': 1, # 50/s => cost = 50 / 50 = 1
|
396
401
|
'v5/spot-cross-margin-trade/repay-history': 1, # 50/s => cost = 50 / 50 = 1
|
402
|
+
# crypto loan
|
403
|
+
'v5/crypto-loan/borrowable-collateralisable-number': 5,
|
404
|
+
'v5/crypto-loan/ongoing-orders': 5,
|
405
|
+
'v5/crypto-loan/repayment-history': 5,
|
406
|
+
'v5/crypto-loan/borrow-history': 5,
|
407
|
+
'v5/crypto-loan/max-collateral-amount': 5,
|
408
|
+
'v5/crypto-loan/adjustment-history': 5,
|
397
409
|
# institutional lending
|
398
410
|
'v5/ins-loan/product-infos': 5,
|
399
411
|
'v5/ins-loan/ensure-tokens-convert': 5,
|
@@ -405,7 +417,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
405
417
|
'v5/lending/history-order': 5,
|
406
418
|
'v5/lending/account': 5,
|
407
419
|
# broker
|
408
|
-
'v5/broker/earning-record': 5,
|
420
|
+
'v5/broker/earning-record': 5, # deprecated
|
409
421
|
'v5/broker/earnings-info': 5,
|
410
422
|
'v5/broker/account-info': 5,
|
411
423
|
'v5/broker/asset/query-sub-member-deposit-record': 10,
|
@@ -526,6 +538,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
526
538
|
'v5/spot-cross-margin-trade/loan': 2.5, # 20/s => cost = 50 / 20 = 2.5
|
527
539
|
'v5/spot-cross-margin-trade/repay': 2.5, # 20/s => cost = 50 / 20 = 2.5
|
528
540
|
'v5/spot-cross-margin-trade/switch': 2.5, # 20/s => cost = 50 / 20 = 2.5
|
541
|
+
# crypto loan
|
542
|
+
'v5/crypto-loan/borrow': 5,
|
543
|
+
'v5/crypto-loan/repay': 5,
|
544
|
+
'v5/crypto-loan/adjust-ltv': 5,
|
529
545
|
# institutional lending
|
530
546
|
'v5/ins-loan/association-uid': 5,
|
531
547
|
# c2c lending
|
@@ -536,6 +552,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
536
552
|
'v5/account/set-collateral-switch-batch': 5,
|
537
553
|
# demo trading
|
538
554
|
'v5/account/demo-apply-money': 5,
|
555
|
+
# broker
|
556
|
+
'v5/broker/award/info': 5,
|
557
|
+
'v5/broker/award/distribute-award': 5,
|
558
|
+
'v5/broker/award/distribution-record': 5,
|
539
559
|
},
|
540
560
|
},
|
541
561
|
},
|
ccxt/async_support/coinbase.py
CHANGED
@@ -89,6 +89,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
89
89
|
'fetchDepositAddress': 'emulated',
|
90
90
|
'fetchDepositAddresses': False,
|
91
91
|
'fetchDepositAddressesByNetwork': True,
|
92
|
+
'fetchDepositMethodId': True,
|
93
|
+
'fetchDepositMethodIds': True,
|
92
94
|
'fetchDeposits': True,
|
93
95
|
'fetchDepositsWithdrawals': True,
|
94
96
|
'fetchFundingHistory': False,
|
@@ -4103,6 +4105,90 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4103
4105
|
data = self.safe_dict(response, 'data', {})
|
4104
4106
|
return self.parse_transaction(data)
|
4105
4107
|
|
4108
|
+
async def fetch_deposit_method_ids(self, params={}):
|
4109
|
+
"""
|
4110
|
+
fetch the deposit id for a fiat currency associated with self account
|
4111
|
+
|
4112
|
+
https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethods
|
4113
|
+
|
4114
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4115
|
+
:returns dict: an array of `deposit id structures <https://docs.ccxt.com/#/?id=deposit-id-structure>`
|
4116
|
+
"""
|
4117
|
+
await self.load_markets()
|
4118
|
+
response = await self.v3PrivateGetBrokeragePaymentMethods(params)
|
4119
|
+
#
|
4120
|
+
# {
|
4121
|
+
# "payment_methods": [
|
4122
|
+
# {
|
4123
|
+
# "id": "21b39a5d-f7b46876fb2e",
|
4124
|
+
# "type": "COINBASE_FIAT_ACCOUNT",
|
4125
|
+
# "name": "CAD Wallet",
|
4126
|
+
# "currency": "CAD",
|
4127
|
+
# "verified": True,
|
4128
|
+
# "allow_buy": False,
|
4129
|
+
# "allow_sell": True,
|
4130
|
+
# "allow_deposit": False,
|
4131
|
+
# "allow_withdraw": False,
|
4132
|
+
# "created_at": "2023-06-29T19:58:46Z",
|
4133
|
+
# "updated_at": "2023-10-30T20:25:01Z"
|
4134
|
+
# }
|
4135
|
+
# ]
|
4136
|
+
# }
|
4137
|
+
#
|
4138
|
+
result = self.safe_list(response, 'payment_methods', [])
|
4139
|
+
return self.parse_deposit_method_ids(result)
|
4140
|
+
|
4141
|
+
async def fetch_deposit_method_id(self, id: str, params={}):
|
4142
|
+
"""
|
4143
|
+
fetch the deposit id for a fiat currency associated with self account
|
4144
|
+
|
4145
|
+
https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethod
|
4146
|
+
|
4147
|
+
:param str id: the deposit payment method id
|
4148
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4149
|
+
:returns dict: a `deposit id structure <https://docs.ccxt.com/#/?id=deposit-id-structure>`
|
4150
|
+
"""
|
4151
|
+
await self.load_markets()
|
4152
|
+
request: dict = {
|
4153
|
+
'payment_method_id': id,
|
4154
|
+
}
|
4155
|
+
response = await self.v3PrivateGetBrokeragePaymentMethodsPaymentMethodId(self.extend(request, params))
|
4156
|
+
#
|
4157
|
+
# {
|
4158
|
+
# "payment_method": {
|
4159
|
+
# "id": "21b39a5d-f7b46876fb2e",
|
4160
|
+
# "type": "COINBASE_FIAT_ACCOUNT",
|
4161
|
+
# "name": "CAD Wallet",
|
4162
|
+
# "currency": "CAD",
|
4163
|
+
# "verified": True,
|
4164
|
+
# "allow_buy": False,
|
4165
|
+
# "allow_sell": True,
|
4166
|
+
# "allow_deposit": False,
|
4167
|
+
# "allow_withdraw": False,
|
4168
|
+
# "created_at": "2023-06-29T19:58:46Z",
|
4169
|
+
# "updated_at": "2023-10-30T20:25:01Z"
|
4170
|
+
# }
|
4171
|
+
# }
|
4172
|
+
#
|
4173
|
+
result = self.safe_dict(response, 'payment_method', {})
|
4174
|
+
return self.parse_deposit_method_id(result)
|
4175
|
+
|
4176
|
+
def parse_deposit_method_ids(self, ids, params={}):
|
4177
|
+
result = []
|
4178
|
+
for i in range(0, len(ids)):
|
4179
|
+
id = self.extend(self.parse_deposit_method_id(ids[i]), params)
|
4180
|
+
result.append(id)
|
4181
|
+
return result
|
4182
|
+
|
4183
|
+
def parse_deposit_method_id(self, depositId):
|
4184
|
+
return {
|
4185
|
+
'info': depositId,
|
4186
|
+
'id': self.safe_string(depositId, 'id'),
|
4187
|
+
'currency': self.safe_string(depositId, 'currency'),
|
4188
|
+
'verified': self.safe_bool(depositId, 'verified'),
|
4189
|
+
'tag': self.safe_string(depositId, 'name'),
|
4190
|
+
}
|
4191
|
+
|
4106
4192
|
async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
4107
4193
|
"""
|
4108
4194
|
fetch a quote for converting from one currency to another
|