ccxt 4.3.13__py2.py3-none-any.whl → 4.3.15__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.3.13'
25
+ __version__ = '4.3.15'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -53,6 +53,7 @@ from ccxt.base.errors import BadSymbol # noqa: F4
53
53
  from ccxt.base.errors import OperationRejected # noqa: F401
54
54
  from ccxt.base.errors import NoChange # noqa: F401
55
55
  from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
56
+ from ccxt.base.errors import MarketClosed # noqa: F401
56
57
  from ccxt.base.errors import BadResponse # noqa: F401
57
58
  from ccxt.base.errors import NullResponse # noqa: F401
58
59
  from ccxt.base.errors import InsufficientFunds # noqa: F401
ccxt/abstract/luno.py CHANGED
@@ -31,5 +31,7 @@ class ImplicitAPI:
31
31
  private_post_withdrawals = privatePostWithdrawals = Entry('withdrawals', 'private', 'POST', {'cost': 1})
32
32
  private_post_send = privatePostSend = Entry('send', 'private', 'POST', {'cost': 1})
33
33
  private_post_oauth2_grant = privatePostOauth2Grant = Entry('oauth2/grant', 'private', 'POST', {'cost': 1})
34
+ private_post_beneficiaries = privatePostBeneficiaries = Entry('beneficiaries', 'private', 'POST', {'cost': 1})
34
35
  private_put_accounts_id_name = privatePutAccountsIdName = Entry('accounts/{id}/name', 'private', 'PUT', {'cost': 1})
35
36
  private_delete_withdrawals_id = privateDeleteWithdrawalsId = Entry('withdrawals/{id}', 'private', 'DELETE', {'cost': 1})
37
+ private_delete_beneficiaries_id = privateDeleteBeneficiariesId = Entry('beneficiaries/{id}', 'private', 'DELETE', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.13'
7
+ __version__ = '4.3.15'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -32,6 +32,7 @@ from ccxt.base.errors import BadSymbol # noqa: F4
32
32
  from ccxt.base.errors import OperationRejected # noqa: F401
33
33
  from ccxt.base.errors import NoChange # noqa: F401
34
34
  from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
35
+ from ccxt.base.errors import MarketClosed # noqa: F401
35
36
  from ccxt.base.errors import BadResponse # noqa: F401
36
37
  from ccxt.base.errors import NullResponse # noqa: F401
37
38
  from ccxt.base.errors import InsufficientFunds # noqa: F401
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.3.13'
5
+ __version__ = '4.3.15'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
+ from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -19,6 +19,7 @@ from ccxt.base.errors import BadRequest
19
19
  from ccxt.base.errors import BadSymbol
20
20
  from ccxt.base.errors import OperationRejected
21
21
  from ccxt.base.errors import MarginModeAlreadySet
22
+ from ccxt.base.errors import MarketClosed
22
23
  from ccxt.base.errors import BadResponse
23
24
  from ccxt.base.errors import InsufficientFunds
24
25
  from ccxt.base.errors import InvalidOrder
@@ -116,8 +117,8 @@ class binance(Exchange, ImplicitAPI):
116
117
  'fetchFundingRates': True,
117
118
  'fetchGreeks': True,
118
119
  'fetchIndexOHLCV': True,
119
- 'fetchIsolatedBorrowRate': False,
120
- 'fetchIsolatedBorrowRates': False,
120
+ 'fetchIsolatedBorrowRate': 'emulated',
121
+ 'fetchIsolatedBorrowRates': True,
121
122
  'fetchL3OrderBook': False,
122
123
  'fetchLastPrices': True,
123
124
  'fetchLedger': True,
@@ -2419,7 +2420,7 @@ class binance(Exchange, ImplicitAPI):
2419
2420
  'Rest API trading is not enabled.': PermissionDenied,
2420
2421
  'This account may not place or cancel orders.': PermissionDenied,
2421
2422
  "You don't have permission.": PermissionDenied, # {"msg":"You don't have permission.","success":false}
2422
- 'Market is closed.': OperationRejected, # {"code":-1013,"msg":"Market is closed."}
2423
+ 'Market is closed.': MarketClosed, # {"code":-1013,"msg":"Market is closed."}
2423
2424
  'Too many requests. Please try again later.': RateLimitExceeded, # {"msg":"Too many requests. Please try again later.","success":false}
2424
2425
  'This action is disabled on self account.': AccountSuspended, # {"code":-2011,"msg":"This action is disabled on self account."}
2425
2426
  'Limit orders require GTC for self phase.': BadRequest,
@@ -3886,8 +3887,8 @@ class binance(Exchange, ImplicitAPI):
3886
3887
  """
3887
3888
  fetches the last price for multiple markets
3888
3889
  :see: https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker # spot
3889
- :see: https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker # swap
3890
- :see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker # future
3890
+ :see: https://binance-docs.github.io/apidocs/futures/en/#symbol-price-ticker # swap
3891
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-tickers # future
3891
3892
  :param str[]|None symbols: unified symbols of the markets to fetch the last prices
3892
3893
  :param dict [params]: extra parameters specific to the exchange API endpoint
3893
3894
  :param str [params.subType]: "linear" or "inverse"
@@ -10434,6 +10435,65 @@ class binance(Exchange, ImplicitAPI):
10434
10435
  rate = self.safe_dict(response, 0)
10435
10436
  return self.parse_borrow_rate(rate)
10436
10437
 
10438
+ async def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
10439
+ """
10440
+ fetch the rate of interest to borrow a currency for margin trading
10441
+ :see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
10442
+ :param str symbol: unified market symbol
10443
+ :param dict [params]: extra parameters specific to the exchange API endpoint
10444
+ *
10445
+ * EXCHANGE SPECIFIC PARAMETERS
10446
+ :param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
10447
+ :returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
10448
+ """
10449
+ request = {
10450
+ 'symbol': symbol,
10451
+ }
10452
+ borrowRates = await self.fetch_isolated_borrow_rates(self.extend(request, params))
10453
+ return self.safe_dict(borrowRates, symbol)
10454
+
10455
+ async def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
10456
+ """
10457
+ fetch the borrow interest rates of all currencies
10458
+ :see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
10459
+ :param dict [params]: extra parameters specific to the exchange API endpoint
10460
+ :param dict [params.symbol]: unified market symbol
10461
+ *
10462
+ * EXCHANGE SPECIFIC PARAMETERS
10463
+ :param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
10464
+ :returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
10465
+ """
10466
+ await self.load_markets()
10467
+ request = {}
10468
+ symbol = self.safe_string(params, 'symbol')
10469
+ params = self.omit(params, 'symbol')
10470
+ if symbol is not None:
10471
+ market = self.market(symbol)
10472
+ request['symbol'] = market['id']
10473
+ response = await self.sapiGetMarginIsolatedMarginData(self.extend(request, params))
10474
+ #
10475
+ # [
10476
+ # {
10477
+ # "vipLevel": 0,
10478
+ # "symbol": "BTCUSDT",
10479
+ # "leverage": "10",
10480
+ # "data": [
10481
+ # {
10482
+ # "coin": "BTC",
10483
+ # "dailyInterest": "0.00026125",
10484
+ # "borrowLimit": "270"
10485
+ # },
10486
+ # {
10487
+ # "coin": "USDT",
10488
+ # "dailyInterest": "0.000475",
10489
+ # "borrowLimit": "2100000"
10490
+ # }
10491
+ # ]
10492
+ # }
10493
+ # ]
10494
+ #
10495
+ return self.parse_isolated_borrow_rates(response)
10496
+
10437
10497
  async def fetch_borrow_rate_history(self, code: str, since: Int = None, limit: Int = None, params={}):
10438
10498
  """
10439
10499
  retrieves a history of a currencies borrow interest rate at specific time slots
@@ -10502,6 +10562,43 @@ class binance(Exchange, ImplicitAPI):
10502
10562
  'info': info,
10503
10563
  }
