VeloraQuote
Documentation for eth_defi.velora.quote.VeloraQuote Python class.
- class VeloraQuote
Bases:
objectVelora price quote response.
Contains the optimal route and pricing information for a swap.
Example response data:
{"blockNumber": 12345678, "network": 1, "srcToken": "0x...", "srcDecimals": 18, "srcAmount": "1000000000000000000", "destToken": "0x...", "destDecimals": 6, "destAmount": "3500000000", "bestRoute": [...], "gasCostUSD": "5.93", "contractAddress": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", "contractMethod": "multiSwap", "srcUSD": "3500.00", "destUSD": "3500.00"}
Attributes summary
Token we are going to receive (token out)
Token we are losing (token in)
Raw data from Velora /prices endpoint (the priceRoute)
Methods summary
__init__(buy_token, sell_token, data)Get the buy amount from the quote.
Get estimated gas cost in USD.
Get the price implied by the quote (buy amount / sell amount).
Get the sell amount from the quote.
pformat()Pretty format the quote data for logging.
- buy_token: eth_defi.token.TokenDetails
Token we are going to receive (token out)
- sell_token: eth_defi.token.TokenDetails
Token we are losing (token in)
- data: dict
Raw data from Velora /prices endpoint (the priceRoute)
This is passed to the /transactions endpoint to build the swap tx.
- get_buy_amount()
Get the buy amount from the quote.
- Returns
Amount of buy token we will receive (human-readable decimals)
- Return type
- get_sell_amount()
Get the sell amount from the quote.
- Returns
Amount of sell token we will spend (human-readable decimals)
- Return type
- get_price()
Get the price implied by the quote (buy amount / sell amount).
- Returns
Price as buy_token per sell_token
- Return type
- get_gas_cost_usd()
Get estimated gas cost in USD.
- Returns
Gas cost in USD or None if not available
- Return type
decimal.Decimal | None
- pformat()
Pretty format the quote data for logging.
- Return type
- __init__(buy_token, sell_token, data)
- Parameters
buy_token (eth_defi.token.TokenDetails) –
sell_token (eth_defi.token.TokenDetails) –
data (dict) –
- Return type
None