Skip to content

feat(webui): Trading signal panel, Predict Future Now, dark theme & bug fixes#309

Open
courasneto wants to merge 1 commit into
shiyu-coder:masterfrom
courasneto:feature/webui-enhancements-trading-signals
Open

feat(webui): Trading signal panel, Predict Future Now, dark theme & bug fixes#309
courasneto wants to merge 1 commit into
shiyu-coder:masterfrom
courasneto:feature/webui-enhancements-trading-signals

Conversation

@courasneto
Copy link
Copy Markdown

Summary

Major improvements to the Kronos Web UI — new trading signal analysis panel, a dedicated future-forecast mode, chart color overhaul, Windows launcher, data download utility, and two critical bug fixes.

New Features

🎯 Predict Future Now

  • New button that uses the most recent 400 candles to forecast the next 120 periods beyond the last data point — a true future forecast, not a backtest.
  • Future timestamps are generated via \pd.date_range\ so the model always forecasts into uncharted territory.
  • No 'actual data' trace is shown in this mode (the future has not happened yet).

📊 Trading Signal Analysis Panel

  • After every prediction, a full signal panel is rendered below the chart, automatically computed from the model output.
  • Signal categories: STRONG BUY / BUY / NEUTRAL / CAUTION / DO NOT BUY, each with a distinct color scheme.
  • Includes: six metric cards (Current Price, Predicted Final Price, Predicted High, Predicted Low, Predicted Mean, Support/Resistance), a trajectory timeline (Now → +Xd → +Xd → End), and an operations grid (Entry, Stop-Loss −3%, Target 1, Target 2, Timeframe).

🎨 Dark Theme & Chart Color Overhaul

  • Chart background: \plotly_dark\ with dark paper/plot background.
  • Historical candles → gray (#78909C) — neutral context window.
  • Prediction candles → blue (#1E88E5) — clearly distinguishable.
  • Actual/backtest candles → orange (#F57C00) — easy visual comparison.

🪟 Windows Launcher (\start.ps1)

  • One-command launcher for Windows/PowerShell.
  • Auto-detects Python with CUDA by iterating all \python.exe\ in PATH and testing \ orch.cuda.is_available().
  • Falls back to CPU if no CUDA Python is found.
  • Deactivates any active venv to prevent using the wrong interpreter.
  • Generates a random available port (10000–60000) and auto-opens the browser.
  • Supports -SkipInstall\ flag for fast repeat launches.

📥 Data Download Utility (\download_data.py)

  • CLI script to download market data (crypto, stocks, forex) via \yfinance\ and save to \data/\ in the Kronos CSV format.
  • Supports all yfinance intervals (\1m, \5m, \15m, \1h, \4h, \1d...).
  • Example: \python download_data.py BTC-USD --interval 4h --period 2y\

Bug Fixes

\�ctual_data\ rendering wrong price range in predict-future mode (critical)

  • Root cause: the \�lse\ branch always fetched \df.iloc[0:lookback+pred_len], so in future mode (no \start_date) it served the oldest candles in the file, rendering an orange trace in a completely wrong price band.
  • Fix: \�ctual_data\ is now mode-aware — \predict_future=True\ → \None; \start_date\ provided → correct slice from the selected time window; otherwise → nothing.

\historical_start_idx\ showing stale data in predict-future mode

  • Root cause: \historical_start_idx\ defaulted to \

@courasneto courasneto force-pushed the feature/webui-enhancements-trading-signals branch from 923a0cc to 5af73a9 Compare May 29, 2026 16:45
…bug fixes

## Summary
Major improvements to the Kronos Web UI focusing on usability, visual clarity,
and a new real-time trading signal analysis panel.

## New Features

### Predict Future Now
- Added a dedicated 'Predict Future Now' button that uses the most recent
  400 candles (lookback) to forecast the next 120 periods beyond the last
  data point — i.e., a true future forecast, not a backtest.
- Future timestamps are generated programmatically via pd.date_range so
  the model always forecasts into the uncharted future.
- No 'actual data' orange trace is shown in this mode (the future hasn't
  happened yet).

### Trading Signal Analysis Panel
- After every prediction a full trading signal panel is displayed below the
  chart, automatically computed from the prediction output.
- Signal categories: STRONG BUY / BUY / NEUTRAL / CAUTION / DO NOT BUY,
  each with a distinct color scheme.
- Panel includes six metric cards: Current Price, Predicted Final Price (%),
  Predicted High, Predicted Low, Predicted Mean, Support / Resistance.
- Trajectory timeline: Now → [Nd: +X%] → [Nd: +X%] → [End: +X%].
- Operations panel: Entry, Stop-Loss (-3%), Target 1, Target 2, Timeframe.

### Dark Theme & Chart Color Overhaul
- Chart background switched to plotly_dark with dark paper/plot bg.
- Historical candles: gray (#78909C / #546E7A) — neutral context.
- Prediction candles: blue (#1E88E5 / #1565C0) — clearly distinguishable.
- Actual/backtest candles: orange (#F57C00 / #BF360C) — easy comparison.

### Windows Launcher (start.ps1)
- One-command launcher: auto-detects the Python installation with CUDA
  support by iterating all python.exe in PATH and testing
  torch.cuda.is_available().
- Falls back to CPU if no CUDA Python is found.
- Deactivates any active venv to prevent using the wrong Python.
- Generates a random port (10000-60000), checks availability via
  Get-NetTCPConnection, then auto-opens the browser after 3 s.
- Supports -SkipInstall flag to skip pip install on repeat launches.

### Data Download Utility (download_data.py)
- CLI utility to download market data (crypto, stocks, forex) via yfinance
  and save to the Kronos data/ directory in the expected CSV format.
- Supports all yfinance intervals (1m, 5m, 15m, 1h, 4h, 1d, 1wk, 1mo).
- Usage: python download_data.py BTC-USD --interval 4h --period 2y

## Bug Fixes

### actual_data showing wrong price range in predict-future mode (critical)
- Root cause: the else branch in the actual_data section always fetched
  df.iloc[0:lookback+pred_len] regardless of mode, so in predict-future
  mode (no start_date) it served the very first candles in the file
  (e.g. 2024 XRP at ~.50 instead of current ~.30), rendering an
  orange trace in a completely wrong price band.
- Fix: actual_data is now mode-aware:
    - predict_future=True  → actual_df = None (no trace)
    - start_date provided  → actual_df from time_range_df[lookback:lookback+pred_len]
    - neither              → no actual data

### historical_start_idx wrong in predict-future mode
- Root cause: historical_start_idx defaulted to 0, so the chart showed
  candles from the very beginning of the file (years-old data) as the
  'historical' context window instead of the last 400 candles.
- Fix: when predict_future=True, historical_start_idx = len(df) - lookback.

## Localization
- All user-visible text translated from Chinese/Portuguese to English.
- html lang attribute updated to 'en'.
- Date formatting locale updated to en-US.
- .gitignore updated to exclude data/ and webui/prediction_results/ (runtime artifacts).
@courasneto courasneto force-pushed the feature/webui-enhancements-trading-signals branch from 5af73a9 to 2f0aa68 Compare May 29, 2026 16:49
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