fetch a quote for converting from one currency to another https://developers.binance.com/docs/convert/trade/Send-quote-request :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
(self, fromCode: str, toCode: str, amount: Num = None, params={})
| 13283 | return result |
| 13284 | |
| 13285 | def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion: |
| 13286 | """ |
| 13287 | fetch a quote for converting from one currency to another |
| 13288 | |
| 13289 | https://developers.binance.com/docs/convert/trade/Send-quote-request |
| 13290 | |
| 13291 | :param str fromCode: the currency that you want to sell and convert from |
| 13292 | :param str toCode: the currency that you want to buy and convert into |
| 13293 | :param float amount: how much you want to trade in units of the from currency |
| 13294 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 13295 | :param str [params.walletType]: either 'SPOT' or 'FUNDING', the default is 'SPOT' |
| 13296 | :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>` |
| 13297 | """ |
| 13298 | if amount is None: |
| 13299 | raise ArgumentsRequired(self.id + ' fetchConvertQuote() requires an amount argument') |
| 13300 | self.load_markets() |
| 13301 | request = { |
| 13302 | 'fromAsset': fromCode, |
| 13303 | 'toAsset': toCode, |
| 13304 | 'fromAmount': amount, |
| 13305 | } |
| 13306 | response = self.sapiPostConvertGetQuote(self.extend(request, params)) |
| 13307 | # |
| 13308 | # { |
| 13309 | # "quoteId":"12415572564", |
| 13310 | # "ratio":"38163.7", |
| 13311 | # "inverseRatio":"0.0000262", |
| 13312 | # "validTimestamp":1623319461670, |
| 13313 | # "toAmount":"3816.37", |
| 13314 | # "fromAmount":"0.1" |
| 13315 | # } |
| 13316 | # |
| 13317 | fromCurrency = self.currency(fromCode) |
| 13318 | toCurrency = self.currency(toCode) |
| 13319 | return self.parse_conversion(response, fromCurrency, toCurrency) |
| 13320 | |
| 13321 | def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion: |
| 13322 | """ |
nothing calls this directly
no test coverage detected