ccxt 4.3.34__py2.py3-none-any.whl → 4.3.36__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 (54) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitbay.py +6 -0
  3. ccxt/abstract/zonda.py +6 -0
  4. ccxt/alpaca.py +1 -1
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/alpaca.py +1 -1
  7. ccxt/async_support/base/exchange.py +42 -42
  8. ccxt/async_support/binance.py +2 -2
  9. ccxt/async_support/bingx.py +4 -3
  10. ccxt/async_support/bit2c.py +2 -1
  11. ccxt/async_support/bitget.py +11 -5
  12. ccxt/async_support/bitmart.py +2 -7
  13. ccxt/async_support/btcmarkets.py +3 -1
  14. ccxt/async_support/bybit.py +1 -1
  15. ccxt/async_support/coinbase.py +60 -3
  16. ccxt/async_support/coinex.py +26 -19
  17. ccxt/async_support/gemini.py +1 -1
  18. ccxt/async_support/kraken.py +3 -1
  19. ccxt/async_support/paymium.py +4 -1
  20. ccxt/async_support/whitebit.py +24 -3
  21. ccxt/async_support/zaif.py +30 -2
  22. ccxt/async_support/zonda.py +6 -0
  23. ccxt/base/exchange.py +85 -76
  24. ccxt/binance.py +2 -2
  25. ccxt/bingx.py +4 -3
  26. ccxt/bit2c.py +2 -1
  27. ccxt/bitget.py +11 -5
  28. ccxt/bitmart.py +2 -7
  29. ccxt/btcmarkets.py +3 -1
  30. ccxt/bybit.py +1 -1
  31. ccxt/coinbase.py +60 -3
  32. ccxt/coinex.py +26 -19
  33. ccxt/gemini.py +1 -1
  34. ccxt/kraken.py +3 -1
  35. ccxt/paymium.py +4 -1
  36. ccxt/pro/__init__.py +1 -1
  37. ccxt/pro/binance.py +4 -4
  38. ccxt/pro/bingx.py +9 -4
  39. ccxt/pro/bitfinex2.py +4 -4
  40. ccxt/pro/bitget.py +24 -1
  41. ccxt/pro/bitmart.py +9 -7
  42. ccxt/pro/bybit.py +6 -6
  43. ccxt/pro/htx.py +5 -6
  44. ccxt/pro/kraken.py +1 -1
  45. ccxt/pro/okx.py +4 -5
  46. ccxt/pro/woo.py +4 -4
  47. ccxt/test/base/test_crypto.py +1 -1
  48. ccxt/whitebit.py +24 -3
  49. ccxt/zaif.py +30 -2
  50. ccxt/zonda.py +6 -0
  51. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/METADATA +4 -4
  52. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/RECORD +54 -54
  53. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/WHEEL +0 -0
  54. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -122,8 +122,8 @@ class coinbase(Exchange, ImplicitAPI):
122
122
  'fetchTickers': True,
123
123
  'fetchTime': True,
124
124
  'fetchTrades': True,
125
- 'fetchTradingFee': False,
126
- 'fetchTradingFees': False,
125
+ 'fetchTradingFee': 'emulated',
126
+ 'fetchTradingFees': True,
127
127
  'fetchWithdrawals': True,
128
128
  'reduceMargin': False,
129
129
  'setLeverage': False,
@@ -4273,6 +4273,63 @@ class coinbase(Exchange, ImplicitAPI):
4273
4273
  'takeProfitPrice': None,
4274
4274
  })
4275
4275
 
