ccxt 4.4.4__py2.py3-none-any.whl → 4.4.5__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.4.4'
25
+ __version__ = '4.4.5'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@ from ccxt.base.types import Entry
4
4
  class ImplicitAPI:
5
5
  sapi_get_copytrading_futures_userstatus = sapiGetCopyTradingFuturesUserStatus = Entry('copyTrading/futures/userStatus', 'sapi', 'GET', {'cost': 2})
6
6
  sapi_get_copytrading_futures_leadsymbol = sapiGetCopyTradingFuturesLeadSymbol = Entry('copyTrading/futures/leadSymbol', 'sapi', 'GET', {'cost': 2})
7
- sapi_get_system_status = sapiGetSystemStatus = Entry('system/status', 'sapi', 'GET', {'cost': 0.1})
7
+ sapi_get_system_status = sapiGetSystemStatus = Entry('system/status', 'sapi', 'GET', {'cost': 1})
8
8
  sapi_get_accountsnapshot = sapiGetAccountSnapshot = Entry('accountSnapshot', 'sapi', 'GET', {'cost': 240})
9
9
  sapi_get_account_info = sapiGetAccountInfo = Entry('account/info', 'sapi', 'GET', {'cost': 0.1})
10
10
  sapi_get_margin_asset = sapiGetMarginAsset = Entry('margin/asset', 'sapi', 'GET', {'cost': 1})
@@ -86,10 +86,10 @@ class ImplicitAPI:
86
86
  sapi_get_capital_config_getall = sapiGetCapitalConfigGetall = Entry('capital/config/getall', 'sapi', 'GET', {'cost': 1})
87
87
  sapi_get_capital_deposit_address = sapiGetCapitalDepositAddress = Entry('capital/deposit/address', 'sapi', 'GET', {'cost': 1})
88
88
  sapi_get_capital_deposit_address_list = sapiGetCapitalDepositAddressList = Entry('capital/deposit/address/list', 'sapi', 'GET', {'cost': 1})
89
- sapi_get_capital_deposit_hisrec = sapiGetCapitalDepositHisrec = Entry('capital/deposit/hisrec', 'sapi', 'GET', {'cost': 0.1})
89
+ sapi_get_capital_deposit_hisrec = sapiGetCapitalDepositHisrec = Entry('capital/deposit/hisrec', 'sapi', 'GET', {'cost': 1})
90
90
  sapi_get_capital_deposit_subaddress = sapiGetCapitalDepositSubAddress = Entry('capital/deposit/subAddress', 'sapi', 'GET', {'cost': 0.1})
91
91
  sapi_get_capital_deposit_subhisrec = sapiGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', 'sapi', 'GET', {'cost': 0.1})
92
- sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 2})
92
+ sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 1})
93
93
  sapi_get_capital_withdraw_address_list = sapiGetCapitalWithdrawAddressList = Entry('capital/withdraw/address/list', 'sapi', 'GET', {'cost': 10})
94
94
  sapi_get_capital_contract_convertible_coins = sapiGetCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'GET', {'cost': 4.0002})
95
95
  sapi_get_convert_tradeflow = sapiGetConvertTradeFlow = Entry('convert/tradeFlow', 'sapi', 'GET', {'cost': 20.001})
@@ -108,7 +108,7 @@ class ImplicitAPI:
108
108
  sapi_get_sub_account_list = sapiGetSubAccountList = Entry('sub-account/list', 'sapi', 'GET', {'cost': 0.1})
109
109
  sapi_get_sub_account_margin_account = sapiGetSubAccountMarginAccount = Entry('sub-account/margin/account', 'sapi', 'GET', {'cost': 1})
110
110
  sapi_get_sub_account_margin_accountsummary = sapiGetSubAccountMarginAccountSummary = Entry('sub-account/margin/accountSummary', 'sapi', 'GET', {'cost': 1})
111
- sapi_get_sub_account_spotsummary = sapiGetSubAccountSpotSummary = Entry('sub-account/spotSummary', 'sapi', 'GET', {'cost': 0.1})
111
+ sapi_get_sub_account_spotsummary = sapiGetSubAccountSpotSummary = Entry('sub-account/spotSummary', 'sapi', 'GET', {'cost': 1})
112
112
  sapi_get_sub_account_status = sapiGetSubAccountStatus = Entry('sub-account/status', 'sapi', 'GET', {'cost': 1})
113
113
  sapi_get_sub_account_sub_transfer_history = sapiGetSubAccountSubTransferHistory = Entry('sub-account/sub/transfer/history', 'sapi', 'GET', {'cost': 0.1})
114
114
  sapi_get_sub_account_transfer_subuserhistory = sapiGetSubAccountTransferSubUserHistory = Entry('sub-account/transfer/subUserHistory', 'sapi', 'GET', {'cost': 0.1})
@@ -280,14 +280,14 @@ class ImplicitAPI:
280
280
  sapi_get_cl_transferhistory = sapiGetClTransferHistory = Entry('cl/transferHistory', 'sapi', 'GET', {'cost': 1})
