fetch a quote for converting from one currency to another https://phemex-docs.github.io/#rfq-quote :param str fromCode: the currency that you want to sell and convert from :param str toCode: the currency that you want to buy and convert into :param float am
(self, fromCode: str, toCode: str, amount: Num = None, params={})
| 4897 | }, market) |
| 4898 | |
| 4899 | def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion: |
| 4900 | """ |
| 4901 | fetch a quote for converting from one currency to another |
| 4902 | |
| 4903 | https://phemex-docs.github.io/#rfq-quote |
| 4904 | |
| 4905 | :param str fromCode: the currency that you want to sell and convert from |
| 4906 | :param str toCode: the currency that you want to buy and convert into |
| 4907 | :param float amount: how much you want to trade in units of the from currency |
| 4908 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 4909 | :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>` |
| 4910 | """ |
| 4911 | self.load_markets() |
| 4912 | fromCurrency = self.currency(fromCode) |
| 4913 | toCurrency = self.currency(toCode) |
| 4914 | valueScale = self.safe_integer(fromCurrency, 'valueScale') |
| 4915 | request = { |
| 4916 | 'fromCurrency': fromCode, |
| 4917 | 'toCurrency': toCode, |
| 4918 | 'fromAmountEv': self.to_en(amount, valueScale), |
| 4919 | } |
| 4920 | response = self.privateGetAssetsQuote(self.extend(request, params)) |
| 4921 | # |
| 4922 | # { |
| 4923 | # "code": 0, |
| 4924 | # "msg": "OK", |
| 4925 | # "data": { |
| 4926 | # "code": "GIF...AAA", |
| 4927 | # "quoteArgs": { |
| 4928 | # "origin": 10, |
| 4929 | # "price": "0.00000939", |
| 4930 | # "proceeds": "0.00000000", |
| 4931 | # "ttlMs": 7000, |
| 4932 | # "expireAt": 1739875826009, |
| 4933 | # "requestAt": 1739875818009, |
| 4934 | # "quoteAt": 1739875816594 |
| 4935 | # } |
| 4936 | # } |
| 4937 | # } |
| 4938 | # |
| 4939 | data = self.safe_dict(response, 'data', {}) |
| 4940 | return self.parse_conversion(data, fromCurrency, toCurrency) |
| 4941 | |
| 4942 | def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion: |
| 4943 | """ |
nothing calls this directly
no test coverage detected