Skip to content

feat: round 3 — LRU cache eviction, OHLCV validation, silent exception logging, Order UUID, slippage cap, BB/SR rendering, multi-stock switcher#38

Merged
AlanFokCo merged 1 commit into
mainfrom
copilot/easyquant-optimization-round-three
May 28, 2026
Merged

feat: round 3 — LRU cache eviction, OHLCV validation, silent exception logging, Order UUID, slippage cap, BB/SR rendering, multi-stock switcher#38
AlanFokCo merged 1 commit into
mainfrom
copilot/easyquant-optimization-round-three

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Third optimization round addressing unbounded memory growth in the data cache, silent error swallowing, order ID collisions under fast iteration, and missing chart overlays in the report viewer.

Data layer

  • LRU cache: _cache replaced with OrderedDict + eviction at 200 entries to prevent unbounded growth in walk-forward / paper trading
  • OHLCV sanity check: _validate_ohlcv() rejects frames missing required columns, non-positive close, or high < low — skips to next source on failure
  • Calendar boundary warning: _warn_calendar_coverage() emits UserWarning when end_date.year > 2028 (hardcoded holiday list limit)
  • Exception logging: All 30 except Exception: passexcept Exception as e: log.debug(...) — control flow unchanged, failures now observable

Backtest reliability

  • Order ID collision: datetime.now().strftime(...)uuid.uuid4().hex[:12]
  • VolumeSlippage cap: impact_pct now clamped to max_slippage_pct (default 5%) to prevent runaway slippage at low volume:
    VolumeSlippage(impact=0.05, max_slippage_pct=0.05)
    # impact_pct = min(impact * (amount / daily_volume), max_slippage_pct)
  • Docstring: simple_factor_analysis() now explicitly states it is not a Fama-French model

Report viewer (ReportViewer.tsx)

  • Bollinger Bands / Support-Resistance: Renders bb_upper/middle/lower_data (dashed) and support/resistance_data (dotted) on the K-line chart — type fields already existed but were unused
  • Multi-stock switcher: When symbols_list has >1 entry, renders a <select> dropdown that merges symbols_data[symbol] into the effective chart data via selectedSymbol state

All 391 existing tests pass, 0 CodeQL alerts.

…arning, debug logging, Order UUID, VolumeSlippage cap, BB/SR rendering, multi-stock switcher
Copilot AI changed the title feat: EasyQuant 第三轮优化 — 数据层加固、回测可信度、Report 丰富度 feat: round 3 — LRU cache eviction, OHLCV validation, silent exception logging, Order UUID, slippage cap, BB/SR rendering, multi-stock switcher May 28, 2026
Copilot AI requested a review from AlanFokCo May 28, 2026 09:33
@AlanFokCo AlanFokCo marked this pull request as ready for review May 28, 2026 11:16
@AlanFokCo AlanFokCo merged commit c7a03ce into main May 28, 2026
6 of 8 checks passed
@AlanFokCo AlanFokCo deleted the copilot/easyquant-optimization-round-three branch May 28, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants