fix: correct color inversion, UnboundLocalError, and Tencent data key bugs#34
Merged
Merged
Conversation
Add eqlib/scientific/ package with: - overfitting.py: walk-forward analysis, parameter sensitivity, OOS test - statistics.py: bootstrap CI, Monte Carlo simulation, significance tests - bias.py: survivorship, lookahead, selection, data bias detection - risk.py: extended risk metrics (VaR, CVaR, stress test, tail risk) - comparison.py: platform comparison and trade verification - validation_runner.py: unified pipeline orchestration - report.py: markdown/JSON/HTML report generation - validation_config.py: global configuration dataclass Add comprehensive tests (56 new tests, 338 total passing)
Copilot
AI
changed the title
feat: Phase 1 backtest scientificity framework
feat: Phase 1 backtest scientificity validation framework
May 27, 2026
Copilot created this pull request from a session on behalf of
AlanFokCo
May 27, 2026 16:31
View session
… bugs - Fix inverted CSS color variables in report.py (--green was red, --red was green) - Fix inverted color logic in _build_daily_pnl() bar charts - Fix UnboundLocalError in _align_fallback() when first data point is skipped - Fix Tencent data key lookup: "hfq" adjust now correctly maps to "hfqday" - Remove redundant local `import datetime` in objects.py
Copilot
AI
changed the title
feat: Phase 1 backtest scientificity validation framework
fix: correct color inversion, UnboundLocalError, and Tencent data key bugs
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codebase audit surfaced five bugs across
report.py,data.py, andobjects.py.Color values swapped in report charts
--greenand--redwere mapped to opposite hex values (--green: #f5222d🔴,--red: #52c41a🟢)_build_daily_pnl()bar chart colors used the same inverted logic — gains rendered red, losses greenUnboundLocalErrorin_align_fallback()basewas only assigned wheni == 0, but if the first data point was skipped (empty series or NaN), subsequent iterations crashed on the unguardedbasereference:Tencent API returns wrong kline series for
hfqadjustThe key lookup was
"qfqday" if adjust else "day", so any non-emptyadjust(including"hfq") resolved to"qfqday". Fixed tof"{adjust}day".Redundant local imports in
objects.pyRemoved two local
import datetimestatements that shadowed the existing module-level import.