ccxt 4.2.21__py2.py3-none-any.whl → 4.2.22__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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +3 -0
- ccxt/abstract/binancecoinm.py +3 -0
- ccxt/abstract/binanceus.py +16 -12
- ccxt/abstract/binanceusdm.py +3 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +1 -0
- ccxt/async_support/binance.py +14 -3
- ccxt/async_support/bitget.py +11 -1
- ccxt/async_support/bitrue.py +1 -0
- ccxt/async_support/bybit.py +49 -10
- ccxt/async_support/coinbasepro.py +1 -0
- ccxt/async_support/coinex.py +34 -12
- ccxt/async_support/deribit.py +145 -0
- ccxt/async_support/okcoin.py +3 -0
- ccxt/async_support/phemex.py +5 -2
- ccxt/async_support/poloniex.py +1 -0
- ccxt/async_support/woo.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bigone.py +1 -0
- ccxt/binance.py +14 -3
- ccxt/bitget.py +11 -1
- ccxt/bitrue.py +1 -0
- ccxt/bybit.py +49 -10
- ccxt/coinbasepro.py +1 -0
- ccxt/coinex.py +34 -12
- ccxt/deribit.py +145 -0
- ccxt/okcoin.py +3 -0
- ccxt/phemex.py +5 -2
- ccxt/poloniex.py +1 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bequant.py +7 -1
- ccxt/pro/binance.py +7 -4
- ccxt/pro/binancecoinm.py +7 -1
- ccxt/pro/binanceus.py +7 -1
- ccxt/pro/bitcoincom.py +7 -1
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bitrue.py +5 -1
- ccxt/pro/okx.py +10 -2
- ccxt/test/test_async.py +14 -1
- ccxt/test/test_sync.py +14 -1
- ccxt/woo.py +1 -1
- {ccxt-4.2.21.dist-info → ccxt-4.2.22.dist-info}/METADATA +4 -4
- {ccxt-4.2.21.dist-info → ccxt-4.2.22.dist-info}/RECORD +47 -47
- {ccxt-4.2.21.dist-info → ccxt-4.2.22.dist-info}/WHEEL +0 -0
- {ccxt-4.2.21.dist-info → ccxt-4.2.22.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/binance.py
CHANGED
@@ -94,6 +94,7 @@ class ImplicitAPI:
|
|
94
94
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
95
95
|
sapi_get_convert_assetinfo = sapiGetConvertAssetInfo = Entry('convert/assetInfo', 'sapi', 'GET', {'cost': 10})
|
96
96
|
sapi_get_convert_orderstatus = sapiGetConvertOrderStatus = Entry('convert/orderStatus', 'sapi', 'GET', {'cost': 0.6667})
|
97
|
+
sapi_get_convert_limit_queryopenorders = sapiGetConvertLimitQueryOpenOrders = Entry('convert/limit/queryOpenOrders', 'sapi', 'GET', {'cost': 20.001})
|
97
98
|
sapi_get_account_status = sapiGetAccountStatus = Entry('account/status', 'sapi', 'GET', {'cost': 0.1})
|
98
99
|
sapi_get_account_apitradingstatus = sapiGetAccountApiTradingStatus = Entry('account/apiTradingStatus', 'sapi', 'GET', {'cost': 0.1})
|
99
100
|
sapi_get_account_apirestrictions_iprestriction = sapiGetAccountApiRestrictionsIpRestriction = Entry('account/apiRestrictions/ipRestriction', 'sapi', 'GET', {'cost': 0.1})
|
@@ -339,6 +340,8 @@ class ImplicitAPI:
|
|
339
340
|
sapi_post_loan_vip_repay = sapiPostLoanVipRepay = Entry('loan/vip/repay', 'sapi', 'POST', {'cost': 40.002})
|
340
341
|
sapi_post_convert_getquote = sapiPostConvertGetQuote = Entry('convert/getQuote', 'sapi', 'POST', {'cost': 1.3334})
|
341
342
|
sapi_post_convert_acceptquote = sapiPostConvertAcceptQuote = Entry('convert/acceptQuote', 'sapi', 'POST', {'cost': 3.3335})
|
343
|
+
sapi_post_convert_limit_placeorder = sapiPostConvertLimitPlaceOrder = Entry('convert/limit/placeOrder', 'sapi', 'POST', {'cost': 3.3335})
|
344
|
+
sapi_post_convert_limit_cancelorder = sapiPostConvertLimitCancelOrder = Entry('convert/limit/cancelOrder', 'sapi', 'POST', {'cost': 1.3334})
|
342
345
|
sapi_post_portfolio_auto_collection = sapiPostPortfolioAutoCollection = Entry('portfolio/auto-collection', 'sapi', 'POST', {'cost': 150})
|
343
346
|
sapi_post_portfolio_asset_collection = sapiPostPortfolioAssetCollection = Entry('portfolio/asset-collection', 'sapi', 'POST', {'cost': 6})
|
344
347
|
sapi_post_portfolio_bnb_transfer = sapiPostPortfolioBnbTransfer = Entry('portfolio/bnb-transfer', 'sapi', 'POST', {'cost': 150})
|
ccxt/abstract/binancecoinm.py
CHANGED
@@ -94,6 +94,7 @@ class ImplicitAPI:
|
|
94
94
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
95
95
|
sapi_get_convert_assetinfo = sapiGetConvertAssetInfo = Entry('convert/assetInfo', 'sapi', 'GET', {'cost': 10})
|
96
96
|
sapi_get_convert_orderstatus = sapiGetConvertOrderStatus = Entry('convert/orderStatus', 'sapi', 'GET', {'cost': 0.6667})
|
97
|
+
sapi_get_convert_limit_queryopenorders = sapiGetConvertLimitQueryOpenOrders = Entry('convert/limit/queryOpenOrders', 'sapi', 'GET', {'cost': 20.001})
|
97
98
|
sapi_get_account_status = sapiGetAccountStatus = Entry('account/status', 'sapi', 'GET', {'cost': 0.1})
|
98
99
|
sapi_get_account_apitradingstatus = sapiGetAccountApiTradingStatus = Entry('account/apiTradingStatus', 'sapi', 'GET', {'cost': 0.1})
|
99
100
|
sapi_get_account_apirestrictions_iprestriction = sapiGetAccountApiRestrictionsIpRestriction = Entry('account/apiRestrictions/ipRestriction', 'sapi', 'GET', {'cost': 0.1})
|
@@ -339,6 +340,8 @@ class ImplicitAPI:
|
|
339
340
|
sapi_post_loan_vip_repay = sapiPostLoanVipRepay = Entry('loan/vip/repay', 'sapi', 'POST', {'cost': 40.002})
|
340
341
|
sapi_post_convert_getquote = sapiPostConvertGetQuote = Entry('convert/getQuote', 'sapi', 'POST', {'cost': 1.3334})
|
341
342
|
sapi_post_convert_acceptquote = sapiPostConvertAcceptQuote = Entry('convert/acceptQuote', 'sapi', 'POST', {'cost': 3.3335})
|
343
|
+
sapi_post_convert_limit_placeorder = sapiPostConvertLimitPlaceOrder = Entry('convert/limit/placeOrder', 'sapi', 'POST', {'cost': 3.3335})
|
344
|
+
sapi_post_convert_limit_cancelorder = sapiPostConvertLimitCancelOrder = Entry('convert/limit/cancelOrder', 'sapi', 'POST', {'cost': 1.3334})
|
342
345
|
sapi_post_portfolio_auto_collection = sapiPostPortfolioAutoCollection = Entry('portfolio/auto-collection', 'sapi', 'POST', {'cost': 150})
|
343
346
|
sapi_post_portfolio_asset_collection = sapiPostPortfolioAssetCollection = Entry('portfolio/asset-collection', 'sapi', 'POST', {'cost': 6})
|
344
347
|
sapi_post_portfolio_bnb_transfer = sapiPostPortfolioBnbTransfer = Entry('portfolio/bnb-transfer', 'sapi', 'POST', {'cost': 150})
|
ccxt/abstract/binanceus.py
CHANGED
@@ -94,6 +94,7 @@ class ImplicitAPI:
|
|
94
94
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
95
95
|
sapi_get_convert_assetinfo = sapiGetConvertAssetInfo = Entry('convert/assetInfo', 'sapi', 'GET', {'cost': 10})
|
96
96
|
sapi_get_convert_orderstatus = sapiGetConvertOrderStatus = Entry('convert/orderStatus', 'sapi', 'GET', {'cost': 0.6667})
|
97
|
+
sapi_get_convert_limit_queryopenorders = sapiGetConvertLimitQueryOpenOrders = Entry('convert/limit/queryOpenOrders', 'sapi', 'GET', {'cost': 20.001})
|
97
98
|
sapi_get_account_status = sapiGetAccountStatus = Entry('account/status', 'sapi', 'GET', {'cost': 0.1})
|
98
99
|
sapi_get_account_apitradingstatus = sapiGetAccountApiTradingStatus = Entry('account/apiTradingStatus', 'sapi', 'GET', {'cost': 0.1})
|
99
100
|
sapi_get_account_apirestrictions_iprestriction = sapiGetAccountApiRestrictionsIpRestriction = Entry('account/apiRestrictions/ipRestriction', 'sapi', 'GET', {'cost': 0.1})
|
@@ -339,6 +340,8 @@ class ImplicitAPI:
|
|
339
340
|
sapi_post_loan_vip_repay = sapiPostLoanVipRepay = Entry('loan/vip/repay', 'sapi', 'POST', {'cost': 40.002})
|
340
341
|
sapi_post_convert_getquote = sapiPostConvertGetQuote = Entry('convert/getQuote', 'sapi', 'POST', {'cost': 1.3334})
|
341
342
|
sapi_post_convert_acceptquote = sapiPostConvertAcceptQuote = Entry('convert/acceptQuote', 'sapi', 'POST', {'cost': 3.3335})
|
343
|
+
sapi_post_convert_limit_placeorder = sapiPostConvertLimitPlaceOrder = Entry('convert/limit/placeOrder', 'sapi', 'POST', {'cost': 3.3335})
|
344
|
+
sapi_post_convert_limit_cancelorder = sapiPostConvertLimitCancelOrder = Entry('convert/limit/cancelOrder', 'sapi', 'POST', {'cost': 1.3334})
|
342
345
|
sapi_post_portfolio_auto_collection = sapiPostPortfolioAutoCollection = Entry('portfolio/auto-collection', 'sapi', 'POST', {'cost': 150})
|
343
346
|
sapi_post_portfolio_asset_collection = sapiPostPortfolioAssetCollection = Entry('portfolio/asset-collection', 'sapi', 'POST', {'cost': 6})
|
344
347
|
sapi_post_portfolio_bnb_transfer = sapiPostPortfolioBnbTransfer = Entry('portfolio/bnb-transfer', 'sapi', 'POST', {'cost': 150})
|
@@ -562,21 +565,21 @@ class ImplicitAPI:
|
|
562
565
|
eapiprivate_delete_allopenorders = eapiPrivateDeleteAllOpenOrders = Entry('allOpenOrders', 'eapiPrivate', 'DELETE', {'cost': 1})
|
563
566
|
eapiprivate_delete_allopenordersbyunderlying = eapiPrivateDeleteAllOpenOrdersByUnderlying = Entry('allOpenOrdersByUnderlying', 'eapiPrivate', 'DELETE', {'cost': 1})
|
564
567
|
eapiprivate_delete_listenkey = eapiPrivateDeleteListenKey = Entry('listenKey', 'eapiPrivate', 'DELETE', {'cost': 1})
|
565
|
-
public_get_ping = publicGetPing = Entry('ping', 'public', 'GET', {'cost':
|
566
|
-
public_get_time = publicGetTime = Entry('time', 'public', 'GET', {'cost':
|
568
|
+
public_get_ping = publicGetPing = Entry('ping', 'public', 'GET', {'cost': 1})
|
569
|
+
public_get_time = publicGetTime = Entry('time', 'public', 'GET', {'cost': 1})
|
567
570
|
public_get_depth = publicGetDepth = Entry('depth', 'public', 'GET', {'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]]})
|
568
|
-
public_get_trades = publicGetTrades = Entry('trades', 'public', 'GET', {'cost':
|
569
|
-
public_get_aggtrades = publicGetAggTrades = Entry('aggTrades', 'public', 'GET', {'cost':
|
570
|
-
public_get_historicaltrades = publicGetHistoricalTrades = Entry('historicalTrades', 'public', 'GET', {'cost':
|
571
|
-
public_get_klines = publicGetKlines = Entry('klines', 'public', 'GET', {'cost':
|
571
|
+
public_get_trades = publicGetTrades = Entry('trades', 'public', 'GET', {'cost': 1})
|
572
|
+
public_get_aggtrades = publicGetAggTrades = Entry('aggTrades', 'public', 'GET', {'cost': 1})
|
573
|
+
public_get_historicaltrades = publicGetHistoricalTrades = Entry('historicalTrades', 'public', 'GET', {'cost': 5})
|
574
|
+
public_get_klines = publicGetKlines = Entry('klines', 'public', 'GET', {'cost': 1})
|
572
575
|
public_get_uiklines = publicGetUiKlines = Entry('uiKlines', 'public', 'GET', {'cost': 0.4})
|
573
|
-
public_get_ticker_24hr = publicGetTicker24hr = Entry('ticker/24hr', 'public', 'GET', {'cost':
|
574
|
-
public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {'cost':
|
576
|
+
public_get_ticker_24hr = publicGetTicker24hr = Entry('ticker/24hr', 'public', 'GET', {'cost': 1, 'noSymbol': 40})
|
577
|
+
public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {'cost': 2, 'noSymbol': 100})
|
575
578
|
public_get_ticker_tradingday = publicGetTickerTradingDay = Entry('ticker/tradingDay', 'public', 'GET', {'cost': 0.8})
|
576
|
-
public_get_ticker_price = publicGetTickerPrice = Entry('ticker/price', 'public', 'GET', {'cost':
|
577
|
-
public_get_ticker_bookticker = publicGetTickerBookTicker = Entry('ticker/bookTicker', 'public', 'GET', {'cost':
|
578
|
-
public_get_exchangeinfo = publicGetExchangeInfo = Entry('exchangeInfo', 'public', 'GET', {'cost':
|
579
|
-
public_get_avgprice = publicGetAvgPrice = Entry('avgPrice', 'public', 'GET', {'cost':
|
579
|
+
public_get_ticker_price = publicGetTickerPrice = Entry('ticker/price', 'public', 'GET', {'cost': 1, 'noSymbol': 2})
|
580
|
+
public_get_ticker_bookticker = publicGetTickerBookTicker = Entry('ticker/bookTicker', 'public', 'GET', {'cost': 1, 'noSymbol': 2})
|
581
|
+
public_get_exchangeinfo = publicGetExchangeInfo = Entry('exchangeInfo', 'public', 'GET', {'cost': 10})
|
582
|
+
public_get_avgprice = publicGetAvgPrice = Entry('avgPrice', 'public', 'GET', {'cost': 1})
|
580
583
|
public_put_userdatastream = publicPutUserDataStream = Entry('userDataStream', 'public', 'PUT', {'cost': 0.4})
|
581
584
|
public_post_userdatastream = publicPostUserDataStream = Entry('userDataStream', 'public', 'POST', {'cost': 0.4})
|
582
585
|
public_delete_userdatastream = publicDeleteUserDataStream = Entry('userDataStream', 'public', 'DELETE', {'cost': 0.4})
|
@@ -592,6 +595,7 @@ class ImplicitAPI:
|
|
592
595
|
private_get_mypreventedmatches = privateGetMyPreventedMatches = Entry('myPreventedMatches', 'private', 'GET', {'cost': 4})
|
593
596
|
private_get_myallocations = privateGetMyAllocations = Entry('myAllocations', 'private', 'GET', {'cost': 4})
|
594
597
|
private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
|
598
|
+
private_get_status = privateGetStatus = Entry('status', 'private', 'GET', {'cost': 1})
|
595
599
|
private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
|
596
600
|
private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
|
597
601
|
private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
|
ccxt/abstract/binanceusdm.py
CHANGED
@@ -94,6 +94,7 @@ class ImplicitAPI:
|
|
94
94
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
95
95
|
sapi_get_convert_assetinfo = sapiGetConvertAssetInfo = Entry('convert/assetInfo', 'sapi', 'GET', {'cost': 10})
|
96
96
|
sapi_get_convert_orderstatus = sapiGetConvertOrderStatus = Entry('convert/orderStatus', 'sapi', 'GET', {'cost': 0.6667})
|
97
|
+
sapi_get_convert_limit_queryopenorders = sapiGetConvertLimitQueryOpenOrders = Entry('convert/limit/queryOpenOrders', 'sapi', 'GET', {'cost': 20.001})
|
97
98
|
sapi_get_account_status = sapiGetAccountStatus = Entry('account/status', 'sapi', 'GET', {'cost': 0.1})
|
98
99
|
sapi_get_account_apitradingstatus = sapiGetAccountApiTradingStatus = Entry('account/apiTradingStatus', 'sapi', 'GET', {'cost': 0.1})
|
99
100
|
sapi_get_account_apirestrictions_iprestriction = sapiGetAccountApiRestrictionsIpRestriction = Entry('account/apiRestrictions/ipRestriction', 'sapi', 'GET', {'cost': 0.1})
|
@@ -339,6 +340,8 @@ class ImplicitAPI:
|
|
339
340
|
sapi_post_loan_vip_repay = sapiPostLoanVipRepay = Entry('loan/vip/repay', 'sapi', 'POST', {'cost': 40.002})
|
340
341
|
sapi_post_convert_getquote = sapiPostConvertGetQuote = Entry('convert/getQuote', 'sapi', 'POST', {'cost': 1.3334})
|
341
342
|
sapi_post_convert_acceptquote = sapiPostConvertAcceptQuote = Entry('convert/acceptQuote', 'sapi', 'POST', {'cost': 3.3335})
|
343
|
+
sapi_post_convert_limit_placeorder = sapiPostConvertLimitPlaceOrder = Entry('convert/limit/placeOrder', 'sapi', 'POST', {'cost': 3.3335})
|
344
|
+
sapi_post_convert_limit_cancelorder = sapiPostConvertLimitCancelOrder = Entry('convert/limit/cancelOrder', 'sapi', 'POST', {'cost': 1.3334})
|
342
345
|
sapi_post_portfolio_auto_collection = sapiPostPortfolioAutoCollection = Entry('portfolio/auto-collection', 'sapi', 'POST', {'cost': 150})
|
343
346
|
sapi_post_portfolio_asset_collection = sapiPostPortfolioAssetCollection = Entry('portfolio/asset-collection', 'sapi', 'POST', {'cost': 6})
|
344
347
|
sapi_post_portfolio_bnb_transfer = sapiPostPortfolioBnbTransfer = Entry('portfolio/bnb-transfer', 'sapi', 'POST', {'cost': 150})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/bigone.py
CHANGED
ccxt/async_support/binance.py
CHANGED
@@ -330,6 +330,7 @@ class binance(Exchange, ImplicitAPI):
|
|
330
330
|
'convert/exchangeInfo': 50,
|
331
331
|
'convert/assetInfo': 10,
|
332
332
|
'convert/orderStatus': 0.6667,
|
333
|
+
'convert/limit/queryOpenOrders': 20.001, # Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
|
333
334
|
'account/status': 0.1,
|
334
335
|
'account/apiTradingStatus': 0.1,
|
335
336
|
'account/apiRestrictions/ipRestriction': 0.1,
|
@@ -601,6 +602,8 @@ class binance(Exchange, ImplicitAPI):
|
|
601
602
|
'loan/vip/repay': 40.002,
|
602
603
|
'convert/getQuote': 1.3334, # Weight(UID): 200 => cost = 0.006667 * 200 = 1.3334
|
603
604
|
'convert/acceptQuote': 3.3335, # Weight(UID): 500 => cost = 0.006667 * 500 = 3.3335
|
605
|
+
'convert/limit/placeOrder': 3.3335, # Weight(UID): 500 => cost = 0.006667 * 500 = 3.3335
|
606
|
+
'convert/limit/cancelOrder': 1.3334, # Weight(UID): 200 => cost = 0.006667 * 200 = 1.3334
|
604
607
|
'portfolio/auto-collection': 150, # Weight(IP): 1500 => cost = 0.1 * 1500 = 150
|
605
608
|
'portfolio/asset-collection': 6, # Weight(IP): 60 => cost = 0.1 * 60 = 6
|
606
609
|
'portfolio/bnb-transfer': 150, # Weight(IP): 1500 => cost = 0.1 * 1500 = 150
|
@@ -7370,12 +7373,20 @@ class binance(Exchange, ImplicitAPI):
|
|
7370
7373
|
|
7371
7374
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
7372
7375
|
"""
|
7376
|
+
:see: https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
7377
|
+
:see: https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
7378
|
+
:see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
7379
|
+
:see: https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
7380
|
+
:see: https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
|
7373
7381
|
fetch all open positions
|
7374
|
-
:param str[]
|
7382
|
+
:param str[] [symbols]: list of unified market symbols
|
7375
7383
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7384
|
+
:param str [method]: method name to call, "positionRisk", "account" or "option", default is "positionRisk"
|
7376
7385
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
7377
7386
|
"""
|
7378
|
-
|
7387
|
+
defaultValue = self.safe_string(self.options, 'fetchPositions', 'positionRisk')
|
7388
|
+
defaultMethod = None
|
7389
|
+
defaultMethod, params = self.handle_option_and_params(params, 'fetchPositions', 'method', defaultValue)
|
7379
7390
|
if defaultMethod == 'positionRisk':
|
7380
7391
|
return await self.fetch_positions_risk(symbols, params)
|
7381
7392
|
elif defaultMethod == 'account':
|
@@ -7383,7 +7394,7 @@ class binance(Exchange, ImplicitAPI):
|
|
7383
7394
|
elif defaultMethod == 'option':
|
7384
7395
|
return await self.fetch_option_positions(symbols, params)
|
7385
7396
|
else:
|
7386
|
-
raise NotSupported(self.id + '.options["fetchPositions"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"')
|
7397
|
+
raise NotSupported(self.id + '.options["fetchPositions"]/params["method"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"')
|
7387
7398
|
|
7388
7399
|
async def fetch_account_positions(self, symbols: Strings = None, params={}):
|
7389
7400
|
"""
|
ccxt/async_support/bitget.py
CHANGED
@@ -59,15 +59,21 @@ class bitget(Exchange, ImplicitAPI):
|
|
59
59
|
'cancelOrders': True,
|
60
60
|
'closeAllPositions': True,
|
61
61
|
'closePosition': True,
|
62
|
+
'createDepositAddress': False,
|
62
63
|
'createMarketBuyOrderWithCost': True,
|
63
64
|
'createMarketOrderWithCost': False,
|
64
65
|
'createMarketSellOrderWithCost': False,
|
65
66
|
'createOrder': True,
|
66
67
|
'createOrders': True,
|
67
68
|
'createOrderWithTakeProfitAndStopLoss': True,
|
69
|
+
'createPostOnlyOrder': True,
|
68
70
|
'createReduceOnlyOrder': False,
|
71
|
+
'createStopLimitOrder': True,
|
69
72
|
'createStopLossOrder': True,
|
73
|
+
'createStopMarketOrder': True,
|
74
|
+
'createStopOrder': True,
|
70
75
|
'createTakeProfitOrder': True,
|
76
|
+
'createTrailingAmountOrder': False,
|
71
77
|
'createTrailingPercentOrder': True,
|
72
78
|
'createTriggerOrder': True,
|
73
79
|
'editOrder': True,
|
@@ -85,6 +91,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
85
91
|
'fetchDepositAddress': True,
|
86
92
|
'fetchDepositAddresses': False,
|
87
93
|
'fetchDeposits': True,
|
94
|
+
'fetchDepositsWithdrawals': False,
|
88
95
|
'fetchDepositWithdrawFee': 'emulated',
|
89
96
|
'fetchDepositWithdrawFees': True,
|
90
97
|
'fetchFundingHistory': True,
|
@@ -98,7 +105,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
98
105
|
'fetchLeverage': True,
|
99
106
|
'fetchLeverageTiers': False,
|
100
107
|
'fetchLiquidations': False,
|
101
|
-
'fetchMarginMode':
|
108
|
+
'fetchMarginMode': False,
|
102
109
|
'fetchMarketLeverageTiers': True,
|
103
110
|
'fetchMarkets': True,
|
104
111
|
'fetchMarkOHLCV': True,
|
@@ -123,8 +130,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
123
130
|
'fetchTrades': True,
|
124
131
|
'fetchTradingFee': True,
|
125
132
|
'fetchTradingFees': True,
|
133
|
+
'fetchTransactions': False,
|
126
134
|
'fetchTransfer': False,
|
127
135
|
'fetchTransfers': True,
|
136
|
+
'fetchWithdrawAddresses': False,
|
128
137
|
'fetchWithdrawal': False,
|
129
138
|
'fetchWithdrawals': True,
|
130
139
|
'reduceMargin': True,
|
@@ -133,6 +142,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
133
142
|
'setLeverage': True,
|
134
143
|
'setMarginMode': True,
|
135
144
|
'setPositionMode': True,
|
145
|
+
'signIn': False,
|
136
146
|
'transfer': True,
|
137
147
|
'withdraw': True,
|
138
148
|
},
|
ccxt/async_support/bitrue.py
CHANGED
@@ -73,6 +73,7 @@ class bitrue(Exchange, ImplicitAPI):
|
|
73
73
|
'fetchDepositsWithdrawals': False,
|
74
74
|
'fetchDepositWithdrawFee': 'emulated',
|
75
75
|
'fetchDepositWithdrawFees': True,
|
76
|
+
'fetchFundingRate': False,
|
76
77
|
'fetchIsolatedBorrowRate': False,
|
77
78
|
'fetchIsolatedBorrowRates': False,
|
78
79
|
'fetchMarginMode': False,
|
ccxt/async_support/bybit.py
CHANGED
@@ -53,7 +53,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
53
53
|
'closeAllPositions': False,
|
54
54
|
'closePosition': False,
|
55
55
|
'createMarketBuyOrderWithCost': True,
|
56
|
-
'createMarketSellOrderWithCost':
|
56
|
+
'createMarketSellOrderWithCost': True,
|
57
57
|
'createOrder': True,
|
58
58
|
'createOrders': True,
|
59
59
|
'createOrderWithTakeProfitAndStopLoss': True,
|
@@ -973,7 +973,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
973
973
|
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
974
974
|
'enableUnifiedMargin': None,
|
975
975
|
'enableUnifiedAccount': None,
|
976
|
-
'createMarketBuyOrderRequiresPrice': True,
|
976
|
+
'createMarketBuyOrderRequiresPrice': True, # only True for classic accounts
|
977
977
|
'createUnifiedMarginAccount': False,
|
978
978
|
'defaultType': 'swap', # 'swap', 'future', 'option', 'spot'
|
979
979
|
'defaultSubType': 'linear', # 'linear', 'inverse'
|
@@ -3302,8 +3302,26 @@ class bybit(Exchange, ImplicitAPI):
|
|
3302
3302
|
market = self.market(symbol)
|
3303
3303
|
if not market['spot']:
|
3304
3304
|
raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
|
3305
|
-
|
3306
|
-
|
3305
|
+
return await self.create_order(symbol, 'market', 'buy', cost, 1, params)
|
3306
|
+
|
3307
|
+
async def create_market_sell_order_with_cost(self, symbol: str, cost, params={}):
|
3308
|
+
"""
|
3309
|
+
:see: https://bybit-exchange.github.io/docs/v5/order/create-order
|
3310
|
+
create a market sell order by providing the symbol and cost
|
3311
|
+
:param str symbol: unified symbol of the market to create an order in
|
3312
|
+
:param float cost: how much you want to trade in units of the quote currency
|
3313
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3314
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3315
|
+
"""
|
3316
|
+
await self.load_markets()
|
3317
|
+
types = await self.is_unified_enabled()
|
3318
|
+
enableUnifiedAccount = types[1]
|
3319
|
+
if not enableUnifiedAccount:
|
3320
|
+
raise NotSupported(self.id + ' createMarketSellOrderWithCost() supports UTA accounts only')
|
3321
|
+
market = self.market(symbol)
|
3322
|
+
if not market['spot']:
|
3323
|
+
raise NotSupported(self.id + ' createMarketSellOrderWithCost() supports spot orders only')
|
3324
|
+
return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
|
3307
3325
|
|
3308
3326
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
3309
3327
|
"""
|
@@ -3344,7 +3362,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3344
3362
|
return await self.create_usdc_order(symbol, type, side, amount, price, params)
|
3345
3363
|
trailingAmount = self.safe_string_2(params, 'trailingAmount', 'trailingStop')
|
3346
3364
|
isTrailingAmountOrder = trailingAmount is not None
|
3347
|
-
orderRequest = self.create_order_request(symbol, type, side, amount, price, params)
|
3365
|
+
orderRequest = self.create_order_request(symbol, type, side, amount, price, params, enableUnifiedAccount)
|
3348
3366
|
response = None
|
3349
3367
|
if isTrailingAmountOrder:
|
3350
3368
|
response = await self.privatePostV5PositionTradingStop(orderRequest)
|
@@ -3365,7 +3383,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3365
3383
|
order = self.safe_value(response, 'result', {})
|
3366
3384
|
return self.parse_order(order, market)
|
3367
3385
|
|
3368
|
-
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
3386
|
+
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}, isUTA=True):
|
3369
3387
|
market = self.market(symbol)
|
3370
3388
|
symbol = market['symbol']
|
3371
3389
|
lowerCaseType = type.lower()
|
@@ -3404,12 +3422,31 @@ class bybit(Exchange, ImplicitAPI):
|
|
3404
3422
|
request['category'] = 'inverse'
|
3405
3423
|
elif market['option']:
|
3406
3424
|
request['category'] = 'option'
|
3407
|
-
|
3425
|
+
cost = self.safe_string(params, 'cost')
|
3426
|
+
params = self.omit(params, 'cost')
|
3427
|
+
# if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
3428
|
+
isMarketBuyAndCostInferable = (lowerCaseType == 'market') and (side == 'buy') and ((price is not None) or (cost is not None))
|
3429
|
+
if market['spot'] and (type == 'market') and isUTA and not isMarketBuyAndCostInferable:
|
3430
|
+
# UTA account can specify the cost of the order on both sides
|
3431
|
+
if (cost is not None) or (price is not None):
|
3432
|
+
request['marketUnit'] = 'quoteCoin'
|
3433
|
+
orderCost = None
|
3434
|
+
if cost is not None:
|
3435
|
+
orderCost = cost
|
3436
|
+
else:
|
3437
|
+
amountString = self.number_to_string(amount)
|
3438
|
+
priceString = self.number_to_string(price)
|
3439
|
+
quoteAmount = Precise.string_mul(amountString, priceString)
|
3440
|
+
orderCost = quoteAmount
|
3441
|
+
request['qty'] = self.cost_to_precision(symbol, orderCost)
|
3442
|
+
else:
|
3443
|
+
request['marketUnit'] = 'baseCoin'
|
3444
|
+
request['qty'] = self.amount_to_precision(symbol, amount)
|
3445
|
+
elif market['spot'] and (type == 'market') and (side == 'buy'):
|
3446
|
+
# classic accounts
|
3408
3447
|
# for market buy it requires the amount of quote currency to spend
|
3409
3448
|
createMarketBuyOrderRequiresPrice = True
|
3410
3449
|
createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
|
3411
|
-
cost = self.safe_number(params, 'cost')
|
3412
|
-
params = self.omit(params, 'cost')
|
3413
3450
|
if createMarketBuyOrderRequiresPrice:
|
3414
3451
|
if (price is None) and (cost is None):
|
3415
3452
|
raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
|
@@ -3505,6 +3542,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3505
3542
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3506
3543
|
"""
|
3507
3544
|
await self.load_markets()
|
3545
|
+
accounts = await self.is_unified_enabled()
|
3546
|
+
isUta = accounts[1]
|
3508
3547
|
ordersRequests = []
|
3509
3548
|
orderSymbols = []
|
3510
3549
|
for i in range(0, len(orders)):
|
@@ -3516,7 +3555,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3516
3555
|
amount = self.safe_value(rawOrder, 'amount')
|
3517
3556
|
price = self.safe_value(rawOrder, 'price')
|
3518
3557
|
orderParams = self.safe_value(rawOrder, 'params', {})
|
3519
|
-
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
3558
|
+
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams, isUta)
|
3520
3559
|
ordersRequests.append(orderRequest)
|
3521
3560
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
3522
3561
|
market = self.market(symbols[0])
|
@@ -53,6 +53,7 @@ class coinbasepro(Exchange, ImplicitAPI):
|
|
53
53
|
'fetchDepositAddress': False, # the exchange does not have self method, only createDepositAddress, see https://github.com/ccxt/ccxt/pull/7405
|
54
54
|
'fetchDeposits': True,
|
55
55
|
'fetchDepositsWithdrawals': True,
|
56
|
+
'fetchFundingRate': False,
|
56
57
|
'fetchLedger': True,
|
57
58
|
'fetchMarginMode': False,
|
58
59
|
'fetchMarkets': True,
|
ccxt/async_support/coinex.py
CHANGED
@@ -1531,8 +1531,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
1531
1531
|
"""
|
1532
1532
|
marketType = None
|
1533
1533
|
marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
1534
|
-
|
1535
|
-
|
1534
|
+
marginMode = None
|
1535
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchBalance', params)
|
1536
|
+
marketType = 'margin' if (marginMode is not None) else marketType
|
1536
1537
|
params = self.omit(params, 'margin')
|
1537
1538
|
if marketType == 'margin':
|
1538
1539
|
return await self.fetch_margin_balance(params)
|
@@ -2006,8 +2007,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2006
2007
|
if timeInForceRaw is not None:
|
2007
2008
|
request['option'] = timeInForceRaw # exchange takes 'IOC' and 'FOK'
|
2008
2009
|
accountId = self.safe_integer(params, 'account_id')
|
2009
|
-
|
2010
|
-
|
2010
|
+
marginMode = None
|
2011
|
+
marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
|
2012
|
+
if marginMode is not None:
|
2011
2013
|
if accountId is None:
|
2012
2014
|
raise BadRequest(self.id + ' createOrder() requires an account_id parameter for margin orders')
|
2013
2015
|
request['account_id'] = accountId
|
@@ -2474,9 +2476,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2474
2476
|
'market': market['id'],
|
2475
2477
|
}
|
2476
2478
|
accountId = self.safe_integer(params, 'account_id')
|
2477
|
-
|
2479
|
+
marginMode = None
|
2480
|
+
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
2478
2481
|
clientOrderId = self.safe_string_2(params, 'client_id', 'clientOrderId')
|
2479
|
-
if
|
2482
|
+
if marginMode is not None:
|
2480
2483
|
if accountId is None:
|
2481
2484
|
raise BadRequest(self.id + ' cancelOrder() requires an account_id parameter for margin orders')
|
2482
2485
|
request['account_id'] = accountId
|
@@ -2815,8 +2818,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2815
2818
|
request['market'] = market['id']
|
2816
2819
|
marketType, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
2817
2820
|
accountId = self.safe_integer(params, 'account_id')
|
2818
|
-
|
2819
|
-
|
2821
|
+
marginMode = None
|
2822
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
|
2823
|
+
if marginMode is not None:
|
2820
2824
|
if accountId is None:
|
2821
2825
|
raise BadRequest(self.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders')
|
2822
2826
|
request['account_id'] = accountId
|
@@ -3180,8 +3184,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
3180
3184
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument for non-spot markets')
|
3181
3185
|
swap = (type == 'swap')
|
3182
3186
|
accountId = self.safe_integer(params, 'account_id')
|
3183
|
-
|
3184
|
-
|
3187
|
+
marginMode = None
|
3188
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
3189
|
+
if marginMode is not None:
|
3185
3190
|
if accountId is None:
|
3186
3191
|
raise BadRequest(self.id + ' fetchMyTrades() requires an account_id parameter for margin trades')
|
3187
3192
|
request['account_id'] = accountId
|
@@ -4419,9 +4424,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
4419
4424
|
else:
|
4420
4425
|
request['limit'] = 100
|
4421
4426
|
params = self.omit(params, 'page')
|
4422
|
-
|
4427
|
+
marginMode = None
|
4428
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchTransfers', params)
|
4423
4429
|
response = None
|
4424
|
-
if
|
4430
|
+
if marginMode is not None:
|
4425
4431
|
response = await self.privateGetMarginTransferHistory(self.extend(request, params))
|
4426
4432
|
else:
|
4427
4433
|
response = await self.privateGetContractTransferHistory(self.extend(request, params))
|
@@ -4968,6 +4974,22 @@ class coinex(Exchange, ImplicitAPI):
|
|
4968
4974
|
depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
|
4969
4975
|
return depositWithdrawFees
|
4970
4976
|
|
4977
|
+
def handle_margin_mode_and_params(self, methodName, params={}, defaultValue=None):
|
4978
|
+
"""
|
4979
|
+
* @ignore
|
4980
|
+
marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
|
4981
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
4982
|
+
:returns Array: the marginMode in lowercase
|
4983
|
+
"""
|
4984
|
+
defaultType = self.safe_string(self.options, 'defaultType')
|
4985
|
+
isMargin = self.safe_value(params, 'margin', False)
|
4986
|
+
marginMode = None
|
4987
|
+
marginMode, params = super(coinex, self).handle_margin_mode_and_params(methodName, params, defaultValue)
|
4988
|
+
if marginMode is None:
|
4989
|
+
if (defaultType == 'margin') or (isMargin is True):
|
4990
|
+
marginMode = 'isolated'
|
4991
|
+
return [marginMode, params]
|
4992
|
+
|
4971
4993
|
def nonce(self):
|
4972
4994
|
return self.milliseconds()
|
4973
4995
|
|