Implementation:Shiyu coder Kronos Prediction Result Output
| Knowledge Sources | |
|---|---|
| Domains | Data_Persistence, Financial_Prediction, Serialization |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
JSON output format specification for persisted prediction results generated by the Kronos WebUI, containing forecasted OHLCV candlestick data alongside ground truth for comparison analysis.
Description
Each time the WebUI executes a prediction via the /api/predict endpoint, the results are saved as a timestamped JSON file in webui/prediction_results/. The format captures the complete prediction context: input parameters, data summary, predicted candlesticks, actual (ground truth) candlesticks, and continuity analysis between predicted and actual values.
This is a Pattern Doc — it documents a data format rather than a callable API. The files are produced by save_prediction_results() in webui/app.py.
Usage
Reference this format when parsing or analyzing saved prediction outputs from the Kronos WebUI. Each JSON file is self-contained and includes all metadata needed to reproduce or evaluate the prediction.
Code Reference
Source Location
- Repository: Shiyu_coder_Kronos
- File: webui/app.py (save_prediction_results)
- Output Directory: webui/prediction_results/
Signature
{
"timestamp": "2025-08-26T16:38:00.302387",
"file_path": "/path/to/source_data.feather",
"prediction_type": "Kronos model prediction (...)",
"prediction_params": {
"lookback": 400,
"pred_len": 120,
"temperature": 1.0,
"top_p": 0.9,
"sample_count": 1,
"start_date": "2025-08-02T13:24"
},
"input_data_summary": {
"rows": 400,
"columns": ["open", "high", "low", "close", "volume"],
"price_range": {
"open": {"min": 112046.9, "max": 114231.95},
"high": {"min": 112200.0, "max": 114260.31},
"low": {"min": 111920.0, "max": 114085.61},
"close": {"min": 112046.9, "max": 114231.95}
},
"last_values": {
"open": 113769.56, "high": 113852.6,
"low": 113731.29, "close": 113818.87
}
},
"prediction_results": [
{"timestamp": "...", "open": ..., "high": ..., "low": ..., "close": ..., "volume": ..., "amount": ...}
],
"actual_data": [
{"timestamp": "...", "open": ..., "high": ..., "low": ..., "close": ..., "volume": ..., "amount": ...}
],
"analysis": {
"continuity": {
"last_prediction": {"open": ..., "high": ..., "low": ..., "close": ...},
"first_actual": {"open": ..., "high": ..., "low": ..., "close": ...},
"gaps": {"open_gap": ..., "high_gap": ..., "low_gap": ..., "close_gap": ...},
"gap_percentages": {"open_gap_pct": ..., "high_gap_pct": ..., "low_gap_pct": ..., "close_gap_pct": ...}
}
}
}
Import
import json
# Load a prediction result file
with open("webui/prediction_results/prediction_20250826_163800.json") as f:
result = json.load(f)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| file_path | str | Yes | Source data file path used for prediction |
| prediction_type | str | Yes | Description string of prediction mode |
| prediction_results | list[dict] | Yes | List of predicted OHLCV candles with timestamps |
| actual_data | list[dict] | No | Ground truth candles for comparison (may be empty) |
| input_data | DataFrame | Yes | Historical input data (summarized in output) |
| prediction_params | dict | Yes | Parameters: lookback, pred_len, temperature, top_p, sample_count, start_date |
Outputs
| Name | Type | Description |
|---|---|---|
| JSON file | File | Timestamped file at webui/prediction_results/prediction_YYYYMMDD_HHMMSS.json |
| prediction_results | list[dict] | 120 predicted OHLCV candles with ISO timestamps |
| actual_data | list[dict] | 120 actual OHLCV candles (if ground truth available) |
| analysis.continuity | dict | Gap analysis between first predicted and first actual candle |
Usage Examples
Loading and Analyzing a Prediction Result
import json
import pandas as pd
# Load saved prediction
with open("webui/prediction_results/prediction_20250826_163800.json") as f:
result = json.load(f)
# Extract prediction parameters
params = result["prediction_params"]
print(f"Lookback: {params['lookback']}, Pred Length: {params['pred_len']}")
print(f"Temperature: {params['temperature']}, Top-p: {params['top_p']}")
# Convert predictions to DataFrame
pred_df = pd.DataFrame(result["prediction_results"])
pred_df["timestamp"] = pd.to_datetime(pred_df["timestamp"])
print(f"Predicted {len(pred_df)} candles")
print(f"Price range: {pred_df['close'].min():.2f} - {pred_df['close'].max():.2f}")
# Compare with actual data if available
if result["actual_data"]:
actual_df = pd.DataFrame(result["actual_data"])
actual_df["timestamp"] = pd.to_datetime(actual_df["timestamp"])
# Check continuity gaps
if "continuity" in result.get("analysis", {}):
gaps = result["analysis"]["continuity"]["gap_percentages"]
print(f"Close price gap: {gaps['close_gap_pct']:.2f}%")
Files Covered
This page documents the output format for all 29 prediction result files in webui/prediction_results/:
- prediction_20250826_163800.json through prediction_20250826_181932.json
- All files contain BTC/USDT 5-minute candlestick predictions with lookback=400 and pred_len=120