4276
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
4277
+ """
4278
+ :see: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
4279
+ fetch the trading fees for multiple markets
4280
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4281
+ :param str [params.type]: 'spot' or 'swap'
4282
+ :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
4283
+ """
4284
+ await self.load_markets()
4285
+ type = None
4286
+ type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
4287
+ isSpot = (type == 'spot')
4288
+ productType = 'SPOT' if isSpot else 'FUTURE'
4289
+ request: dict = {
4290
+ 'product_type': productType,
4291
+ }
4292
+ response = await self.v3PrivateGetBrokerageTransactionSummary(self.extend(request, params))
4293
+ #
4294
+ # {
4295
+ # total_volume: '0',
4296
+ # total_fees: '0',
4297
+ # fee_tier: {
4298
+ # pricing_tier: 'Advanced 1',
4299
+ # usd_from: '0',
4300
+ # usd_to: '1000',
4301
+ # taker_fee_rate: '0.008',
4302
+ # maker_fee_rate: '0.006',
4303
+ # aop_from: '',
4304
+ # aop_to: ''
4305
+ # },
4306
+ # margin_rate: null,
4307
+ # goods_and_services_tax: null,
4308
+ # advanced_trade_only_volume: '0',
4309
+ # advanced_trade_only_fees: '0',
4310
+ # coinbase_pro_volume: '0',
4311
+ # coinbase_pro_fees: '0',
4312
+ # total_balance: '',
4313
+ # has_promo_fee: False
4314
+ # }
4315
+ #
4316
+ data = self.safe_dict(response, 'fee_tier', {})
4317
+ taker_fee = self.safe_number(data, 'taker_fee_rate')
4318
+ marker_fee = self.safe_number(data, 'maker_fee_rate')
4319
+ result: dict = {}
4320
+ for i in range(0, len(self.symbols)):
4321
+ symbol = self.symbols[i]
4322
+ market = self.market(symbol)
4323
+ if (isSpot and market['spot']) or (not isSpot and not market['spot']):
4324
+ result[symbol] = {
4325
+ 'info': response,
4326
+ 'symbol': symbol,
4327
+ 'maker': taker_fee,
4328
+ 'taker': marker_fee,
4329
+ 'percentage': True,
4330
+ }
4331
+ return result
4332
+
4276
4333
  def create_auth_token(self, seconds: Int, method: Str = None, url: Str = None):
4277
4334
  # it may not work for v2
4278
4335
  uri = None
@@ -4375,7 +4375,7 @@ class coinex(Exchange, ImplicitAPI):
4375
4375
  async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4376
4376
  """
4377
4377
  make a withdrawal
4378
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account015_submit_withdraw
4378
+ :see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
4379
4379
  :param str code: unified currency code
4380
4380
  :param float amount: the amount to withdraw
4381
4381
  :param str address: the address to withdraw to
@@ -4388,35 +4388,42 @@ class coinex(Exchange, ImplicitAPI):
4388
4388
  self.check_address(address)
4389
4389
  await self.load_markets()
4390
4390
  currency = self.currency(code)
4391
- networkCode = self.safe_string_upper(params, 'network')
4391
+ networkCode = self.safe_string_upper_2(params, 'network', 'chain')
4392
4392
  params = self.omit(params, 'network')
4393
4393
  if tag:
4394
4394
  address = address + ':' + tag
4395
4395
  request: dict = {
4396
- 'coin_type': currency['id'],
4397
- 'coin_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
4398
- 'actual_amount': float(self.number_to_string(amount)), # the actual amount without fees, https://www.coinex.com/fees
4399
- 'transfer_method': 'onchain', # onchain, local
4396
+ 'ccy': currency['id'],
4397
+ 'to_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
4398
+ 'amount': self.number_to_string(amount), # the actual amount without fees, https://www.coinex.com/fees
4400
4399
  }
4401
4400
  if networkCode is not None:
4402
- request['smart_contract_name'] = self.network_code_to_id(networkCode)
4403
- response = await self.v1PrivatePostBalanceCoinWithdraw(self.extend(request, params))
4401
+ request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
4402
+ response = await self.v2PrivatePostAssetsWithdraw(self.extend(request, params))
4404
4403
  #
4405
4404
  # {
4406
4405
  # "code": 0,
4407
4406
  # "data": {
4408
- # "actual_amount": "1.00000000",
4409
- # "amount": "1.00000000",
4410
- # "coin_address": "1KAv3pazbTk2JnQ5xTo6fpKK7p1it2RzD4",
4411
- # "coin_type": "BCH",
4412
- # "coin_withdraw_id": 206,
4407
+ # "withdraw_id": 31193755,
4408
+ # "created_at": 1716874165038,
4409
+ # "withdraw_method": "ON_CHAIN",
4410
+ # "ccy": "USDT",
4411
+ # "amount": "17.3",
4412
+ # "actual_amount": "15",
4413
+ # "chain": "TRC20",
4414
+ # "tx_fee": "2.3",
4415
+ # "fee_asset": "USDT",
4416
+ # "fee_amount": "2.3",
4417
+ # "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4418
+ # "memo": "",
4419
+ # "tx_id": "",
4413
4420
  # "confirmations": 0,
4414
- # "create_time": 1524228297,
4415
- # "status": "audit",
4416
- # "tx_fee": "0",
4417
- # "tx_id": ""
4421
+ # "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4422
+ # "explorer_tx_url": "https://tronscan.org/#/transaction/",
4423
+ # "remark": "",
4424
+ # "status": "audit_required"
4418
4425
  # },
4419
- # "message": "Ok"
4426
+ # "message": "OK"
4420
4427
  # }
4421
4428
  #
4422
4429
  transaction = self.safe_dict(response, 'data', {})
@@ -4520,7 +4527,7 @@ class coinex(Exchange, ImplicitAPI):
4520
4527
  # "remark": ""
4521
4528
  # }
4522
4529
  #
4523
- # fetchWithdrawals
4530
+ # fetchWithdrawals and withdraw
4524
4531
  #
4525
4532
  # {
4526
4533
  # "withdraw_id": 259364,
@@ -832,7 +832,7 @@ class gemini(Exchange, ImplicitAPI):
832
832
  :see: https://docs.gemini.com/rest-api/#ticker-v2
833
833
  :param str symbol: unified symbol of the market to fetch the ticker for
834
834
  :param dict [params]: extra parameters specific to the exchange API endpoint
835
- :param dict [params.fetchTickerMethod]: 'fetchTickerV2', 'fetchTickerV1' or 'fetchTickerV1AndV2' - 'fetchTickerV1' for original ccxt.gemini.fetch_ticker- 'fetchTickerV1AndV2' for 2 api calls to get the result of both fetchTicker methods - default = 'fetchTickerV1'
835
+ :param dict [params.fetchTickerMethod]: 'fetchTickerV2', 'fetchTickerV1' or 'fetchTickerV1AndV2' - 'fetchTickerV1' for original ccxt.gemini.fetchTicker - 'fetchTickerV1AndV2' for 2 api calls to get the result of both fetchTicker methods - default = 'fetchTickerV1'
836
836
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
837
837
  """
