fix(ifind): legal A-share windows across a long closure are refused

Open
#483 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
fintech-quant

Research direction

Read ifind_ashare.py:31-42 and the renamed test_minimum_bars_never_exceeds_the_weekday_derived_bar_count sweep; PR #477 provides context, and #482 tracks a separate test gap. Explore whether an iFinD-served trading calendar can inform the bar-completeness floor without weakening protection against truncated replies. Done means complete windows across National Day and Spring Festival closures are accepted while genuinely truncated replies are still refused.

Written by the indexing model from the issue text.

Description

Follow-up from #474 item 1 (PR #477). Known and documented in the code; filing so it is tracked rather than only commented.

minimum_bars_for_window derives its floor from weekdays, which cannot see exchange holidays. A window whose data is complete and correct is refused as truncated when more than half its weekdays fall inside a closure.

floor = max(4, weekdays * 4 * 0.5) → refusal whenever real_trading_days < weekdays / 2.

Measured (sweep over every legal span, both real closures):

window span floor real trading days real bars
2026-09-28 → 2026-10-09 11d 18 4 16
2026-09-25 → 2026-10-08 13d 18 4 16
2024-02-05 → 2024-02-17 12d 20 4 16

Both National Day (Oct 1–7) and Spring Festival reproduce it.

Two things worth knowing before working this:

  • It is not reachable at the full 14-day span. Refusals cluster at 11–13 days; a 14-day window picks up enough weekdays on either side of the closure to clear its own floor. The comment at ifind_ashare.py:31-42 implies the widest windows are affected — they are not.
  • The existing sweep cannot catch it. test_minimum_bars_never_exceeds_the_weekday_derived_bar_count varies weekdays only, so no closure ever enters it. Renamed in PR #477 to stop it claiming coverage it does not have; the separate mutation-strength gap in that same test is #482.

It fails in the safe direction — a visible refusal, not a short curve charted as real — which is why it shipped. Lowering _MINIMUM_BAR_COMPLETENESS is not the fix: it trades a visible false refusal for silent acceptance of a genuinely truncated reply, which is the case the guard exists for. The fix is a CN trading calendar, which ifind_ashare.py deliberately does not carry (it would be a second, unversioned holiday table beside the exchange's own). An iFinD-served calendar would avoid that.

User-visible today: formatBacktestError names both holidays as the likely cause, so the message is accurate — the run is still refused.

Dominant language
Python
Stars
767
Forks
156
Avg merge
1d 18h
Merged PRs (30d)
73

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Open-Finance-Lab/AgenticTrading

All issues in Open-Finance-Lab/AgenticTrading

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.