Matic Slippage API
In this section we will see how to get Matic DEX pool slippage information using our API. The slippage API helps you understand price impact and liquidity depth for token swaps on Matic DEX pools.
Understanding Slippage and Price Impact
Slippage refers to the difference between the expected price of a trade and the actual execution price. When swapping tokens in a DEX pool, larger trades can move the price due to limited liquidity, resulting in slippage.
The DEXPoolSlippages API provides detailed information about:
- Maximum input amounts that can be swapped at different slippage tolerances
- Minimum output amounts guaranteed at each slippage level
- Average execution prices for different trade sizes
- Price impact calculations for both swap directions (A to B and B to A)
For a comprehensive explanation of how DEX pools work, liquidity calculations, and price tables, refer to the DEXPools Cube documentation.
Realtime Slippage Monitoring
This subscription query returns real-time slippage data for all DEX pools on Matic. You can monitor price impact and liquidity depth as trades occur.
You can find the query here
subscription {
EVM(network: matic) {
DEXPoolSlippages {
Price {
BtoA {
Price
MinAmountOut
MaxAmountIn
}
AtoB {
Price
MinAmountOut
MaxAmountIn
}
Pool {
PoolId
SmartContract
Pair {
Decimals
SmartContract
Name
}
CurrencyB {
Symbol
SmartContract
Name
Decimals
}
CurrencyA {
Symbol
SmartContract
Name
Decimals
}
}
Dex {
SmartContract
ProtocolVersion
ProtocolName
ProtocolFamily
}
SlippageBasisPoints
}
Block {
Time
Number
}
}
}
}