281
281
  sapi_get_apipartner_checkeligibility = sapiGetApipartnerCheckEligibility = Entry('apipartner/checkEligibility', 'sapi', 'GET', {'cost': 1})
282
282
  sapi_get_apipartner_rebatehistory = sapiGetApipartnerRebateHistory = Entry('apipartner/rebateHistory', 'sapi', 'GET', {'cost': 1})
283
- sapi_post_asset_dust = sapiPostAssetDust = Entry('asset/dust', 'sapi', 'POST', {'cost': 0.06667})
283
+ sapi_post_asset_dust = sapiPostAssetDust = Entry('asset/dust', 'sapi', 'POST', {'cost': 10})
284
284
  sapi_post_asset_dust_btc = sapiPostAssetDustBtc = Entry('asset/dust-btc', 'sapi', 'POST', {'cost': 0.1})
285
285
  sapi_post_asset_transfer = sapiPostAssetTransfer = Entry('asset/transfer', 'sapi', 'POST', {'cost': 6.0003})
286
286
  sapi_post_asset_get_funding_asset = sapiPostAssetGetFundingAsset = Entry('asset/get-funding-asset', 'sapi', 'POST', {'cost': 0.1})
287
287
  sapi_post_asset_convert_transfer = sapiPostAssetConvertTransfer = Entry('asset/convert-transfer', 'sapi', 'POST', {'cost': 0.033335})
288
288
  sapi_post_account_disablefastwithdrawswitch = sapiPostAccountDisableFastWithdrawSwitch = Entry('account/disableFastWithdrawSwitch', 'sapi', 'POST', {'cost': 0.1})
289
289
  sapi_post_account_enablefastwithdrawswitch = sapiPostAccountEnableFastWithdrawSwitch = Entry('account/enableFastWithdrawSwitch', 'sapi', 'POST', {'cost': 0.1})
290
- sapi_post_capital_withdraw_apply = sapiPostCapitalWithdrawApply = Entry('capital/withdraw/apply', 'sapi', 'POST', {'cost': 4.0002})
290
+ sapi_post_capital_withdraw_apply = sapiPostCapitalWithdrawApply = Entry('capital/withdraw/apply', 'sapi', 'POST', {'cost': 1})
291
291
  sapi_post_capital_contract_convertible_coins = sapiPostCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'POST', {'cost': 4.0002})
292
292
  sapi_post_capital_deposit_credit_apply = sapiPostCapitalDepositCreditApply = Entry('capital/deposit/credit-apply', 'sapi', 'POST', {'cost': 0.1})
293
293
  sapi_post_margin_borrow_repay = sapiPostMarginBorrowRepay = Entry('margin/borrow-repay', 'sapi', 'POST', {'cost': 20.001})
@@ -439,7 +439,7 @@ class ImplicitAPI:
439
439
  sapiv2_post_loan_flexible_borrow = sapiV2PostLoanFlexibleBorrow = Entry('loan/flexible/borrow', 'sapiV2', 'POST', {'cost': 40.002})
440
440
  sapiv2_post_loan_flexible_repay = sapiV2PostLoanFlexibleRepay = Entry('loan/flexible/repay', 'sapiV2', 'POST', {'cost': 40.002})
441
441
  sapiv2_post_loan_flexible_adjust_ltv = sapiV2PostLoanFlexibleAdjustLtv = Entry('loan/flexible/adjust/ltv', 'sapiV2', 'POST', {'cost': 40.002})
442
- sapiv3_get_sub_account_assets = sapiV3GetSubAccountAssets = Entry('sub-account/assets', 'sapiV3', 'GET', {'cost': 0.40002})
442
+ sapiv3_get_sub_account_assets = sapiV3GetSubAccountAssets = Entry('sub-account/assets', 'sapiV3', 'GET', {'cost': 1})
443
443
  sapiv3_get_accountstatus = sapiV3GetAccountStatus = Entry('accountStatus', 'sapiV3', 'GET', {'cost': 1})
444
444
  sapiv3_get_apitradingstatus = sapiV3GetApiTradingStatus = Entry('apiTradingStatus', 'sapiV3', 'GET', {'cost': 1})
445
445
  sapiv3_get_sub_account_list = sapiV3GetSubAccountList = Entry('sub-account/list', 'sapiV3', 'GET', {'cost': 1})
@@ -641,48 +641,48 @@ class ImplicitAPI:
641
641
  eapiprivate_delete_allopenorders = eapiPrivateDeleteAllOpenOrders = Entry('allOpenOrders', 'eapiPrivate', 'DELETE', {'cost': 1})
642
642
  eapiprivate_delete_allopenordersbyunderlying = eapiPrivateDeleteAllOpenOrdersByUnderlying = Entry('allOpenOrdersByUnderlying', 'eapiPrivate', 'DELETE', {'cost': 1})
