Cloud Scheduler Integration - Quick Reference
What Changed?
Cortex Trader bot is now automatically scheduled to run every 5 minutes via GCP Cloud Scheduler instead of requiring manual startup.Key Files
| File | Change | Purpose |
|---|---|---|
apphosting.yaml | ➕ 8 lines | Added cortex-trader-execution job |
src/app/api/cron/execute-cortex-trades/route.ts | ➕ NEW | Cloud Function endpoint to run Python bot |
src/app/home/automate/page.tsx | ➕ 120 lines | Dashboard status display for scheduler |
README.md | ➕ 3 lines | Documentation links |
Deployment
Verification
-
Cloud Scheduler (GCP Console)
- Should show:
cortex-trader-executionwith status ACTIVE
- Should show:
-
Trader Dashboard (
/home/automate)- Should display Cloud Scheduler Status card with execution details
-
First Execution
- Happens within 5 minutes of deployment
- Check status card for results
How It Works
Monitoring
Dashboard →/home/automate → Cloud Scheduler Status card shows:
- ✅ Status (completed/failed)
- ✅ Trades executed
- ✅ Last execution time
- ✅ Next execution time
- ❌ Errors (if any)
Troubleshooting
| Problem | Solution |
|---|---|
| Job shows INACTIVE | Check CRON_SECRET env var in App Hosting |
| Status stuck on “pending” | Wait 5+ min for first execution |
| cortex_trader.py fails | Check cortex_trader.log for Python errors |
| Dashboard shows error | Review Firestore: _system/cortex_execution_log |
Environment Variables Needed
Documentation
- Full Setup: CLOUD_SCHEDULER_SETUP.md
- Deployment: DEPLOYMENT_CHECKLIST.md
- Summary: CLOUD_SCHEDULER_SUMMARY.md
Build Status
✅ Compiles successfully (13.1s)Commits
46e58f2- Integrate Cortex Trader with Cloud Schedulerbaf2e10- Add Cloud Scheduler documentation77887c7- Add deployment checklistc084521- Add integration summary
Ready to deploy! 🚀