feat: multi-timeframe technical analysis (weekly/monthly)#13
Merged
Conversation
Support multi-timeframe analysis by aggregating daily PriceBar data into weekly (ISO week) and monthly (calendar month) bars. OHLCV aggregation handles None values gracefully. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TechnicalIndicators gains a timeframe tag (daily/weekly/monthly). New MultiTimeframeTechnical wraps daily + optional weekly/monthly results for multi-timeframe analysis output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New analyze_technical_multi() computes daily/weekly/monthly indicators in a single call by aggregating daily bars and reusing compute_technical. Existing analyze_technical() unchanged for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The technical command now shows monthly→weekly→daily indicator layers. Default data window expanded from 1 year to 2 years to support monthly MACD calculation. JSON output includes all three timeframes. Batch mode remains daily-only for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Design document for adding weekly/monthly indicator output to the analyze technical command via computation-layer aggregation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address code review feedback: document sort invariant in _aggregate_bars. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…date _ensure_prices_cached now checks if the earliest cached bar covers the requested start date. If not, it fetches the missing earlier portion. This fixes the issue where expanding the default window from 1→2 years would skip fetching because >10 bars already existed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 years (36 monthly bars) ensures monthly MACD(26) has sufficient data. The previous 2-year window only yielded 24 monthly bars, falling short. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
haoinvest/engine/aggregation.py)analyze technicalnow outputs layered indicators: monthly → weekly → dailyMultiTimeframeTechnicalmodel wraps all three timeframesDesign Decisions
analyze_technical()unchanged, batch mode stays daily-only, daily kv_output format preservedTest plan
uv run haoinvest analyze technical 600519shows monthly/weekly/daily sectionsuv run haoinvest analyze technical 600519 --jsonhas monthly/weekly/daily keys🤖 Generated with Claude Code