643
643
  eapiprivate_delete_listenkey = eapiPrivateDeleteListenKey = Entry('listenKey', 'eapiPrivate', 'DELETE', {'cost': 1})
644
- public_get_ping = publicGetPing = Entry('ping', 'public', 'GET', {'cost': 0.2})
645
- public_get_time = publicGetTime = Entry('time', 'public', 'GET', {'cost': 0.2})
644
+ public_get_ping = publicGetPing = Entry('ping', 'public', 'GET', {'cost': 1})
645
+ public_get_time = publicGetTime = Entry('time', 'public', 'GET', {'cost': 1})
646
646
  public_get_depth = publicGetDepth = Entry('depth', 'public', 'GET', {'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]]})
647
- public_get_trades = publicGetTrades = Entry('trades', 'public', 'GET', {'cost': 2})
648
- public_get_aggtrades = publicGetAggTrades = Entry('aggTrades', 'public', 'GET', {'cost': 0.4})
649
- public_get_historicaltrades = publicGetHistoricalTrades = Entry('historicalTrades', 'public', 'GET', {'cost': 2})
650
- public_get_klines = publicGetKlines = Entry('klines', 'public', 'GET', {'cost': 0.4})
647
+ public_get_trades = publicGetTrades = Entry('trades', 'public', 'GET', {'cost': 1})
648
+ public_get_aggtrades = publicGetAggTrades = Entry('aggTrades', 'public', 'GET', {'cost': 1})
649
+ public_get_historicaltrades = publicGetHistoricalTrades = Entry('historicalTrades', 'public', 'GET', {'cost': 5})
650
+ public_get_klines = publicGetKlines = Entry('klines', 'public', 'GET', {'cost': 1})
651
651
  public_get_uiklines = publicGetUiKlines = Entry('uiKlines', 'public', 'GET', {'cost': 0.4})
652
- public_get_ticker_24hr = publicGetTicker24hr = Entry('ticker/24hr', 'public', 'GET', {'cost': 0.4, 'noSymbol': 16})
653
- public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {'cost': 0.4, 'noSymbol': 16})
652
+ public_get_ticker_24hr = publicGetTicker24hr = Entry('ticker/24hr', 'public', 'GET', {'cost': 1, 'noSymbol': 40})
653
+ public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {'cost': 2, 'noSymbol': 100})
654
654
  public_get_ticker_tradingday = publicGetTickerTradingDay = Entry('ticker/tradingDay', 'public', 'GET', {'cost': 0.8})
655
- public_get_ticker_price = publicGetTickerPrice = Entry('ticker/price', 'public', 'GET', {'cost': 0.4, 'noSymbol': 0.8})
656
- public_get_ticker_bookticker = publicGetTickerBookTicker = Entry('ticker/bookTicker', 'public', 'GET', {'cost': 0.4, 'noSymbol': 0.8})
657
- public_get_exchangeinfo = publicGetExchangeInfo = Entry('exchangeInfo', 'public', 'GET', {'cost': 4})
658
- public_get_avgprice = publicGetAvgPrice = Entry('avgPrice', 'public', 'GET', {'cost': 0.4})
655
+ public_get_ticker_price = publicGetTickerPrice = Entry('ticker/price', 'public', 'GET', {'cost': 1, 'noSymbol': 2})
656
+ public_get_ticker_bookticker = publicGetTickerBookTicker = Entry('ticker/bookTicker', 'public', 'GET', {'cost': 1, 'noSymbol': 2})
657
+ public_get_exchangeinfo = publicGetExchangeInfo = Entry('exchangeInfo', 'public', 'GET', {'cost': 10})
658
+ public_get_avgprice = publicGetAvgPrice = Entry('avgPrice', 'public', 'GET', {'cost': 1})
659
659
  public_put_userdatastream = publicPutUserDataStream = Entry('userDataStream', 'public', 'PUT', {'cost': 0.4})
660
660
  public_post_userdatastream = publicPostUserDataStream = Entry('userDataStream', 'public', 'POST', {'cost': 0.4})
661
661
  public_delete_userdatastream = publicDeleteUserDataStream = Entry('userDataStream', 'public', 'DELETE', {'cost': 0.4})
