How to stream new Solana token pairs
By RoaringCrypto · Guide · 5 min ReadOk, so you need a steady, cheap, fast feed of new solana tokens pairs. A lot of people want this to discover the new tokens on solana as quickly as possible or to build up their own analysis tool. However, it can be difficult to hit the ground running getting such data as it requires understanding each exchanges instruction formats and knowing what to look out for.
Coinmarketcap, coingecko or even dexscreener can provide this data, but its either a bit clunky to access or very delayed. You could get the data directly from the chain yourself but this often required paying for an rpc endpoint. It then requires in-depth knowledge to understand how to read solana transactions and extract specific information like pair created.
You can get a feed of new tokens very quickly by following a few steps. In this article:
1. Connect to the websocket api
2. Subscribe to the data you want
3. Upgrade if nessisary
1. Connect to the websocket api
Connect to the SolanaStreaming websocket using your preferred programming language. Examples can be found on the
home page. Websockets provide real-time push updates so you instantly get notified when a new
pair becomes available. With traditional REST apis, you would need to continuously poll an endpoint which can use up
valuable credits or hit rate limits fast. For this article, I will use wscat
. It is a command line
program that runs on node which can be used on windows and mac.
wscat --connect wss://api.solanastreaming.com --header X-API-KEY:923aeea0ac3549a80dcd9f881986eaf7
The api key in the command above is a demo key and should be replaced with your own. If you get an error instead of getting connected straight away, you can curl the endpoint for a more accurate error diagnosis:
curl https://api.solanastreaming.com -i --header "X-API-KEY: 923aeea0ac3549a80dcd9f881986eaf7"
Note
Our endpoints use certificates signed by the lets encrypt authority so please ensure these are in your trusted CA roots. They are normally included with all modern distros.2. Subscribe to the data you want
Once connected, you will need to subscribe to the events you want to receive. In the case of new pairs, you can send the message below over the websocket. It will give all new the pairs created (including launch tokens) from supported exchanges and that have a pair with wsol. With wscat, once connected, simply copy the JSON in and press enter.
{ "id":1, "method":"newPairSubscribe", "params": { "include_launchpad_tokens": true } }
All messages sent over the websocket connection must conform the jsonrpc spec.
The server will respond with either a failure or a success with the subscription id which is used if you want to stop receiveing these events. It will then push notifications onto the websocket for you to consume. To find out more about the different endpoints and data received you can check out the docs. Below is an example response notification from the server for a new pair created.
Note
When subscribing, you may need to wait a few minutes before the first message shows up. It depends on how often new tokens are created. You can check dexscreener to see how often new pairs are created.{ "slot": 301578636, "signature": "UWnvRXCHpmDxb9tQAYYEEoY8r2JVZ3CcbDLpsFp8EGBdv5njjyEkGXhYxcFCc7Y68X15SWrfve4rycvM4vGRJh7", "blockTime": 1731688226, "pair": { "sourceExchange": "raydium", "ammAccount": "CDnqCfvxQvncrWpoTT36xBCcthzQyh8RumuvoFsFZNVC", "baseToken": { "account": "G9GZaVRPiYRfNQF7oqNoeXKwB5jFbLSHe5fxLcCpump", "info": { "decimals": 9, "supply": "206900000000000000", "metadata": { "name": "randomcoin", "symbol": "randomcoin", "logo": "https://arweave.net/xDf9sPlSY4SMmFQzyCK-xakNl-m7a17lKPO6BttSO3M" }, "mintAuthority": null, "freezeAuthority": null } }, "quoteToken": { "account": "So11111111111111111111111111111111111111112", "info": null }, "baseTokenLiquidityAdded": "206900000000000000", "quoteTokenLiquidityAdded": "630000000000" } }
3. Upgrade (if nessisary)
As our free accounts only provide a limited number of messages sufficient to analyse the platform, you will need to upgrade your account to get a full stream of the chain data. We dont charge by some arbitrary credit system, we charge a flat fee every month for all the data.
Get started by signing up for an api key now!