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

Method create_convert_trade

python/ccxt/bybit.py:8807–8838  ·  view source on GitHub ↗

convert from one currency to another https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote :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: th

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

Source from the content-addressed store, hash-verified

8805 return self.parse_conversion(data, fromCurrency, toCurrency)
8806
8807 def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
8808 """
8809 convert from one currency to another
8810
8811 https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
8812
8813 :param str id: the id of the trade that you want to make
8814 :param str fromCode: the currency that you want to sell and convert from
8815 :param str toCode: the currency that you want to buy and convert into
8816 :param float amount: how much you want to trade in units of the from currency
8817 :param dict [params]: extra parameters specific to the exchange API endpoint
8818 :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
8819 """
8820 self.load_markets()
8821 request = {
8822 'quoteTxId': id,
8823 }
8824 response = self.privatePostV5AssetExchangeConvertExecute(self.extend(request, params))
8825 #
8826 # {
8827 # "retCode": 0,
8828 # "retMsg": "ok",
8829 # "result": {
8830 # "exchangeStatus": "processing",
8831 # "quoteTxId": "1010020692439483803499737088"
8832 # },
8833 # "retExtInfo": {},
8834 # "time": 1727257904969
8835 # }
8836 #
8837 data = self.safe_dict(response, 'result', {})
8838 return self.parse_conversion(data)
8839
8840 def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
8841 """

Callers

nothing calls this directly

Calls 5

parse_conversionMethod · 0.95
safe_dictMethod · 0.80
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected