Automated Market Making Explained
Understand how automated market makers price Solana swaps, why liquidity depth and slippage matter, and where Carbium routing fits in the trade path.
Automated Market Making Explained
Automated market makers are the pool-based trading systems behind many Solana swaps. Instead of matching one buyer against one seller in an order book, an AMM lets a trader exchange against liquidity that other users have deposited into an on-chain pool.
This page is the concept layer. It explains the mechanics that make a quote move, then maps those mechanics to Carbium's DEX and Swap API surfaces. For route-source behavior and provider IDs, use Supported DEXs and Routing Sources.
Part of the Carbium Solana infrastructure stack.
The pool decides the price
An AMM pool usually holds two assets, such as SOL and USDC. Traders add one asset to the pool and remove the other. Liquidity providers deposit both assets and earn fees when trades use that pool.
The important developer takeaway is simple: the pool's inventory changes during the trade, so the price is not fixed like a static API value.
In a constant-product pool, the simplified pricing model is:
x * y = k| Symbol | Meaning |
|---|---|
x | Amount of token A in the pool |
y | Amount of token B in the pool |
k | Product that the pool tries to preserve after the trade |
If a trader buys SOL with USDC, the pool loses SOL and gains USDC. As SOL becomes scarcer inside that pool, the marginal price rises. That is why larger trades usually receive a worse average price than smaller trades against the same pool.
Slippage is a boundary, not a guess
Slippage is the difference between the quote a user accepts and the execution price the transaction is allowed to tolerate. It can come from the trade size itself, price movement between quote and signing, or a route changing before the transaction lands.
For application builders, slippage should be treated as a user-risk boundary:
| Mistake | Better policy |
|---|---|
| Increasing slippage until a route appears | Explain the route miss or ask for explicit user approval |
| Displaying only the expected output | Also display the minimum received amount when available |
| Treating a quote as final execution | Re-check the signed transaction result on-chain |
| Hiding route changes from logs | Log route, output amount, minimum amount, and failure reason |
Carbium's Q1 guide documents slippage_bps on the current executable quote flow. The older v1 quote and swap surfaces use slippage. Keep those request families separate when debugging.
AMM designs you will meet on Solana
Solana liquidity is not one uniform pool type. A route can pass through different market designs, each with a different risk profile.
| Design | What changes for the trader | Why developers care |
|---|---|---|
| Constant-product pool | Price moves along the pool inventory curve | Large trades can move price quickly on shallow pools |
| Concentrated liquidity pool | Liquidity is concentrated around selected price ranges | Good depth near the active price, weaker depth outside it |
| Stable or pegged-asset pool | Curve is shaped for assets expected to trade near parity | Better for pairs such as stablecoins or liquid staking assets when the peg holds |
| Launch or bonding-curve market | Price follows launch-specific rules before normal pool liquidity exists | Swap API routing may not behave like a mature AMM pair |
The route source matters, but the exact pool state matters more. A supported venue can still fail to serve a specific pair, amount, or pool hint.
Supported provider does not mean every route is available at every size. Treat route availability as dynamic market state, not as a static feature flag.
Where Carbium fits
Carbium sits above individual liquidity sources. The browser DEX gives users a wallet-signed swap path, while the Swap API gives builders quote and transaction-building surfaces for apps, wallets, and bots.
| Carbium surface | Use it for | Do not use it for |
|---|---|---|
| Carbium DEX | User-facing swaps, route review, wallet signing | Backend API-key handling |
| Q1 | Current quote flow and optional executable txn when user_account is provided | Older fromMint / toMint request paths |
| All Quote | Provider-level quote visibility and diagnostics | Main executable swap flow |
| Supported DEXs and Routing Sources | Provider IDs, route misses, and routing policy | General AMM education |
| Executing Swaps | Signing, submission, and confirmation after a transaction payload exists | Quote selection |
For most new API integrations, start with Q1 instead of a provider-pinned legacy path.
curl --request GET \
--url 'https://api.carbium.io/api/v2/quote?src_mint=So11111111111111111111111111111111111111112&dst_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount_in=1000000&slippage_bps=50&user_account=YOUR_WALLET' \
--header 'X-API-KEY: YOUR_API_KEY'That request asks Carbium for a SOL -> USDC quote using raw token units. If user_account is included and the route can be built, the response can include a base64 txn payload for the signing flow.
How to read an AMM-backed quote
Before a wallet or bot signs, inspect the quote like an operator rather than only checking whether a response exists.
| Field or signal | What it tells you |
|---|---|
| Input and output mint | Confirms the pair is the one the user intended |
| Raw input amount | Confirms the quote uses base units, not UI-rounded token units |
| Expected output | Shows the route's best estimate before execution |
| Minimum output | Shows the slippage-bounded floor |
| Route plan | Explains which liquidity source or split was selected |
| Price impact | Flags trades that are too large for available liquidity |
| Missing route | Signals that the pair, amount, provider, pool, or market state cannot serve the request |
If the quote looks acceptable, move to signing and confirmation. If it does not, do not hide the issue by widening slippage silently.
Common failure patterns
| Symptom | Likely explanation | First place to go |
|---|---|---|
| No route for a pair | No documented route source can serve that exact request | Supported DEXs and Routing Sources |
| Quote succeeds but no transaction payload appears | The request did not include the fields needed for executable build, or the path is quote-only | Q1 |
| Transaction payload exists but execution fails | The problem moved to signing, blockhash freshness, simulation, or RPC submission | Executing Swaps |
| Large trades price badly | Pool depth is not enough for the requested size | Reduce size, split intentionally, or change product policy |
| The same symbol points to the wrong asset | Token symbol matching is unsafe | Verify mint addresses before quoting or signing |
That split keeps the concept clear: AMMs explain why price and liquidity move; Carbium docs explain how to request, route, sign, and confirm a trade through the right product surface.
Use this page to understand the market mechanics, then use Q1 or the browser DEX depending on whether you are building an integration or making a wallet-signed swap. Platform access starts at carbium.io.
Updated 2 days ago
