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 +1 -1
- ccxt/abstract/bybit.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +99 -3
- ccxt/async_support/bybit.py +100 -99
- ccxt/async_support/coinbase.py +96 -1
- ccxt/async_support/coinex.py +392 -375
- ccxt/async_support/okx.py +1 -1
- ccxt/base/exchange.py +5 -1
- ccxt/binance.py +99 -3
- ccxt/bybit.py +100 -99
- ccxt/coinbase.py +96 -1
- ccxt/coinex.py +392 -375
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/woo.py +137 -9
- {ccxt-4.3.12.dist-info → ccxt-4.3.14.dist-info}/METADATA +4 -4
- {ccxt-4.3.12.dist-info → ccxt-4.3.14.dist-info}/RECORD +21 -21
- {ccxt-4.3.12.dist-info → ccxt-4.3.14.dist-info}/WHEEL +0 -0
- {ccxt-4.3.12.dist-info → ccxt-4.3.14.dist-info}/top_level.txt +0 -0
ccxt/async_support/okx.py
CHANGED
@@ -5220,7 +5220,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5220
5220
|
# }
|
5221
5221
|
#
|
5222
5222
|
marketId = self.safe_string(position, 'instId')
|
5223
|
-
market = self.safe_market(marketId, market)
|
5223
|
+
market = self.safe_market(marketId, market, None, 'contract')
|
5224
5224
|
symbol = market['symbol']
|
5225
5225
|
pos = self.safe_string(position, 'pos') # 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way(hedge) mode: -1 if short, 1 if long, 0 if position is not open
|
5226
5226
|
contractsAbs = Precise.string_abs(pos)
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.14'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -461,6 +461,10 @@ class Exchange(object):
|
|
461
461
|
|
462
462
|
self.after_construct()
|
463
463
|
|
464
|
+
is_sandbox = self.safe_bool_2(self.options, 'sandbox', 'testnet', False)
|
465
|
+
if is_sandbox:
|
466
|
+
self.set_sandbox_mode(is_sandbox)
|
467
|
+
|
464
468
|
# convert all properties from underscore notation foo_bar to camelcase notation fooBar
|
465
469
|
cls = type(self)
|
466
470
|
for name in dir(self):
|
ccxt/binance.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.binance import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
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
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -115,8 +115,8 @@ class binance(Exchange, ImplicitAPI):
|
|
115
115
|
'fetchFundingRates': True,
|
116
116
|
'fetchGreeks': True,
|
117
117
|
'fetchIndexOHLCV': True,
|
118
|
-
'fetchIsolatedBorrowRate':
|
119
|
-
'fetchIsolatedBorrowRates':
|
118
|
+
'fetchIsolatedBorrowRate': 'emulated',
|
119
|
+
'fetchIsolatedBorrowRates': True,
|
120
120
|
'fetchL3OrderBook': False,
|
121
121
|
'fetchLastPrices': True,
|
122
122
|
'fetchLedger': True,
|
@@ -10433,6 +10433,65 @@ class binance(Exchange, ImplicitAPI):
|
|
10433
10433
|
rate = self.safe_dict(response, 0)
|
10434
10434
|
return self.parse_borrow_rate(rate)
|
10435
10435
|
|
10436
|
+
def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
10437
|
+
"""
|
10438
|
+
fetch the rate of interest to borrow a currency for margin trading
|
10439
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
|
10440
|
+
:param str symbol: unified market symbol
|
10441
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
10442
|
+
*
|
10443
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
10444
|
+
:param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
|
10445
|
+
:returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
|
10446
|
+
"""
|
10447
|
+
request = {
|
10448
|
+
'symbol': symbol,
|
10449
|
+
}
|
10450
|
+
borrowRates = self.fetch_isolated_borrow_rates(self.extend(request, params))
|
10451
|
+
return self.safe_dict(borrowRates, symbol)
|
10452
|
+
|
10453
|
+
def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
|
10454
|
+
"""
|
10455
|
+
fetch the borrow interest rates of all currencies
|
10456
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
|
10457
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
10458
|
+
:param dict [params.symbol]: unified market symbol
|
10459
|
+
*
|
10460
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
10461
|
+
:param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
|
10462
|
+
:returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
|
10463
|
+
"""
|
10464
|
+
self.load_markets()
|
10465
|
+
request = {}
|
10466
|
+
symbol = self.safe_string(params, 'symbol')
|
10467
|
+
params = self.omit(params, 'symbol')
|
10468
|
+
if symbol is not None:
|
10469
|
+
market = self.market(symbol)
|
10470
|
+
request['symbol'] = market['id']
|
10471
|
+
response = self.sapiGetMarginIsolatedMarginData(self.extend(request, params))
|
10472
|
+
#
|
10473
|
+
# [
|
10474
|
+
# {
|
10475
|
+
# "vipLevel": 0,
|
10476
|
+
# "symbol": "BTCUSDT",
|
10477
|
+
# "leverage": "10",
|
10478
|
+
# "data": [
|
10479
|
+
# {
|
10480
|
+
# "coin": "BTC",
|
10481
|
+
# "dailyInterest": "0.00026125",
|
10482
|
+
# "borrowLimit": "270"
|
10483
|
+
# },
|
10484
|
+
# {
|
10485
|
+
# "coin": "USDT",
|
10486
|
+
# "dailyInterest": "0.000475",
|
10487
|
+
# "borrowLimit": "2100000"
|
10488
|
+
# }
|
10489
|
+
# ]
|
10490
|
+
# }
|
10491
|
+
# ]
|
10492
|
+
#
|
10493
|
+
return self.parse_isolated_borrow_rates(response)
|
10494
|
+
|
10436
10495
|
def fetch_borrow_rate_history(self, code: str, since: Int = None, limit: Int = None, params={}):
|
10437
10496
|
"""
|
10438
10497
|
retrieves a history of a currencies borrow interest rate at specific time slots
|
@@ -10501,6 +10560,43 @@ class binance(Exchange, ImplicitAPI):
|
|
10501
10560
|
'info': info,
|
10502
10561
|
}
|
10503
10562
|
|
10563
|
+
def parse_isolated_borrow_rate(self, info, market: Market = None):
|
10564
|
+
#
|
10565
|
+
# {
|
10566
|
+
# "vipLevel": 0,
|
10567
|
+
# "symbol": "BTCUSDT",
|
10568
|
+
# "leverage": "10",
|
10569
|
+
# "data": [
|
10570
|
+
# {
|
10571
|
+
# "coin": "BTC",
|
10572
|
+
# "dailyInterest": "0.00026125",
|
10573
|
+
# "borrowLimit": "270"
|
10574
|
+
# },
|
10575
|
+
# {
|
10576
|
+
# "coin": "USDT",
|
10577
|
+
# "dailyInterest": "0.000475",
|
10578
|
+
# "borrowLimit": "2100000"
|
10579
|
+
# }
|
10580
|
+
# ]
|
10581
|
+
# }
|
10582
|
+
#
|
10583
|
+
marketId = self.safe_string(info, 'symbol')
|
10584
|
+
market = self.safe_market(marketId, market, None, 'spot')
|
10585
|
+
data = self.safe_list(info, 'data')
|
10586
|
+
baseInfo = self.safe_dict(data, 0)
|
10587
|
+
quoteInfo = self.safe_dict(data, 1)
|
10588
|
+
return {
|
10589
|
+
'info': info,
|
10590
|
+
'symbol': self.safe_string(market, 'symbol'),
|
10591
|
+
'base': self.safe_string(baseInfo, 'coin'),
|
10592
|
+
'baseRate': self.safe_number(baseInfo, 'dailyInterest'),
|
10593
|
+
'quote': self.safe_string(quoteInfo, 'coin'),
|
10594
|
+
'quoteRate': self.safe_number(quoteInfo, 'dailyInterest'),
|
10595
|
+
'period': 86400000,
|
10596
|
+
'timestamp': None,
|
10597
|
+
'datetime': None,
|
10598
|
+
}
|
10599
|
+
|
10504
10600
|
def create_gift_code(self, code: str, amount, params={}):
|
10505
10601
|
"""
|
10506
10602
|
create gift code
|