Slippage
Slippage is how much worse than the estimate the result may be before the swap fails. It’s set with slippage_type and one or two values, written as a fraction: 0.01 is 1%, 0.001 is 0.1%.
slippage_type=Fixed&slippage=0.01Uses exactly the slippage you give. Must be between 0 and 1.
slippage_type=Auto&min_slippage=0.001&max_slippage=0.05Picks a slippage between min_slippage and max_slippage based on how volatile the tokens are. Both must be between 0 and 1, and max_slippage must not be less than min_slippage.
How far toward max_slippage it goes depends on the more volatile of the two tokens:
- Tokens created in the last ~100 blocks get
max_slippage. - Tokens created in the last ~1000 blocks get 60% of the way to
max_slippage. - Older tokens get more slippage the more their price changed in the last 24 hours, and the higher their 24h volume is compared to their market cap and liquidity. Calm, liquid tokens stay at
min_slippage. - Tokens the aggregator has no data about get 80% of the way to
max_slippage.
Use Auto when you trade many different tokens and don’t want to tune slippage for each one: stablecoin pairs get tight limits, fresh meme tokens get loose ones.
Limits
Section titled “Limits”Whatever the type, the slippage actually used is clamped to between 0.01% and 99.99%.
Routes without slippage
Section titled “Routes without slippage”Quotes with "has_slippage": false have a guaranteed result: staking and unstaking (Meta Pool, LiNEAR, rNEAR, xRHEA) and 1:1 conversions (Wrap). For them, worst_case_amount equals estimated_amount and the slippage setting doesn’t matter.