838
838
  method = self.safe_value(self.options, 'fetchTickerMethod', 'fetchTickerV1')
@@ -970,7 +970,9 @@ class kraken(Exchange, ImplicitAPI):
970
970
  else:
971
971
  request['interval'] = timeframe
972
972
  if since is not None:
973
- request['since'] = self.number_to_string(self.parse_to_int(since / 1000)) # expected to be in seconds
973
+ scaledSince = self.parse_to_int(since / 1000)
974
+ timeFrameInSeconds = parsedTimeframe * 60
975
+ request['since'] = self.number_to_string(scaledSince - timeFrameInSeconds) # expected to be in seconds
974
976
  response = await self.publicGetOHLC(self.extend(request, params))
975
977
  #
976
978
  # {
@@ -407,7 +407,10 @@ class paymium(Exchange, ImplicitAPI):
407
407
  request: dict = {
408
408
  'uuid': id,
409
409
  }
410
- return await self.privateDeleteUserOrdersUuidCancel(self.extend(request, params))
410
+ response = await self.privateDeleteUserOrdersUuidCancel(self.extend(request, params))
411
+ return self.safe_order({
412
+ 'info': response,
413
+ })
411
414
 
412
415
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
413
416
  """
@@ -1341,7 +1341,27 @@ class whitebit(Exchange, ImplicitAPI):
1341
1341
  'market': market['id'],
1342
1342
  'orderId': int(id),
1343
1343
  }
1344
- return await self.v4PrivatePostOrderCancel(self.extend(request, params))
1344
+ response = await self.v4PrivatePostOrderCancel(self.extend(request, params))
1345
+ #
1346
+ # {
1347
+ # "orderId": 4180284841, # order id
1348
+ # "clientOrderId": "customId11", # custom order identifier; "clientOrderId": "" - if not specified.
1349
+ # "market": "BTC_USDT", # deal market
1350
+ # "side": "buy", # order side
1351
+ # "type": "stop market", # order type
1352
+ # "timestamp": 1595792396.165973, # current timestamp
1353
+ # "dealMoney": "0", # if order finished - amount in money currency that is finished
1354
+ # "dealStock": "0", # if order finished - amount in stock currency that is finished
1355
+ # "amount": "0.001", # amount
1356
+ # "takerFee": "0.001", # maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
1357
+ # "makerFee": "0.001", # maker fee ratio. If the number less than 0.0001 - it will be rounded to zero
1358
+ # "left": "0.001", # if order not finished - rest of the amount that must be finished
1359
+ # "dealFee": "0", # fee in money that you pay if order is finished
1360
+ # "price": "40000", # price if price isset
1361
+ # "activation_price": "40000" # activation price if activation price is set
1362
+ # }
1363
+ #
1364
+ return self.parse_order(response)
1345
1365
 
1346
1366
  async def cancel_all_orders(self, symbol: Str = None, params={}):
1347
1367
  """
