Skip to content

Commit 4b1e8e1

Browse files
WinstonLiytpeteryang1you-n-gXianBWSH-Src
authored
docs: Updated documentation for all the major scenarios. (#190)
* Fixed some bugs introduced during refactoring. * update data_agent_fin_doc * Updated documentation for the four major scenarios * feat: remove pdfs and enable online pdf readings (#183) * remove pdfs and enable online pdf readings * update doc format * use url as key * feat: add entry for rdagent. (#187) * Add entries * update entry for rdagent * lint * fix typo * docs: Demo links (#188) add demo links * fix: Fix a fail href in readme (#189) * fix a ci bug * doc * feat: remove pdfs and enable online pdf readings (#183) * remove pdfs and enable online pdf readings * update doc format * use url as key * feat: add entry for rdagent. (#187) * Add entries * update entry for rdagent * lint * fix typo * doc * Updated documentation for med_model scenarios. * fix a ci bug --------- Co-authored-by: Xu Yang <peteryang@vip.qq.com> Co-authored-by: you-n-g <you-n-g@users.noreply.github.com> Co-authored-by: XianBW <36835909+XianBW@users.noreply.github.com> Co-authored-by: SH-Src <suhan.c@outlook.com>
1 parent 44f61bf commit 4b1e8e1

8 files changed

Lines changed: 301 additions & 136 deletions

File tree

docs/scens/data_agent_fin.rst

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ Finance Data Agent
1010

1111
📖 Background
1212
~~~~~~~~~~~~~~
13-
In the dynamic world of quantitative trading, **factors** are the secret weapons that traders use to harness market inefficiencies.
14-
15-
These powerful tools—ranging from straightforward metrics like price-to-earnings ratios to intricate discounted cash flow models—unlock the potential to predict stock prices with remarkable precision.
16-
By tapping into this rich vein of data, quantitative traders craft sophisticated strategies that not only capitalize on market patterns but also drastically enhance trading efficiency and accuracy.
17-
18-
Embrace the power of factors, and you're not just trading; you're strategically outsmarting the market.
13+
In the dynamic world of quantitative trading, **factors** serve as the strategic tools that enable traders to exploit market inefficiencies.
14+
These factors—ranging from simple metrics like price-to-earnings ratios to complex models like discounted cash flows—are the key to predicting stock prices with a high degree of accuracy.
1915

16+
By leveraging these factors, quantitative traders can develop sophisticated strategies that not only identify market patterns but also significantly enhance trading efficiency and precision.
17+
The ability to systematically analyze and apply these factors is what separates ordinary trading from truly strategic market outmaneuvering.
18+
And this is where the **Finance Model Agent** comes into play.
2019

2120
🎥 Demo
2221
~~~~~~~~~~
@@ -82,7 +81,7 @@ You can try our demo by running the following command:
8281
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
8382

8483
.. code-block:: sh
85-
84+
8685
conda create -n rdagent python=3.10
8786
8887
- Activate the environment:
@@ -91,12 +90,12 @@ You can try our demo by running the following command:
9190
9291
conda activate rdagent
9392
94-
- 🛠️ Run Make Files
95-
- Navigate to the directory containing the MakeFile and set up the development environment:
93+
- 📦 Install the RDAgent
94+
- You can directly install the RDAgent package from PyPI:
9695

9796
.. code-block:: sh
9897
99-
make dev
98+
pip install rdagent
10099
101100
- ⚙️ Environment Configuration
102101
- Place the `.env` file in the same directory as the `.env.example` file.
@@ -118,33 +117,12 @@ You can try our demo by running the following command:
118117
- **Env Config**
119118

120119
The following environment variables can be set in the `.env` file to customize the application's behavior:
121-
- **Path to the folder containing private data (default fundamental data in Qlib):**
122-
123-
.. code-block:: sh
124-
125-
FACTOR_CODER_DATA_FOLDER=/path/to/data/factor_implementation_source_data_all
126-
127-
- **Path to the folder containing partial private data (for debugging):**
128-
129-
.. code-block:: sh
130-
131-
FACTOR_CODER_DATA_FOLDER_DEBUG=/path/to/data/factor_implementation_source_data_debug
132-
133-
- **Maximum time (in seconds) for writing factor code:**
134-
135-
.. code-block:: sh
136-
137-
FACTOR_CODER_FILE_BASED_EXECUTION_TIMEOUT=300
138-
139-
- **Maximum number of factors to write in one experiment:**
140-
141-
.. code-block:: sh
142-
143-
FACTOR_CODER_SELECT_THRESHOLD=5
144-
145-
- **Number of developing loops for writing factors:**
146-
147-
.. code-block:: sh
148120

149-
FACTOR_CODER_MAX_LOOP=10
121+
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.FactorBasePropSetting
122+
:settings-show-field-summary: False
123+
:exclude-members: Config
150124

125+
.. autopydantic_settings:: rdagent.components.coder.factor_coder.config.FactorImplementSettings
126+
:settings-show-field-summary: False
127+
:members: coder_use_cache, data_folder, data_folder_debug, cache_location, enable_execution_cache, file_based_execution_timeout, select_method, select_threshold, max_loop, knowledge_base_path, new_knowledge_base_path
128+
:exclude-members: Config, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler

docs/scens/data_copilot_fin.rst

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Furthermore, rather than hastily replicating factors from a report, it's essenti
1717
Does the factor capture the essential market dynamics? How unique is it compared to the factors already in your library?
1818

1919
Therefore, there is an urgent need for a systematic approach to design a framework that can effectively manage this process.
20-
This is where our RDAgent comes into play.
20+
And this is where the **Finance Data Copilot** steps in.
2121

2222

2323
🎥 Demo
@@ -91,12 +91,12 @@ You can try our demo by running the following command:
9191
9292
conda activate rdagent
9393
94-
- 🛠️ Run Make Files
95-
- Navigate to the directory containing the MakeFile and set up the development environment:
94+
- 📦 Install the RDAgent
95+
- You can directly install the RDAgent package from PyPI:
9696

9797
.. code-block:: sh
9898
99-
make dev
99+
pip install rdagent
100100
101101
- ⚙️ Environment Configuration
102102
- Place the `.env` file in the same directory as the `.env.example` file.
@@ -105,11 +105,21 @@ You can try our demo by running the following command:
105105
- If you want to change the default environment variables, you can refer to `Env Config`_ below
106106

107107
- 🚀 Run the Application
108-
.. code-block:: sh
108+
- Store the factors you want to extract from the financial reports in your desired folder. Then, save the paths of the reports in the `report_result_json_file_path`. The format should be as follows:
109109

110-
rdagent fin_factor_report
110+
.. code-block:: json
111111
112+
[
113+
"git_ignore_folder/report/fin_report1.pdf",
114+
"git_ignore_folder/report/fin_report2.pdf",
115+
"git_ignore_folder/report/fin_report3.pdf"
116+
]
112117
118+
- Run the application using the following command:
119+
120+
.. code-block:: sh
121+
122+
rdagent fin_factor_report
113123
114124
🛠️ Usage of modules
115125
~~~~~~~~~~~~~~~~~~~~~
@@ -119,32 +129,13 @@ You can try our demo by running the following command:
119129
- **Env Config**
120130

121131
The following environment variables can be set in the `.env` file to customize the application's behavior:
122-
- **Path to the folder containing research reports:**
123-
124-
.. code-block:: sh
125-
126-
QLIB_FACTOR_LOCAL_REPORT_PATH=/path/to/research/reports
127-
128-
- **Path to the JSON file listing research reports for factor extraction:**
129-
130-
.. code-block:: sh
131-
132-
QLIB_FACTOR_REPORT_RESULT_JSON_FILE_PATH=/path/to/reports/list.json
133132

134-
- **Maximum time (in seconds) for writing factor code:**
135-
136-
.. code-block:: sh
137-
138-
FACTOR_CODER_FILE_BASED_EXECUTION_TIMEOUT=300
139-
140-
- **Maximum number of factors to write in one experiment:**
141-
142-
.. code-block:: sh
143-
144-
FACTOR_CODER_SELECT_THRESHOLD=5
145-
146-
- **Number of developing loops for writing factors:**
147-
148-
.. code-block:: sh
133+
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.FactorFromReportPropSetting
134+
:settings-show-field-summary: False
135+
:show-inheritance:
136+
:exclude-members: Config
149137

150-
FACTOR_CODER_MAX_LOOP=10
138+
.. autopydantic_settings:: rdagent.components.coder.factor_coder.config.FactorImplementSettings
139+
:settings-show-field-summary: False
140+
:members: coder_use_cache, data_folder, data_folder_debug, cache_location, enable_execution_cache, file_based_execution_timeout, select_method, select_threshold, max_loop, knowledge_base_path, new_knowledge_base_path
141+
:exclude-members: Config, python_bin, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler

docs/scens/model_agent_fin.rst

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ Finance Model Agent
99

1010
📖 Background
1111
~~~~~~~~~~~~~~
12-
TODO
12+
In the realm of quantitative finance, both factor discovery and model development play crucial roles in driving performance.
13+
While much attention is often given to the discovery of new financial factors, the **models** that leverage these factors are equally important.
14+
The effectiveness of a quantitative strategy depends not only on the factors used but also on how well these factors are integrated into robust, predictive models.
15+
16+
However, the process of developing and optimizing these models can be labor-intensive and complex, requiring continuous refinement and adaptation to ever-changing market conditions.
17+
And this is where the **Finance Model Agent** steps in.
1318

1419
🎥 Demo
1520
~~~~~~~~~~
@@ -19,9 +24,9 @@ TODO: Here should put a video of the demo.
1924
🌟 Introduction
2025
~~~~~~~~~~~~~~~~
2126

22-
In this scenario, our automated system proposes hypothesis, constructs model, implements code, receives back-testing, and uses feedbacks.
23-
Hypothesis is iterated in this continuous process.
24-
The system aims to automatically optimise performance metrics from Qlib library thereby finding the optimised code through autonomous research and development.
27+
In this scenario, our automated system proposes hypothesis, constructs model, implements code, conducts back-testing, and utilizes feedback in a continuous, iterative process.
28+
29+
The goal is to automatically optimize performance metrics within the Qlib library, ultimately discovering the most efficient code through autonomous research and development.
2530

2631
Here's an enhanced outline of the steps:
2732

@@ -84,22 +89,58 @@ You can try our demo by running the following command:
8489
8590
conda activate rdagent
8691
87-
- 🛠️ Run Make Files
88-
- Navigate to the directory containing the MakeFile and set up the development environment:
92+
- 📦 Install the RDAgent
93+
- You can directly install the RDAgent package from PyPI:
8994

9095
.. code-block:: sh
9196
92-
make dev
97+
pip install rdagent
9398
9499
- ⚙️ Environment Configuration
95100
- Place the `.env` file in the same directory as the `.env.example` file.
96101
- The `.env.example` file contains the environment variables required for users using the OpenAI API (Please note that `.env.example` is an example file. `.env` is the one that will be finally used.)
97102

103+
- Export each variable in the .env file:
104+
105+
.. code-block:: sh
106+
107+
export $(grep -v '^#' .env | xargs)
108+
109+
- If you want to change the default environment variables, you can refer to `Env Config`_ below
110+
98111
- 🚀 Run the Application
99112
.. code-block:: sh
100113
101114
rdagent fin_model
102115
103116
🛠️ Usage of modules
104117
~~~~~~~~~~~~~~~~~~~~~
105-
TODO: Show some examples:
118+
119+
.. _Env Config:
120+
121+
- **Env Config**
122+
123+
The following environment variables can be set in the `.env` file to customize the application's behavior:
124+
125+
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.ModelBasePropSetting
126+
:settings-show-field-summary: False
127+
:exclude-members: Config
128+
129+
- **Qlib Config**
130+
- The `config.yaml` file located in the `model_template` folder contains the relevant configurations for running the developed model in Qlib. The default settings include key information such as:
131+
- **market**: Specifies the market, which is set to `csi300`.
132+
- **fields_group**: Defines the fields group, with the value `feature`.
133+
- **col_list**: A list of columns used, including various indicators such as `RESI5`, `WVMA5`, `RSQR5`, and others.
134+
- **start_time**: The start date for the data, set to `2008-01-01`.
135+
- **end_time**: The end date for the data, set to `2020-08-01`.
136+
- **fit_start_time**: The start date for fitting the model, set to `2008-01-01`.
137+
- **fit_end_time**: The end date for fitting the model, set to `2014-12-31`.
138+
139+
- The default hyperparameters used in the configuration are as follows:
140+
- **n_epochs**: The number of epochs, set to `100`.
141+
- **lr**: The learning rate, set to `1e-3`.
142+
- **early_stop**: The early stopping criterion, set to `10`.
143+
- **batch_size**: The batch size, set to `2000`.
144+
- **metric**: The evaluation metric, set to `loss`.
145+
- **loss**: The loss function, set to `mse`.
146+
- **n_jobs**: The number of parallel jobs, set to `20`.

docs/scens/model_agent_med.rst

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,111 @@
11
.. _model_agent_med:
22

3-
===================
3+
=======================
44
Medical Model Agent
5-
===================
5+
=======================
6+
7+
**🤖 Automated Medical Predtion Model Evolution**
8+
------------------------------------------------------------------------------------------
9+
10+
📖 Background
11+
~~~~~~~~~~~~~~
12+
In this scenario, we consider the problem of risk prediction from patients' ICU monitoring data. We use the a public EHR dataset - MIMIC-III and extract a binary classification task for evaluating the framework.
13+
In this task, we aim at predicting the whether the patients will suffer from Acute Respiratory Failure (ARF) based their first 12 hours ICU monitoring data.
14+
15+
🎥 Demo
16+
~~~~~~~~~~
17+
TODO: Here should put a video of the demo.
18+
19+
20+
🌟 Introduction
21+
~~~~~~~~~~~~~~~~
22+
23+
In this scenario, our automated system proposes hypothesis, constructs model, implements code, receives back-testing, and uses feedbacks.
24+
Hypothesis is iterated in this continuous process.
25+
The system aims to automatically optimise performance metrics of medical prediction thereby finding the optimised code through autonomous research and development.
26+
27+
Here's an enhanced outline of the steps:
28+
29+
**Step 1 : Hypothesis Generation 🔍**
30+
31+
- Generate and propose initial hypotheses based on previous experiment analysis and domain expertise, with thorough reasoning and justification.
32+
33+
**Step 2 : Model Creation ✨**
34+
35+
- Transform the hypothesis into a model.
36+
- Develop, define, and implement a machine learning model, including its name, description, and formulation.
37+
38+
**Step 3 : Model Implementation 👨‍💻**
39+
40+
- Implement the model code based on the detailed description.
41+
- Evolve the model iteratively as a developer would, ensuring accuracy and efficiency.
42+
43+
**Step 4 : Backtesting with MIMIC-III 📉**
44+
45+
- Conduct backtesting using the newly developed model on the extracted task from MIMIC-III.
46+
- Evaluate the model's effectiveness and performance in terms of AUROC score.
47+
48+
**Step 5 : Feedback Analysis 🔍**
49+
50+
- Analyze backtest results to assess performance.
51+
- Incorporate feedback to refine hypotheses and improve the model.
52+
53+
**Step 6 :Hypothesis Refinement ♻️**
54+
55+
- Refine hypotheses based on feedback from backtesting.
56+
- Repeat the process to continuously improve the model.
57+
58+
⚡ Quick Start
59+
~~~~~~~~~~~~~~~~~
60+
61+
You can try our demo by running the following command:
62+
63+
- 🐍 Create a Conda Environment
64+
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
65+
66+
.. code-block:: sh
67+
68+
conda create -n rdagent python=3.10
69+
70+
- Activate the environment:
71+
72+
.. code-block:: sh
73+
74+
conda activate rdagent
75+
76+
- 📦 Install the RDAgent
77+
- You can directly install the RDAgent package from PyPI:
78+
79+
.. code-block:: sh
80+
81+
pip install rdagent
82+
83+
- ⚙️ Environment Configuration
84+
- Place the `.env` file in the same directory as the `.env.example` file.
85+
- The `.env.example` file contains the environment variables required for users using the OpenAI API (Please note that `.env.example` is an example file. `.env` is the one that will be finally used.)
86+
87+
- Export each variable in the .env file:
88+
89+
.. code-block:: sh
90+
91+
export $(grep -v '^#' .env | xargs)
92+
93+
- If you want to change the default environment variables, you can refer to `Env Config`_ below
94+
95+
- 🚀 Run the Application
96+
.. code-block:: sh
97+
98+
rdagent med_model
99+
100+
🛠️ Usage of modules
101+
~~~~~~~~~~~~~~~~~~~~~
102+
103+
.. _Env Config:
104+
105+
- **Env Config**
106+
107+
The following environment variables can be set in the `.env` file to customize the application's behavior:
108+
109+
.. autopydantic_settings:: rdagent.app.data_mining.conf.PropSetting
110+
:settings-show-field-summary: False
111+
:exclude-members: Config

0 commit comments

Comments
 (0)