Skip to main content
GoldRush’s newPairs subscription on SOLANA_MAINNET delivers new DEX pairs as they appear.

Subscribe

subscription {
  newPairs(chain_name: SOLANA_MAINNET) {
    block_signed_at
    protocol
    pair_address
    base_token { contract_address contract_ticker_symbol contract_decimals }
    quote_token { contract_address contract_ticker_symbol contract_decimals }
    liquidity
  }
}
import asyncio
import os
from gql import gql, Client
from gql.transport.websockets import WebsocketsTransport

WS_URL = "wss://streaming.goldrushdata.com/graphql"

SUBSCRIPTION = gql("""
subscription {
  newPairs(chain_name: SOLANA_MAINNET) {
    block_signed_at
    protocol
    pair_address
    base_token { contract_address contract_ticker_symbol contract_decimals }
    quote_token { contract_address contract_ticker_symbol contract_decimals }
    liquidity
  }
}
""")

async def main():
    transport = WebsocketsTransport(
        url=WS_URL,
        init_payload={"GOLDRUSH_API_KEY": os.environ["GOLDRUSH_API_KEY"]},
    )
    async with Client(transport=transport, fetch_schema_from_transport=False) as session:
        async for result in session.subscribe(SUBSCRIPTION):
            print(result["newPairs"])

asyncio.run(main())
Connect via WebSocket at wss://streaming.goldrushdata.com/graphql with your API key in the connection parameters. The protocol field carries the DEX protocol name. Filter client-side to scope to a particular venue.

Patterns

”New pools” tab

Stream the firehose, dedupe by pair_address, drop pools below a liquidity threshold to filter spam, and display chronologically.

Cross-DEX arbitrage discovery

The same base/quote pair can launch on multiple venues within minutes. Group new pools by base/quote token addresses to discover routes for arb.

Production considerations

  • Reconnect on close or error. Wrap the subscribe call in a function and re-invoke on error / complete with a 1-2s backoff.
  • Dedupe by pair_address. During brief reconnects you may see a recently-emitted pool twice; deduplicate on pair_address.
  • No backfill on reconnect. The subscription delivers events from the moment it opens. For historical pairs and swaps, use the warehouse swaps recipe.