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 +2 -1
- ccxt/abstract/luno.py +2 -0
- ccxt/async_support/__init__.py +2 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +103 -6
- ccxt/async_support/bingx.py +1 -0
- ccxt/async_support/bybit.py +105 -105
- ccxt/async_support/coinbase.py +96 -1
- ccxt/async_support/coinex.py +427 -408
- ccxt/async_support/cryptocom.py +2 -1
- ccxt/async_support/hitbtc.py +1 -0
- ccxt/async_support/luno.py +2 -0
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/phemex.py +1 -1
- ccxt/base/errors.py +6 -0
- ccxt/base/exchange.py +11 -7
- ccxt/binance.py +103 -6
- ccxt/bingx.py +1 -0
- ccxt/bybit.py +105 -105
- ccxt/coinbase.py +96 -1
- ccxt/coinex.py +427 -408
- ccxt/cryptocom.py +2 -1
- ccxt/hitbtc.py +1 -0
- ccxt/luno.py +2 -0
- ccxt/okx.py +1 -1
- ccxt/phemex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/hitbtc.py +1 -1
- ccxt/pro/independentreserve.py +3 -3
- ccxt/pro/poloniex.py +3 -3
- ccxt/pro/woo.py +137 -9
- {ccxt-4.3.13.dist-info → ccxt-4.3.15.dist-info}/METADATA +4 -4
- {ccxt-4.3.13.dist-info → ccxt-4.3.15.dist-info}/RECORD +35 -35
- {ccxt-4.3.13.dist-info → ccxt-4.3.15.dist-info}/WHEEL +0 -0
- {ccxt-4.3.13.dist-info → ccxt-4.3.15.dist-info}/top_level.txt +0 -0
ccxt/async_support/cryptocom.py
CHANGED
@@ -509,7 +509,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
509
509
|
strike = self.safe_string(market, 'strike')
|
510
510
|
marginBuyEnabled = self.safe_value(market, 'margin_buy_enabled')
|
511
511
|
marginSellEnabled = self.safe_value(market, 'margin_sell_enabled')
|
512
|
-
|
512
|
+
expiryString = self.omit_zero(self.safe_string(market, 'expiry_timestamp_ms'))
|
513
|
+
expiry = int(expiryString) if (expiryString is not None) else None
|
513
514
|
symbol = base + '/' + quote
|
514
515
|
type = None
|
515
516
|
contract = None
|
ccxt/async_support/hitbtc.py
CHANGED
ccxt/async_support/luno.py
CHANGED
@@ -150,6 +150,7 @@ class luno(Exchange, ImplicitAPI):
|
|
150
150
|
'withdrawals': 1,
|
151
151
|
'send': 1,
|
152
152
|
'oauth2/grant': 1,
|
153
|
+
'beneficiaries': 1,
|
153
154
|
# POST /api/exchange/1/move
|
154
155
|
},
|
155
156
|
'put': {
|
@@ -157,6 +158,7 @@ class luno(Exchange, ImplicitAPI):
|
|
157
158
|
},
|
158
159
|
'delete': {
|
159
160
|
'withdrawals/{id}': 1,
|
161
|
+
'beneficiaries/{id}': 1,
|
160
162
|
},
|
161
163
|
},
|
162
164
|
},
|
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/async_support/phemex.py
CHANGED
@@ -2299,7 +2299,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2299
2299
|
if lastTradeTimestamp == 0:
|
2300
2300
|
lastTradeTimestamp = None
|
2301
2301
|
timeInForce = self.parse_time_in_force(self.safe_string(order, 'timeInForce'))
|
2302
|
-
stopPrice = self.omit_zero(self.
|
2302
|
+
stopPrice = self.omit_zero(self.safe_string_2(order, 'stopPx', 'stopPxRp'))
|
2303
2303
|
postOnly = (timeInForce == 'PO')
|
2304
2304
|
reduceOnly = self.safe_value(order, 'reduceOnly')
|
2305
2305
|
execInst = self.safe_string(order, 'execInst')
|
ccxt/base/errors.py
CHANGED
@@ -15,6 +15,7 @@ error_hierarchy = {
|
|
15
15
|
'NoChange': {
|
16
16
|
'MarginModeAlreadySet': {},
|
17
17
|
},
|
18
|
+
'MarketClosed': {},
|
18
19
|
},
|
19
20
|
'BadResponse': {
|
20
21
|
'NullResponse': {},
|
@@ -99,6 +100,10 @@ class MarginModeAlreadySet(NoChange):
|
|
99
100
|
pass
|
100
101
|
|
101
102
|
|
103
|
+
class MarketClosed(OperationRejected):
|
104
|
+
pass
|
105
|
+
|
106
|
+
|
102
107
|
class BadResponse(ExchangeError):
|
103
108
|
pass
|
104
109
|
|
@@ -209,6 +214,7 @@ __all__ = [
|
|
209
214
|
'OperationRejected',
|
210
215
|
'NoChange',
|
211
216
|
'MarginModeAlreadySet',
|
217
|
+
'MarketClosed',
|
212
218
|
'BadResponse',
|
213
219
|
'NullResponse',
|
214
220
|
'InsufficientFunds',
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.15'
|
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):
|
@@ -3088,15 +3092,15 @@ class Exchange(object):
|
|
3088
3092
|
# timestamp and symbol operations don't belong in safeTicker
|
3089
3093
|
# they should be done in the derived classes
|
3090
3094
|
return self.extend(ticker, {
|
3091
|
-
'bid': self.parse_number(self.omit_zero(self.
|
3095
|
+
'bid': self.parse_number(self.omit_zero(self.safe_string(ticker, 'bid'))),
|
3092
3096
|
'bidVolume': self.safe_number(ticker, 'bidVolume'),
|
3093
|
-
'ask': self.parse_number(self.omit_zero(self.
|
3097
|
+
'ask': self.parse_number(self.omit_zero(self.safe_string(ticker, 'ask'))),
|
3094
3098
|
'askVolume': self.safe_number(ticker, 'askVolume'),
|
3095
3099
|
'high': self.parse_number(self.omit_zero(self.safe_string(ticker, 'high'))),
|
3096
|
-
'low': self.parse_number(self.omit_zero(self.
|
3097
|
-
'open': self.parse_number(self.omit_zero(
|
3098
|
-
'close': self.parse_number(self.omit_zero(
|
3099
|
-
'last': self.parse_number(self.omit_zero(
|
3100
|
+
'low': self.parse_number(self.omit_zero(self.safe_string(ticker, 'low'))),
|
3101
|
+
'open': self.parse_number(self.omit_zero(open)),
|
3102
|
+
'close': self.parse_number(self.omit_zero(close)),
|
3103
|
+
'last': self.parse_number(self.omit_zero(last)),
|
3100
3104
|
'change': self.parse_number(change),
|
3101
3105
|
'percentage': self.parse_number(percentage),
|
3102
3106
|
'average': self.parse_number(average),
|
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
|
@@ -18,6 +18,7 @@ from ccxt.base.errors import BadRequest
|
|
18
18
|
from ccxt.base.errors import BadSymbol
|
19
19
|
from ccxt.base.errors import OperationRejected
|
20
20
|
from ccxt.base.errors import MarginModeAlreadySet
|
21
|
+
from ccxt.base.errors import MarketClosed
|
21
22
|
from ccxt.base.errors import BadResponse
|
22
23
|
from ccxt.base.errors import InsufficientFunds
|
23
24
|
from ccxt.base.errors import InvalidOrder
|
@@ -115,8 +116,8 @@ class binance(Exchange, ImplicitAPI):
|
|
115
116
|
'fetchFundingRates': True,
|
116
117
|
'fetchGreeks': True,
|
117
118
|
'fetchIndexOHLCV': True,
|
118
|
-
'fetchIsolatedBorrowRate':
|
119
|
-
'fetchIsolatedBorrowRates':
|
119
|
+
'fetchIsolatedBorrowRate': 'emulated',
|
120
|
+
'fetchIsolatedBorrowRates': True,
|
120
121
|
'fetchL3OrderBook': False,
|
121
122
|
'fetchLastPrices': True,
|
122
123
|
'fetchLedger': True,
|
@@ -2418,7 +2419,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2418
2419
|
'Rest API trading is not enabled.': PermissionDenied,
|
2419
2420
|
'This account may not place or cancel orders.': PermissionDenied,
|
2420
2421
|
"You don't have permission.": PermissionDenied, # {"msg":"You don't have permission.","success":false}
|
2421
|
-
'Market is closed.':
|
2422
|
+
'Market is closed.': MarketClosed, # {"code":-1013,"msg":"Market is closed."}
|
2422
2423
|
'Too many requests. Please try again later.': RateLimitExceeded, # {"msg":"Too many requests. Please try again later.","success":false}
|
2423
2424
|
'This action is disabled on self account.': AccountSuspended, # {"code":-2011,"msg":"This action is disabled on self account."}
|
2424
2425
|
'Limit orders require GTC for self phase.': BadRequest,
|
@@ -3885,8 +3886,8 @@ class binance(Exchange, ImplicitAPI):
|
|
3885
3886
|
"""
|
3886
3887
|
fetches the last price for multiple markets
|
3887
3888
|
:see: https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker # spot
|
3888
|
-
:see: https://binance-docs.github.io/apidocs/
|
3889
|
-
:see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-
|
3889
|
+
:see: https://binance-docs.github.io/apidocs/futures/en/#symbol-price-ticker # swap
|
3890
|
+
:see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-tickers # future
|
3890
3891
|
:param str[]|None symbols: unified symbols of the markets to fetch the last prices
|
3891
3892
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3892
3893
|
:param str [params.subType]: "linear" or "inverse"
|
@@ -10433,6 +10434,65 @@ class binance(Exchange, ImplicitAPI):
|
|
10433
10434
|
rate = self.safe_dict(response, 0)
|
10434
10435
|
return self.parse_borrow_rate(rate)
|
10435
10436
|
|
10437
|
+
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 = self.fetch_isolated_borrow_rates(self.extend(request, params))
|
10452
|
+
return self.safe_dict(borrowRates, symbol)
|
10453
|
+
|
10454
|
+
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
|
+
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 = 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
|
+
|
10436
10496
|
def fetch_borrow_rate_history(self, code: str, since: Int = None, limit: Int = None, params={}):
|
10437
10497
|
"""
|
10438
10498
|
retrieves a history of a currencies borrow interest rate at specific time slots
|
@@ -10501,6 +10561,43 @@ class binance(Exchange, ImplicitAPI):
|
|
10501
10561
|
'info': info,
|
10502
10562
|
}
|
10503
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
|
+
|
10504
10601
|
def create_gift_code(self, code: str, amount, params={}):
|
10505
10602
|
"""
|
10506
10603
|
create gift code
|
ccxt/bingx.py
CHANGED
@@ -400,6 +400,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
400
400
|
'100202': InsufficientFunds,
|
401
401
|
'100204': BadRequest,
|
402
402
|
'100400': BadRequest,
|
403
|
+
'100410': OperationFailed, # {"code":100410,"msg":"The current system is busy, please try again later"}
|
403
404
|
'100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
|
404
405
|
'100440': ExchangeError,
|
405
406
|
'100500': OperationFailed, # {"code":100500,"msg":"The current system is busy, please try again later","debugMsg":""}
|