@@ -1378,7 +1398,7 @@ class whitebit(Exchange, ImplicitAPI):
1378
1398
  #
1379
1399
  # []
1380
1400
  #
1381
- return response
1401
+ return self.parse_orders(response, market)
1382
1402
 
1383
1403
  async def cancel_all_orders_after(self, timeout: Int, params={}):
1384
1404
  """
@@ -1588,7 +1608,7 @@ class whitebit(Exchange, ImplicitAPI):
1588
1608
 
1589
1609
  def parse_order(self, order: dict, market: Market = None) -> Order:
1590
1610
  #
1591
- # createOrder, fetchOpenOrders
1611
+ # createOrder, fetchOpenOrders, cancelOrder
1592
1612
  #
1593
1613
  # {
1594
1614
  # "orderId":105687928629,
@@ -1603,6 +1623,7 @@ class whitebit(Exchange, ImplicitAPI):
1603
1623
  # "takerFee":"0.001",
1604
1624
  # "makerFee":"0",
1605
1625
  # "left":"100",
1626
+ # "price": "40000", # price if price isset
1606
1627
  # "dealFee":"0",
1607
1628
  # "activation_price":"0.065" # stop price(if stop limit or stop market)
1608
1629
  # }
@@ -461,7 +461,23 @@ class zaif(Exchange, ImplicitAPI):
461
461
  request: dict = {
462
462
  'order_id': id,
463
463
  }
464
- return await self.privatePostCancelOrder(self.extend(request, params))
464
+ response = await self.privatePostCancelOrder(self.extend(request, params))
465
+ #
466
+ # {
467
+ # "success": 1,
468
+ # "return": {
469
+ # "order_id": 184,
470
+ # "funds": {
471
+ # "jpy": 15320,
472
+ # "btc": 1.392,
473
+ # "mona": 2600,
474
+ # "kaori": 0.1
475
+ # }
476
+ # }
477
+ # }
478
+ #
479
+ data = self.safe_dict(response, 'return')
480
+ return self.parse_order(data)
465
481
 
466
482
  def parse_order(self, order: dict, market: Market = None) -> Order:
467
483
  #
@@ -474,6 +490,18 @@ class zaif(Exchange, ImplicitAPI):
474
490
  # "comment" : "demo"
475
491
  # }
476
492
  #
493
+ # cancelOrder
494
+ #
495
+ # {
496
+ # "order_id": 184,
497
+ # "funds": {
498
+ # "jpy": 15320,
499
+ # "btc": 1.392,
500
+ # "mona": 2600,
501
+ # "kaori": 0.1
502
+ # }
503
+ # }
504
+ #
477
505
  side = self.safe_string(order, 'action')
478
506
  side = 'buy' if (side == 'bid') else 'sell'
479
507
  timestamp = self.safe_timestamp(order, 'timestamp')
@@ -481,7 +509,7 @@ class zaif(Exchange, ImplicitAPI):
481
509
  symbol = self.safe_symbol(marketId, market, '_')
482
510
  price = self.safe_string(order, 'price')
483
511
  amount = self.safe_string(order, 'amount')
484
- id = self.safe_string(order, 'id')
512
+ id = self.safe_string_2(order, 'id', 'order_id')
485
513
  return self.safe_order({
486
514
  'id': id,
487
515
  'clientOrderId': None,
@@ -183,6 +183,10 @@ class zonda(Exchange, ImplicitAPI):
183
183
  'balances/BITBAY/balance',
184
184
  'fiat_cantor/rate/{baseId}/{quoteId}',
185
185
  'fiat_cantor/history',
186
+ 'client_payments/v2/customer/crypto/{currency}/channels/deposit',
187
+ 'client_payments/v2/customer/crypto/{currency}/channels/withdrawal',
188
+ 'client_payments/v2/customer/crypto/deposit/fee',
189
+ 'client_payments/v2/customer/crypto/withdrawal/fee',
186
190
  ],
187
191
  'post': [
188
192
  'trading/offer/{symbol}',
@@ -193,6 +197,8 @@ class zonda(Exchange, ImplicitAPI):
193
197
  'fiat_cantor/exchange',
194
198
  'api_payments/withdrawals/crypto',
195
199
  'api_payments/withdrawals/fiat',
200
+ 'client_payments/v2/customer/crypto/deposit',
201
+ 'client_payments/v2/customer/crypto/withdrawal',
196
202
  ],
197
203
  'delete': [
198
204
  'trading/offer/{symbol}/{id}/{side}/{price}',