Edwin Salguero
feat: prepare for Streamlit Cloud deployment - fix requirements.txt, add deployment config, error handling, and entry point
aaa6e1c |
Download STREAMLIT_DEPLOYMENT.md from ParallelLLC/algorithmic_trading: direct link, hf CLI and curl.
- Browser
- Download file 3.22 kB
-
https://huggingface.co/ParallelLLC/algorithmic_trading/resolve/main/STREAMLIT_DEPLOYMENT.md
- Command line
-
hf download hf://ParallelLLC/algorithmic_trading/STREAMLIT_DEPLOYMENT.md
-
curl -L -o STREAMLIT_DEPLOYMENT.md https://huggingface.co/ParallelLLC/algorithmic_trading/resolve/main/STREAMLIT_DEPLOYMENT.md
3.22 kB
Streamlit Cloud Deployment Guide
Overview
This guide will help you deploy your algorithmic trading system to Streamlit Cloud.
Files Created for Deployment
1. streamlit_app.py (Root Entry Point)
- Main entry point for Streamlit Cloud
- Imports and runs the UI from the
ui/directory
2. .streamlit/config.toml
- Streamlit configuration for deployment
- Optimized for cloud deployment
3. packages.txt
- System dependencies for the deployment environment
4. Updated requirements.txt
- Fixed dependencies for cloud deployment
- Removed problematic packages
Deployment Steps
1. Push to GitHub
git add .
git commit -m "feat: prepare for Streamlit Cloud deployment"
git push origin main
2. Deploy to Streamlit Cloud
- Go to share.streamlit.io
- Sign in with your GitHub account
- Click "New app"
- Configure your app:
- Repository:
your-username/algorithmic_trading - Branch:
main - Main file path:
streamlit_app.py - App URL: Choose your preferred URL
- Repository:
3. Environment Variables (Optional)
If you want to use real API keys, add these in Streamlit Cloud:
ALPACA_API_KEYALPACA_SECRET_KEYALPACA_BASE_URL
Deployment Features
β Deployment Mode
- The app automatically detects deployment environment
- Falls back to demo mode if modules aren't available
- Shows sample data and mock trading functionality
β Error Handling
- Graceful handling of missing dependencies
- Informative error messages
- Fallback functionality
β Performance Optimized
- Minimal dependencies
- Efficient imports
- Cloud-optimized configuration
Troubleshooting
Common Issues
Import Errors
- The app now handles missing modules gracefully
- Check the browser console for specific error messages
Dependency Issues
- All dependencies are now properly specified in
requirements.txt - System packages are included in
packages.txt
- All dependencies are now properly specified in
Configuration Issues
- The app uses a default configuration in deployment mode
- No external files are required
Debug Mode
To debug deployment issues:
- Check the Streamlit Cloud logs
- Look for error messages in the browser console
- Verify all files are properly committed to GitHub
Local Testing
Test the deployment version locally:
streamlit run streamlit_app.py
Features Available in Deployment
β Working Features
- Configuration loading (demo mode)
- Data visualization with sample data
- Chart generation
- UI navigation
- Mock trading interface
β οΈ Limited Features
- Real API connections (requires environment variables)
- Live trading (demo mode only)
- Model training (simulated)
Next Steps
- Deploy to Streamlit Cloud using the steps above
- Test the deployment to ensure everything works
- Add environment variables for real API access
- Monitor the deployment for any issues
Support
If you encounter issues:
- Check the Streamlit Cloud logs
- Verify all files are committed to GitHub
- Test locally with
streamlit run streamlit_app.py - Review the error handling in the code
The deployment is now ready! π