|
| 1 | +# Jupiter API Migration Guide |
| 2 | + |
| 3 | +## Overview ✅ |
| 4 | + |
| 5 | +Successfully migrated from CoinGecko to Jupiter ecosystem APIs for comprehensive token data fetching. This provides better coverage for Solana tokens and more reliable data sources. |
| 6 | + |
| 7 | +## What Changed |
| 8 | + |
| 9 | +### ❌ Removed: CoinGecko Dependencies |
| 10 | +- Removed CoinGecko API integration |
| 11 | +- Removed `COINGECKO_API_KEY` environment variable |
| 12 | +- Eliminated CoinGecko-specific market data endpoints |
| 13 | + |
| 14 | +### ✅ Added: Jupiter + Birdeye Integration |
| 15 | +- **Jupiter Price API v6**: Real-time token prices |
| 16 | +- **Jupiter Tokens API**: Token metadata and information |
| 17 | +- **Birdeye API**: Comprehensive market data, liquidity, social metrics, and historical data |
| 18 | + |
| 19 | +## New Data Sources |
| 20 | + |
| 21 | +### 1. Price Data |
| 22 | +**Source**: Jupiter Price API v6 |
| 23 | +``` |
| 24 | +https://price.jup.ag/v6/price?ids={mint} |
| 25 | +``` |
| 26 | +- ✅ Real-time prices for all Jupiter-supported tokens |
| 27 | +- ✅ High reliability and low latency |
| 28 | +- ✅ Free to use |
| 29 | + |
| 30 | +### 2. Market Data (Market Cap, Volume) |
| 31 | +**Primary**: Birdeye API |
| 32 | +``` |
| 33 | +https://public-api.birdeye.so/defi/token_overview?address={mint} |
| 34 | +``` |
| 35 | +**Fallback**: Jupiter Tokens API |
| 36 | +``` |
| 37 | +https://tokens.jup.ag/tokens/{mint} |
| 38 | +``` |
| 39 | +- ✅ Market capitalization |
| 40 | +- ✅ 24h trading volume |
| 41 | +- ✅ Liquidity data |
| 42 | +- ✅ Automatic fallback system |
| 43 | + |
| 44 | +### 3. Historical Data |
| 45 | +**Source**: Birdeye History API |
| 46 | +``` |
| 47 | +https://public-api.birdeye.so/defi/history_price |
| 48 | +``` |
| 49 | +- ✅ Multi-day price history |
| 50 | +- ✅ Accurate volatility calculations |
| 51 | +- ✅ Fallback to simulated data if API unavailable |
| 52 | + |
| 53 | +### 4. Social Metrics |
| 54 | +**Source**: Birdeye Social API |
| 55 | +``` |
| 56 | +https://public-api.birdeye.so/defi/token_social |
| 57 | +``` |
| 58 | +- ✅ Twitter followers |
| 59 | +- ✅ Telegram members |
| 60 | +- ✅ Website verification |
| 61 | +- ✅ 24h activity metrics |
| 62 | +- ✅ Calculated composite social score (0-100) |
| 63 | + |
| 64 | +### 5. Token Age |
| 65 | +**Source**: Birdeye Creation Info + Jupiter Tokens |
| 66 | +- ✅ Actual token creation timestamps |
| 67 | +- ✅ Accurate age calculations in days |
| 68 | +- ✅ Fallback mechanisms |
| 69 | + |
| 70 | +### 6. Liquidity Data |
| 71 | +**Source**: Multi-source aggregation |
| 72 | +- ✅ Birdeye liquidity pools |
| 73 | +- ✅ Jupiter DEX aggregation |
| 74 | +- ✅ Cross-validation between sources |
| 75 | + |
| 76 | +## API Key Requirements |
| 77 | + |
| 78 | +### Required: Birdeye API Key |
| 79 | +```bash |
| 80 | +BIRDEYE_API_KEY=your_birdeye_api_key |
| 81 | +``` |
| 82 | + |
| 83 | +**How to get Birdeye API Key**: |
| 84 | +1. Visit [Birdeye.so](https://birdeye.so) |
| 85 | +2. Sign up for an account |
| 86 | +3. Go to API section |
| 87 | +4. Generate your API key |
| 88 | +5. Add to your `.env` file |
| 89 | + |
| 90 | +### Optional: Dune Analytics (for advanced analytics) |
| 91 | +```bash |
| 92 | +DUNE_API_KEY=your_dune_analytics_api_key |
| 93 | +``` |
| 94 | + |
| 95 | +## Benefits of the Migration |
| 96 | + |
| 97 | +### 🚀 **Better Solana Coverage** |
| 98 | +- Jupiter covers virtually all Solana tokens |
| 99 | +- Real-time data from the largest Solana DEX aggregator |
| 100 | +- Better price discovery for meme tokens |
| 101 | + |
| 102 | +### 📊 **More Comprehensive Data** |
| 103 | +- Social metrics integration |
| 104 | +- Real historical price data |
| 105 | +- Multi-source liquidity aggregation |
| 106 | +- Token age verification |
| 107 | + |
| 108 | +### 💰 **Cost Effectiveness** |
| 109 | +- Jupiter Price API is free |
| 110 | +- Birdeye offers generous free tier |
| 111 | +- Reduced API costs compared to CoinGecko Pro |
| 112 | + |
| 113 | +### ⚡ **Better Performance** |
| 114 | +- Lower latency for Solana-native APIs |
| 115 | +- Fallback mechanisms for reliability |
| 116 | +- Optimized for meme token data |
| 117 | + |
| 118 | +## Configuration Updates |
| 119 | + |
| 120 | +### Environment Variables |
| 121 | +**Old**: |
| 122 | +```bash |
| 123 | +COINGECKO_API_KEY=your_coingecko_key |
| 124 | +DUNE_API_KEY=your_dune_key |
| 125 | +``` |
| 126 | + |
| 127 | +**New**: |
| 128 | +```bash |
| 129 | +BIRDEYE_API_KEY=your_birdeye_key |
| 130 | +DUNE_API_KEY=your_dune_key # Optional |
| 131 | +``` |
| 132 | + |
| 133 | +### Strategy Config |
| 134 | +No changes required to `config/strategy.json` - all token configurations remain the same. |
| 135 | + |
| 136 | +## Testing the Migration |
| 137 | + |
| 138 | +### 1. Update Environment |
| 139 | +```bash |
| 140 | +# Copy the new template |
| 141 | +cp env.template .env |
| 142 | + |
| 143 | +# Add your Birdeye API key |
| 144 | +BIRDEYE_API_KEY=your_actual_birdeye_key |
| 145 | +``` |
| 146 | + |
| 147 | +### 2. Test Data Fetching |
| 148 | +```bash |
| 149 | +npm run build |
| 150 | +npm start |
| 151 | +``` |
| 152 | + |
| 153 | +### 3. Verify Data Quality |
| 154 | +Check logs for successful data fetching: |
| 155 | +``` |
| 156 | +✓ DataProvider initialized with Jupiter APIs |
| 157 | +✓ Token screening completed: Passed: X tokens |
| 158 | +``` |
| 159 | + |
| 160 | +## API Rate Limits |
| 161 | + |
| 162 | +### Jupiter (Free) |
| 163 | +- Price API: No explicit limits |
| 164 | +- High throughput for price queries |
| 165 | + |
| 166 | +### Birdeye (Free Tier) |
| 167 | +- 1000 requests/day |
| 168 | +- Sufficient for strategy operations |
| 169 | +- Upgrade available for higher volume |
| 170 | + |
| 171 | +## Troubleshooting |
| 172 | + |
| 173 | +### Issue: Missing Birdeye API Key |
| 174 | +**Error**: API calls failing or returning limited data |
| 175 | +**Solution**: Add `BIRDEYE_API_KEY` to your `.env` file |
| 176 | + |
| 177 | +### Issue: Rate Limit Exceeded |
| 178 | +**Error**: 429 responses from Birdeye |
| 179 | +**Solution**: |
| 180 | +1. Reduce polling frequency |
| 181 | +2. Upgrade to paid Birdeye plan |
| 182 | +3. Fallback to Jupiter-only data |
| 183 | + |
| 184 | +### Issue: Token Not Found |
| 185 | +**Error**: No data for specific token |
| 186 | +**Solution**: |
| 187 | +1. Verify token mint address |
| 188 | +2. Check if token is listed on Jupiter |
| 189 | +3. Ensure token has sufficient liquidity |
| 190 | + |
| 191 | +## Migration Checklist |
| 192 | + |
| 193 | +- ✅ Updated DataProvider to use Jupiter + Birdeye APIs |
| 194 | +- ✅ Removed CoinGecko dependencies |
| 195 | +- ✅ Added comprehensive fallback mechanisms |
| 196 | +- ✅ Updated environment configuration |
| 197 | +- ✅ Enhanced social metrics calculation |
| 198 | +- ✅ Improved historical data accuracy |
| 199 | +- ✅ Added multi-source liquidity aggregation |
| 200 | +- ✅ Maintained backward compatibility |
| 201 | +- ✅ Added proper error handling and logging |
| 202 | + |
| 203 | +## Next Steps |
| 204 | + |
| 205 | +1. **Get Birdeye API Key**: Sign up at birdeye.so |
| 206 | +2. **Update Environment**: Add `BIRDEYE_API_KEY` to `.env` |
| 207 | +3. **Test Strategy**: Run with real data |
| 208 | +4. **Monitor Performance**: Check data quality and API reliability |
| 209 | +5. **Consider Upgrades**: Evaluate paid plans for higher volume |
| 210 | + |
| 211 | +The migration to Jupiter APIs provides better data quality, coverage, and cost-effectiveness for Solana meme token strategies! 🚀 |
0 commit comments