Skip to main content

Solana DEX Trades gRPC Stream

The dex_trades gRPC Stream provides real-time DEX trade/swap data across supported Solana protocols (Pump.fun, Raydium, Orca, Jupiter, and more).


Overview

Subscribe to live DEX swaps with context-aware filtering. Each event includes transaction details, token context, trade amounts, and market address. Data is in protobuf format — use bitquery-corecast-proto to parse.

Filters required

At least one filter per subscription. See Filtering Options.

Configuration

To subscribe to DEX trades, configure your stream as follows:

server:
address: "corecast.bitquery.io"
authorization: "<your_api_token>"
insecure: false

stream:
type: "dex_trades"

filters:
programs:
- "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" # Pump.fun example

Available Data

The DEX trades stream provides comprehensive trade information including:

  • Transaction details: Slot, signature, status, fees (in native and USD)
  • Account information: Signers, token accounts, program IDs
  • Token context: Mint addresses, decimals, owners
  • Trade specifics: Amounts, protocols, pools
  • Balance updates: Pre/post balances for accounts and token accounts, showing pool liquidity changes

Sample Data Structure

Here's an example of the data structure you'll receive:

{
"Block": {
"Slot": 370028492
},
"Transaction": {
"Index": 779,
"Signature": "2eoFGRLxJFXhLGBXS4dPgSGYfjF9yGx3Tfc4EgJqrndiMqTX22SZwaH1E8E8p7333z2CWqofY8YvJgB7DN6hJv1L",
"Status": {
"Success": true,
"ErrorMessage": ""
},
"Header": {
...
"Accounts": [...]
}
},
"Trade": {
"InstructionIndex": 9,
"Dex": {
"ProgramAddress": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",
"ProtocolName": "pump_amm",
"ProtocolFamily": "Pumpswap"
},
"Market": {
"MarketAddress": "6pSvYm5Yff625pUPAWNDmhccHMqw1itAyjoV2DGpDTDJ",
"BaseCurrency": {
...
},
"QuoteCurrency": {
...
}
},
"Buy": {
"Amount": 2797967683010,
"Currency": {
...
},
"Account": {
...
}
},
"Sell": {
"Amount": 6645427517,
"Currency": {
...
},
"Account": {
...
}
}
}
}

Key Points

  • No price data: Prices are not included as they're not on-chain information. Calculate prices from token amounts and decimals.
  • Token context: Each token account includes mint address, owner, decimals, and program ID.
  • Multiple protocols: Supports various DEX protocols on Solana.

Filtering Options

The filter options are defined in the request.proto file. You can filter DEX trades using the following filters:

message SubscribeTradesRequest {
AddressFilter program;
AddressFilter pool;
AddressFilter token;
AddressFilter trader;
}

Available filters:

  • program: Filter by DEX program address
  • pool: Filter by specific pool/market address
  • token: Filter by token mint address (e.g., WSOL, USDC)
  • trader: Filter by trader's wallet address

Schema Reference

Python Installation

For Python development, install the protobuf package:

pip install bitquery-corecast-proto

NPM Package

npm install bitquery-corecast-proto

This package includes all necessary protobuf definitions without requiring manual downloads.


Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.