{"uid":"cap_iWx7sbOMmcmAUV5YqfyiD","slug":"amm-price-impact-bps-9e75d849","name":"AMM Price Impact (bps)","description":"AMM price impact in bps for a swap input against reserves. Call when pre-trade impact checks for pool size vs order size. Returns impact bps and mid vs execution as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.","url":"https://api.delx.ai/api/v1/x402/amm-price-impact-bps","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"fee_bps":{"type":"integer","description":"Input field: fee bps."},"amount_in":{"type":"integer","description":"Input field: amount in."},"reserve_in":{"type":"integer","description":"Input field: reserve in."},"reserve_out":{"type":"integer","description":"Input field: reserve out."}}},"responseSchema":{"type":"json","example":{"schema":"delx/util-amm-price-impact-bps/v1","amount_in":50,"amount_out":47.48297375815593,"impact_bps":530.0902708124378}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_VHbsSVEuGir9Bnx_JPyUF","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the price impact in basis points for a swap against AMM reserves using deterministic constant-product math, returning mid-price vs execution price comparison.","exampleAgentPrompt":"Before I execute this swap, can you calculate the AMM price impact in basis points? I'm swapping 5000 units in, the pool has 1000000 units reserve_in and 800000 units reserve_out, with a 30 bps fee.","exampleUseCases":[{"title":"Pre-trade slippage guard for DEX bot","prompt":"I'm about to swap 50000 USDC worth of tokens into a pool with 2000000 reserve_in and 1500000 reserve_out at 30 bps fee — can you tell me the price impact in bps so I know if it's within my 50 bps slippage limit?"},{"title":"Pool depth adequacy check for large order","prompt":"We have a whale order of 200000 units going into a pool with only 500000 in reserve_in and 480000 in reserve_out with a 25 bps fee — what's the price impact in basis points so we can decide whether to split the order?"},{"title":"Backtesting AMM fill quality","prompt":"For my backtest, calculate the price impact bps for a 10000 unit swap where reserve_in was 300000 and reserve_out was 310000 with a 30 bps fee, so I can compare mid price versus execution price."}],"resultDescription":"Returns a deterministic JSON object containing the price impact in basis points, the mid price derived from pool reserves, and the execution price after applying the constant-product formula and fee, computed entirely from the supplied inputs with no external data calls.","failureModes":["Missing required fields (amount_in, reserve_in, reserve_out) returns a validation error","Zero reserve values cause division-by-zero errors","Extremely large amount_in relative to reserves may produce >100% impact values that must be interpreted carefully","Invalid types (non-integer inputs) result in schema validation failures","Payment failure via x402 protocol prevents endpoint access"],"whenToPreferThis":"Choose this endpoint when you need a fast, deterministic, offline-style calculation of AMM price impact using the constant-product (x*y=k) formula before submitting a trade. It requires no RPC calls, no live market data, no API keys, and no external dependencies — making it ideal for pre-trade guardrails, simulation loops, backtesting pipelines, or any context where you already have pool reserve data and need a reliable impact estimate in basis points.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T19:02:49.775Z","isFirstParty":false}