662
- private_get_allorderlist = privateGetAllOrderList = Entry('allOrderList', 'private', 'GET', {'cost': 4})
663
- private_get_openorderlist = privateGetOpenOrderList = Entry('openOrderList', 'private', 'GET', {'cost': 1.2})
664
- private_get_orderlist = privateGetOrderList = Entry('orderList', 'private', 'GET', {'cost': 0.8})
665
- private_get_order = privateGetOrder = Entry('order', 'private', 'GET', {'cost': 0.8})
666
- private_get_openorders = privateGetOpenOrders = Entry('openOrders', 'private', 'GET', {'cost': 1.2, 'noSymbol': 16})
667
- private_get_allorders = privateGetAllOrders = Entry('allOrders', 'private', 'GET', {'cost': 4})
668
- private_get_account = privateGetAccount = Entry('account', 'private', 'GET', {'cost': 4})
669
- private_get_mytrades = privateGetMyTrades = Entry('myTrades', 'private', 'GET', {'cost': 4})
670
- private_get_ratelimit_order = privateGetRateLimitOrder = Entry('rateLimit/order', 'private', 'GET', {'cost': 8})
671
- private_get_mypreventedmatches = privateGetMyPreventedMatches = Entry('myPreventedMatches', 'private', 'GET', {'cost': 4})
662
+ private_get_allorderlist = privateGetAllOrderList = Entry('allOrderList', 'private', 'GET', {'cost': 10})
663
+ private_get_openorderlist = privateGetOpenOrderList = Entry('openOrderList', 'private', 'GET', {'cost': 3})
664
+ private_get_orderlist = privateGetOrderList = Entry('orderList', 'private', 'GET', {'cost': 2})
665
+ private_get_order = privateGetOrder = Entry('order', 'private', 'GET', {'cost': 2})
666
+ private_get_openorders = privateGetOpenOrders = Entry('openOrders', 'private', 'GET', {'cost': 3, 'noSymbol': 40})
667
+ private_get_allorders = privateGetAllOrders = Entry('allOrders', 'private', 'GET', {'cost': 10})
668
+ private_get_account = privateGetAccount = Entry('account', 'private', 'GET', {'cost': 10})
669
+ private_get_mytrades = privateGetMyTrades = Entry('myTrades', 'private', 'GET', {'cost': 10})
670
+ private_get_ratelimit_order = privateGetRateLimitOrder = Entry('rateLimit/order', 'private', 'GET', {'cost': 20})
671
+ private_get_mypreventedmatches = privateGetMyPreventedMatches = Entry('myPreventedMatches', 'private', 'GET', {'cost': 10})
672
672
  private_get_myallocations = privateGetMyAllocations = Entry('myAllocations', 'private', 'GET', {'cost': 4})
673
673
  private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
674
- private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
674
+ private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 1})
675
675
  private_post_orderlist_oco = privatePostOrderListOco = Entry('orderList/oco', 'private', 'POST', {'cost': 0.2})
676
676
  private_post_orderlist_oto = privatePostOrderListOto = Entry('orderList/oto', 'private', 'POST', {'cost': 0.2})
677
677
  private_post_orderlist_otoco = privatePostOrderListOtoco = Entry('orderList/otoco', 'private', 'POST', {'cost': 0.2})
678
678
  private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
679
679
  private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
680
- private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 0.2})
681
- private_post_order_cancelreplace = privatePostOrderCancelReplace = Entry('order/cancelReplace', 'private', 'POST', {'cost': 0.2})
682
- private_post_order_test = privatePostOrderTest = Entry('order/test', 'private', 'POST', {'cost': 0.2})
683
- private_delete_openorders = privateDeleteOpenOrders = Entry('openOrders', 'private', 'DELETE', {'cost': 0.2})
684
- private_delete_orderlist = privateDeleteOrderList = Entry('orderList', 'private', 'DELETE', {'cost': 0.2})
685
- private_delete_order = privateDeleteOrder = Entry('order', 'private', 'DELETE', {'cost': 0.2})
680
+ private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 1})
681
+ private_post_order_cancelreplace = privatePostOrderCancelReplace = Entry('order/cancelReplace', 'private', 'POST', {'cost': 1})
682
+ private_post_order_test = privatePostOrderTest = Entry('order/test', 'private', 'POST', {'cost': 1})
683
+ private_delete_openorders = privateDeleteOpenOrders = Entry('openOrders', 'private', 'DELETE', {'cost': 1})
684
+ private_delete_orderlist = privateDeleteOrderList = Entry('orderList', 'private', 'DELETE', {'cost': 1})
685
+ private_delete_order = privateDeleteOrder = Entry('order', 'private', 'DELETE', {'cost': 1})
686
686
  papi_get_ping = papiGetPing = Entry('ping', 'papi', 'GET', {'cost': 1})
687
687
  papi_get_um_order = papiGetUmOrder = Entry('um/order', 'papi', 'GET', {'cost': 1})
