Skip to content

webui: future-forecast mode with TradingView-style chart interaction#342

Open
rishab-bf wants to merge 1 commit into
shiyu-coder:masterfrom
rishab-bf:feature/webui-future-forecast-tradingview
Open

webui: future-forecast mode with TradingView-style chart interaction#342
rishab-bf wants to merge 1 commit into
shiyu-coder:masterfrom
rishab-bf:feature/webui-future-forecast-tradingview

Conversation

@rishab-bf

Copy link
Copy Markdown

What changed

Reworks the web UI prediction flow around forecasting forward from the latest data, and makes the chart behave like a standard trading chart.

Forecasting

  • Predictions now use the most recent 400 bars in the file and forecast 120 bars beyond its end, instead of requiring a 400+120 backtest window inside the data.
  • The forecast is anchored 2 trading days back, so its first bars overlap known candles - users get an immediate visual quality check of the model against reality before the true-future portion begins. The overlapping bars also feed the existing predicted-vs-actual comparison table.
  • Future timestamps are session-aware (make_future_timestamps): daily data advances over business days; intraday data stays inside the observed session (e.g. 09:15-15:30) and rolls to the next business day.

Chart

  • Forecast renders as blue/purple candlesticks, visually distinct from the teal/red actual candles; a dotted divider with a "Forecast starts here" annotation marks the boundary.
  • TradingView-style interaction: scroll-wheel zoom, drag to pan, double-click to reset, and the price axis auto-fits the visible candles on every x-range change (autoFitY relayout handler).
  • Non-trading time is removed from the axis via rangebreaks: weekends, market holidays auto-detected from gaps in the loaded data, and overnight hours for intraday files.
  • Chart fills the viewport height, opens zoomed to the last ~60 bars + forecast, and the legend sits below the plot so candles get the full panel width.

Misc

  • Server port is configurable via KRONOS_WEBUI_PORT (default 8090) for machines where 7070 is occupied; the Werkzeug reloader is disabled to avoid duplicate model loads.
  • The fixed 400+120 time-window slider is hidden (superseded by the always-latest forecast flow).

Why

The previous UI could only "re-predict the past" for comparison; there was no way to get an actual forward forecast from the latest bar, which is the primary thing users ask of the model. Tested end-to-end on NSE (Indian market) daily and 5-minute data.

Notes for reviewers

  • Frontend still uses the bundled plotly.js v1.58 via CDN; rangebreaks and scrollZoom are supported there and were verified working.
  • create_prediction_chart keeps backward compatibility with the old backtest-window path (start_date), which the API still accepts.

🤖 Generated with Claude Code

Reworks the web UI prediction flow around forecasting forward from the
latest data instead of backtest-window comparison:

- Predictions always use the most recent 400 bars and forecast 120 bars
  beyond the end of the file. The forecast is anchored 2 trading days
  back so its first bars overlap known candles, giving users an
  immediate visual quality check before the true-future portion.
- Future timestamps are session-aware: daily data advances over
  business days; intraday data stays inside the observed trading
  session and rolls to the next business day.
- Forecast renders as blue/purple candlesticks, clearly distinct from
  the teal/red actual candles; a dotted divider marks where the
  forecast begins.
- TradingView-style chart interaction: scroll-wheel zoom, drag to pan,
  double-click reset, and the price axis auto-fits the visible candles
  on every x-range change.
- Non-trading time is removed from the axis via rangebreaks: weekends,
  holidays detected from gaps in the data, and overnight hours for
  intraday files.
- Chart fills the viewport height; legend moved below the plot; the
  fixed time-window slider is hidden.
- Server port is configurable via KRONOS_WEBUI_PORT (default 8090)
  for machines where 7070 is taken.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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