This endpoint allows users to preview the results of a swap before execution. It calculates the expected output amount, price impact, and fees without actually performing the swap or requiring any deposits.
The simulation:
Price impact measures how much the swap moves the pool price:
5%: High impact, consider splitting the trade
Simulations are read-only operations and don’t require authentication. Anyone can simulate swaps to explore pool rates.
pool_id - LP public key of the poolasset_in_address - Asset being providedasset_out_address - Asset being receivedamount_in - Amount to simulate swapping200 OK with simulation results400 Bad Request if pool or assets are invalid500 Internal Server Error if simulation failsSwap simulation parameters including pool, assets, and amount
Request body for simulating a swap without executing it.
Simulation allows users to preview swap outcomes including expected output, price impact, and fees before committing to the transaction.
LP public key of the pool to simulate the swap through. The pool must exist and be active.
"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
Address of the asset the user would provide. Must be one of the two assets in the selected pool.
"03bitcoinassetpubkey0000000000000000000000000000000000000000000000"
Address of the asset the user wants to receive. Must be the other asset in the selected pool.
"03usdstablecoinpubkey111111111111111111111111111111111111111111111"
Amount of input asset to simulate swapping, in its smallest unit. Must be positive. Larger amounts will show greater price impact.
x >= 0100000000
Optional integrator fee rate in basis points applied on the input amount. 25 bps = 0.25%
x >= 025
Simulation completed successfully
Response from swap simulation with expected outcomes.
Expected amount of output asset the user would receive, in its smallest unit. This is after all fees are deducted.
x >= 04950000
Effective execution price of the swap. Shows how many units of output asset per unit of input asset.
"0.00004950"
Total fee paid denominated in the input asset only. For B->A swaps, this includes LP, host, and integrator fees (all charged in B). For A->B swaps, host and integrator fees are charged in the output asset (B) and are therefore not included here; only the LP fee (in A) is reported.
x >= 050000
Price impact of the swap as a percentage. Higher values indicate more slippage from the ideal price.
"0.51%"
Warning message if the simulation detects potential issues. Common warnings include high slippage or low liquidity.
"High price impact detected"