Spaces:
Sleeping
Sleeping
metadata
title: Paydirt Model Updates
emoji: π
colorFrom: red
colorTo: yellow
sdk: docker
app_port: 8501
pinned: false
π Paydirt NHL Model Updates
A Streamlit application for generating NHL DFS lineup projections and updating model data in real-time.
Features
- NHL Lineup Generation: Automated lineup optimization for DraftKings and FanDuel
- Real-time Updates: Integrates with Google Sheets for live data updates
- Multiple Platforms: Supports both DK and FD contests
- Ownership Projections: ML-powered ownership predictions using XGBoost, LightGBM, and KNN models
- Discord Notifications: Automatic notifications when updates complete
- MongoDB Integration: Stores historical data and projections
Architecture
- Python/Streamlit: Web interface and data processing
- Go: High-performance lineup generation
- MongoDB: Data storage and retrieval
- Google Sheets API: Live data integration
- Docker: Containerized deployment
Setup
Local Development
- Install Dependencies
pip install -r requirements.txt
- Configure Secrets
Create .streamlit/secrets.toml:
MONGODB_URI = "your-mongodb-uri"
GOOGLE_PROJECT_ID_1 = "your-project-id"
# ... (see .streamlit/secrets.toml.example for full template)
- Build Go Programs (if developing locally on Windows)
cd func/dk_nhl_go
go build -o NHL_seed_frames.exe NHL_seed_frames.go
cd ../fd_nhl_go
go build -o NHL_seed_frames.exe NHL_seed_frames.go
- Run the App
streamlit run src/streamlit_app.py
Hugging Face Deployment
This app is configured for deployment on Hugging Face Spaces using Docker.
- Create a Space on Hugging Face with Docker SDK
- Add Secrets in Space settings (Settings β Repository secrets)
- Add all variables from
.streamlit/secrets.toml.example
- Add all variables from
- Push Code to your Space repository
- The Docker build will automatically:
- Build Go programs for Linux
- Install Python dependencies
- Configure the environment
Project Structure
Paydirt_model_updates/
βββ src/
β βββ streamlit_app.py # Main Streamlit application
βββ func/
β βββ NHL_own_regress.py # Ownership prediction models
β βββ dk_nhl_go/ # DraftKings lineup generator (Go)
β βββ fd_nhl_go/ # FanDuel lineup generator (Go)
βββ Dockerfile # Docker configuration
βββ requirements.txt # Python dependencies
βββ go.mod # Go module definition
βββ README.md # This file
Technologies Used
Python Stack
- Streamlit: Web interface
- pandas: Data manipulation
- numpy: Numerical operations
- xgboost/lightgbm/scikit-learn: Machine learning models
- pymongo: MongoDB client
- gspread: Google Sheets API
- ortools: Linear optimization
Go Stack
- MongoDB Driver: Database connectivity
- High-performance lineup generation algorithms
Environment Variables
Required environment variables (can be set in .streamlit/secrets.toml or as environment variables):
| Variable | Description |
|---|---|
MONGODB_URI |
MongoDB connection string |
GOOGLE_PROJECT_ID_1 |
Google Cloud project ID (primary) |
GOOGLE_PRIVATE_KEY_1 |
Service account private key (primary) |
GOOGLE_CLIENT_EMAIL_1 |
Service account email (primary) |
GOOGLE_PROJECT_ID_2 |
Google Cloud project ID (backup) |
GOOGLE_PRIVATE_KEY_2 |
Service account private key (backup) |
GOOGLE_CLIENT_EMAIL_2 |
Service account email (backup) |
DISCORD_WEBHOOK_URL |
Discord webhook for notifications |
MASTER_SHEET_URL |
Google Sheets URL for master data |
Usage
- Open the app in your browser
- Check connection status in the sidebar
- Click "π Generate NHL Lineups" to start the process
- Monitor progress as the app:
- Builds prop betting tables
- Generates player-level outcomes
- Creates stack matrices
- Runs lineup optimization
- Updates MongoDB with results
- Sends Discord notifications
Security Notes
- Never commit
.streamlit/secrets.tomlto version control - Use Hugging Face Secrets for production deployment
- Rotate service account keys regularly
- Keep MongoDB credentials secure
License
Proprietary - Paydirt Sports
Support
For issues or questions, contact the development team.