diff --git a/.gitignore b/.gitignore index 88244b47..2e5dd32d 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,7 @@ mlruns/ # possible output from coder or runner *.pth *qlib_res.csv + +# shell script +*.out +*.sh diff --git a/rdagent/app/qlib_rd_loop/factor.py b/rdagent/app/qlib_rd_loop/factor.py index 85e29380..4d23d7b7 100644 --- a/rdagent/app/qlib_rd_loop/factor.py +++ b/rdagent/app/qlib_rd_loop/factor.py @@ -1,5 +1,5 @@ """ -TODO: Factor Structure RD-Loop +Factor Structure RD-Loop """ from dotenv import load_dotenv diff --git a/rdagent/components/proposal/factor_proposal.py b/rdagent/components/proposal/factor_proposal.py index 8ec66efc..df61b006 100644 --- a/rdagent/components/proposal/factor_proposal.py +++ b/rdagent/components/proposal/factor_proposal.py @@ -44,6 +44,7 @@ class FactorHypothesisGen(HypothesisGen): targets="factors", scenario=self.scen.get_scenario_all_desc(), hypothesis_output_format=context_dict["hypothesis_output_format"], + hypothesis_specification=context_dict["hypothesis_specification"], ) ) user_prompt = ( diff --git a/rdagent/components/proposal/model_proposal.py b/rdagent/components/proposal/model_proposal.py index 4c1d203e..110c07a9 100644 --- a/rdagent/components/proposal/model_proposal.py +++ b/rdagent/components/proposal/model_proposal.py @@ -40,7 +40,7 @@ class ModelHypothesisGen(HypothesisGen): targets="model", scenario=self.scen.get_scenario_all_desc(), hypothesis_output_format=context_dict["hypothesis_output_format"], - hypothesis_specification = context_dict["hypothesis_specification"], + hypothesis_specification=context_dict["hypothesis_specification"], ) ) user_prompt = ( diff --git a/rdagent/scenarios/qlib/prompts.yaml b/rdagent/scenarios/qlib/prompts.yaml index 292bbf07..1ee860ae 100644 --- a/rdagent/scenarios/qlib/prompts.yaml +++ b/rdagent/scenarios/qlib/prompts.yaml @@ -64,6 +64,21 @@ model_hypothesis_specification: |- } ] +factor_hypothesis_specification: |- + Additional Specifications: + Hypotheses should grow and evolve based on the previous hypothesis. If there is no previous hypothesis, start with something simple. Gradually build up upon previous hypotheses and feedback. + Ensure that the hypothesis focuses on the creation and selection of factors in quantitative finance. Each hypothesis should address specific factor characteristics such as type (momentum, value, quality), calculation methods, or inclusion criteria. Avoid hypotheses related to model architecture or optimization processes. + + Sample Hypotheses (Only learn from the format as these are not the knowledge): + - "Include a momentum factor based on the last 12 months' returns." + - "Add a value factor calculated as the book-to-market ratio." + - "Incorporate a quality factor derived from return on equity (ROE)." + - "Use a volatility factor based on the standard deviation of returns over the past 6 months." + - "Include a sentiment factor derived from news sentiment scores." + - "The momentum factor should be calculated using a 6-month look-back period." + - "Combine value and momentum factors using a weighted average approach." + - "Filter stocks by market capitalization before calculating the factors." + factor_experiment_output_format: |- The output should follow JSON format. The schema is as follows: { diff --git a/rdagent/scenarios/qlib/proposal/factor_proposal.py b/rdagent/scenarios/qlib/proposal/factor_proposal.py index a24dbb26..b1dadc66 100644 --- a/rdagent/scenarios/qlib/proposal/factor_proposal.py +++ b/rdagent/scenarios/qlib/proposal/factor_proposal.py @@ -33,6 +33,7 @@ class QlibFactorHypothesisGen(FactorHypothesisGen): "hypothesis_and_feedback": hypothesis_feedback, "RAG": ..., "hypothesis_output_format": prompt_dict["hypothesis_output_format"], + "hypothesis_specification": prompt_dict["factor_hypothesis_specification"], } return context_dict, True