Stream Raydium swaps in real time
By Lunar Shadow Labs · Updated
Raydium runs three AMM programs on Solana: the original AMM v4, the constant-product CPMM and the
concentrated-liquidity CLMM. Our feed decodes swaps on all three into one swap message, with venue
raydium_v4, raydium_cpmm or raydium_clmm, so your code handles them the
same way.
Market data only. Nothing here is a recommendation to trade any pool or token.
Subscribe
import asyncio, json, os, websockets # pip install websockets
URL = "wss://feed.lunarshadowlabs.com/ws?venues=raydium_v4,raydium_cpmm,raydium_clmm&kinds=swap"
HEADERS = {"Authorization": f"Bearer {os.environ['LSL_KEY']}"}
def handle(m):
base = int(m["base_amount"]) / 10 ** m["base_decimals"]
quote = int(m["quote_amount"]) / 10 ** m["quote_decimals"]
side = "buy " if m["is_buy"] else "sell"
print(m["venue"], side, m["pool"], f"{base:,.4f} base for {quote:,.6f} quote",
"price", m["price"], "via", m["via"] or "direct")
async def main():
async with websockets.connect(URL, additional_headers=HEADERS, max_size=None) as ws:
async for raw in ws:
m = json.loads(raw)
if m["kind"] == "swap": # control messages (gaps, resume) are covered in the docs
handle(m)
asyncio.run(main())
To follow particular pools or tokens, add a watchlist: &watch=<pool or mint>,…. Add
pool_create,liquidity to kinds to see new pools and deposits as well. For production
use, add the resume and reconnect loop from the docs.
A CPMM swap, in full
{
"v": 1,
"seq": 15543840,
"kind": "swap",
"venue": "raydium_cpmm",
"keys": [
"3DQt2VMR16uEappSeetSTU491YQzhupyhRx8c1XV25Nc",
"So11111111111111111111111111111111111111112",
"HM7gGBXX8R7ruVFV2yV7SH28UHjsJpi7q72NzJdjiu6b",
"9bceNeZdYVTwXu4AvByxRBKMaJ7VMhMATTMwyxs8RFcL"
],
"stage": "executed",
"source": "geyser",
"commitment": "processed",
"slot": 454422427,
"sig": "5gQiYpYfPkzsJw2pej8JtiYQm7Yva3z7Eq71G5v6u3N6RH7TsWQCTyk1B1RWHki7g1G7grso3gnAfTdSJmR8QvmN",
"ix": 5,
"inner": 0,
"t_ingest_us": 1791429767367622,
"t_emit_us": 1791429767367675,
"via": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
"pool": "HM7gGBXX8R7ruVFV2yV7SH28UHjsJpi7q72NzJdjiu6b",
"user": "9bceNeZdYVTwXu4AvByxRBKMaJ7VMhMATTMwyxs8RFcL",
"base_mint": "3DQt2VMR16uEappSeetSTU491YQzhupyhRx8c1XV25Nc",
"quote_mint": "So11111111111111111111111111111111111111112",
"is_buy": true,
"base_amount": "3981419566651",
"quote_amount": "2000000000",
"base_decimals": 6,
"quote_decimals": 9,
"price": 0.0000005023333930320522,
"fees": {"trade": "5000000", "creator": "0"},
"partial": false,
"derived": false,
"base_flags": {"program": "token2022", "decimals": 6, "supply": "951250683505459", "mint_authority": null, "freeze_authority": null, "metadata_pointer": "3DQt2VMR16uEappSeetSTU491YQzhupyhRx8c1XV25Nc", "extensions": [18, 19]},
"quote_flags": {"program": "spl", "decimals": 9, "supply": "0", "mint_authority": null, "freeze_authority": null, "extensions": []},
"x": {
"input_transfer_fee": "0",
"output_transfer_fee": "0",
"exact_in": true,
"quote_rule": "priority"
}
}
Captured from our live feed on 2026-10-08.
- Base and quote: the quote is the first of USDC, USDT and SOL found in the pool, otherwise the
pool's second token;
x.quote_rulesays which rule applied.is_buy: truemeans the user received the base token: here 3,981,420 tokens for 2 SOL. - Amounts are what the user paid and received, after any Token-2022 transfer fees.
x.input_transfer_feeandx.output_transfer_feeshow those fees when a mint charges them. fees.tradeis the pool's trading fee, charged in the input token (5,000,000 lamports = 0.25% of the 2 SOL paid).fees.creatoris the pool creator's share, when the pool has one.x.exact_intells you whether the trader fixed the input amount (true) or the output amount. It is not the trade direction;is_buyis.viais the outer program:JUP6Lkb…is Jupiter's aggregator. Most Raydium swaps arrive this way. In an hour we sampled on 2026-10-08, 82% of AMM v4, 87% of CPMM and 84% of CLMM swaps came through another program.
What differs on AMM v4 and CLMM
The top-level fields are identical on all three venues. Only fees and x change.
AMM v4
"venue": "raydium_v4", "is_buy": true,
"base_amount": "192773509", "quote_amount": "1251063", "price": 0.0000064898076841045624,
"fees": {},
"x": {"exact_in": true, "quote_rule": "priority"}
Excerpt of an AMM v4 swap captured from our live feed on 2026-10-08 (seq 15542187).
feesis empty: AMM v4's swap log doesn't report the fee, and we don't estimate one. Every v4 swap in our sample had{}.
CLMM
"venue": "raydium_clmm", "is_buy": true,
"base_mint": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", "quote_mint": "So11111111111111111111111111111111111111112",
"base_amount": "5575955", "quote_amount": "17874155", "price": 0.0032055773405631855,
"fees": {"trade_0": "0", "trade_1": "8938"},
"x": {"transfer_fee_0": "0", "transfer_fee_1": "0",
"sqrt_price_x64": "33019275354619823973", "tick": "11644", "quote_rule": "priority"}
Excerpt of a CLMM swap captured from our live feed on 2026-10-08 (seq 15545153).
trade_0andtrade_1are the fee in the pool's token 0 and token 1, in the pool's own order, not base/quote. Here the user paid SOL, and the 8,938-lamport fee is 0.05% of the 0.0179 SOL paid.x.sqrt_price_x64andx.tickare the pool's price state after the swap, as the program reports it. You rarely need them:pricealready gives quote per whole base token.- A small share of CPMM and CLMM swaps (under 2% in our sample) also arrive with
fees: {}, when the program's event doesn't include the fee.
New Raydium pools and launches
Add pool_create and liquidity to kinds to see pools as they are created and
funded. Tokens launched on Raydium's launchpad trade on a separate venue, launchlab, until they
migrate; see new tokens on Raydium LaunchLab.
Try the feed
One WebSocket, 12 Solana venues, one flat price.
Start free trial Read the docs
3-day free trial, then $49/month per license plus applicable tax, charged automatically every month until you cancel. Cancel online any time before the trial ends and you pay nothing. Starting a trial means you agree to the Terms. Market data only, no signals or advice.
More guides
- New Meteora DLMM pools in real time
- pump.fun → PumpSwap migrations in real time
- pump.fun trades and new tokens over WebSocket
- New tokens on Raydium LaunchLab, streamed
- Solana DEX data APIs compared
- One feed across 12 Solana venues
- Token-2022 risk flags, live on every event
- Raw Yellowstone gRPC vs a decoded WebSocket