p = "/Users/deanpowers/deploy-portfolio-agent/README.md" s = open(p, encoding="utf-8").read() if "## Changelog" in s: print("INFO: README already complete") raise SystemExit(0) # Ensure the code block from "Running locally" is properly closed if s.count("```") % 2 != 0: # Odd number of fences — need to close the last one if not s.rstrip().endswith("```"): s = s.rstrip() + "\n```\n" print("OK: closed truncated code block") s = s.rstrip() + "\n\n" + """Then open `http://localhost:8080`. **Requirements:** Python 3.9+, a FRED API key (free at [fredaccount.stlouisfed.org](https://fredaccount.stlouisfed.org/apikeys)). ## Configuration Environment variables (in `.env`): | Variable | Required | Purpose | |---|---|---| | `FRED_API_KEY` | Yes | Treasury yields, VIX | | `FLASK_SECRET` | Yes | Session signing | | `BYBIT_KEY` | Optional | Bot P&L (read-only) | | `BYBIT_SECRET` | Optional | Bot P&L (read-only) | | `TELEGRAM_BOT_TOKEN` | Optional | Scan alerts | | `TELEGRAM_CHAT_ID` | Optional | Where alerts go | | `CRON_SECRET` | Optional | Protect hourly scan | | `GCS_BUCKET` | Optional | Enable GCS storage mode | **Never commit `.env`.** ## Contributing Issues and PRs welcome. For anything beyond a small fix, open an issue first. ## Changelog See [CHANGELOG.md](./CHANGELOG.md) for what's new. ## Disclaimer Provided for educational and informational purposes. **Not financial advice.** No responsibility for trading losses. Test with small amounts. ## License MIT — see [LICENSE](./LICENSE). """ open(p, "w", encoding="utf-8").write(s) print("OK: README completed") print("saved")