> ## Documentation Index
> Fetch the complete documentation index at: https://pond.dflow.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Slippage and Price Impact

> How slippage and price impact work and how to control them in Trading API requests

Slippage is the price drift between quote and execution. Price impact is the gap between market price and your effective fill, caused by your trade's size relative to available liquidity.

## Slippage

[`GET /order`](https://pond.dflow.net/resources/trading-api/order/order) uses auto slippage unless you set `slippageBps`.

To set your own, set `slippageBps` to a non-negative integer in basis points (1 bp = 0.01%). If the execution price falls outside the tolerance, the trade fails safely.

Setting slippage too low can cause trades to fail during high volatility or when liquidity is thin.

> [accordion] Request an Order with Custom Slippage
>
> ```typescript theme={null}
> import "dotenv/config";
>
> const DFLOW_TRADE_API_URL =
>   process.env.DFLOW_TRADE_API_URL ?? "https://dev-quote-api.dflow.net";
> const DFLOW_API_KEY = process.env.DFLOW_API_KEY; // optional; not needed for dev endpoints
> const headers: HeadersInit = {};
> if (DFLOW_API_KEY) headers["x-api-key"] = DFLOW_API_KEY;
>
> const SOL_MINT = "So11111111111111111111111111111111111111112";
> const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
>
> const params = new URLSearchParams({
>   inputMint: SOL_MINT,
>   outputMint: USDC_MINT,
>   amount: "1000000000", // 1 SOL
>   slippageBps: "500", // 5%
> });
> const response = await fetch(`${DFLOW_TRADE_API_URL}/order?${params}`, { headers });
> const order = await response.json();
>
> console.log("slippageBps:", order.slippageBps, "minOutAmount:", order.minOutAmount);
> ```

## Price Impact

Set `priceImpactTolerancePct` on [`GET /order`](https://pond.dflow.net/resources/trading-api/order/order#parameter-price-impact-tolerance-pct) to an integer percent from 0 to 100 (1 = 1%). If unspecified, the server determines the threshold. A route that exceeds it returns a `price_impact_too_high` [error](https://pond.dflow.net/resources/error-codes.md).

`/order` returns the estimate as `priceImpactPct`, where `0.01` means 1%.

> [accordion] Request an Order with a Price Impact Limit
>
> ```typescript theme={null}
> import "dotenv/config";
>
> const DFLOW_TRADE_API_URL =
>   process.env.DFLOW_TRADE_API_URL ?? "https://dev-quote-api.dflow.net";
> const DFLOW_API_KEY = process.env.DFLOW_API_KEY; // optional; not needed for dev endpoints
> const headers: HeadersInit = {};
> if (DFLOW_API_KEY) headers["x-api-key"] = DFLOW_API_KEY;
>
> const SOL_MINT = "So11111111111111111111111111111111111111112";
> const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
>
> const params = new URLSearchParams({
>   inputMint: SOL_MINT,
>   outputMint: USDC_MINT,
>   amount: "1000000000000", // 1,000 SOL
>   priceImpactTolerancePct: "1", // reject routes with more than 1% price impact
> });
> const response = await fetch(`${DFLOW_TRADE_API_URL}/order?${params}`, { headers });
> const order = await response.json();
>
> if (order.code === "price_impact_too_high") {
>   console.log("Rejected:", order.msg);
> } else {
>   console.log("Price impact:", Number(order.priceImpactPct) * 100, "%");
> }
> ```
