Repository Analysis

shiyu-coder/Kronos

Kronos: A Foundation Model for the Language of Financial Markets

3.2 Likely human-written View on GitHub
3.2
Adjusted Score
3.2
Raw Score
100%
Time Factor
2026-04-13
Last Push
27,575
Stars
Python
Language
78,563
Lines of Code
73
Files
207
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 0MEDIUM 28LOW 179

Pattern Findings

207 matches across 8 categories. Click a row to expand file-level details.

Decorative Section Separators23 hits · 69 pts
SeverityFileLineSnippet
MEDIUMfinetune/config.py9 # =================================================================
MEDIUMfinetune/config.py11 # =================================================================
MEDIUMfinetune/config.py30 # =================================================================
MEDIUMfinetune/config.py32 # =================================================================
MEDIUMfinetune/config.py43 # =================================================================
MEDIUMfinetune/config.py45 # =================================================================
MEDIUMfinetune/config.py72 # =================================================================
MEDIUMfinetune/config.py74 # =================================================================
MEDIUMfinetune/config.py96 # =================================================================
MEDIUMfinetune/config.py98 # =================================================================
MEDIUMfinetune/config.py109 # =================================================================
MEDIUMfinetune/config.py111 # =================================================================
MEDIUMfinetune/qlib_test.py28# =================================================================================
MEDIUMfinetune/qlib_test.py30# =================================================================================
MEDIUMfinetune/qlib_test.py92# =================================================================================
MEDIUMfinetune/qlib_test.py94# =================================================================================
MEDIUMfinetune/qlib_test.py203# =================================================================================
MEDIUMfinetune/qlib_test.py205# =================================================================================
MEDIUMfinetune/qlib_test.py298# =================================================================================
MEDIUMfinetune/qlib_test.py300# =================================================================================
MEDIUMexamples/get_akshare_date_2024-2025_x.py619 # =====================================================
MEDIUMexamples/get_date_new.py651 # =====================================================
MEDIUMexamples/prediction_akshare_2024-2025.py532 # =========================================================
Hyper-Verbose Identifiers63 hits · 62 pts
SeverityFileLineSnippet
LOWtests/test_kronos_regression.py46def test_kronos_predictor_regression(context_len):
LOWtests/test_kronos_regression.py91def test_kronos_predictor_mse(context_len, expected_mse):
LOWexamples/get_akshare_date_2024-2025_x.py157def parse_kline_data_directly(response_text, stock_code, start_year, end_year):
LOWexamples/get_akshare_date_2024-2025_x.py353def get_stock_data_with_retry(stock_code="002354", start_year=2024, end_year=2025, retry_count=2):
LOWexamples/prediction_new.py664 def _get_default_market_analysis(self):
LOWexamples/prediction_new.py672 def _get_default_sector_analysis(self):
LOWexamples/prediction_new.py682 def _get_default_macro_analysis(self):
LOWexamples/prediction_new.py689 def _get_default_fundamental_analysis(self):
LOWexamples/prediction_new.py89def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2):
LOWexamples/prediction_new.py105def create_realistic_fallback_data(stock_code="600580"):
LOWexamples/prediction_new.py191def save_all_history_stock_data(df, stock_code, save_dir):
LOWexamples/prediction_new.py284def calculate_prediction_parameters(df, target_days=60):
LOWexamples/prediction_new.py333def calculate_optimal_interval(min_val, max_val):
LOWexamples/prediction_new.py363def get_stock_price_reference(stock_code, current_price):
LOWexamples/prediction_new.py600 def analyze_company_fundamentals(self, stock_code):
LOWexamples/prediction_new.py651 def _calculate_trend_strength(self, df):
LOWexamples/prediction_new.py702def enhance_prediction_with_market_factors(
LOWexamples/prediction_new.py757def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis):
LOWexamples/prediction_new.py826def create_comprehensive_market_report(enhancement_info, output_dir, stock_code):
LOWexamples/prediction_new.py850def generate_analysis_summary(enhancement_info):
LOWexamples/prediction_new.py895def plot_comprehensive_prediction(
LOWexamples/prediction_new.py1148def run_comprehensive_kronos_prediction(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1):
LOWexamples/prediction_new_GUI.py959 def _get_default_market_analysis(self):
LOWexamples/prediction_new_GUI.py967 def _get_default_sector_analysis(self):
LOWexamples/prediction_new_GUI.py977 def _get_default_macro_analysis(self):
LOWexamples/prediction_new_GUI.py984 def _get_default_fundamental_analysis(self):
LOWexamples/prediction_new_GUI.py391def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2):
LOWexamples/prediction_new_GUI.py407def create_realistic_fallback_data(stock_code="600580"):
LOWexamples/prediction_new_GUI.py493def save_all_history_stock_data(df, stock_code, save_dir):
LOWexamples/prediction_new_GUI.py586def calculate_prediction_parameters(df, target_days=60):
LOWexamples/prediction_new_GUI.py616def generate_trading_dates_only(last_date, pred_len):
LOWexamples/prediction_new_GUI.py649def calculate_optimal_interval(min_val, max_val):
LOWexamples/prediction_new_GUI.py895 def analyze_company_fundamentals(self, stock_code):
LOWexamples/prediction_new_GUI.py946 def _calculate_trend_strength(self, df):
LOWexamples/prediction_new_GUI.py997def smooth_prediction_results(prediction_df, historical_df, smooth_factor=0.3):
LOWexamples/prediction_new_GUI.py1070def apply_post_holiday_adjustment(prediction_df, future_dates, holiday_periods):
LOWexamples/prediction_new_GUI.py1105def validate_prediction_results(historical_df, prediction_df, max_price_change=0.3):
LOWexamples/prediction_new_GUI.py1140def run_comprehensive_prediction_gui(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1,
LOWexamples/prediction_new_GUI.py1327def enhance_prediction_with_market_factors(historical_df, prediction_df, stock_code, market_analyzer):
LOWexamples/prediction_new_GUI.py1369def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis):
LOWexamples/prediction_new_GUI.py1410def create_comprehensive_market_report(enhancement_info, output_dir, stock_code):
LOWexamples/prediction_new_GUI.py1433def plot_optimized_prediction_gui(historical_df, base_pred_df, enhanced_pred_df, future_trading_dates,
LOWexamples/get_date_new.py23def get_stock_data_eastmoney_all_history(stock_code="002354"):
LOWexamples/get_date_new.py147def parse_kline_data_directly_all_history(response_text, stock_code):
LOWexamples/get_date_new.py190def get_stock_data_akshare_all_history(stock_code="002354"):
LOWexamples/get_date_new.py243def get_stock_data_baostock_all_history(stock_code="002354"):
LOWexamples/get_date_new.py354def get_stock_data_with_retry_all_history(stock_code="002354", retry_count=2):
LOWexamples/get_date_new.py378def create_sample_data_all_history(stock_code="002354"):
LOWexamples/get_date_new.py504def display_all_history_data_info(df, stock_code):
LOWexamples/get_date_new.py566def save_all_history_stock_data(df, stock_code, save_dir="D:/lianghuajiaoyi/Kronos/examples/data"):
LOWexamples/prediction_akshare_2024-2025.py78def calculate_prediction_parameters(df, target_days=100):
LOWexamples/prediction_akshare_2024-2025.py112def generate_future_dates_with_holidays(last_date, pred_len):
LOWexamples/prediction_akshare_2024-2025.py152def plot_prediction_with_details(kline_df, pred_df, future_dates, stock_code="002354", stock_name="股票", pred_len=100,
LOWexamples/prediction_akshare_2024-2025.py312def generate_prediction_report(close_df, volume_df, pred_df, future_dates, stock_code="002354", stock_name="股票",
LOWexamples/run_backtest_kronos.py132 def calculate_trading_signals(self, hist_df, pred_df, threshold=0.02):
LOWexamples/yuce/historical_backtest.py57 def simulate_model_prediction(self, df, lookback_days=60, pred_days=30):
LOWexamples/yuce/historical_backtest.py104 def calculate_prediction_accuracy(self, results_df):
LOWmodel/kronos.py389def auto_regressive_inference(tokenizer, model, x, x_stamp, y_stamp, max_context, pred_len, clip=5, T=1.0, top_k=0, top_
LOWmodel/module.py157 def get_hard_per_sample_entropy(self, zb_by_sample):
LOWwebui/templates/index.html843 function setupSliderEventListeners() {
3 more matches not shown…
Excessive Try-Catch Wrapping39 hits · 38 pts
SeverityFileLineSnippet
LOWexamples/get_akshare_date_2024-2025_x.py152 except Exception as e:
LOWexamples/get_akshare_date_2024-2025_x.py195 except Exception as e:
LOWexamples/get_akshare_date_2024-2025_x.py256 except Exception as e:
LOWexamples/get_akshare_date_2024-2025_x.py348 except Exception as e:
LOWexamples/prediction_new.py84 except Exception as e:
LOWexamples/prediction_new.py472 except Exception as e:
LOWexamples/prediction_new.py543 except Exception as e:
LOWexamples/prediction_new.py596 except Exception as e:
LOWexamples/prediction_new.py647 except Exception as e:
LOWexamples/prediction_new.py1172 except Exception as e:
LOWexamples/prediction_new.py1295 except Exception as e:
LOWexamples/prediction_new_GUI.py311 except Exception as e:
LOWexamples/prediction_new_GUI.py386 except Exception as e:
LOWexamples/prediction_new_GUI.py767 except Exception as e:
LOWexamples/prediction_new_GUI.py838 except Exception as e:
LOWexamples/prediction_new_GUI.py891 except Exception as e:
LOWexamples/prediction_new_GUI.py942 except Exception as e:
LOWexamples/prediction_new_GUI.py1176 except Exception as e:
LOWexamples/prediction_new_GUI.py1319 except Exception as e:
LOWexamples/prediction_new_GUI.py1611 except Exception as e:
LOWexamples/get_date_new.py142 except Exception as e:
LOWexamples/get_date_new.py184 except Exception as e:
LOWexamples/get_date_new.py238 except Exception as e:
LOWexamples/get_date_new.py349 except Exception as e:
LOWexamples/prediction_akshare_2024-2025.py504 except Exception as e:
LOWexamples/run_backtest_kronos.py408 except Exception as e:
LOWexamples/prediction_cn_markets_day.py60 except Exception as e:
LOWexamples/yuce/historical_backtest.py329 except Exception as e:
LOWwebui/run.py84 except Exception as e:
LOWwebui/app.py122 except Exception as e:
LOWwebui/app.py205 except Exception as e:
LOWwebui/app.py401 except Exception as e:
LOWwebui/app.py489 except Exception as e:
LOWwebui/app.py610 except Exception as e:
LOWwebui/app.py623 except Exception as e:
LOWwebui/app.py662 except Exception as e:
LOWfinetune_csv/train_sequential.py308 except Exception as e:
MEDIUMfinetune_csv/train_sequential.py310 print(f"Error occurred during training: {str(e)}")
LOWfinetune_csv/train_sequential.py355 except Exception:
Unused Imports44 hits · 37 pts
SeverityFileLineSnippet
LOWfinetune/config.py1
LOWfinetune/qlib_test.py11
LOWfinetune/qlib_test.py16
LOWfinetune/qlib_test.py19
LOWfinetune/train_tokenizer.py6
LOWfinetune/train_tokenizer.py7
LOWexamples/get_akshare_date_2024-2025_x.py4
LOWexamples/prediction_new.py8
LOWexamples/prediction_new.py10
LOWexamples/prediction_new.py13
LOWexamples/prediction_new.py13
LOWexamples/prediction_new.py13
LOWexamples/prediction_new.py13
LOWexamples/prediction_new_GUI.py8
LOWexamples/prediction_new_GUI.py10
LOWexamples/prediction_new_GUI.py13
LOWexamples/prediction_new_GUI.py13
LOWexamples/prediction_new_GUI.py13
LOWexamples/prediction_new_GUI.py13
LOWexamples/prediction_new_GUI.py17
LOWexamples/prediction_new_GUI.py19
LOWexamples/get_date_new.py4
LOWexamples/run_backtest_kronos.py6
LOWexamples/run_backtest_kronos.py6
LOWexamples/yuce/historical_backtest.py6
LOWexamples/yuce/historical_backtest.py6
LOWmodel/kronos.py10
LOWwebui/run.py15
LOWwebui/run.py16
LOWwebui/run.py17
LOWwebui/run.py18
LOWwebui/run.py19
LOWwebui/run.py56
LOWwebui/run.py56
LOWwebui/run.py56
LOWwebui/app.py3
LOWfinetune_csv/train_sequential.py6
LOWfinetune_csv/train_sequential.py7
LOWfinetune_csv/train_sequential.py11
LOWfinetune_csv/train_sequential.py15
LOWfinetune_csv/finetune_tokenizer.py11
LOWfinetune_csv/finetune_base_model.py5
LOWfinetune_csv/finetune_base_model.py13
LOWfinetune_csv/finetune_base_model.py21
Deep Nesting29 hits · 26 pts
SeverityFileLineSnippet
LOWfinetune/qlib_test.py239
LOWfinetune/train_tokenizer.py74
LOWexamples/get_akshare_date_2024-2025_x.py23
LOWexamples/get_akshare_date_2024-2025_x.py157
LOWexamples/get_akshare_date_2024-2025_x.py384
LOWexamples/get_akshare_date_2024-2025_x.py500
LOWexamples/prediction_new.py333
LOWexamples/prediction_new.py702
LOWexamples/prediction_new.py476
LOWexamples/prediction_new_GUI.py649
LOWexamples/prediction_new_GUI.py1070
LOWexamples/prediction_new_GUI.py1105
LOWexamples/prediction_new_GUI.py771
LOWexamples/get_date_new.py23
LOWexamples/get_date_new.py147
LOWexamples/get_date_new.py378
LOWexamples/get_date_new.py504
LOWexamples/prediction_akshare_2024-2025.py369
LOWexamples/run_backtest_kronos.py158
LOWexamples/run_backtest_kronos.py359
LOWexamples/yuce/historical_backtest.py264
LOWmodel/kronos.py225
LOWwebui/app.py78
LOWwebui/app.py209
LOWwebui/app.py342
LOWwebui/app.py405
LOWfinetune_csv/config_loader.py25
LOWfinetune_csv/finetune_tokenizer.py151
LOWfinetune_csv/finetune_base_model.py239
Redundant / Tautological Comments5 hits · 10 pts
SeverityFileLineSnippet
LOWfinetune/qlib_data_preprocess.py43 # Check if start_index lookbackw_window will cause negative index
LOWfinetune/qlib_data_preprocess.py47 # Check if end_index exceeds the range of the array
LOWfinetune/qlib_data_preprocess.py53 # Check if end_index+predictw_window will exceed the range of the array
LOWwebui/start.sh8# Check if Python is installed
LOWwebui/start.sh14# Check if in correct directory
Self-Referential Comments3 hits · 7 pts
SeverityFileLineSnippet
MEDIUMfinetune/qlib_test.py311 # Create a dedicated dictionary for this run's configuration
MEDIUMmodel/kronos.py129 mask = 2 ** torch.arange(self.codebook_dim//2, device=x1.device, dtype=torch.long) # Create a mask for bit e
MEDIUMmodel/kronos.py134 mask = 2 ** torch.arange(self.codebook_dim, device=x.device, dtype=torch.long) # Create a mask for bit extra
AI Slop Vocabulary1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMfinetune/dataset.py115 # Apply normalization and robust clipping to the entire sequence