- Optimized `scripts/test_automation.py` by switching to sequential execution to reduce subprocess overhead.
- Optimized `ExpertMAPSARSizeOptimized_Improved.mq5` with 1-second caching for trade allowance checks and execution flow reordering.
- Optimized `SMC_TrendBreakout_MTF_EA.mq5` with trade allowance caching, log throttling, and static array usage.
- Added performance findings to `.jules/bolt.md`.
- Verified all changes with integration tests.
Extracts the dashboard HTML string into a global constant and compiles it
using Jinja2 only once (lazily) instead of re-parsing the string on every
request. This improves response latency for the dashboard.
- Extracted `DASHBOARD_HTML` constant
- Implemented `DASHBOARD_TEMPLATE` lazy compilation
- Replaced `render_template_string` with `DASHBOARD_TEMPLATE.render()`
- Verified with `scripts/test_web_dashboard.py`
- Replaced sequential execution of `ask_gemini` and `ask_jules` with `concurrent.futures.ThreadPoolExecutor`.
- Reduced total execution time by running independent network-bound tasks in parallel.
- Added necessary import for `concurrent.futures`.
⚡ Bolt: Parallelize AI requests (~2x speedup)
- Modified `scripts/review_pull_requests.py` to filter `git for-each-ref` output by unmerged branches.
- Reduces algorithmic complexity from O(N) to O(M) where N is total branches and M is active branches.
- Avoids expensive `ahead-behind` calculations for potentially thousands of stale merged branches.
- Replaced O(N) `git log` parsing with O(1) `git rev-list --count` for branch commit counts.
- Updated `get_all_branch_details` to return an empty `commits` list to ensure consistent data structure with `get_branch_info`, preventing potential runtime errors.
- Changed base branch reference from `main` to `origin/main` to support CI/CD environments and shallow clones where local `main` might be missing.
- Removed unused `commits` list generation in `get_branch_info` to improve fallback performance.
- Changed `check_authorized` in `scripts/telegram_deploy_bot.py` to fail closed (deny all) if `TELEGRAM_ALLOWED_USER_IDS` is unset or empty.
- Updated `scripts/TELEGRAM_BOT_SETUP.md` and `QUICK_DEPLOY.md` to document that `TELEGRAM_ALLOWED_USER_IDS` is now mandatory for bot access.
- Added Sentinel Journal entry in `.jules/sentinel.md` documenting the vulnerability and learning.
- Verified fix with reproduction script.
- Updated all references from Singapore 09 to Singapore 10 across documentation and scripts.
- Updated dates and timestamps to reflect the current migration date (February 4, 2026).
- Added migration details to VPS_SETUP_NOTES.md.
- Verified repository consistency and ran validation tests.
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
- Updated `docs/NOTEBOOK_LM_CONTEXT.txt` with user-provided NotebookLM URL and context directives.
- Enhanced `scripts/market_research.py` and `scripts/upgrade_repo.py`:
- Added proper Jules integration using the REST API structure `{"model": ..., "prompt": ...}` to match MQL5 implementation.
- Added warning suppression for deprecated `google.generativeai` warnings.
- Added robustness checks for API keys.
- Enhanced `scripts/schedule_research.py` with file logging (`logs/scheduler.log`) and next-run prediction.
- Implements `CPositionManager` class in `ManagePositions.mqh` for robust Trailing Stop and Break Even logic.
- Updates `SMC_TrendBreakout_MTF_EA.mq5` to use `CPositionManager` and exposes Scalping inputs.
- Adds preset files for M5, M15, M30 scalping in `mt5/MQL5/Presets/`.
- Documents strategy parameters in `docs/SCALPING_STRATEGY.md`.
- Adds `scripts/research_scalping.py` utility.
- Added `scripts/setup_forge_runner.sh` for automated Gitea runner registration.
- Optimized `SMC_TrendBreakout_MTF.mq5` by replacing manual loops with native `ArrayMaximum`/`ArrayMinimum`.
- Optimized `SMC_TrendBreakout_MTF_EA.mq5`:
- Replaced `CopyTime` with `iTime` for faster bar checks.
- Replaced non-existent `iDonchian` handle with standard MQL5 price range logic using `CopyHigh`/`CopyLow`.
- Removed redundant code and handles in `OnInit`/`OnDeinit`.
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
- Moved `yfinance` and `pandas` imports inside `get_market_data`
- Moved `google.generativeai` import inside `analyze_with_gemini`
- Reduces startup time when these libraries are not immediately needed (e.g. missing API keys or dry runs)
- Keeps fallback simulation logic intact
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
- Updated `scripts/market_research.py` to provide helpful hints on Jules NameResolutionError.
- Updated `docs/USER_NOTES.md` to document the schedule setup and current API status.
- Created `docs/upgrade_suggestions.md` to establish the upgrade context (NotebookLM) and track pending analysis.
- Verified scheduler execution (PID running).
- Note: Gemini API is currently rate-limited (429) and Jules API endpoint requires verification.
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
Replaced per-branch git log calls with a single git for-each-ref command using the ahead-behind atom. This optimizes the script from O(N) to O(1) git subprocess calls.
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
Replaced blocking `subprocess.run` calls with `asyncio.create_subprocess_exec` to ensure the Telegram bot event loop remains responsive during long-running deployment tasks.
Key changes:
- Switched to `asyncio.create_subprocess_exec` for command execution.
- implemented `asyncio.wait_for` to handle the 300s timeout.
- Added explicit process cleanup (kill/wait) on timeout.
- Manually decoded stdout/stderr since async subprocesses return bytes.
Verified with a reproduction script showing the event loop gap dropped from ~2.0s (blocking) to ~0.1s (non-blocking).
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
Parallelizes the Gemini and Jules AI analysis calls in `scripts/market_research.py` using `concurrent.futures`. This optimization allows both API requests to execute concurrently, reducing the total execution time of the script to the duration of the slower request rather than the sum of both.
Changes:
- Imported `concurrent.futures` in `scripts/market_research.py`.
- Replaced sequential calls to `analyze_with_gemini` and `analyze_with_jules` with `ThreadPoolExecutor` submission.