Lunar Shadow Labs

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.

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).

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).

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.

← All guides

More guides