Kronos: A Foundation Model for the Language of Financial Markets
This report summarizes scanner evidence for shiyu-coder/Kronos, a Python project with 44,371 GitHub stars. SynthScan examined 78,563 lines of code across 73 source files, recording 220 pattern matches distributed across 13 syntactic categories. The legacy adjusted pattern signal is 3.6 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Payload schema: 1.0.0 · Engine: 2.0.0 · Scoring: heuristic-density-v1 · Scan date: 2026-10-31.
Can maintainers explain intent, assumptions, and trade-offs? 109 finding(s).
Are imports declared and package/API names verified? 44 finding(s).
Are wrappers, guards, and repeated structures necessary? 131 finding(s).
Which changes need focused human review? 220 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 220 distinct pattern matches across 13 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/config.py | 9 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 11 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 30 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 32 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 43 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 45 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 72 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 74 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 96 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 98 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 109 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 111 | # ================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 28 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 30 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 92 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 94 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 203 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 205 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 298 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 300 | # ================================================================================= | COMMENT |
| MEDIUM | examples/get_akshare_date_2024-2025_x.py | 619 | # ===================================================== | COMMENT |
| MEDIUM | examples/get_date_new.py | 651 | # ===================================================== | COMMENT |
| MEDIUM | examples/prediction_akshare_2024-2025.py | 532 | # ========================================================= | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_kronos_regression.py | 46 | def test_kronos_predictor_regression(context_len): | CODE |
| LOW | tests/test_kronos_regression.py | 91 | def test_kronos_predictor_mse(context_len, expected_mse): | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 157 | def parse_kline_data_directly(response_text, stock_code, start_year, end_year): | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 353 | def get_stock_data_with_retry(stock_code="002354", start_year=2024, end_year=2025, retry_count=2): | CODE |
| LOW⚡ | examples/prediction_new.py | 664 | def _get_default_market_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 672 | def _get_default_sector_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 682 | def _get_default_macro_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 689 | def _get_default_fundamental_analysis(self): | CODE |
| LOW | examples/prediction_new.py | 89 | def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2): | CODE |
| LOW | examples/prediction_new.py | 105 | def create_realistic_fallback_data(stock_code="600580"): | CODE |
| LOW | examples/prediction_new.py | 191 | def save_all_history_stock_data(df, stock_code, save_dir): | CODE |
| LOW | examples/prediction_new.py | 284 | def calculate_prediction_parameters(df, target_days=60): | CODE |
| LOW | examples/prediction_new.py | 333 | def calculate_optimal_interval(min_val, max_val): | CODE |
| LOW | examples/prediction_new.py | 363 | def get_stock_price_reference(stock_code, current_price): | CODE |
| LOW | examples/prediction_new.py | 600 | def analyze_company_fundamentals(self, stock_code): | CODE |
| LOW | examples/prediction_new.py | 651 | def _calculate_trend_strength(self, df): | CODE |
| LOW | examples/prediction_new.py | 702 | def enhance_prediction_with_market_factors( | CODE |
| LOW | examples/prediction_new.py | 757 | def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis): | CODE |
| LOW | examples/prediction_new.py | 826 | def create_comprehensive_market_report(enhancement_info, output_dir, stock_code): | CODE |
| LOW | examples/prediction_new.py | 850 | def generate_analysis_summary(enhancement_info): | CODE |
| LOW | examples/prediction_new.py | 895 | def plot_comprehensive_prediction( | CODE |
| LOW | examples/prediction_new.py | 1148 | def run_comprehensive_kronos_prediction(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 959 | def _get_default_market_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 967 | def _get_default_sector_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 977 | def _get_default_macro_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 984 | def _get_default_fundamental_analysis(self): | CODE |
| LOW | examples/prediction_new_GUI.py | 391 | def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2): | CODE |
| LOW | examples/prediction_new_GUI.py | 407 | def create_realistic_fallback_data(stock_code="600580"): | CODE |
| LOW | examples/prediction_new_GUI.py | 493 | def save_all_history_stock_data(df, stock_code, save_dir): | CODE |
| LOW | examples/prediction_new_GUI.py | 586 | def calculate_prediction_parameters(df, target_days=60): | CODE |
| LOW | examples/prediction_new_GUI.py | 616 | def generate_trading_dates_only(last_date, pred_len): | CODE |
| LOW | examples/prediction_new_GUI.py | 649 | def calculate_optimal_interval(min_val, max_val): | CODE |
| LOW | examples/prediction_new_GUI.py | 895 | def analyze_company_fundamentals(self, stock_code): | CODE |
| LOW | examples/prediction_new_GUI.py | 946 | def _calculate_trend_strength(self, df): | CODE |
| LOW | examples/prediction_new_GUI.py | 997 | def smooth_prediction_results(prediction_df, historical_df, smooth_factor=0.3): | CODE |
| LOW | examples/prediction_new_GUI.py | 1070 | def apply_post_holiday_adjustment(prediction_df, future_dates, holiday_periods): | CODE |
| LOW | examples/prediction_new_GUI.py | 1105 | def validate_prediction_results(historical_df, prediction_df, max_price_change=0.3): | CODE |
| LOW | examples/prediction_new_GUI.py | 1140 | def run_comprehensive_prediction_gui(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1, | CODE |
| LOW | examples/prediction_new_GUI.py | 1327 | def enhance_prediction_with_market_factors(historical_df, prediction_df, stock_code, market_analyzer): | CODE |
| LOW | examples/prediction_new_GUI.py | 1369 | def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis): | CODE |
| LOW | examples/prediction_new_GUI.py | 1410 | def create_comprehensive_market_report(enhancement_info, output_dir, stock_code): | CODE |
| LOW | examples/prediction_new_GUI.py | 1433 | def plot_optimized_prediction_gui(historical_df, base_pred_df, enhanced_pred_df, future_trading_dates, | CODE |
| LOW | examples/get_date_new.py | 23 | def get_stock_data_eastmoney_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 147 | def parse_kline_data_directly_all_history(response_text, stock_code): | CODE |
| LOW | examples/get_date_new.py | 190 | def get_stock_data_akshare_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 243 | def get_stock_data_baostock_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 354 | def get_stock_data_with_retry_all_history(stock_code="002354", retry_count=2): | CODE |
| LOW | examples/get_date_new.py | 378 | def create_sample_data_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 504 | def display_all_history_data_info(df, stock_code): | CODE |
| LOW | examples/get_date_new.py | 566 | def save_all_history_stock_data(df, stock_code, save_dir="D:/lianghuajiaoyi/Kronos/examples/data"): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 78 | def calculate_prediction_parameters(df, target_days=100): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 112 | def generate_future_dates_with_holidays(last_date, pred_len): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 152 | def plot_prediction_with_details(kline_df, pred_df, future_dates, stock_code="002354", stock_name="股票", pred_len=100, | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 312 | def generate_prediction_report(close_df, volume_df, pred_df, future_dates, stock_code="002354", stock_name="股票", | CODE |
| LOW | examples/run_backtest_kronos.py | 132 | def calculate_trading_signals(self, hist_df, pred_df, threshold=0.02): | CODE |
| LOW | examples/yuce/historical_backtest.py | 57 | def simulate_model_prediction(self, df, lookback_days=60, pred_days=30): | CODE |
| LOW | examples/yuce/historical_backtest.py | 104 | def calculate_prediction_accuracy(self, results_df): | CODE |
| LOW | model/kronos.py | 389 | def auto_regressive_inference(tokenizer, model, x, x_stamp, y_stamp, max_context, pred_len, clip=5, T=1.0, top_k=0, top_ | CODE |
| LOW | model/module.py | 157 | def get_hard_per_sample_entropy(self, zb_by_sample): | CODE |
| LOW | webui/templates/index.html | 843 | function setupSliderEventListeners() { | CODE |
| 3 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/get_akshare_date_2024-2025_x.py | 152 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 195 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 256 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 348 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 84 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 472 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 543 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 596 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 647 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 1172 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 1295 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 311 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 386 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 767 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 838 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 891 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 942 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1176 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1319 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1611 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 142 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 184 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 238 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 349 | except Exception as e: | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 504 | except Exception as e: | CODE |
| LOW | examples/run_backtest_kronos.py | 408 | except Exception as e: | CODE |
| LOW | examples/prediction_cn_markets_day.py | 60 | except Exception as e: | CODE |
| LOW | examples/yuce/historical_backtest.py | 329 | except Exception as e: | CODE |
| LOW | webui/run.py | 84 | except Exception as e: | CODE |
| LOW | webui/app.py | 122 | except Exception as e: | CODE |
| LOW | webui/app.py | 205 | except Exception as e: | CODE |
| LOW | webui/app.py | 401 | except Exception as e: | CODE |
| LOW | webui/app.py | 489 | except Exception as e: | CODE |
| LOW | webui/app.py | 610 | except Exception as e: | CODE |
| LOW | webui/app.py | 623 | except Exception as e: | CODE |
| LOW | webui/app.py | 662 | except Exception as e: | CODE |
| LOW | finetune_csv/train_sequential.py | 308 | except Exception as e: | CODE |
| MEDIUM | finetune_csv/train_sequential.py | 310 | print(f"Error occurred during training: {str(e)}") | CODE |
| LOW | finetune_csv/train_sequential.py | 355 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune/config.py | 1 | CODE | |
| LOW | finetune/qlib_test.py | 11 | CODE | |
| LOW | finetune/qlib_test.py | 16 | CODE | |
| LOW | finetune/qlib_test.py | 19 | CODE | |
| LOW | finetune/train_tokenizer.py | 6 | CODE | |
| LOW | finetune/train_tokenizer.py | 7 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 4 | CODE | |
| LOW | examples/prediction_new.py | 8 | CODE | |
| LOW | examples/prediction_new.py | 10 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 8 | CODE | |
| LOW | examples/prediction_new_GUI.py | 10 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 17 | CODE | |
| LOW | examples/prediction_new_GUI.py | 19 | CODE | |
| LOW | examples/get_date_new.py | 4 | CODE | |
| LOW | examples/run_backtest_kronos.py | 6 | CODE | |
| LOW | examples/run_backtest_kronos.py | 6 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 6 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 6 | CODE | |
| LOW | model/kronos.py | 10 | CODE | |
| LOW | webui/run.py | 15 | CODE | |
| LOW | webui/run.py | 16 | CODE | |
| LOW | webui/run.py | 17 | CODE | |
| LOW | webui/run.py | 18 | CODE | |
| LOW | webui/run.py | 19 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/app.py | 3 | CODE | |
| LOW | finetune_csv/train_sequential.py | 6 | CODE | |
| LOW | finetune_csv/train_sequential.py | 7 | CODE | |
| LOW | finetune_csv/train_sequential.py | 11 | CODE | |
| LOW | finetune_csv/train_sequential.py | 15 | CODE | |
| LOW | finetune_csv/finetune_tokenizer.py | 11 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 5 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 13 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 21 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune/qlib_test.py | 239 | CODE | |
| LOW | finetune/train_tokenizer.py | 74 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 23 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 157 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 384 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 500 | CODE | |
| LOW | examples/prediction_new.py | 333 | CODE | |
| LOW | examples/prediction_new.py | 702 | CODE | |
| LOW | examples/prediction_new.py | 476 | CODE | |
| LOW | examples/prediction_new_GUI.py | 649 | CODE | |
| LOW | examples/prediction_new_GUI.py | 1070 | CODE | |
| LOW | examples/prediction_new_GUI.py | 1105 | CODE | |
| LOW | examples/prediction_new_GUI.py | 771 | CODE | |
| LOW | examples/get_date_new.py | 23 | CODE | |
| LOW | examples/get_date_new.py | 147 | CODE | |
| LOW | examples/get_date_new.py | 378 | CODE | |
| LOW | examples/get_date_new.py | 504 | CODE | |
| LOW | examples/prediction_akshare_2024-2025.py | 369 | CODE | |
| LOW | examples/run_backtest_kronos.py | 158 | CODE | |
| LOW | examples/run_backtest_kronos.py | 359 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 264 | CODE | |
| LOW | model/kronos.py | 225 | CODE | |
| LOW | webui/app.py | 78 | CODE | |
| LOW | webui/app.py | 209 | CODE | |
| LOW | webui/app.py | 342 | CODE | |
| LOW | webui/app.py | 405 | CODE | |
| LOW | finetune_csv/config_loader.py | 25 | CODE | |
| LOW | finetune_csv/finetune_tokenizer.py | 151 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 239 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | examples/prediction_new.py | 493 | except: | CODE |
| HIGH | examples/prediction_new_GUI.py | 788 | except: | CODE |
| HIGH | finetune_csv/train_sequential.py | 355 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | finetune/qlib_data_preprocess.py | 43 | # Check if start_index lookbackw_window will cause negative index | COMMENT |
| LOW⚡ | finetune/qlib_data_preprocess.py | 47 | # Check if end_index exceeds the range of the array | COMMENT |
| LOW⚡ | finetune/qlib_data_preprocess.py | 53 | # Check if end_index+predictw_window will exceed the range of the array | COMMENT |
| LOW | webui/start.sh | 8 | # Check if Python is installed | COMMENT |
| LOW | webui/start.sh | 14 | # Check if in correct directory | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | README.md | 239 | ### Step 1: Configure Your Experiment | COMMENT |
| LOW | README.md | 251 | ### Step 2: Prepare the Dataset | COMMENT |
| LOW | README.md | 261 | ### Step 3: Run the Finetuning | COMMENT |
| LOW | README.md | 287 | ### Step 4: Evaluate with Backtesting | COMMENT |
| LOW | finetune_csv/README.md | 75 | # Step 1: Train tokenizer | COMMENT |
| LOW | finetune_csv/README.md | 78 | # Step 2: Train predictor (requires fine-tuned tokenizer) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/qlib_test.py | 311 | # Create a dedicated dictionary for this run's configuration | COMMENT |
| MEDIUM | model/kronos.py | 129 | mask = 2 ** torch.arange(self.codebook_dim//2, device=x1.device, dtype=torch.long) # Create a mask for bit e | CODE |
| MEDIUM | model/kronos.py | 134 | mask = 2 ** torch.arange(self.codebook_dim, device=x.device, dtype=torch.long) # Create a mask for bit extra | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | README.md | 138 | # Define context window and prediction length | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/dataset.py | 115 | # Apply normalization and robust clipping to the entire sequence | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_kronos_regression.py | 36 | def set_seed(seed: int) -> None: | CODE |
| LOW | tests/data/generate_regression_output.py | 26 | def set_seed(seed: int) -> None: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune_csv/finetune_base_model.py | 27 | CODE |