Skip to content

Continuous enhancement: drawdown resilience quant diagnostic - #7

Open
ryun6249 wants to merge 1 commit into
automation/continuous-enhancement-20260519-1403from
automation/continuous-enhancement-20260519-1501
Open

Continuous enhancement: drawdown resilience quant diagnostic#7
ryun6249 wants to merge 1 commit into
automation/continuous-enhancement-20260519-1403from
automation/continuous-enhancement-20260519-1501

Conversation

@ryun6249

Copy link
Copy Markdown
Owner

Continuous Enhancement Report

1. Current Status

  • Project purpose: FastAPI-served local financial research workstation with deterministic Quantamental, Quant Lab, market, macro, forecast, and AI Portfolio workflows.
  • Existing structure preserved: yes. Static UI, FastAPI routers, schemas, services, deterministic engines, and smoke harnesses remain in place.
  • Main issues found: QAM/VAB diagnostics were visible, but drawdown recovery quality was not available as a first-class deterministic diagnostic or score-screen key.

2. Changes Made

Compatibility

  • Added drawdown_resilience as an additive score-screen key; existing defaults and score keys are unchanged.
  • Did not change composite score weights, trading/order execution, strategy entry/exit logic, providers, secrets, or .env.

Data Consistency

  • Added drawdown_recovery_resilience_v1 with required/available observations, input provenance, component scores, warnings, and used_in_composite_score=false.
  • Exposed the diagnostic through quant.metrics.algorithms, component scores, health metadata, screening rows, and API output.

UI/UX

  • Added DRS score/class rows to the Quantamental overview and score summary.
  • Added a Score Threshold Screener option labeled Drawdown Resilience / 雮欗彮 須岆车.
  • Bumped app and Quantamental bundle versions to avoid stale static assets.

Visualization

  • DRS appears alongside QAM/VAB as compact, secondary quant diagnostic context.

AI Briefing

  • Added DRS to quant_snapshot and deterministic AI key_changes as drawdown_recovery_algorithm.
  • AI remains constrained to interpreting deterministic engine output only.

Translation

  • Added concise Korean/English labels while preserving numeric/date/unit behavior.

Performance

  • Reuses already-loaded price, return, volatility, drawdown, risk-adjusted, and liquidity vectors; no new provider calls or background loops.

Tests / Validation

  • Python compile, JS syntax, ruff, UI contract, targeted pytest, full pytest, live API, Browser desktop/mobile, Quantamental smoke, and cross-tab smoke retry passed.

3. Changed Files

File Change Reason
pipelines/quantamental/quant_engine.py Added drawdown_recovery_resilience_v1 Deterministic drawdown recovery diagnostic
pipelines/quantamental/service.py Health and score-screen adapter support Expose DRS through API/screening data
pipelines/quantamental/ai_service.py Added DRS to AI context/key changes Keep AI briefing grounded in deterministic data
core/schemas/quantamental.py Added drawdown_resilience score key Additive request contract
app/web/modules/quantamental-ui.js DRS labels, summary, overview, score-screen label Visible UI integration
app/web/app.js Score metric labels and validation Make score-screen option usable
app/web/index.html Added option and bumped bundle versions Avoid stale UI bundle and expose option
scripts/check_ui_contract.py Added DRS UI markers Static UI contract validation
scripts/quantamental_ui_smoke.py Smoke score screen with DRS Browser regression coverage
scripts/ai_portfolio_ui_smoke.py Updated bundle versions Cross-dashboard smoke compatibility
tests/test_quantamental_api.py API and score-screen tests Validate response shape and score key
tests/test_quantamental_engines.py Engine/AI guard tests Validate algorithm and AI context
tests/test_ui_modules.py Module rendering tests Validate DRS HTML output
tests/test_ui_routing_contract.py Routing/version/marker tests Preserve UI asset contract
docs/CONTINUOUS_ENHANCEMENT_LOG.md Added 15:01 run log Document analysis, plan, validation, and safety

4. Validation Results

Check Command / Tool Result Notes
Lint python -m ruff check pipelines\quantamental\quant_engine.py pipelines\quantamental\service.py pipelines\quantamental\ai_service.py core\schemas\quantamental.py tests\test_quantamental_api.py tests\test_quantamental_engines.py Passed Changed Python surfaces
Build node --check app\web\modules\quantamental-ui.js; node --check app\web\app.js; Python compile command Passed Repo has no npm/pnpm build manifest
Test python -m pytest tests\test_quantamental_engines.py tests\test_quantamental_api.py tests\test_ui_modules.py tests\test_ui_routing_contract.py -q Passed 81 passed, 4 subtests passed
Test python -m pytest -q Passed 693 passed, 9 subtests passed
UI validation Browser at http://127.0.0.1:8000/ui/?range=1Y#quantamental Passed Desktop/mobile, All view, quality badge, DRS visible, no overflow/errors
UI validation python scripts\quantamental_ui_smoke.py --base-url http://127.0.0.1:8000 --output reports\quantamental_ui_smoke_continuous_20260519_1501.json Passed Required tickers, invalid ticker, GLOBAL, DRS screen, AI/Q&A
UI validation python scripts\ai_portfolio_ui_smoke.py --base-url http://127.0.0.1:8000 --timeout-s 240 --output reports\ai_portfolio_ui_smoke_continuous_20260519_1501_retry.json Passed First 180s run timed out on Macro search; retry passed
Data validation Live /api/v1/quantamental/health and AAPL analysis Passed Health lists DRS; AAPL AI key changes include DRS
AI briefing validation Deterministic AI report tests and live AAPL payload Passed AI interprets DRS without overriding deterministic signal

5. Remaining Risks

  • DRS thresholds are deterministic heuristics and should be calibrated with broader cross-sectional validation before being treated as a production ranking signal.
  • Existing Macro series search can be slow under cross-tab smoke; retry passed, but the first timeout remains a performance watch item.

6. Next Enhancement Suggestions

  1. Add calibration diagnostics comparing DRS buckets against realized forward drawdown/recovery windows.
  2. Add a compact DRS explanation tooltip listing inputs and score direction in the Quantamental UI.
  3. Improve Macro series search latency so cross-tab smoke does not need retry tolerance.

7. Safety Notes

  • main/master was not modified directly.
  • Auto-merge was not enabled.
  • Secrets were not touched.
  • Trading/order execution logic was not modified.
  • Unsupported facts were not presented as verified.

@ryun6249 ryun6249 added the enhancement New feature or request label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant