Skip to content

Custom Video: RSI/MACD indicator panels on chart slides - #41

Merged
lnanology merged 1 commit into
mainfrom
feature/video-indicator-charts
Sep 7, 2026
Merged

Custom Video: RSI/MACD indicator panels on chart slides#41
lnanology merged 1 commit into
mainfrom
feature/video-indicator-charts

Conversation

@lnanology

Copy link
Copy Markdown
Owner

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.

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.
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
finlab-ai Ready Ready Preview Sep 7, 2026 2:30am UTC

@lnanology
lnanology merged commit 09f05cd into main Sep 7, 2026
4 checks passed
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.

1 participant