Commit 2f0aa68
committed
feat(webui): trading signal panel, predict-future mode, dark theme & 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).1 parent 67b630e commit 2f0aa68
5 files changed
Lines changed: 620 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments