@@ -17,6 +17,8 @@ A **Crypto Price API** allows developers to access real-time and historical cryp
1717- Get price change percentage for ROI calculations
1818- Get token volume data with configurable time intervals
1919- Stream live token volume updates
20+ - Get volume data for multiple tokens simultaneously
21+ - Stream live volume updates for multiple tokens simultaneously
2022- Convert token addresses into ` currencyId ` for queries
2123- Extendable query SDK workflow for adding new APIs
2224- Open source & developer-friendly
@@ -148,17 +150,64 @@ const ws = getTokenVolumeStream("<Access Token>", "TOKEN ADDRESS", {
148150
149151---
150152
153+ ### 7. Get volume data for multiple tokens
154+
155+ ``` js
156+ const { getMultipleTokenVolume } = require (" bitquery-crypto-price" );
157+
158+ (async () => {
159+ const tokenAddresses = [
160+ " 0x4d15a3a2286d883af0aa1b3f21367843fac63e07" , // WETH
161+ " 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" , // USDC
162+ " 0xdac17f958d2ee523a2206206994597c13d831ec7" // USDT
163+ ];
164+ const data = await getMultipleTokenVolume (" <Access Token>" , tokenAddresses, 3600 ); // 3600 = 1 hour interval
165+ console .log (JSON .stringify (data, null , 2 ));
166+ })();
167+ ```
168+
169+ ---
170+
171+ ### 8. Stream live volume updates for multiple tokens
172+
173+ ``` js
174+ const { getMultipleTokenVolumeStream } = require (" bitquery-crypto-price" );
175+
176+ const tokenAddresses = [
177+ " 0x4d15a3a2286d883af0aa1b3f21367843fac63e07" , // WETH
178+ " 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" , // USDC
179+ " 0xdac17f958d2ee523a2206206994597c13d831ec7" // USDT
180+ ];
181+
182+ const ws = getMultipleTokenVolumeStream (" <Access Token>" , tokenAddresses, {
183+ interval: 3600 , // optional: time interval in seconds (default: 3600)
184+ autoCloseMs: 30000 , // optional: auto-close after 30 seconds
185+ onData : (data ) => {
186+ console .log (" Live multiple token volumes:" , JSON .stringify (data, null , 2 ));
187+ },
188+ onError : (err ) => {
189+ console .error (" Stream error:" , err);
190+ },
191+ });
192+
193+ // ws.close() // manually close if needed
194+ ```
195+
196+ ---
197+
151198## 🛠️ Available Functions
152199
153- | Function | Description |
154- | ----------------------- | ------------------------------------------------------------- |
155- | ` getCurrencyId ` | Get ` currencyId ` from a token address (required for queries) |
156- | ` getTokenPrice ` | Fetch the latest token price (point-in-time query) |
157- | ` getTokenPriceStream ` | Subscribe to real-time token price updates (WebSocket stream) |
158- | ` getPriceChange ` | Get top tokens by price change percentage (point-in-time query) |
159- | ` getPriceChangeStream ` | Subscribe to real-time price change updates (WebSocket stream) |
160- | ` getTokenVolume ` | Fetch token volume data (point-in-time query) |
161- | ` getTokenVolumeStream ` | Subscribe to real-time token volume updates (WebSocket stream) |
200+ | Function | Description |
201+ | ------------------------------- | ---------------------------------------------------------------- |
202+ | ` getCurrencyId ` | Get ` currencyId ` from a token address (required for queries) |
203+ | ` getTokenPrice ` | Fetch the latest token price (point-in-time query) |
204+ | ` getTokenPriceStream ` | Subscribe to real-time token price updates (WebSocket stream) |
205+ | ` getPriceChange ` | Get top tokens by price change percentage (point-in-time query) |
206+ | ` getPriceChangeStream ` | Subscribe to real-time price change updates (WebSocket stream) |
207+ | ` getTokenVolume ` | Fetch token volume data (point-in-time query) |
208+ | ` getTokenVolumeStream ` | Subscribe to real-time token volume updates (WebSocket stream) |
209+ | ` getMultipleTokenVolume ` | Fetch volume data for multiple tokens (point-in-time query) |
210+ | ` getMultipleTokenVolumeStream ` | Subscribe to real-time volume updates for multiple tokens (WebSocket stream) |
162211
163212---
164213
0 commit comments