688
688
  papi_get_um_openorder = papiGetUmOpenOrder = Entry('um/openOrder', 'papi', 'GET', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.4'
7
+ __version__ = '4.4.5'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.4'
5
+ __version__ = '4.4.5'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1223,6 +1223,7 @@ class binance(Exchange, ImplicitAPI):
1223
1223
  # exchange-specific options
1224
1224
  'options': {
1225
1225
  'sandboxMode': False,
1226
+ 'fetchMargins': True,
1226
1227
  'fetchMarkets': [
1227
1228
  'spot', # allows CORS in browsers
1228
1229
  'linear', # allows CORS in browsers
@@ -2854,13 +2855,12 @@ class binance(Exchange, ImplicitAPI):
2854
2855
  if type == 'option' and sandboxMode:
2855
2856
  continue
2856
2857
  fetchMarkets.append(type)
2857
- fetchMargins = False
2858
+ fetchMargins = self.safe_bool(self.options, 'fetchMargins', False)
2858
2859
  for i in range(0, len(fetchMarkets)):
2859
2860
  marketType = fetchMarkets[i]
2860
2861
  if marketType == 'spot':
2861
2862
  promisesRaw.append(self.publicGetExchangeInfo(params))
2862
- if self.check_required_credentials(False) and not sandboxMode:
2863
- fetchMargins = True
2863
+ if fetchMargins and self.check_required_credentials(False) and not sandboxMode:
2864
2864
  promisesRaw.append(self.sapiGetMarginAllPairs(params))
2865
2865
  promisesRaw.append(self.sapiGetMarginIsolatedAllPairs(params))
2866
2866
  elif marketType == 'linear':
@@ -44,6 +44,7 @@ class binanceus(binance, ImplicitAPI):
44
44
  'options': {
45
45
  'fetchMarkets': ['spot'],
46
46
  'defaultType': 'spot',
47
+ 'fetchMargins': False,
47
48
  'quoteOrderQty': False,
48
49
  },
49
50
  'has': {
@@ -1535,6 +1535,7 @@ class bitget(Exchange, ImplicitAPI):
1535
1535
  retrieves data on all markets for bitget
1536
1536
  :see: https://www.bitget.com/api-doc/spot/market/Get-Symbols
1537
1537
  :see: https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts
1538
+ :see: https://www.bitget.com/api-doc/margin/common/support-currencies
1538
1539
  :param dict [params]: extra parameters specific to the exchange API endpoint
1539
1540
  :returns dict[]: an array of objects representing market data
1540
1541
  """
@@ -1543,9 +1544,10 @@ class bitget(Exchange, ImplicitAPI):
1543
1544
  if sandboxMode:
1544
1545
  types = ['swap']
1545
1546
  promises = []
1547
+ fetchMargins = False
1546
1548
  for i in range(0, len(types)):
1547
1549
  type = types[i]
1548
- if type == 'swap':
1550
+ if (type == 'swap') or (type == 'future'):
1549
1551
  subTypes = None
1550
1552
  if sandboxMode:
1551
1553
  # the following are simulated trading markets ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
@@ -1553,15 +1555,33 @@ class bitget(Exchange, ImplicitAPI):
1553
1555
  else:
1554
1556
  subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES']
1555
1557
  for j in range(0, len(subTypes)):
1556
- promises.append(self.fetch_markets_by_type(type, self.extend(params, {
1558
+ promises.append(self.publicMixGetV2MixMarketContracts(self.extend(params, {
1557
1559
  'productType': subTypes[j],
1558
1560
  })))
1561
+ elif type == 'spot':
1562
+ promises.append(self.publicSpotGetV2SpotPublicSymbols(params))
1563
+ fetchMargins = True
1564
+ promises.append(self.publicMarginGetV2MarginCurrencies(params))
1565
+ else:
1566
+ raise NotSupported(self.id + ' does not support ' + type + ' market')
1567
+ results = await asyncio.gather(*promises)
1568
+ markets = []
1569
+ self.options['crossMarginPairsData'] = []
1570
+ self.options['isolatedMarginPairsData'] = []
1571
+ for i in range(0, len(results)):
1572
+ res = self.safe_dict(results, i)
1573
+ data = self.safe_list(res, 'data', [])
1574
+ firstData = self.safe_dict(data, 0, {})
1575
+ isBorrowable = self.safe_string(firstData, 'isBorrowable')
1576
+ if fetchMargins and isBorrowable is not None:
1577
+ keysList = list(self.index_by(data, 'symbol').keys())
1578
+ self.options['crossMarginPairsData'] = keysList
1579
+ self.options['isolatedMarginPairsData'] = keysList
1559
1580
  else:
1560
- promises.append(self.fetch_markets_by_type(types[i], params))
1561
- promises = await asyncio.gather(*promises)
1562
- result = promises[0]
1563
- for i in range(1, len(promises)):
1564
- result = self.array_concat(result, promises[i])
1581
+ markets = self.array_concat(markets, data)
1582
+ result = []
1583
+ for i in range(0, len(markets)):
1584
+ result.append(self.parse_market(markets[i]))
1565
1585
  return result
1566
1586
 
1567
1587
  def parse_market(self, market: dict) -> Market:
@@ -1649,11 +1669,20 @@ class bitget(Exchange, ImplicitAPI):
1649
1669
  expiry = None
1650
1670
  expiryDatetime = None
1651
1671
  symbolType = self.safe_string(market, 'symbolType')
1672
+ marginModes = None
1673
+ isMarginTradingAllowed = False
1652
1674
  if symbolType is None:
1653
1675
  type = 'spot'
1654
1676
  spot = True
1655
1677
  pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision')))
1656
1678
  amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
1679
+ hasCrossMargin = self.in_array(marketId, self.options['crossMarginPairsData'])
1680
+ hasIsolatedMargin = self.in_array(marketId, self.options['isolatedMarginPairsData'])
1681
+ marginModes = {
1682
+ 'cross': hasCrossMargin,
1683
+ 'isolated': hasIsolatedMargin,
1684
+ }
1685
+ isMarginTradingAllowed = hasCrossMargin or hasCrossMargin
1657
1686
  else:
1658
1687
  if symbolType == 'perpetual':
1659
1688
  type = 'swap'
@@ -1689,6 +1718,10 @@ class bitget(Exchange, ImplicitAPI):
1689
1718
  preciseAmount.reduce()
1690
1719
  amountString = str(preciseAmount)
1691
1720
  amountPrecision = self.parse_number(amountString)
1721
+ marginModes = {
1722
+ 'cross': True,
1723
+ 'isolated': True,
1724
+ }
1692
1725
  status = self.safe_string_2(market, 'status', 'symbolStatus')
1693
1726
  active = None
1694
1727
  if status is not None:
@@ -1708,7 +1741,8 @@ class bitget(Exchange, ImplicitAPI):
1708
1741
  'settleId': settleId,
1709
1742
  'type': type,
1710
1743
  'spot': spot,
1711
- 'margin': None,
1744
+ 'margin': spot and isMarginTradingAllowed,
1745
+ 'marginModes': marginModes,
1712
1746
  'swap': swap,
1713
1747
  'future': future,
1714
1748
  'option': False,
@@ -1749,88 +1783,6 @@ class bitget(Exchange, ImplicitAPI):
1749
1783
  'info': market,
1750
1784
  }
1751
1785
 
1752
- async def fetch_markets_by_type(self, type, params={}):
1753
- response = None
1754
- if type == 'spot':
1755
- response = await self.publicSpotGetV2SpotPublicSymbols(params)
1756
- elif (type == 'swap') or (type == 'future'):
1757
- response = await self.publicMixGetV2MixMarketContracts(params)
1758
- else:
1759
- raise NotSupported(self.id + ' does not support ' + type + ' market')
1760
- #
1761
- # spot
1762
- #
1763
- # {
1764
- # "code": "00000",
1765
- # "msg": "success",
1766
- # "requestTime": 1700102364653,
1767
- # "data": [
1768
- # {
1769
- # "symbol": "TRXUSDT",
1770
- # "baseCoin": "TRX",
1771
- # "quoteCoin": "USDT",
1772
- # "minTradeAmount": "0",
1773
- # "maxTradeAmount": "10000000000",
1774
- # "takerFeeRate": "0.002",
1775
- # "makerFeeRate": "0.002",
1776
- # "pricePrecision": "6",
1777
- # "quantityPrecision": "4",
1778
- # "quotePrecision": "6",
1779
- # "status": "online",
1780
- # "minTradeUSDT": "5",
1781
- # "buyLimitPriceRatio": "0.05",
1782
- # "sellLimitPriceRatio": "0.05"
1783
- # },
1784
- # ]
1785
- # }
1786
- #
1787
- # swap and future
1788
- #
1789
- # {
1790
- # "code": "00000",
1791
- # "msg": "success",
1792
- # "requestTime": 1700102364709,
1793
- # "data": [
1794
- # {
1795
- # "symbol": "BTCUSDT",
1796
- # "baseCoin": "BTC",
1797
- # "quoteCoin": "USDT",
1798
- # "buyLimitPriceRatio": "0.01",
1799
- # "sellLimitPriceRatio": "0.01",
1800
- # "feeRateUpRatio": "0.005",
1801
- # "makerFeeRate": "0.0002",
1802
- # "takerFeeRate": "0.0006",
1803
- # "openCostUpRatio": "0.01",
1804
- # "supportMarginCoins": ["USDT"],
1805
- # "minTradeNum": "0.001",
1806
- # "priceEndStep": "1",
1807
- # "volumePlace": "3",
1808
- # "pricePlace": "1",
1809
- # "sizeMultiplier": "0.001",
1810
- # "symbolType": "perpetual",
1811
- # "minTradeUSDT": "5",
1812
- # "maxSymbolOrderNum": "200",
1813
- # "maxProductOrderNum": "400",
1814
- # "maxPositionNum": "150",
1815
- # "symbolStatus": "normal",
1816
- # "offTime": "-1",
1817
- # "limitOpenTime": "-1",
1818
- # "deliveryTime": "",
1819
- # "deliveryStartTime": "",
1820
- # "deliveryPeriod": "",
1821
- # "launchTime": "",
1822
- # "fundInterval": "8",
1823
- # "minLever": "1",
1824
- # "maxLever": "125",
1825
- # "posLimit": "0.05",
1826
- # "maintainTime": ""
1827
- # },
1828
- # ]
1829
- # }
1830
- #
1831
- data = self.safe_value(response, 'data', [])
1832
- return self.parse_markets(data)
1833
-
1834
1786
  async def fetch_currencies(self, params={}) -> Currencies:
1835
1787
  """
1836
1788
  fetches all available currencies on an exchange
@@ -115,7 +115,7 @@ class bybit(Exchange, ImplicitAPI):
115
115
  'fetchOpenOrders': True,
116
116
  'fetchOption': True,
117
117
  'fetchOptionChain': True,
118
- 'fetchOrder': False,
118
+ 'fetchOrder': True,
119
119
  'fetchOrderBook': True,
120
120
  'fetchOrders': False,
121
121
  'fetchOrderTrades': True,
@@ -4527,13 +4527,84 @@ class bybit(Exchange, ImplicitAPI):
4527
4527
  :param str id: the order id
4528
4528
  :param str symbol: unified symbol of the market the order was made in
4529
4529
  :param dict [params]: extra parameters specific to the exchange API endpoint
4530
+ :param dict [params.acknowledged]: to suppress the warning, set to True
4530
4531
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4531
4532
  """
4532
- res = await self.is_unified_enabled()
4533
- enableUnifiedAccount = self.safe_bool(res, 1)
4534
- if enableUnifiedAccount:
4535
- raise NotSupported(self.id + ' fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder')
4536
- return await self.fetch_order_classic(id, symbol, params)
4533
+ await self.load_markets()
4534
+ enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
4535
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4536
+ if not isUnifiedAccount:
4537
+ return await self.fetch_order_classic(id, symbol, params)
4538
+ acknowledge = False
4539
+ acknowledge, params = self.handle_option_and_params(params, 'fetchOrder', 'acknowledged')
4540
+ if not acknowledge:
4541
+ raise ArgumentsRequired(self.id + ' fetchOrder() can only access an order if it is in last 500 orders(of any status) for your account. Set params["acknowledged"] = True to hide self warning. Alternatively, we suggest to use fetchOpenOrder or fetchClosedOrder')
4542
+ market = self.market(symbol)
4543
+ marketType = None
4544
+ marketType, params = self.get_bybit_type('fetchOrder', market, params)
4545
+ request: dict = {
4546
+ 'symbol': market['id'],
4547
+ 'orderId': id,
4548
+ 'category': marketType,
4549
+ }
4550
+ isTrigger = None
4551
+ isTrigger, params = self.handle_param_bool_2(params, 'trigger', 'stop', False)
4552
+ if isTrigger:
4553
+ request['orderFilter'] = 'StopOrder'
4554
+ response = await self.privateGetV5OrderRealtime(self.extend(request, params))
4555
+ #
4556
+ # {
4557
+ # "retCode": 0,
4558
+ # "retMsg": "OK",
4559
+ # "result": {
4560
+ # "nextPageCursor": "1321052653536515584%3A1672217748287%2C1321052653536515584%3A1672217748287",
4561
+ # "category": "spot",
4562
+ # "list": [
4563
+ # {
4564
+ # "symbol": "ETHUSDT",
4565
+ # "orderType": "Limit",
4566
+ # "orderLinkId": "1672217748277652",
4567
+ # "orderId": "1321052653536515584",
4568
+ # "cancelType": "UNKNOWN",
4569
+ # "avgPrice": "",
4570
+ # "stopOrderType": "tpslOrder",
4571
+ # "lastPriceOnCreated": "",
4572
+ # "orderStatus": "Cancelled",
4573
+ # "takeProfit": "",
4574
+ # "cumExecValue": "0",
4575
+ # "triggerDirection": 0,
4576
+ # "isLeverage": "0",
4577
+ # "rejectReason": "",
4578
+ # "price": "1000",
4579
+ # "orderIv": "",
4580
+ # "createdTime": "1672217748287",
4581
+ # "tpTriggerBy": "",
4582
+ # "positionIdx": 0,
4583
+ # "timeInForce": "GTC",
4584
+ # "leavesValue": "500",
4585
+ # "updatedTime": "1672217748287",
4586
+ # "side": "Buy",
4587
+ # "triggerPrice": "1500",
4588
+ # "cumExecFee": "0",
4589
+ # "leavesQty": "0",
4590
+ # "slTriggerBy": "",
4591
+ # "closeOnTrigger": False,
4592
+ # "cumExecQty": "0",
4593
+ # "reduceOnly": False,
4594
+ # "qty": "0.5",
4595
+ # "stopLoss": "",
4596
+ # "triggerBy": "1192.5"
4597
+ # }
4598
+ # ]
4599
+ # },
4600
+ # "retExtInfo": {},
4601
+ # "time": 1672219526294
4602
+ # }
4603
+ #
4604
+ result = self.safe_dict(response, 'result', {})
4605
+ innerList = self.safe_list(result, 'list', [])
4606
+ order = self.safe_dict(innerList, 0, {})
4607
+ return self.parse_order(order, market)
4537
4608
 
4538
4609
  async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4539
4610
  res = await self.is_unified_enabled()
@@ -667,9 +667,9 @@ class lykke(Exchange, ImplicitAPI):
667
667
  currencyId = self.safe_string(balance, 'assetId')
668
668
  code = self.safe_currency_code(currencyId)
669
669
  account = self.account()
670
- free = self.safe_string(balance, 'available')
670
+ total = self.safe_string(balance, 'available')
671
671
  used = self.safe_string(balance, 'reserved')
672
- account['free'] = free
672
+ account['total'] = total
673
673
  account['used'] = used
674
674
  result[code] = account
675
675
  return self.safe_balance(result)
@@ -104,7 +104,7 @@ class mexc(Exchange, ImplicitAPI):
104
104
  'fetchOrderBooks': None,
105
105
  'fetchOrders': True,
106
106
  'fetchOrderTrades': True,
107
- 'fetchPosition': True,
107
+ 'fetchPosition': 'emulated',
108
108
  'fetchPositionHistory': 'emulated',
109
109
  'fetchPositionMode': True,
110
110
  'fetchPositions': True,
@@ -2737,6 +2737,9 @@ class mexc(Exchange, ImplicitAPI):
2737
2737
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2738
2738
  """
2739
2739
  cancels an open order
2740
+ :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-order
2741
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
2742
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-stop-limit-trigger-order-under-maintenance
2740
2743
  :param str id: order id
2741
2744
  :param str symbol: unified symbol of the market the order was made in
2742
2745
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2839,6 +2842,7 @@ class mexc(Exchange, ImplicitAPI):
2839
2842
  async def cancel_orders(self, ids, symbol: Str = None, params={}):
2840
2843
  """
2841
2844
  cancel multiple orders
2845
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
2842
2846
  :param str[] ids: order ids
2843
2847
  :param str symbol: unified market symbol, default is None
2844
2848
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4452,6 +4456,7 @@ class mexc(Exchange, ImplicitAPI):
4452
4456
  async def fetch_position(self, symbol: str, params={}):
4453
4457
  """
4454
4458
  fetch data on a single open contract trade position
4459
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4455
4460
  :param str symbol: unified market symbol of the market the position is held in, default is None
4456
4461
  :param dict [params]: extra parameters specific to the exchange API endpoint
4457
4462
  :returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
@@ -4467,6 +4472,7 @@ class mexc(Exchange, ImplicitAPI):
4467
4472
  async def fetch_positions(self, symbols: Strings = None, params={}):
4468
4473
  """
4469
4474
  fetch all open positions
4475
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4470
4476
  :param str[]|None symbols: list of unified market symbols
4471
4477
  :param dict [params]: extra parameters specific to the exchange API endpoint
4472
4478
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
@@ -640,7 +640,7 @@ class paradex(Exchange, ImplicitAPI):
640
640
  'low': None,
641
641
  'bid': self.safe_string(ticker, 'bid'),
642
642
  'bidVolume': None,
643
- 'ask': self.safe_string(ticker, 'sdk'),
643
+ 'ask': self.safe_string(ticker, 'ask'),
644
644
  'askVolume': None,
645
645
  'vwap': None,
646
646
  'open': None,
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.4'
7
+ __version__ = '4.4.5'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/binance.py CHANGED
@@ -1222,6 +1222,7 @@ class binance(Exchange, ImplicitAPI):
1222
1222
  # exchange-specific options
1223
1223
  'options': {
1224
1224
  'sandboxMode': False,
1225
+ 'fetchMargins': True,
1225
1226
  'fetchMarkets': [
1226
1227
  'spot', # allows CORS in browsers
1227
1228
  'linear', # allows CORS in browsers
@@ -2853,13 +2854,12 @@ class binance(Exchange, ImplicitAPI):
2853
2854
  if type == 'option' and sandboxMode:
2854
2855
  continue
2855
2856
  fetchMarkets.append(type)
2856
- fetchMargins = False
2857
+ fetchMargins = self.safe_bool(self.options, 'fetchMargins', False)
2857
2858
  for i in range(0, len(fetchMarkets)):
2858
2859
  marketType = fetchMarkets[i]
2859
2860
  if marketType == 'spot':
2860
2861
  promisesRaw.append(self.publicGetExchangeInfo(params))
2861
- if self.check_required_credentials(False) and not sandboxMode:
2862
- fetchMargins = True
2862
+ if fetchMargins and self.check_required_credentials(False) and not sandboxMode:
2863
2863
  promisesRaw.append(self.sapiGetMarginAllPairs(params))
2864
2864
  promisesRaw.append(self.sapiGetMarginIsolatedAllPairs(params))
2865
2865
  elif marketType == 'linear':
ccxt/binanceus.py CHANGED
@@ -44,6 +44,7 @@ class binanceus(binance, ImplicitAPI):
44
44
  'options': {
45
45
  'fetchMarkets': ['spot'],
46
46
  'defaultType': 'spot',
47
+ 'fetchMargins': False,
47
48
  'quoteOrderQty': False,
48
49
  },
49
50
  'has': {