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

Method create_convert_trade

python/ccxt/whitebit.py:3475–3501  ·  view source on GitHub ↗

convert from one currency to another https://docs.whitebit.com/private/http-trade-v4/#convert-confirm :param str id: the id of the trade that you want to make :param str fromCode: the currency that you want to sell and convert from :param str toCode: the cu

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

Source from the content-addressed store, hash-verified

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 """
3477 convert from one currency to another
3478
3479 https://docs.whitebit.com/private/http-trade-v4/#convert-confirm
3480
3481 :param str id: the id of the trade that you want to make
3482 :param str fromCode: the currency that you want to sell and convert from
3483 :param str toCode: the currency that you want to buy and convert into
3484 :param float [amount]: how much you want to trade in units of the from currency
3485 :param dict [params]: extra parameters specific to the exchange API endpoint
3486 :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
3487 """
3488 self.load_markets()
3489 fromCurrency = self.currency(fromCode)
3490 toCurrency = self.currency(toCode)
3491 request = {
3492 'quoteId': id,
3493 }
3494 response = self.v4PrivatePostConvertConfirm(self.extend(request, params))
3495 #
3496 # {
3497 # "finalGive": "4",
3498 # "finalReceive": "0.00004772"
3499 # }
3500 #
3501 return self.parse_conversion(response, fromCurrency, toCurrency)
3502
3503 def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
3504 """

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