### Install DexPaprika CLI via shell script Source: https://docs.dexpaprika.com/tutorials/cli Use these commands to download and install the latest binary. The second example demonstrates how to specify a custom installation directory. ```bash curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` ```bash DEXPAPRIKA_INSTALL_DIR=/usr/local/bin curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` -------------------------------- ### Get WETH Price on Ethereum using DexPaprika PHP SDK Source: https://docs.dexpaprika.com/get-started/sdk-php Quickstart example demonstrating how to create a client and fetch the price of Wrapped Ether (WETH) on the Ethereum network. Requires the autoloader and the DexPaprika Client namespace. ```php tokens->getTokenDetails('ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'); echo "{$weth['name']}: ${$weth['price_usd']}"; // Output: Wrapped Ether: $3245.67 ``` -------------------------------- ### DexPaprika CLI Command Examples Source: https://docs.dexpaprika.com/ai-integration/skills If `dexpaprika-cli` is installed, your agent can use it to interact with DexPaprika services. These commands cover streaming live prices and finding newly created pools. ```bash Use dexpaprika-cli to stream live prices for WETH on Ethereum ``` ```bash Run dexpaprika-cli to find newly created pools on Solana ``` -------------------------------- ### Install DexPaprika and CoinPaprika Plugins Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Install both the DexPaprika and CoinPaprika plugins to get comprehensive crypto market data, including DEX information and global rankings. ```bash /plugin install dexpaprika /plugin install coinpaprika ``` -------------------------------- ### Install and Use PM2 for Background Service (Linux/Mac) Source: https://docs.dexpaprika.com/tutorials/crypto-alert-bot Installs PM2 globally, starts the `index.js` script as a background service named 'crypto-alert', and saves the current process list to ensure it restarts on system boot. ```bash npm install -g pm2 pm2 start index.js --name crypto-alert pm2 save ``` -------------------------------- ### API Examples Source: https://docs.dexpaprika.com/tutorials/cli Practical examples demonstrating how to use the DexPaprika CLI for common tasks. ```APIDOC ## Examples ### Get a Token Price ```bash dexpaprika-cli token solana So11111111111111111111111111111111111111112 ``` ### Search for a Token Search for a token when you don't know its address. ```bash dexpaprika-cli search jupiter ``` ### List Top Pools by Volume ```bash dexpaprika-cli pools ethereum --limit 10 ``` ### Get OHLCV History for a Pool ```bash dexpaprika-cli pool-ohlcv ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --start 2025-01-01 ``` ### Stream Live Prices #### Single Token Stream Streams prices until you press `Ctrl+C`. ```bash dexpaprika-cli stream ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 ``` #### Stream with Limit Stop streaming after a specified number of price updates. ```bash dexpaprika-cli stream ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --limit 50 ``` #### Stream Multiple Tokens from Watchlist Use a JSON file to specify multiple tokens for streaming. ```bash dexpaprika-cli stream --tokens watchlist.json --limit 100 ``` ### Interactive REPL Start an interactive session for running commands without prefixing `dexpaprika-cli`. ```bash dexpaprika-cli shell ``` ### Batch Prices for a Portfolio Get prices for multiple tokens in a single request. ```bash dexpaprika-cli prices ethereum --tokens 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x6b175474e89094c44da98b954eedeac495271d0f ``` ``` -------------------------------- ### Install and Use Forever for Background Service (Windows) Source: https://docs.dexpaprika.com/tutorials/crypto-alert-bot Installs the 'forever' module globally, which is used to ensure a Node.js script runs continuously. Starts the `index.js` script using 'forever'. ```bash npm install -g forever forever start index.js ``` -------------------------------- ### Install DexPaprika Plugin Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Install the DexPaprika plugin from the CoinPaprika marketplace. Select 'Install now' when prompted to complete the installation. ```bash /plugin install dexpaprika ``` -------------------------------- ### Make a GET Request using C# Source: https://docs.dexpaprika.com/api-reference/tokens/get-top-x-pools-for-a-token An asynchronous C# example using HttpClient to make a GET request to the DexPaprika API. It reads and prints the response content if the request is successful. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); var url = "https://api.dexpaprika.com/networks/ethereum/pools"; var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } ``` -------------------------------- ### Install Self-Hosted MCP Server Source: https://docs.dexpaprika.com/ai-integration Commands to install or run the DexPaprika MCP server locally. ```bash npm install -g dexpaprika-mcp ``` ```bash npx dexpaprika-mcp ``` -------------------------------- ### Install and Run DexPaprika MCP Server Source: https://docs.dexpaprika.com/ai-integration/mcp Commands for installing the server globally or running it directly via npx. ```bash npm install -g dexpaprika-mcp ``` ```bash dexpaprika-mcp ``` ```bash npx dexpaprika-mcp ``` -------------------------------- ### Install DexPaprika SDK Source: https://docs.dexpaprika.com/get-started/sdk-python Installation methods for the DexPaprika Python SDK using pip, poetry, or source code. ```bash # Using pip pip install dexpaprika-sdk # Using poetry poetry add dexpaprika-sdk # From source git clone https://github.com/coinpaprika/dexpaprika-sdk-python.git cd dexpaprika-sdk-python pip install -e . ``` -------------------------------- ### Custom Installation Directory Source: https://docs.dexpaprika.com/tutorials/cli Specify a custom directory for the installation script to avoid permission issues. ```bash DEXPAPRIKA_INSTALL_DIR=~/bin curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` -------------------------------- ### Install DexPaprika PHP SDK from Source Source: https://docs.dexpaprika.com/get-started/sdk-php Clone the repository and install dependencies from source using Composer. This method requires Git. ```bash git clone https://github.com/coinpaprika/dexpaprika-sdk-php.git cd dexpaprika-sdk-php composer install ``` -------------------------------- ### Install multiple skills via CLI Source: https://docs.dexpaprika.com/ai-integration/skills Omit the --skill flag to install all available skills from the repository at once. ```bash npx skills add github.com/coinpaprika/skills/ ``` -------------------------------- ### Verify DexPaprika CLI installation Source: https://docs.dexpaprika.com/tutorials/cli Run this command to confirm the API is reachable and the tool is installed correctly. ```bash dexpaprika-cli status ``` -------------------------------- ### Install Required Dependencies Source: https://docs.dexpaprika.com/tutorials/local-analytics-with-duckdb Command to install the necessary Python libraries for the ETL pipeline. ```bash pip install requests pandas duckdb aiohttp ``` -------------------------------- ### List Installed Skills Source: https://docs.dexpaprika.com/ai-integration/skills Run this command to view all the skills currently installed for your AI agent. This helps in managing and verifying your installed tools. ```bash npx skills list ``` -------------------------------- ### Install DexPaprika Skill using npm Source: https://docs.dexpaprika.com/ai-integration/skills Use this command to install the DexPaprika skill for your AI agent. This command requires Node.js and npm to be installed. ```bash npx skills add ``` -------------------------------- ### Example Query: Supported Networks Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example query to discover all the blockchain networks supported by the DexPaprika plugin. ```natural_language What blockchain networks are supported by DexPaprika? ``` -------------------------------- ### Install Required Python Libraries Source: https://docs.dexpaprika.com/tutorials/scaling-with-clickhouse Command to install the necessary dependencies for the ETL and analytics scripts. ```bash pip install clickhouse-connect aiohttp pandas requests ``` -------------------------------- ### Start ClickHouse Server on Ubuntu/Debian Source: https://docs.dexpaprika.com/tutorials/scaling-with-clickhouse Starts the ClickHouse server service using systemd on Ubuntu or Debian systems. ```bash # Start the server sudo systemctl start clickhouse-server ``` -------------------------------- ### Install DexPaprika MCP Server Source: https://docs.dexpaprika.com/ai-integration/mcp Use this command to install or reinstall the DexPaprika MCP server globally. ```bash npm install -g dexpaprika-mcp ``` -------------------------------- ### View Installed Plugins Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide View all installed plugins, including DexPaprika, by running the '/plugin' command and selecting 'Manage Plugins'. ```bash /plugin ``` -------------------------------- ### Install DexPaprika SDK Source: https://docs.dexpaprika.com/get-started/sdk-ts Install the DexPaprika SDK using npm, yarn, or pnpm. Ensure you have Node.js 14.0.0 or higher. ```bash # using npm npm install @dexpaprika/sdk # using yarn yarn add @dexpaprika/sdk # using pnpm pnpm add @dexpaprika/sdk ``` -------------------------------- ### Example Query: Token Prices Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example query to find the current prices of specific tokens (USDC and USDT) on the Ethereum network. ```natural_language Show me the current price of USDC and USDT on Ethereum. ``` -------------------------------- ### Example Query: Token Search Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example query to find all liquidity pools that include a specific token, such as PEPE. ```natural_language Find all pools that include the PEPE token. ``` -------------------------------- ### Install DuckDB MCP Server Source: https://docs.dexpaprika.com/tutorials/local-analytics-with-duckdb Installs the 'mcp-server-duckdb' package using npx, which is required to connect an AI assistant to the DuckDB database. ```bash npx -y @smithery/cli install mcp-server-duckdb --client claude ``` -------------------------------- ### Example Query: Top Liquidity Pools Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example query to retrieve information about the top liquidity pools on the Ethereum network based on volume. ```natural_language What are the top liquidity pools on Ethereum by volume? ``` -------------------------------- ### Install DexPaprika CLI Source: https://docs.dexpaprika.com/ai-integration Installs the DexPaprika CLI tool. Works on macOS and Linux. Windows binaries are available on GitHub releases. ```bash curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` -------------------------------- ### Python Streaming Example Source: https://docs.dexpaprika.com/skill A Python example demonstrating how to use the requests library to connect to the streaming endpoint and process incoming price data. ```APIDOC ## Python Streaming Example ### Description This code snippet shows how to use Python's `requests` library to consume the Server-Sent Events (SSE) stream from the Dexpaprika API and print token prices. ### Language Python ### Code Example ```python import requests import json assets = [ {"chain": "ethereum", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "method": "t_p"}, {"chain": "solana", "address": "So11111111111111111111111111111111111111112", "method": "t_p"} ] r = requests.post("https://streaming.dexpaprika.com/stream", headers={"Accept": "text/event-stream", "Content-Type": "application/json"}, json=assets, stream=True) for line in r.iter_lines(): if line and line.startswith(b'data:'): data = json.loads(line[5:]) print(f"{data['c']} {data['a']}: ${data['p']}") ``` ``` -------------------------------- ### Complete Example: Fetching and Displaying DEX Data Source: https://docs.dexpaprika.com/get-started/sdk-go This comprehensive example demonstrates initializing the client, fetching network and token details, listing and displaying DEX pools, and handling potential errors. ```go package main import ( "context" "fmt" "log" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func main() { // Initialize client client := dexpaprika.NewClient() // Create context with timeout ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() // Get Ethereum network details networks, err := client.Networks.List(ctx) if err != nil { log.Fatalf("Error fetching networks: %v", err) } var ethereum *dexpaprika.Network for _, network := range networks { if network.ID == "ethereum" { ethereum = &network break } } if ethereum == nil { log.Fatal("Ethereum network not found") } fmt.Printf("Found %s with %d DEXes\n", ethereum.DisplayName, ethereum.DexesCount) // Get WETH token details weth, err := client.Tokens.GetDetails( ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", ) if err != nil { log.Fatalf("Error fetching token details: %v", err) } fmt.Printf("%s price: $%.2f\n", weth.Name, weth.PriceUSD) // Find WETH/USDC pools options := &dexpaprika.ListOptions{ Limit: 5, Page: 0, OrderBy: "volume_usd", Sort: "desc", } pools, err := client.Tokens.GetPools( ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH options, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC ) if err != nil { log.Fatalf("Error fetching pools: %v", err) } // Show top pools fmt.Println("Top WETH/USDC pools:") for _, pool := range pools.Pools { fmt.Printf("%s: $%.2f 24h volume\n", pool.DexName, pool.VolumeUSD) } } ``` -------------------------------- ### Complete DexPaprika SDK Example Source: https://docs.dexpaprika.com/get-started/sdk-python A comprehensive example demonstrating client initialization, fetching network and token details, finding liquidity pools, and displaying results. Includes standard Python main execution block. ```python from dexpaprika_sdk import DexPaprikaClient def main(): # Initialize client client = DexPaprikaClient() # Get Ethereum network details networks = client.networks.list() ethereum = next((n for n in networks if n.id == "ethereum"), None) print(f"Found {ethereum.display_name} with {ethereum.dexes_count} DEXes") # Get WETH token details weth = client.tokens.get_details( network_id="ethereum", token_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ) print(f"{weth.name} price: ${weth.price_usd}") # Find WETH/USDC pools pools = client.tokens.get_pools( network_id="ethereum", token_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH limit=5, order_by="volume_usd", sort="desc", address="0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" # USDC ) # Show top pools print('Top WETH/USDC pools:') for pool in pools.pools: print(f"{pool.dex_name}: ${pool.volume_usd:,.2f} 24h volume") if __name__ == "__main__": main() ``` -------------------------------- ### Complete DexPaprika SDK Example Source: https://docs.dexpaprika.com/get-started/sdk-ts A comprehensive example demonstrating client initialization, fetching network and token details, finding pools, and displaying pool information. Includes basic error handling. ```javascript import { DexPaprikaClient } from '@dexpaprika/sdk'; async function main() { // Initialize client const client = new DexPaprikaClient(); // Get Ethereum network details const networks = await client.networks.list(); const ethereum = networks.find(n => n.id === 'ethereum'); console.log(`Found ${ethereum.name} with ${ethereum.dexes_count} DEXes`); // Get WETH token details const weth = await client.tokens.getDetails( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ); console.log(`${weth.name} price: $${weth.price_usd}`); // Find WETH/USDC pools const pools = await client.tokens.getPools( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH { limit: 5, sort: 'desc', orderBy: 'volume_usd', pairWith: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC } ); // Show top pools console.log('Top WETH/USDC pools:'); pools.data.forEach(pool => { console.log(`${pool.dex.name}: $${pool.volume_usd_24h.toLocaleString()} 24h volume`); }); } main().catch(console.error); ``` -------------------------------- ### Example Query: Specific Pool Analysis Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example query to get detailed information about a specific liquidity pool, such as the USDC/ETH pool on Uniswap V3. ```natural_language Tell me about the USDC/ETH pool on Uniswap V3. ``` -------------------------------- ### Project Setup Commands Source: https://docs.dexpaprika.com/tutorials/crypto-alert-bot Commands to clone an existing project repository or initialize a new Node.js project for the crypto alert bot. ```bash git clone https://github.com/coinpaprika/tutorials/tree/main/crypto-alert-bot # OR mkdir crypto-alert-bot cd crypto-alert-bot npm init -y ``` -------------------------------- ### Complete DexPaprika SDK Example Source: https://docs.dexpaprika.com/get-started/sdk-php This example demonstrates initializing the client, fetching network details, retrieving token information, and finding token pools. It includes basic error handling for API exceptions. ```php networks->getNetworks(); $ethereum = null; foreach ($networks['networks'] as $network) { if ($network['id'] === 'ethereum') { $ethereum = $network; break; } } echo "Found {$ethereum['display_name']} with {$ethereum['dexes_count']} DEXes\n"; // Get WETH token details $weth = $client->tokens->getTokenDetails( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ); echo "{$weth['name']} price: ${$weth['price_usd']}\n"; // Find WETH/USDC pools $pools = $client->tokens->getTokenPools( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH [ 'limit' => 5, 'orderBy' => 'volume_usd', 'sort' => 'desc', 'address' => '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC ] ); // Show top pools echo "Top WETH/USDC pools:\n"; foreach ($pools['pools'] as $pool) { echo "{$pool['dex_name']}: $" . number_format($pool['volume_usd'], 2) . " 24h volume\n"; } } catch (DexPaprikaApiException $e) { echo "API Error: {$e->getMessage()}\n"; } catch (Exception $e) { echo "Error: {$e->getMessage()}\n"; } } main(); ``` -------------------------------- ### Java GET request for pools Source: https://docs.dexpaprika.com/api-reference/pools/get-top-x-pools-deprecated This Java example demonstrates how to make an HTTP GET request to the DexPaprika API to retrieve pool data. It handles input/output streams and potential exceptions. ```java import java.io.*; import java.net.HttpURLConnection; import java.net.URL; public class DexPaprikaExample { public static void main(String[] args) { try { URL url = new URL("https://api.dexpaprika.com/networks/ethereum/pools"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; StringBuilder content = new StringBuilder(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } if (responseCode == 200) { System.out.println(content.toString()); } else { System.out.println("Error: " + responseCode); } } } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### Install DexPaprika Go SDK Source: https://docs.dexpaprika.com/get-started/sdk-go Use this command to add the DexPaprika Go SDK to your project. ```bash go get github.com/coinpaprika/dexpaprika-sdk-go ``` -------------------------------- ### C# GET request for pools Source: https://docs.dexpaprika.com/api-reference/pools/get-top-x-pools-deprecated This C# example shows how to perform an asynchronous HTTP GET request to the DexPaprika API to retrieve pool data using HttpClient. It handles success and error status codes. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); var url = "https://api.dexpaprika.com/networks/ethereum/pools"; var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } else { ``` -------------------------------- ### Agent Workflow Examples Source: https://docs.dexpaprika.com/tutorials/cli Commands for AI agents to retrieve machine-readable data for tokens and pools. ```bash # Agent searches for a token dexpaprika-cli --output json --raw search "pepe" | jq '.tokens[0]' # Agent gets the price dexpaprika-cli --output json --raw token ethereum 0x6982508145454ce325ddbe47a25d4ec3d2311933 | jq '.summary.price_usd' # Agent finds the top pool dexpaprika-cli --output json --raw token-pools ethereum 0x6982508145454ce325ddbe47a25d4ec3d2311933 | jq '.[0]' ``` -------------------------------- ### Setup Basic Logging Source: https://docs.dexpaprika.com/tutorials/local-analytics-with-duckdb Configures the root logger to display INFO level messages and above, including timestamps and log levels. ```python logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') ``` -------------------------------- ### Get Historical OHLCV Data for a Pool Source: https://docs.dexpaprika.com/tutorials/cli Fetches historical Open, High, Low, Close, and Volume (OHLCV) data for a specific trading pool, with a specified start date. ```bash dexpaprika-cli pool-ohlcv ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --start 2025-01-01 ``` -------------------------------- ### GET /websites/dexpaprika/ohlcv Source: https://docs.dexpaprika.com/api-reference/pools/get-ohlcv-data-for-a-pool-pair Fetches OHLCV data for a specified period. You can filter by start and end times, set the interval for each data point, and choose whether to invert the price ratio. ```APIDOC ## GET /websites/dexpaprika/ohlcv ### Description Retrieves historical Open-High-Low-Close-Volume (OHLCV) data for a given financial instrument. The data can be filtered by time range and interval, and the price ratio can be inverted. ### Method GET ### Endpoint /websites/dexpaprika/ohlcv ### Parameters #### Query Parameters - **start** (string) - Optional - Start time for the OHLCV data. Accepted formats: Unix timestamp, RFC3339 timestamp (e.g., "2023-10-27T10:00:00Z"), Date (e.g., "2023-10-27", interpreted as 00:00:00 UTC). - **end** (string) - Optional - End time for the OHLCV data. Accepted formats: Unix timestamp, RFC3339 timestamp (e.g., "2023-10-27T10:00:00Z"), Date (e.g., "2023-10-27", interpreted as 00:00:00 UTC). - **limit** (integer) - Optional - Maximum number of OHLCV records to return. Default: 1. Minimum: 1. Maximum: 366. - **interval** (string) - Optional - The time interval for each OHLCV record (candle). Enum: ["1m", "5m", "10m", "15m", "30m", "1h", "6h", "12h", "24h"]. Default: "24h". - **inversed** (boolean) - Optional - Whether to invert the price ratio in OHLCV calculations (e.g., quote token vs. base token). Default: false. ### Response #### Success Response (200) - **time_open** (string) - The opening timestamp of the OHLCV period. - **time_close** (string) - The closing timestamp of the OHLCV period. - **open** (number) - The opening price for the period. - **high** (number) - The highest price reached during the period. - **low** (number) - The lowest price reached during the period. - **close** (number) - The closing price for the period. - **volume** (integer) - The total volume traded during the period. #### Response Example ```json [ { "time_open": "2023-10-27T10:00:00Z", "time_close": "2023-10-27T11:00:00Z", "open": 1500.5, "high": 1525.75, "low": 1495.25, "close": 1510, "volume": 1234567890123 } ] ``` ``` -------------------------------- ### Main ETL Function Setup Source: https://docs.dexpaprika.com/tutorials/local-analytics-with-duckdb Initializes the main ETL process by creating a 'dbs' directory if it doesn't exist and setting up an aiohttp client session. ```python async def main(): """Main ETL function to build the local DuckDB database.""" os.makedirs("dbs", exist_ok=True) async with aiohttp.ClientSession() as session: ``` -------------------------------- ### Fetch Pools Data with C# Source: https://docs.dexpaprika.com/api-reference/pools/advanced-pool-filtering-on-a-specific-network This C# example shows how to make an asynchronous GET request to the pools endpoint using HttpClient. It checks for successful status codes before reading the content. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); var url = "https://api.dexpaprika.com/networks/ethereum/pools"; var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } else ``` -------------------------------- ### Fetch Pools Data with Java Source: https://docs.dexpaprika.com/api-reference/pools/advanced-pool-filtering-on-a-specific-network This Java example shows how to perform a GET request to the pools endpoint using HttpURLConnection. It includes basic error handling for the HTTP response code. ```java import java.io.*; import java.net.HttpURLConnection; import java.net.URL; public class DexPaprikaExample { public static void main(String[] args) { try { URL url = new URL("https://api.dexpaprika.com/networks/ethereum/pools"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; StringBuilder content = new StringBuilder(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } if (responseCode == 200) { System.out.println(content.toString()); } else { System.out.println("Error: " + responseCode); } } } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### Get Pool OHLCV Data Source: https://docs.dexpaprika.com/get-started/sdk-php Retrieves OHLCV (Open, High, Low, Close, Volume) chart data for a pool. Specify 'start', 'end', 'interval', and 'limit' for time-series analysis. ```php pools->getPoolOHLCV( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', $startDate, [ 'end' => $endDate, 'interval' => '1h', 'limit' => 168 // 24 * 7 hours ] ); echo "Received {$ohlcv} OHLCV data points"; ?> ``` -------------------------------- ### Practical Use Case: Portfolio Monitoring Source: https://docs.dexpaprika.com/tutorials/claude-code-plugin-guide Example of how to use the plugin for portfolio monitoring by tracking specific tokens on Ethereum and requesting their current prices and highest volume pools. ```natural_language Monitor these tokens on Ethereum: - WETH (0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) - USDC (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) - DAI (0x6b175474e89094c44da98b954eedeac495271d0f) Show their current prices and highest volume pools. ``` -------------------------------- ### DexPaprika Filter Endpoint for Pool Discovery Source: https://docs.dexpaprika.com/tutorials/vibe-coding-with-ai An example GET request to the DexPaprika filter endpoint to find newly created liquidity pools on Solana with specific volume and transaction criteria, sorted by volume. ```http GET /networks/solana/pools/filter?created_after={24h_ago_timestamp}&volume_24h_min=10000&txns_24h_min=100&sort_by=volume_24h&sort_dir=desc ``` -------------------------------- ### Fetch pool data via GET request Source: https://docs.dexpaprika.com/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages Examples for retrieving pool data from the DexPaprika API across multiple programming languages. Note that browser-based requests may encounter CORS issues. ```bash curl -X GET "https://api.dexpaprika.com/networks/ethereum/pools" | jq ``` ```js const https = require('https'); const options = { hostname: 'api.dexpaprika.com', path: '/networks/ethereum/pools', method: 'GET', }; const req = https.request(options, res => { let data = ''; res.on('data', chunk => { data += chunk; }); res.on('end', () => { console.log(JSON.parse(data)); }); }); req.on('error', error => { console.error(error); }); req.end(); ``` ```python import requests url = "https://api.dexpaprika.com/networks/ethereum/pools" response = requests.get(url) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code} -> {response.text}") ``` ```php "https://api.dexpaprika.com/networks/ethereum/pools", CURLOPT_RETURNTRANSFER => true )); $response = curl_exec($curl); if(curl_errno($curl)) { echo "Error: " . curl_error($curl); } else { echo $response; } curl_close($curl); ?> ``` ```java import java.io.*; import java.net.HttpURLConnection; import java.net.URL; public class DexPaprikaExample { public static void main(String[] args) { try { URL url = new URL("https://api.dexpaprika.com/networks/ethereum/pools"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; StringBuilder content = new StringBuilder(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } if (responseCode == 200) { System.out.println(content.toString()); } else { System.out.println("Error: " + responseCode); } } } catch (Exception e) { e.printStackTrace(); } } } ``` ```go package main import ( "fmt" "io/ioutil" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.dexpaprika.com/networks/ethereum/pools", nil) if err != nil { log.Fatal(err) } resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) } if resp.StatusCode == http.StatusOK { fmt.Println(string(body)) } else { fmt.Printf("Error: %d -> %s\n", resp.StatusCode, body) } } ``` ```csharp using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); var url = "https://api.dexpaprika.com/networks/ethereum/pools"; var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } ``` -------------------------------- ### Get Pool OHLCV Data Source: https://docs.dexpaprika.com/get-started/sdk-go Retrieves OHLCV (Open, High, Low, Close, Volume) chart data for a liquidity pool. Specify start time, limit, interval, and optionally an end time and inversion. ```go // Start time 7 days ago startTime := time.Now().AddDate(0, 0, -7) options := &dexpaprika.OHLCVOptions{ Start: startTime, Limit: 100, Interval: "1h", Inversed: false, } ohlcv, err := client.Pools.GetOHLCV(ctx, "ethereum", "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", options) ``` -------------------------------- ### Get OHLCV Data for a Pool Pair Source: https://docs.dexpaprika.com/tutorials/retrieve-historical-data Retrieve historical OHLCV data for a specific trading pool. Parameters include start date, limit for data points, time interval, and an option to inverse the price ratio. ```bash curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=2025-01-01&limit=30&interval=24h&inversed=true" | jq ``` -------------------------------- ### Get Token Price using Go SDK Source: https://docs.dexpaprika.com/get-started/sdk-go Fetches the details and price of a specific token on a given network using the DexPaprika Go SDK. Ensure you have Go 1.24+ installed and an active internet connection. The client is initialized without an API key. ```go package main import ( "context" "fmt" "log" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func main() { // Create client client := dexpaprika.NewClient() // Create context with timeout ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() // Get WETH token details on Ethereum token, err := client.Tokens.GetDetails(ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2") if err != nil { log.Fatalf("Error getting token details: %v", err) } fmt.Printf("%s: $%.2f\n", token.Name, token.PriceUSD) // Output: Wrapped Ether: $3245.67 } ``` -------------------------------- ### Example .env file for API Key Source: https://docs.dexpaprika.com/api-pro/introduction Store your API key in an environment variable using a .env file. Ensure this file is added to your .gitignore to prevent accidental exposure. ```bash DEXPAPRIKA_PRO_API_KEY=api_your_personal_api_key ``` -------------------------------- ### Configure and Use SDK Caching Source: https://docs.dexpaprika.com/get-started/sdk-ts Demonstrates how to configure built-in caching with custom TTL, max size, and enable/disable it. Also shows manual cache management and direct usage of the Cache class. ```javascript import { DexPaprikaClient, Cache } from '@dexpaprika/sdk'; // The SDK includes built-in caching by default // This example shows how to configure it // Configure caching with custom settings const client = new DexPaprikaClient('https://api.dexpaprika.com', {}, { cache: { ttl: 60 * 1000, // 1 minute cache TTL (default is 5 minutes) maxSize: 100, // Store up to 100 responses (default is 1000) enabled: true // Enable caching (enabled by default) } }); // Demonstration of cache behavior async function demonstrateCaching() { console.time('First call'); await client.networks.list(); // Makes an API request console.timeEnd('First call'); console.time('Second call'); await client.networks.list(); // Returns cached result console.timeEnd('Second call'); // You can also manage the cache manually client.clearCache(); // Clear all cached data console.log(client.cacheSize); // Get current cache size client.setCacheEnabled(false); // Disable caching } // Using the Cache class directly const manualCache = new Cache({ ttl: 30 * 1000, // 30 second TTL maxSize: 50 // Store maximum 50 items }); manualCache.set('myKey', { data: 'example data' }); const data = manualCache.get('myKey'); manualCache.delete('myKey'); manualCache.clear(); ``` -------------------------------- ### Configure and Manage Caching in PHP Source: https://docs.dexpaprika.com/get-started/sdk-php Demonstrates enabling default caching, bypassing the cache for fresh data, and configuring custom filesystem cache storage. ```php setupCache(); // First call - hits the API $startTime = microtime(true); $networks = $client->networks->getNetworks(); $firstCallTime = microtime(true) - $startTime; echo "First call (API): {$networks['networks']} networks, took {$firstCallTime} s\n"; // Second call - served from cache (much faster) $startTime = microtime(true); $networks = $client->networks->getNetworks(); $secondCallTime = microtime(true) - $startTime; echo "Second call (cached): {$networks['networks']} networks, took {$secondCallTime} s\n"; echo "Cache speedup: {$firstCallTime / $secondCallTime} x\n"; // You can skip the cache when you need fresh data $client->getConfig()->setCacheEnabled(false); $freshNetworks = $client->networks->getNetworks(); $client->getConfig()->setCacheEnabled(true); // Custom cache configuration $cache = new FilesystemCache('/path/to/custom/cache'); $client->setupCache($cache, 300); // 5 minutes TTL // Clear the entire cache $client->getConfig()->getCache()->clear(); ``` -------------------------------- ### Install DexPaprika PHP SDK using Composer Source: https://docs.dexpaprika.com/get-started/sdk-php Use Composer to install the DexPaprika PHP SDK. Ensure you have PHP 7.4 or higher and Composer installed. ```bash composer require coinpaprika/dexpaprika-sdk-php ``` -------------------------------- ### Verify Skill Installation Path Source: https://docs.dexpaprika.com/ai-integration/skills Use this command to confirm that the skill files are correctly located in the project directory. ```bash ls .claude/skills/dexpaprika-api/ ``` -------------------------------- ### Install TypeScript Dependencies Source: https://docs.dexpaprika.com/streaming/guides/react-integration Install the necessary type definitions for React development. ```bash npm install --save-dev @types/react ```