mirror of
https://github.com/triqbit/mt5-ai-xauusd-trader.git
synced 2026-11-02 06:56:15 +00:00
Optimized `TradingEnv._get_observation` in `src/environment/gym_env.py` by: 1. Pre-calculating rolling means and standard deviations in `__init__` using Pandas. 2. Using a pre-allocated observation buffer to avoid repeated memory allocations. 3. Vectorizing the normalization process. Measurably faster: Increased observation generation speed from ~12k steps/s to ~67k steps/s (~5.5x speedup). Verified with `tests/test_env_consistency.py` to ensure optimized output matches the original implementation exactly. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: triqbit <242833443+triqbit@users.noreply.github.com>