- Path injection (B614): centralized safe_resolve_path in core/utils.py,
refactored 6 UI modules to use it with safe_root validation
- B701: added explicit autoescape=select_autoescape() to Jinja2
Environment() calls in 3 files
- B101: replaced assert statements with proper if/raise patterns in
12+ files (partial)
- B112: added logger.warning() to bare except:continue blocks in
5 files
B608: Bandit flags any f-string containing "select" as potential SQL
injection. All four cases (app.py, ds_trace.py, llm_st.py, merge.py)
are Streamlit UI labels or log messages — not database queries.
B701: Jinja2 autoescape=False warnings in coder.py and utils.py are
false positives — these render Python code and plain-text templates,
not HTML. Enabling autoescape would corrupt the rendered code.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Summarize all but the 2 most recent experiments to compact bullet lines
(factor name, PASS/FAIL, IC value, 120-char observation snippet) instead
of including full verbatim traces; reduces prompt from ~121k to ~40-60k tokens
- Fix _evaluate_factor_directly and _save_factor_values to look for result.h5
and factor.py in sub_workspace_list instead of experiment_workspace
- Fix Series.to_parquet() → Series.to_frame().to_parquet() in _save_factor_values
- Update factor_data_template README: correct bars-per-day (1440, not 96)
- Update prompts to accept 2024-only debug dataset output as valid factor result
- Fix factor_coder prompts: allow 2024 debug data in date-range instruction
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rule 7 extended: session-based aggregations (London/NY/Asian) must also
be shifted by 1 trading day before use — same as daily aggregations
- Rule 8 added: prefer pure intraday rolling factors (RSI, Bollinger, VWAP
deviation, rolling std) that have no look-ahead risk and vary every minute
- predix_full_eval.py: apply _shift_daily_constant_factor_if_needed before IC
- predix_gen_strategies_real_bt.py: improved swing prompt with daily-level
signal logic guidance for daily-constant factors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Daily factors (e.g. daily_log_return) carried same-day close data at 00:00,
giving the model end-of-day information at bar open — a classic look-ahead bias
that produced spurious IC=0.25 and Sharpe=24 with 98% win rate.
Changes:
- factor_runner.py: add _shift_daily_constant_factor_if_needed() that detects
factors where >90% of days have a single unique intraday value, then shifts
them by 1 trading day before IC computation
- prompts.yaml: add rule #7 instructing LLM to always shift(1) daily aggregates
before forward-filling to minute bars
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add explicit warning against .date on datetime index (causes data loss
to single year, only 314 entries instead of 2020-2026)
- Add explicit warning against df.merge() which destroys MultiIndex
(causes RangeIndex output instead of required MultiIndex)
- Enforce column name must be exactly factor_name, not a shortened alias
- Require transform() over apply() for per-group calculations to
preserve row count
- Add MultiIndex assertion before saving to result.h5
- Document expected output: ~1500+ daily entries for full 2020-2026 range
- Fix daily/1min contradiction in factor_experiment_loader prompts
- Rename daily_pv.h5 to intraday_pv.h5 (generate.py, utils.py, README)
- Fix FactorDatetimeDailyEvaluator to accept 1min bars as correct
- Add _write_run_log() to log every factor attempt to results/logs/
- Add _ensure_results_dirs() to create all result directories
- Extract all 44 prompt YAML files to prompts/ centralized directory
- Add prompts/INDEX.md for navigation
Tests: 93 passed
* update rdagent cmd
* fix log error message
* use multiProcessing.Process instead of subprocess.Popen
* add traces to gitignore
* add user interactor in RDLoop (finance scenarios)
* add interactor (feedback, hypothesis) for quant scens
* fix the test_end in qlib conf
* add features init config, general instruction to qlib scenarios
* set base features for based exp
* fix bug when combine factors
* move traces folder to git_ignore_folder
* fix bug in features init
* fix quant interact bug
* fix logger warning error
* bug fixes
* modify rdagent logger, now it can set file output
* adjust cli functions and fix logger bug
* fix server port transport problem
* update server_ui in cli
* add web code
* fix CI problem
* black fix
* update web ui README
* update README
* update readme
* fix: prevent calendar index overflow when signal data ends early
* fix: make test_end optional to resolve Qlib backtest calendar misalignment
* fix: enhance GPU information output in get_gpu_info function
* fix: improve GPU information output in get_gpu_info function for better clarity
---------
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
* refactor: unify qlib experiment configs, runners, and templates
* fix: use PropSetting instances instead of class attributes in qlib runners
* docs: add configurable train/valid/test time segments for fintech scenarios
* implement runtime_env func for quant
* add runtime_info code
* add runtime env information to the prompt
* format with black
* optimize get_runtime_env code
* delete unnecessary files
* some refinement
* fix fin_quant bugs
---------
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
* fix model input shape bug and costeer_model bug
* fix a bug
* fix a bug in docker result extraction
* a system-level optimization
* add a filter of stdout
* update
* add stdout to model
* model training_hyperparameters update
* quant scenario
* update some quant settings
* llm choose action
* Thompson Sampling Bandit for action choosing
* refine both scens
* add trace messages for quant scen
* fix some bugs
* fix some bugs
* update
* update
* update
* fix
* fix
* fix
* update for merge
* fix ci
* fix some bugs
* fix ci
* fix ci
* fix ci
* fix ci
* refactor
* default qlib4rdagent local env downloading
* fix ci
* fix ci
* fix a bug
* fix ci
* fix: align all prompts on template (#908)
* use template to render all prompts
* fix CI
---------
Co-authored-by: Xu Yang <xuyang1@microsoft.com>
* add fin_quant in cli
* fix a bug
* fix ci
* fix some bugs
* refactor
* remove the columns in hypothesis if no value generated in this column
* fix a bug
* fix ci
* fix conda env
* add qlib gitignore
* remove existed qlib folder & install torch in qlib conda
* fix workspace ui in feedback
* align model config in coder and runner in docker or conda
* fix CI
* fix CI
---------
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
Co-authored-by: Xu Yang <xuyang1@microsoft.com>
* Use ExtendedBaseSettings to replace BaseSettings
* update a more general way to pass the default setting
* update all code
* fix CI
* fix CI
* fix qlib scenario
* fix CI
* fix CI
* fix CI & add data science interfaces
* remove redundant code
* abandon costeer knowledge base v1
---------
Co-authored-by: Xu Yang <xuyang1@microsoft.com>
Co-authored-by: XianBW <36835909+XianBW@users.noreply.github.com>
* udpate plot
* log and reduce token
* trace tag
* add simple_background parameter to get_scenario_all_desc
* update trace
* update first version code
* chat model map
* add annotation for stack index
* add annotation
* reformatted by black
* several update on kaggle scenarios
* update some new change
* fix CI
* fix CI
* fix a bug
* fix bugs in graph RAG
---------
Co-authored-by: Tim <illking@foxmail.com>
* add qlib_factor_strategy
* refine the code of action choosing
* fix a bug
* feat: template for kaggle (#308)
* init for s3e26
* ci issue
* fix a small bug in model runner which might cause error when model is the first try (#309)
* update
---------
Co-authored-by: Haoran Pan <167847254+TPLin22@users.noreply.github.com>
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
* Fixed some bugs introduced during refactoring.
* Add description for scenario experiments.
* Update factor_from_report_w_sc.py
* fix some ci bugs.
* add @property to get_experiment_setting
* fix a ci error.
* Fixed some bugs introduced during refactoring.
* Improved documentation for two factor scenarios.
* Update factor_from_report_w_sc.py
* Improved some details.
* Fixed some bugs introduced during refactoring.
* fix a minor bug
* build factor source data (price and volumns) from qlib if no source data is provided by the user (#168)
* Fixed some bugs introduced during refactoring.
* fix a small bug
* fix a small bug
* Remove redundant 'key steps' section in frontend scene display.
---------
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
* Init todo
* update all code
* update
* Extract factors from financial reports loop finished
* Fix two small bugs.
* Delete rdagent/app/qlib_rd_loop/run_script.sh
* Minor mod
* Delete rdagent/app/qlib_rd_loop/nohup.out
* Fix a small bug in file reading.
* some updates
* Update the detailed process and prompt of factor loop.
* Evaluation & dataset
* Optimize the prompt for generating hypotheses and feedback in the factor loop.
* Generate new data
* dataset generation
* Performed further optimizations on the factor loop and report extraction loop, added log handling for both processes, and implemented a screenshot feature for report extraction.
* Update rdagent/components/coder/factor_coder/CoSTEER/evaluators.py
* Update package.txt for fitz.
* add the result
* Performed further optimizations on the factor loop and report extraction loop, added log handling for both processes, and implemented a screenshot feature for report extraction. (#100) (#102)
- Performed further optimizations on the factor loop and report extraction loop.
- Added log handling for both processes.
- Implemented a screenshot feature for report extraction.
* Analysis
* Optimized log output.
* Factor update
* A draft of the "Quick Start" section for README
* Add scenario descriptions.
* Updates
* Adjust content
* Enable logging of backtesting in Qlib and store rich-text descriptions in Trace. Support one-step debugging for factor extraction.
* Reformat analysis.py
* CI fix
* Refactor
* remove useless code
* fix bugs (#111)
* Fix two small bugs.
* Fix a merge bug.
* Fix two small bugs.
* fix some bugs.
* Fix some format bugs.
* Restore a file.
* Fix a format bug.
* draft renew of evaluators
* fix a small bug.
* fix a small bug
* Support Factor Report Loop
* Update framework for extracting factors from research reports.
* Refactor report-based factor extraction and fix minor bugs.
* fix a small bug of log.
* change some prompts
* improve factor_runner
* fix a small bug
* change some prompts
* cancel some comments
* cancel some comments and fix some bugs
---------
Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
Co-authored-by: Taozhi Wang <taozhi.mark.wang@gmail.com>
Co-authored-by: Suhan Cui <51844791+SH-Src@users.noreply.github.com>
* Init todo
* Evaluation & dataset
* Generate new data
* dataset generation
* add the result
* Analysis
* Factor update
* Updates
* Reformat analysis.py
* CI fix
* Further Optimised Model Workflow by Incorporating Feedbacks on Exp Task Card
* Rebasing To build the extraction & implementation demo
* Revised for clean code
* Revised further to show "Knowledge"
* Revised to make model_research_copilot better
* Further Optimised Model Workflow by Incorporating Feedbacks on Exp Task Card
* Rebasing To build the extraction & implementation demo
* Revised for clean code
* Revised further to show "Knowledge"
* Revised to make model_research_copilot better
---------
Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: Taozhi Wang <taozhi.mark.wang@gmail.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
Co-authored-by: cyncyw <47289405+taozhiwang@users.noreply.github.com>
- A draft of the "Quick Start" section for your README.
- Enable logging of backtesting in Qlib and store rich-text descriptions in Trace.
- Support one-step debugging for factor extraction.
- Performed further optimizations on the factor loop and report extraction loop.
- Added log handling for both processes.
- Implemented a screenshot feature for report extraction.