* @method * @name pacifica#fetchMarginMode * @description fetches the margin mode of the trading pair * @param {string} symbol unified symbol of the market to fetch the margin mode for * @param {object} [params] extra parameters specific to the exchange API endpoint * @param
(symbol, params = {})
| 769 | * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/?id=margin-mode-structure} |
| 770 | */ |
| 771 | async fetchMarginMode(symbol, params = {}) { |
| 772 | await this.loadAccountSettings(); |
| 773 | let userAccount = undefined; |
| 774 | [userAccount, params] = this.handleOriginAndSingleAddress('fetchMarginMode', params); |
| 775 | const cacheAddress = this.walletAddress; |
| 776 | let settings = undefined; |
| 777 | if (userAccount === cacheAddress) { |
| 778 | settings = this.handleOption('fetchMarginMode', 'settings', undefined); |
| 779 | } |
| 780 | else { |
| 781 | const request = { |
| 782 | 'account': userAccount, |
| 783 | }; |
| 784 | settings = await this.fetchAccountSettings(this.extend(request, params)); |
| 785 | } |
| 786 | // { |
| 787 | // "WLFI/USDC:USDC": { |
| 788 | // "symbol": "WLFI", |
| 789 | // "isolated": false, |
| 790 | // "leverage": 5, |
| 791 | // "created_at": 1758085929703, |
| 792 | // "updated_at": 1758086074002 |
| 793 | // }, |
| 794 | // } |
| 795 | const setting = this.safeDict(settings, symbol, undefined); |
| 796 | if (setting === undefined) { |
| 797 | // NOTE: Upon account creation, all markets have margin settings default to cross margin and leverage default to max. |
| 798 | // When querying this endpoint, all markets with default margin and leverage settings on this account will return blank. |
| 799 | return { |
| 800 | 'symbol': symbol, |
| 801 | 'marginMode': this.handleOption('fetchMarginMode', 'defaultMarginMode', 'cross'), |
| 802 | }; |
| 803 | } |
| 804 | else { |
| 805 | return this.parseMarginModeFromSetting(symbol, setting); |
| 806 | } |
| 807 | } |
| 808 | parseMarginModeFromSetting(symbol, setting) { |
| 809 | // { |
| 810 | // "symbol": "WLFI", |
nothing calls this directly
no test coverage detected