ccxt 4.3.12__py2.py3-none-any.whl → 4.3.14__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.12'
25
+ __version__ = '4.3.14'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bybit.py CHANGED
@@ -128,6 +128,7 @@ class ImplicitAPI:
128
128
  private_get_v5_account_fee_rate = privateGetV5AccountFeeRate = Entry('v5/account/fee-rate', 'private', 'GET', {'cost': 10})
129
129
  private_get_v5_account_info = privateGetV5AccountInfo = Entry('v5/account/info', 'private', 'GET', {'cost': 5})
130
130
  private_get_v5_account_transaction_log = privateGetV5AccountTransactionLog = Entry('v5/account/transaction-log', 'private', 'GET', {'cost': 1})
131
+ private_get_v5_account_contract_transaction_log = privateGetV5AccountContractTransactionLog = Entry('v5/account/contract-transaction-log', 'private', 'GET', {'cost': 1})
131
132
  private_get_v5_account_smp_group = privateGetV5AccountSmpGroup = Entry('v5/account/smp-group', 'private', 'GET', {'cost': 1})
132
133
  private_get_v5_account_mmp_state = privateGetV5AccountMmpState = Entry('v5/account/mmp-state', 'private', 'GET', {'cost': 5})
133
134
  private_get_v5_asset_exchange_order_record = privateGetV5AssetExchangeOrderRecord = Entry('v5/asset/exchange/order-record', 'private', 'GET', {'cost': 5})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.12'
7
+ __version__ = '4.3.14'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.3.12'
5
+ __version__ = '4.3.14'
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
@@ -116,8 +116,8 @@ class binance(Exchange, ImplicitAPI):
116
116
  'fetchFundingRates': True,
117
117
  'fetchGreeks': True,
118
118
  'fetchIndexOHLCV': True,
119
- 'fetchIsolatedBorrowRate': False,
120
- 'fetchIsolatedBorrowRates': False,
119
+ 'fetchIsolatedBorrowRate': 'emulated',
120
+ 'fetchIsolatedBorrowRates': True,
121
121
  'fetchL3OrderBook': False,
122
122
  'fetchLastPrices': True,
123
123
  'fetchLedger': True,
@@ -10434,6 +10434,65 @@ class binance(Exchange, ImplicitAPI):
10434
10434
  rate = self.safe_dict(response, 0)
10435
10435
  return self.parse_borrow_rate(rate)
10436
10436
 
10437
+ async def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
10438
+ """
10439
+ fetch the rate of interest to borrow a currency for margin trading
10440
+ :see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
10441
+ :param str symbol: unified market symbol
10442
+ :param dict [params]: extra parameters specific to the exchange API endpoint
10443
+ *
10444
+ * EXCHANGE SPECIFIC PARAMETERS
10445
+ :param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
10446
+ :returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
10447
+ """
10448
+ request = {
10449
+ 'symbol': symbol,
10450
+ }
10451
+ borrowRates = await self.fetch_isolated_borrow_rates(self.extend(request, params))
10452
+ return self.safe_dict(borrowRates, symbol)
10453
+
10454
+ async def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
10455
+ """
10456
+ fetch the borrow interest rates of all currencies
10457
+ :see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
10458
+ :param dict [params]: extra parameters specific to the exchange API endpoint
10459
+ :param dict [params.symbol]: unified market symbol
10460
+ *
10461
+ * EXCHANGE SPECIFIC PARAMETERS
10462
+ :param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
10463
+ :returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
10464
+ """
10465
+ await self.load_markets()
10466
+ request = {}
10467
+ symbol = self.safe_string(params, 'symbol')
10468
+ params = self.omit(params, 'symbol')
10469
+ if symbol is not None:
10470
+ market = self.market(symbol)
10471
+ request['symbol'] = market['id']
10472
+ response = await self.sapiGetMarginIsolatedMarginData(self.extend(request, params))
10473
+ #
10474
+ # [
10475
+ # {
10476
+ # "vipLevel": 0,
10477
+ # "symbol": "BTCUSDT",
10478
+ # "leverage": "10",
10479
+ # "data": [
10480
+ # {
10481
+ # "coin": "BTC",
10482
+ # "dailyInterest": "0.00026125",
10483
+ # "borrowLimit": "270"
10484
+ # },
10485
+ # {
10486
+ # "coin": "USDT",
10487
+ # "dailyInterest": "0.000475",
10488
+ # "borrowLimit": "2100000"
10489
+ # }
10490
+ # ]
10491
+ # }
10492
+ # ]
10493
+ #
10494
+ return self.parse_isolated_borrow_rates(response)
10495
+
10437
10496
  async def fetch_borrow_rate_history(self, code: str, since: Int = None, limit: Int = None, params={}):
10438
10497
  """
10439
10498
  retrieves a history of a currencies borrow interest rate at specific time slots
@@ -10502,6 +10561,43 @@ class binance(Exchange, ImplicitAPI):
10502
10561
  'info': info,
10503
10562
  }
10504
10563
 
10564
+ def parse_isolated_borrow_rate(self, info, market: Market = None):
10565
+ #
10566
+ # {
10567
+ # "vipLevel": 0,
10568
+ # "symbol": "BTCUSDT",
10569
+ # "leverage": "10",
10570
+ # "data": [
10571
+ # {
10572
+ # "coin": "BTC",
10573
+ # "dailyInterest": "0.00026125",
10574
+ # "borrowLimit": "270"
10575
+ # },
10576
+ # {
10577
+ # "coin": "USDT",
10578
+ # "dailyInterest": "0.000475",
10579
+ # "borrowLimit": "2100000"
10580
+ # }
10581
+ # ]
10582
+ # }
10583
+ #
10584
+ marketId = self.safe_string(info, 'symbol')
10585
+ market = self.safe_market(marketId, market, None, 'spot')
10586
+ data = self.safe_list(info, 'data')
10587
+ baseInfo = self.safe_dict(data, 0)
10588
+ quoteInfo = self.safe_dict(data, 1)
10589
+ return {
10590
+ 'info': info,
10591
+ 'symbol': self.safe_string(market, 'symbol'),
10592
+ 'base': self.safe_string(baseInfo, 'coin'),
10593
+ 'baseRate': self.safe_number(baseInfo, 'dailyInterest'),
10594
+ 'quote': self.safe_string(quoteInfo, 'coin'),
10595
+ 'quoteRate': self.safe_number(quoteInfo, 'dailyInterest'),
10596
+ 'period': 86400000,
10597
+ 'timestamp': None,
10598
+ 'datetime': None,
10599
+ }
10600
+
10505
10601
  async def create_gift_code(self, code: str, amount, params={}):
10506
10602
  """
10507
10603
  create gift code