Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/crypto/liquidity-pool-analyzer/skills/analyzing-liquidity-pools

analyzing-liquidity-pools

Verified

Analyze DEX liquidity pools for TVL, volume, fees, impermanent loss, and LP profitability. Use when analyzing liquidity pools, calculating impermanent loss, or comparing DEX pools. Trigger with phrases like "analyze liquidity pool", "calculate impermanent loss", "LP returns", "pool TVL", "DEX pool metrics", or "compare pools".

FileKindSize
ARD.mdmarkdown9.9 KB
PRD.mdmarkdown6.1 KB
SKILL.mdskill md4.2 KB
config/settings.yamlconfig2.1 KB
references/errors.mdmarkdown4.1 KB
references/examples.mdmarkdown7.3 KB
references/implementation.mdmarkdown2.7 KB
scripts/formatters.pyscript11.6 KB
scripts/il_calculator.pyscript8.0 KB
scripts/pool_analyzer.pyscript7.3 KB
scripts/pool_fetcher.pyscript12.5 KB
scripts/pool_metrics.pyscript9.9 KB

references/errors.md

View on GitHub
# Error Handling Reference

## API Errors

### Subgraph Query Timeout

```
Error: requests.exceptions.Timeout: Request timed out after 15s
```

**Cause**: The Graph subgraph is slow or unavailable.
**Solution**:

- Script automatically falls back to DeFiLlama data
- Wait and retry if fresh subgraph data is needed
- Check The Graph status page for outages

### Subgraph Rate Limit

```
Error: 429 Too Many Requests
```

**Cause**: Too many subgraph queries in short period.
**Solution**:

- The Graph allows ~100 queries/minute on free tier
- Cache is used by default to reduce queries
- Wait 60 seconds before retrying

### DeFiLlama API Error

```
Error: Failed to fetch from DeFiLlama
```

**Cause**: DeFiLlama API unavailable.
**Solution**:

- Falls back to cached data if available
- Uses mock data for testing if needed
- Retry after a few minutes

## Pool Errors

### Pool Not Found

```
Error: Pool not found on ethereum
```

**Cause**: Pool address doesn't exist or wrong chain.
**Solution**:

- Verify pool address is correct
- Check you're using the right chain flag (--chain)
- Address must be lowercase for subgraphs

### Invalid Pool Address

```
Error: Invalid pool address format
```

**Cause**: Address format is incorrect.
**Solution**:

- Ensure address starts with 0x
- Address should be 42 characters (0x + 40 hex chars)
- Use lowercase for consistency

### Token Pair Not Found

```
Warning: No pools found for ETH/BTC
```

**Cause**: No pools exist for this pair on the selected protocol.
**Solution**:

- Try different protocol (--protocol)
- Check token symbols are correct
- Some pairs only exist on certain chains

## Calculation Errors

### Invalid Price Values

```
Error: Entry price must be greater than 0
```

**Cause**: Invalid price input for IL calculation.
**Solution**:

- Entry and current prices must be positive numbers
- Don't include currency symbols ($)
- Use decimal notation (2000, not 2,000)

### IL Calculation Error

```
Error: Cannot calculate IL for negative price ratio
```

**Cause**: Current price is 0 or negative.
**Solution**:

- Verify price inputs are correct
- Current price cannot be 0

## Output Errors

### File Write Permission Denied

```
PermissionError: [Errno 13] Permission denied: 'output.json'
```

**Cause**: Cannot write to output file location.
**Solution**:

- Check file/directory permissions
- Try different output path
- Use stdout (no --output flag)

### Invalid Output Format

```
Error: Invalid format 'xml'
```

**Cause**: Unsupported output format.
**Solution**: Use supported formats:

- `table` (default)
- `json`
- `csv`

## Cache Errors

### Cache Read Error

```
Warning: Could not read cache file
```

**Cause**: Cache file corrupted or permissions issue.
**Solution**:

- Delete cache: `rm ~/.lp_analyzer_cache.json`
- Script will fetch fresh data

### Stale Cache Warning

```
Using cached data (10 min old)
```

**Cause**: Cache TTL exceeded but API unavailable.
**Solution**:

- Not critical - data is still usable
- Use `--no-cache` to force refresh when API is back

## Import Errors

### Missing requests Library

```
Warning: requests library not available
```

**Cause**: Python `requests` package not installed.
**Solution**:

```bash
pip install requests
```

### Module Not Found

```
ModuleNotFoundError: No module named 'pool_fetcher'
```

**Cause**: Running script from wrong directory.
**Solution**:

```bash
# Run from scripts directory or use full path
python /path/to/scripts/pool_analyzer.py --help
```

## Recovery Commands

### Reset Cache

```bash
rm ~/.lp_analyzer_cache.json
```

### Test Subgraph Connectivity

```bash
curl -X POST https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3 \
  -H "Content-Type: application/json" \
  -d '{"query": "{ pools(first: 1) { id } }"}'
```

### Verbose Mode for Debugging

```bash
python pool_analyzer.py --verbose --pair ETH/USDC
```

### Test with Known Pool

```bash
# Uniswap V3 ETH/USDC 0.05% pool
python pool_analyzer.py --pool 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --verbose
```

---
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall