Skip to main content
Use routing controls to cap path search, split count, and response size for swap quotes.

Definition

The Aggregator builds candidate paths from the current pool snapshot, scores output for each path, and allocates the requested amount across one or more paths. The quote response reports the amount, price impact, and optional path breakdown.

Decision Table

NeedParameterUse
Fewer paths in the responsemaxSplitsLower it to reduce split count
Fewer hops per routemaxHopsLower it when routes become too complex
Path details for UI or debuggingincludePaths=trueEnable only when you need paths[]
MultiversX algorithm overridealgorithmUse greedy, lagrangian, or hybrid
Stellar direct-user comparisonplatform=allCompare Soroban and Classic planes; returns one winning quote

Algorithm Choices

AlgorithmMechanicsUse when
greedyAllocates chunks to the highest-rate candidate path until marginal output declines.You need bounded compute and can accept a local allocation result.
lagrangianSearches for a marginal-rate balance across active AMM paths.You need a split allocation for a larger trade and can allow more compute.
hybridRuns both paths and returns the larger output.You want the server default on MultiversX.
The Stellar Aggregator selects routing internally. Use maxSplits, maxHops, platform, and includePaths instead of an algorithm parameter.

Worked Example

curl "https://swap.xoxno.com/api/v1/quote?\
from=WEGLD-bd4d79&\
to=USDC-c76f1f&\
amountIn=1000000000000000000&\
maxSplits=3&\
maxHops=4&\
includePaths=true"
Verify the result:
  • amountOut is present and non-zero.
  • paths is present when includePaths=true.
  • Each paths[].splitPpm value adds up to 1000000 across active paths.

Edge Cases

CaseBehaviorFix
Quote exceeds transaction budgetThe service may fail or degrade the route, depending on product.Lower maxSplits or maxHops.
Reverse quoteSplit support is product-specific; Stellar reverse quotes are single-path.Keep maxSplits=1 unless the endpoint documents split reverse support.
Missing path detailsincludePaths defaults to false on quote endpoints.Pass includePaths=true.