Skip to content

fix(holdings): stock.holdings を欠く最新 report_data を読み飛ばす - #104

Merged
Ries630 merged 2 commits into
mainfrom
claude/project-thread-f7xfl9
Oct 29, 2026
Merged

Ries630 merged 2 commits into
mainfrom
claude/project-thread-f7xfl9

Conversation

@Ries630

@Ries630 Ries630 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Requested by りーす · project thread

概要

analyze.py --market jp/us (引数なしの保有モード) で保有が空になる問題の修正。

原因

lib/holdings.py の latest_report_path() が日付最新の report_data_*.json を無条件に採っていた。最新ファイルが stock.holdings を欠くと load_holdings() が 0 件を返し、analyze.py は「対象市場の保有銘柄が見つからない」で終わる。同じ経路の held_tickers() も Investment 側の保有が空になるため、screen.py の母集団除外も効いていなかった。

変更

  • latest_report_path() は stock.holdings (リスト) を持つ最新ファイルまで遡る。遡ったときは読み飛ばしたファイル名を stderr に [warn] で出す。基準日は遡った先の as_of になり、保有ヘッダの経過日数に現れる
  • 空リストの stock.holdings は「保有 0 件」として有効扱い (遡らない)
  • どのファイルも stock.holdings を持たなければ FileNotFoundError
  • docs/output-contract.md の保有データの鮮度に読み方を追記
  • テスト 3 件追加 (遡る / 空リストは遡らない / 全滅で失敗)

Generated by Claude Code

最新の report_data が stock.holdings を持たないと保有が 0 件になり、
analyze.py --market jp/us の保有モードが空振りしていた。持つファイルまで
遡り、遡ったことを stderr に出す。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ghWwWfKwr9X9hwAaQaNQy
@Ries630 Ries630 self-assigned this Oct 29, 2026
@Ries630
Ries630 marked this pull request as ready for review October 29, 2026 01:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T01:48:45.161392Z 7654b43 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7654b43598

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/holdings.py Resolved
@Ries630
Ries630 merged commit 9b6937d into main Oct 29, 2026
1 check passed
@Ries630
Ries630 deleted the claude/project-thread-f7xfl9 branch October 29, 2026 01:50
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