CrowdTrendz DEX icon

CrowdTrendz DEX

Interact with Cardano blockchain wallets and Minswap DEX

Calculate Quote Prices

AI-generated

Summary

Calculate price metrics from the incoming item’s quote data. Reads quote (or treats the item itself as the quote), extracts amounts from a direct quote or the first route, and returns the input-to-output price and minimum price using a 3% default slippage for route-based quotes.

Inputs

  • Incoming item JSON (required) — Provide quote data as quote.amount_in and quote.amount_out (optionally quote.min_amount_out), or as quote.routes with at least one route containing swapAmount.quantity and returnAmount.quantity. Optional top-level fromToken, toToken, and settings.humanReadableAmounts affect token labels and ADA unit conversion.

Output shape

A single item per input item, containing a timestamp and either calculated price metrics or an error.

Successful results include fromToken, toToken, pricePerToken, and minPricePerToken. Missing token labels default to unknown. When settings.humanReadableAmounts is false or absent, amounts are converted between lovelace and ADA only for tokens labeled lovelace. Unparseable quote data returns a timestamp and error field; it does not throw from the calculation helper.

Links

Discussion