╔═══════════════════════════════════════════════════════════════════════════╗
║                    DEX DATA SOURCES - QUICK REFERENCE                      ║
╚═══════════════════════════════════════════════════════════════════════════╝

OBJECTIVE: Find free APIs with M15+ frequency and 2022+ historical depth

┌─────────────────────────────────────────────────────────────────────────┐
│ 🎯 RECOMMENDATION FOR YOUR USE CASE                                     │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  ✅ Best Solution: Dune Analytics (free API key required)               │
│     • SQL queries on blockchain data                                     │
│     • Full history back to 2021 (Uniswap V3 genesis)                   │
│     • Custom M15 aggregation via GROUP BY                               │
│     • Free tier: 30 requests/min                                        │
│     • Sign up: https://dune.com/settings/api                           │
│                                                                           │
│  ⚠️  Alternative: CryptoCompare (H1 only, free API key)                 │
│     • Hourly data back to 2021                                          │
│     • Not DEX-specific (CEX + DEX mixed)                               │
│     • Free tier: 100k calls/month                                       │
│                                                                           │
└─────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│ 📊 DATA SOURCE COMPARISON                                               │
├──────────────────┬──────────┬────────────┬─────────┬──────────┬────────┤
│ Source           │ Freq     │ History    │ Auth    │ OHLCV    │ 2022+  │
├──────────────────┼──────────┼────────────┼─────────┼──────────┼────────┤
│ GeckoTerminal    │ M1       │ ~6 months  │ ❌ No   │ ✅ Yes   │ ❌ No  │
│ DEX Screener     │ M5       │ Real-time  │ ❌ No   │ ❌ No    │ ❌ No  │
│ CryptoCompare    │ M1/H1    │ 7d/3y+     │ 🔑 Key  │ ✅ Yes   │ ✅ H1  │
│ Dune Analytics   │ Custom   │ Full       │ 🔑 Key  │ ⚠️  DIY  │ ✅ Yes │
└──────────────────┴──────────┴────────────┴─────────┴──────────┴────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│ 🚀 QUICK START COMMANDS                                                 │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  1. GeckoTerminal (M1 OHLCV - Recent 6 months)                          │
│     curl "https://api.geckoterminal.com/api/v2/networks/eth/pools/\    │
│           0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv/minute\      │
│           ?limit=100"                                                    │
│                                                                           │
│  2. DEX Screener (M5 Volume Snapshots - Real-time)                      │
│     curl "https://api.dexscreener.com/latest/dex/pairs/ethereum/\      │
│           0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"                   │
│                                                                           │
│  3. CryptoCompare (H1 OHLCV - Back to 2021)                             │
│     curl "https://min-api.cryptocompare.com/data/v2/histohour?\        │
│           fsym=ETH&tsym=USDC&limit=2000"                                │
│                                                                           │
│  4. Dune Analytics (Custom SQL - Full history)                          │
│     # Requires API key - Sign up at dune.com/settings/api              │
│     curl -X POST "https://api.dune.com/api/v1/query/{id}/execute" \   │
│          -H "X-Dune-API-Key: YOUR_KEY"                                  │
│                                                                           │
└─────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│ 📈 HYBRID COLLECTION STRATEGY                                           │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  Phase 1: Historical Backfill (2022-2024)                               │
│  ├─ Source: Dune Analytics                                              │
│  ├─ Method: SQL on Swap events → M15 aggregation                       │
│  └─ Output: ~105k candles                                               │
│                                                                           │
│  Phase 2: Recent Data (Last 6 months)                                   │
│  ├─ Source: GeckoTerminal                                               │
│  ├─ Method: M1 candles → resample to M15                               │
│  └─ Merge: Join with Phase 1 data                                      │
│                                                                           │
│  Phase 3: Live Updates (Ongoing)                                        │
│  ├─ Source: GeckoTerminal or DEX Screener                              │
│  ├─ Frequency: Poll every 5-15 minutes                                 │
│  └─ Append: Add new candles to dataset                                 │
│                                                                           │
└─────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│ 💡 KEY FINDINGS                                                         │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  ❌ No truly free source with M15+ AND 2022+ without API key            │
│  ✅ Best free option: Dune Analytics (requires signup)                 │
│  ⚠️  GeckoTerminal: Great for M1, but only 6 months history            │
│  ⚠️  CryptoCompare: H1 works, but not DEX-specific                     │
│  ❌ The Graph hosted service: Deprecated (301 redirects)               │
│                                                                           │
└─────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│ 📚 DOCUMENTATION                                                        │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  README.md                    - This overview                           │
│  FINDINGS_SUMMARY.md          - Complete analysis (12KB)               │
│  API_ENDPOINTS_REFERENCE.md   - Detailed API docs (11KB)              │
│  test_recommended_sources.sh  - Validation script                      │
│                                                                           │
└─────────────────────────────────────────────────────────────────────────┘

╔═══════════════════════════════════════════════════════════════════════════╗
║  Research Date: 2025-11-04 | APIs Tested: 20+ | Viable Sources: 4        ║
║  Location: /tmp/defi-research/ | Documentation: 3 files | Scripts: 10     ║
╚═══════════════════════════════════════════════════════════════════════════╝

Next Steps:
  1. Sign up for Dune Analytics free API key (dune.com/settings/api)
  2. Test SQL query for Uniswap V3 Swap event aggregation
  3. Validate data quality and gap coverage
  4. Implement hybrid collection strategy (Dune + GeckoTerminal)

