fetch the set leverage for a market :param str symbol: unified symbol of the market :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.account]: will default to walletAddress if not provided :returns dict: a `leve
(self, symbol: str, params={})
| 639 | return self.safe_balance(result) |
| 640 | |
| 641 | async def fetch_leverage(self, symbol: str, params={}) -> Leverage: |
| 642 | """ |
| 643 | fetch the set leverage for a market |
| 644 | :param str symbol: unified symbol of the market |
| 645 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 646 | :param str [params.account]: will default to walletAddress if not provided |
| 647 | :returns dict: a `leverage structure <https://docs.ccxt.com/?id=leverage-structure>` |
| 648 | """ |
| 649 | await self.load_account_settings() |
| 650 | await self.load_markets() |
| 651 | market = self.market(symbol) |
| 652 | userAccount = None |
| 653 | userAccount, params = self.handle_origin_and_single_address('fetchLeverage', params) |
| 654 | cacheAddress = self.walletAddress |
| 655 | settings = None |
| 656 | if userAccount == cacheAddress: |
| 657 | settings = self.handle_option('fetchLeverage', 'settings', None) |
| 658 | else: |
| 659 | request = { |
| 660 | 'account': userAccount, |
| 661 | } |
| 662 | settings = await self.fetch_account_settings(self.extend(request, params)) |
| 663 | setting = self.safe_dict(settings, symbol, None) |
| 664 | if setting is None: |
| 665 | # NOTE: Upon account creation, all markets have margin settings default to cross margin and leverage default to max. |
| 666 | # When querying self endpoint, all markets with default margin and leverage settings on self account will return blank. |
| 667 | return self.parse_leverage_from_market(market) |
| 668 | else: |
| 669 | return self.parse_leverage_from_setting(symbol, setting) |
| 670 | |
| 671 | def parse_leverage_from_setting(self, symbol: Str, setting: dict) -> Leverage: |
| 672 | # { |
nothing calls this directly
no test coverage detected