An advanced fantasy football trade analysis tool with IDP support, historical data analysis, and AI-powered trade suggestions.
- IDP Support - Full support for Individual Defensive Players (DL, LB, DB)
- Multi-Factor Analysis - 5-component valuation system with historical trends
- VORP Calculations - Position-specific Value Over Replacement Player metrics
- Age & Injury Adjustments - Dynamic player value adjustments
- Team Performance Impact - Offensive/defensive rankings affect valuations
- Strength of Schedule - Matchup analysis for remaining season
- Smart Trade Suggestions - Get 3-5 AI-generated trade recommendations
- Roster Analysis - Automatic strength/weakness identification
- Manual Trade Evaluator - Analyze custom trades with detailed breakdowns
- League Power Rankings - Compare teams across your league
- Sleeper API - Direct league import with one ID
- SportsDataIO API - Professional-grade projections and stats
- Historical Data - 3-5 year trend analysis
- Real-time Updates - Cached data with hourly refresh
- Python 3.8 or higher
- pip (Python package manager)
- Internet connection for API calls
Option 1: Automated (Recommended)
Linux/Mac:
chmod +x run_app.sh
./run_app.shWindows:
run_app.batOption 2: Manual
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyThe app will automatically open in your browser at http://localhost:8501
-
Get Your Sleeper League ID
- Go to sleeper.app and open your league
- Copy the ID from the URL:
sleeper.app/leagues/YOUR_LEAGUE_ID/team
-
Enter League ID
- Paste it in the sidebar
- Wait for data to load (5-10 seconds)
-
Select Your Team
- Choose your team from the dropdown
-
Start Analyzing!
- View AI trade suggestions
- Analyze custom trades
- Check league power rankings
- Quick Start Guide - Get up and running in 5 minutes
- Usage Examples - Real-world scenarios and strategies
- Deployment Guide - Deploy to cloud platforms
- Technical Details - In-depth technical documentation
The app works out-of-the-box with mock data:
- No API key required
- 200+ players with realistic projections
- All features fully functional
- Perfect for testing and learning
For real NFL data, get a free SportsDataIO API key:
- Sign up at sportsdata.io (free tier: 1000 requests/month)
- Get your API key
- Open
app.pyand replace:with your actual keyAPI_KEY = "YOUR_SPORTSDATAIO_KEY_HERE"
- Restart the app
With real data you get:
- Actual NFL projections
- 3-year historical statistics
- Real player ages and injury status
- Team performance metrics
- Strength of schedule analysis
Each player receives an adjusted value based on:
Adjusted Value = (
Base Projection ร 60% +
Historical Average ร 20% +
Team Performance ร 10% +
Matchup SOS ร 5%
) ร Age Factor ร Injury Factor
- Under 25: 1.0x (baseline)
- 25-27: 1.05x (prime years boost)
- 28-29: 1.0x (still productive)
- 30-31: 0.9x (slight decline risk)
- 32+: 0.8x (significant age risk)
- QB: Top 12 (1-QB leagues)
- RB: Top 24
- WR: Top 30
- TE: Top 12
- DL/LB/DB: Top 24-30 (IDP)
- Streamlit - Interactive web framework
- Pandas - Data analysis
- Altair - Declarative visualizations
- FuzzyWuzzy - Fuzzy string matching
- Requests - HTTP library
fantasy-trade-analyzer/
โโโ app.py # Main application
โโโ requirements.txt # Python dependencies
โโโ test_setup.py # Setup verification script
โโโ config_example.py # Configuration template
โ
โโโ README.md # Main documentation (this file)
โโโ QUICKSTART.md # Quick start guide
โโโ EXAMPLES.md # Usage examples
โโโ DEPLOYMENT.md # Deployment instructions
โโโ README_STREAMLIT.md # Technical details
โ
โโโ run_app.sh # Linux/Mac run script
โโโ run_app.bat # Windows run script
- Evaluate trade offers objectively
- Identify buy-low/sell-high opportunities
- Find win-win trades with league mates
- Prepare for trade negotiations
- Veto lopsided trades with data
- Help new players understand values
- Create league balance
- Study player valuations
- Analyze market trends
- Build trade models
Edit app.py to match your league:
# Adjust valuation weights
SCORING_WEIGHTS = {
'projections': 0.50, # Reduce projection weight
'historical': 0.30, # Increase historical weight
'team_performance': 0.10,
'matchup_sos': 0.05,
'age_injury': 0.05
}
# Adjust position baselines for league size
POSITION_BASELINES = {
'QB': 10, # 10-team league
'RB': 20, # Fewer starting RBs
# ...
}Enhance predictions with scikit-learn:
from sklearn.ensemble import RandomForestRegressor
# Train on historical data
model = RandomForestRegressor()
model.fit(historical_features, actual_points)
# Make predictions
enhanced_projection = model.predict(current_features)See config_example.py for more customization options.
Verify everything works:
python test_setup.pyThis checks:
- โ Python version (3.8+)
- โ Required packages installed
- โ API connectivity
- โ App file integrity
Deploy to the cloud for 24/7 access:
- Push to GitHub
- Connect at share.streamlit.io
- Deploy in 1 click
- Heroku - Custom domain support
- AWS EC2 - Full control
- Docker - Containerized deployment
- Azure - Microsoft ecosystem
See DEPLOYMENT.md for detailed instructions.
- Dynasty/keeper mode with long-term valuations
- Machine learning projection enhancements
- Export trade history and results
- Multi-league portfolio management
- Custom scoring system builder
- Mobile app (iOS/Android)
- ESPN/Yahoo API integration
- Automated trade finder
- League chat integration
- Trade deadline alerts
- Playoff impact calculator
Contributions welcome! Ideas for improvements:
-
Add Features
- New data sources
- Additional metrics
- UI enhancements
-
Improve Algorithms
- Better age curves
- Position-specific adjustments
- ML models
-
Documentation
- More examples
- Video tutorials
- Strategy guides
This tool provides analysis based on projections and statistical models. Fantasy football involves uncertainty and luck. Use this as one input in your decision-making process.
- Projections are estimates, not guarantees
- Injuries and team changes affect values
- Your league context matters
- Trust your judgment
"Error fetching Sleeper users"
- Verify League ID is correct
- Check internet connection
- Ensure league is active
"Using mock data" warning
- Normal without API key
- All features still work
- Add API key for real data
Slow loading
- First load caches data (slower)
- Subsequent loads are faster
- Large leagues take longer
See documentation for more troubleshooting tips.
MIT License - feel free to use, modify, and distribute.
- Sleeper - For their excellent free API
- SportsDataIO - For professional-grade NFL data
- Streamlit - For making Python web apps easy
- Fantasy Football Community - For inspiration and feedback
- ๐ Read the documentation
- ๐ฌ Check examples
- ๐ Report issues on GitHub
- โญ Star the repo if you find it useful!
Made with โค๏ธ for fantasy football enthusiasts
Get Started โข Documentation โข Examples โข Deploy
"Helped me identify a trade that won me my championship!" - League Winner 2025
"The AI suggestions found value I never would have seen." - Fantasy Analyst
"Perfect for commissioners dealing with trade disputes." - League Commissioner
Ready to dominate your league? Install now and start analyzing! ๐