MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_convert_quote

Method fetch_convert_quote

python/ccxt/whitebit.py:3440–3473  ·  view source on GitHub ↗

fetch a quote for converting from one currency to another https://docs.whitebit.com/private/http-trade-v4/#convert-estimate :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 int

(self, fromCode: str, toCode: str, amount: Num = None, params={})

Source from the content-addressed store, hash-verified

3438 return self.parse_transactions(records, currency, since, limit)
3439
3440 def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
3441 """
3442 fetch a quote for converting from one currency to another
3443
3444 https://docs.whitebit.com/private/http-trade-v4/#convert-estimate
3445
3446 :param str fromCode: the currency that you want to sell and convert from
3447 :param str toCode: the currency that you want to buy and convert into
3448 :param float amount: how much you want to trade in units of the from currency
3449 :param dict [params]: extra parameters specific to the exchange API endpoint
3450 :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
3451 """
3452 self.load_markets()
3453 fromCurrency = self.currency(fromCode)
3454 toCurrency = self.currency(toCode)
3455 request = {
3456 'from': fromCode,
3457 'to': toCode,
3458 'amount': self.number_to_string(amount),
3459 'direction': 'from',
3460 }
3461 response = self.v4PrivatePostConvertEstimate(self.extend(request, params))
3462 #
3463 # {
3464 # "give": "4",
3465 # "receive": "0.00004762",
3466 # "rate": "0.0000119",
3467 # "id": "1740889",
3468 # "expireAt": 1741090147,
3469 # "from": "USDT",
3470 # "to": "BTC"
3471 # }
3472 #
3473 return self.parse_conversion(response, fromCurrency, toCurrency)
3474
3475 def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
3476 """

Callers

nothing calls this directly

Calls 5

parse_conversionMethod · 0.95
load_marketsMethod · 0.45
currencyMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected