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
| Need | Parameter | Use |
|---|---|---|
| Fewer paths in the response | maxSplits | Lower it to reduce split count |
| Fewer hops per route | maxHops | Lower it when routes become too complex |
| Path details for UI or debugging | includePaths=true | Enable only when you need paths[] |
| MultiversX algorithm override | algorithm | Use greedy, lagrangian, or hybrid |
| Stellar direct-user comparison | platform=all | Compare Soroban and Classic planes; returns one winning quote |
Algorithm Choices
| Algorithm | Mechanics | Use when |
|---|---|---|
greedy | Allocates chunks to the highest-rate candidate path until marginal output declines. | You need bounded compute and can accept a local allocation result. |
lagrangian | Searches for a marginal-rate balance across active AMM paths. | You need a split allocation for a larger trade and can allow more compute. |
hybrid | Runs both paths and returns the larger output. | You want the server default on MultiversX. |
maxSplits, maxHops, platform, and includePaths instead of an algorithm parameter.
Worked Example
amountOutis present and non-zero.pathsis present whenincludePaths=true.- Each
paths[].splitPpmvalue adds up to1000000across active paths.
Edge Cases
| Case | Behavior | Fix |
|---|---|---|
| Quote exceeds transaction budget | The service may fail or degrade the route, depending on product. | Lower maxSplits or maxHops. |
| Reverse quote | Split support is product-specific; Stellar reverse quotes are single-path. | Keep maxSplits=1 unless the endpoint documents split reverse support. |
| Missing path details | includePaths defaults to false on quote endpoints. | Pass includePaths=true. |

