> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# DEX Firehose on Solana

> Subscribe to new DEX pairs on Solana in real time over a WebSocket connection using the newPairs subscription.

GoldRush's `newPairs` subscription on `SOLANA_MAINNET` delivers new DEX pairs as they appear.

## Subscribe

<CodeGroup>
  ```graphql GraphQL Subscription theme={null}
  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
    }
  }
  ```

  ```python Python theme={null}
  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())
  ```
</CodeGroup>

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](/goldrush-solana/warehouse/dex-swaps).

## Related

* [DEX Swaps warehouse recipe](/goldrush-solana/warehouse/dex-swaps) - decoded swaps landed in your warehouse.
* [New DEX Pairs Stream reference](/api-reference/streaming-api/subscriptions/new-dex-pairs-stream) - full subscription schema.