10504
10564
 
10565
+ def parse_isolated_borrow_rate(self, info, market: Market = None):
10566
+ #
10567
+ # {
10568
+ # "vipLevel": 0,
10569
+ # "symbol": "BTCUSDT",
10570
+ # "leverage": "10",
10571
+ # "data": [
10572
+ # {
10573
+ # "coin": "BTC",
10574
+ # "dailyInterest": "0.00026125",
10575
+ # "borrowLimit": "270"
10576
+ # },
10577
+ # {
10578
+ # "coin": "USDT",
10579
+ # "dailyInterest": "0.000475",
10580
+ # "borrowLimit": "2100000"
10581
+ # }
10582
+ # ]
10583
+ # }
10584
+ #
10585
+ marketId = self.safe_string(info, 'symbol')
10586
+ market = self.safe_market(marketId, market, None, 'spot')
10587
+ data = self.safe_list(info, 'data')
10588
+ baseInfo = self.safe_dict(data, 0)
10589
+ quoteInfo = self.safe_dict(data, 1)
10590
+ return {
10591
+ 'info': info,
10592
+ 'symbol': self.safe_string(market, 'symbol'),
10593
+ 'base': self.safe_string(baseInfo, 'coin'),
10594
+ 'baseRate': self.safe_number(baseInfo, 'dailyInterest'),
10595
+ 'quote': self.safe_string(quoteInfo, 'coin'),
10596
+ 'quoteRate': self.safe_number(quoteInfo, 'dailyInterest'),
10597
+ 'period': 86400000,
10598
+ 'timestamp': None,
10599
+ 'datetime': None,
10600
+ }
10601
+
10505
10602
  async def create_gift_code(self, code: str, amount, params={}):
10506
10603
  """
10507
10604
  create gift code
@@ -401,6 +401,7 @@ class bingx(Exchange, ImplicitAPI):
401
401
  '100202': InsufficientFunds,
402
402
  '100204': BadRequest,
403
403
  '100400': BadRequest,
404
+ '100410': OperationFailed, # {"code":100410,"msg":"The current system is busy, please try again later"}
404
405
  '100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
405
406
  '100440': ExchangeError,
406
407
  '100500': OperationFailed, # {"code":100500,"msg":"The current system is busy, please try again later","debugMsg":""}