Custom Video: RSI/MACD indicator panels on chart slides - #41
Merged
Conversation
AJ's upgrade #3 request ("1-4可以全做"): a topic that explicitly names RSI or MACD (e.g. "NVDA's RSI", "講吓大市MACD走勢") now gets a real indicator panel drawn below the candlestick chart on every chart slide in that video. - _detect_requested_indicator(): keyword match (English + Chinese) for "rsi" vs "macd" in the topic text. None (unchanged behavior, plain candlesticks) when neither is named. - _compute_indicator_series(): fetches its own 6-month OHLC history (longer than _fetch_candles' 2mo -- MACD's 26-period EMA needs real warmup data) and calls TechnicalAnalysisService._rsi()/_macd() directly -- the exact same static methods get_technical_analysis() already uses for chart-analysis.html, so this can never drift from what that page shows for the same ticker. Returns the last 20 values, aligned to the same window the candlesticks render. - _draw_indicator_panel(): RSI as a 0-100 line with 30/70 reference lines; MACD as histogram bars + MACD/signal lines with a zero line. - _render_slide()'s "chart" branch shrinks the candlestick area to make room for the panel when indicator data is present; unchanged (full-height candles) when it's None. - generate_custom_video() detects the indicator once per video and computes it per chart ticker; result dict gets an "indicator" key when used. Best-effort throughout, matching this file's existing chart/support- resistance/background-image helpers: any failure (insufficient history, fetch error) just means no panel, never blocks the video. Verified: py_compile, functional tests (keyword detection incl. zh, _compute_indicator_series success/empty/short-history/exception/ unrecognized-indicator paths against a real pandas RSI/MACD calc on synthetic OHLC data, _draw_indicator_panel incl. edge cases, full _render_slide chart+indicator and chart-without-indicator paths, end-to-end generate_custom_video() wiring for indicator-requested and indicator-not-requested topics), backend boot (66 routes, unchanged). Depends on feature/video-multi-chart-slides (branched from it) -> feature/video-ai-background-image (branched from that) -- merge in that order: background-image, then multi-chart-slides, then this one.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
AJ's upgrade #3 request ("1-4可以全做"): a topic that explicitly names RSI or MACD (e.g. "NVDA's RSI", "講吓大市MACD走勢") now gets a real indicator panel drawn below the candlestick chart on every chart slide in that video.
Best-effort throughout, matching this file's existing chart/support- resistance/background-image helpers: any failure (insufficient history, fetch error) just means no panel, never blocks the video.
Verified: py_compile, functional tests (keyword detection incl. zh, _compute_indicator_series success/empty/short-history/exception/ unrecognized-indicator paths against a real pandas RSI/MACD calc on synthetic OHLC data, _draw_indicator_panel incl. edge cases, full _render_slide chart+indicator and chart-without-indicator paths, end-to-end generate_custom_video() wiring for indicator-requested and indicator-not-requested topics), backend boot (66 routes, unchanged).
Depends on feature/video-multi-chart-slides (branched from it) -> feature/video-ai-background-image (branched from that) -- merge in that order: background-image, then multi-chart-slides, then this one.