mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
doc: Improved documentation for two factor scenarios. (#172)
* Fixed some bugs introduced during refactoring. * Improved documentation for two factor scenarios. * Update factor_from_report_w_sc.py * Improved some details.
This commit is contained in:
@@ -4,42 +4,79 @@
|
||||
Finance Data Agent
|
||||
=====================
|
||||
|
||||
Scen1
|
||||
-----
|
||||
🤖 Knowledge-Based Hypothesis Generation and Iteration
|
||||
|
||||
Scen1 Intro
|
||||
~~~~~~~~~~~
|
||||
In this scenario, our model autonomously generates and tests hypotheses using a knowledge base. The process involves:
|
||||
**Automated Quantitative Trading & Iterative Factors Evolution 🤖**
|
||||
-------------------------------------------------------------------
|
||||
|
||||
- **🔍 Hypothesis Generation**: The model proposes new hypotheses.
|
||||
- **📝 Factor Creation**: Write and define new factors.
|
||||
- **✅ Factor Validation**: Validate the factors quantitatively.
|
||||
- **📈 Backtesting with Qlib**:
|
||||
Background
|
||||
~~~~~~~~~~
|
||||
In the dynamic world of quantitative trading, **factors** are the secret weapons that traders use to harness market inefficiencies.
|
||||
|
||||
- **Dataset**: CSI300
|
||||
- **Model**: LGBModel
|
||||
- **Factors**: Alpha158 +
|
||||
- **Data Split**:
|
||||
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.
|
||||
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.
|
||||
|
||||
- **Train**: 2008-01-01 to 2014-12-31
|
||||
- **Valid**: 2015-01-01 to 2016-12-31
|
||||
- **Test**: 2017-01-01 to 2020-08-01
|
||||
- **🔄 Feedback Analysis**: Analyze backtest results.
|
||||
- **🔧 Hypothesis Refinement**: Refine hypotheses based on feedback and repeat.
|
||||
Embrace the power of factors, and you're not just trading; you're strategically outsmarting the market.
|
||||
|
||||
Scen1 Demo
|
||||
|
||||
Introduction
|
||||
~~~~~~~~~~~~
|
||||
In this scenario, our agent illustrates the iterative process of hypothesis generation, knowledge construction, and decision-making.
|
||||
|
||||
It highlights how financial factors evolve through continuous feedback and refinement.
|
||||
|
||||
Here's an enhanced outline of the steps:
|
||||
|
||||
**Step 1 : Hypothesis Generation 🔍**
|
||||
|
||||
- Generate and propose initial hypotheses based on previous experiment analysis and domain expertise, with thorough reasoning and financial justification.
|
||||
|
||||
**Step 2 : Factor Creation ✨**
|
||||
|
||||
- Based on the hypothesis, divide the tasks.
|
||||
- Each task involves developing, defining, and implementing a new financial factor, including its name, description, formulation, and variables.
|
||||
|
||||
**Step 3 : Factor Implementation 👨💻**
|
||||
|
||||
- Implement the factor code based on the description, evolving it as a developer would.
|
||||
- Quantitatively validate the newly created factors.
|
||||
|
||||
**Step 4 : Backtesting with Qlib 📉**
|
||||
|
||||
- Integrate the full dataset into the factor implementation code and prepare the factor library.
|
||||
- Perform backtesting using the Alpha158+ model in Qlib to assess the factor's effectiveness and performance.
|
||||
|
||||
+----------------+------------+----------------+----------------------------------------------------+
|
||||
| Dataset | Model | Factors | Data Split |
|
||||
+================+============+================+====================================================+
|
||||
| CSI300 | LGBModel | Alpha158 Plus | +-----------+--------------------------+ |
|
||||
| | | | | Train | 2008-01-01 to 2014-12-31 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
| | | | | Valid | 2015-01-01 to 2016-12-31 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
| | | | | Test | 2017-01-01 to 2020-08-01 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
+----------------+------------+----------------+----------------------------------------------------+
|
||||
|
||||
|
||||
**Step 5 : Feedback Analysis 🔍**
|
||||
- Analyze backtest results.
|
||||
- Incorporate feedback to refine hypotheses.
|
||||
|
||||
**Step 6 :Hypothesis Refinement ♻️**
|
||||
- Refine hypotheses based on feedback and repeat the process.
|
||||
|
||||
Demo
|
||||
~~~~~~~~~~
|
||||
.. TODO
|
||||
|
||||
Scen1 Quick Start
|
||||
Quick Start
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
To quickly start the factor extraction process, run the following command in your terminal within the 'rdagent' virtual environment:
|
||||
To quickly start the Automated Quantitative Trading & Iterative Factors Evolution process, run the following command in your terminal within the `rdagent` virtual environment:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
python rdagent/app/qlib_rd_loop/factor.py
|
||||
python rdagent/app/qlib_rd_loop/factor_w_sc.py
|
||||
|
||||
|
||||
Usage of modules
|
||||
|
||||
@@ -5,42 +5,80 @@ Finance Data Copilot
|
||||
=====================
|
||||
|
||||
|
||||
Scen2:
|
||||
------
|
||||
📄 Research Report-Based Factor Extraction
|
||||
**Automated Quantitative Trading & Factors Extraction from Financial Reports📄**
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Scen2 Intro
|
||||
~~~~~~~~~~~
|
||||
In this scenario, factors and hypotheses are extracted from research reports. The process includes:
|
||||
Background
|
||||
~~~~~~~~~~
|
||||
**Research reports** are treasure troves of insights, often unveiling potential **factors** that can drive successful quantitative trading strategies.
|
||||
Yet, with the sheer volume of reports available, extracting the most valuable insights efficiently becomes a daunting task.
|
||||
|
||||
- **🔍 Factor Extraction**: Extract relevant factors from research reports.
|
||||
- **📝 Factor Creation**: Define these extracted factors.
|
||||
- **✅ Factor Validation**: Validate the extracted factors.
|
||||
- **📈 Backtesting with Qlib**:
|
||||
Furthermore, rather than hastily replicating factors from a report, it's essential to delve into the underlying logic of their construction.
|
||||
Does the factor capture the essential market dynamics? How unique is it compared to the factors already in your library?
|
||||
|
||||
- **Dataset**: CSI300
|
||||
- **Model**: LGBModel
|
||||
- **Factors**: Alpha158 +
|
||||
- **Data Split**:
|
||||
Therefore, there is an urgent need for a systematic approach to design a framework that can effectively manage this process.
|
||||
This is where our R&D Agent comes into play.
|
||||
|
||||
- **Train**: 2008-01-01 to 2014-12-31
|
||||
- **Valid**: 2015-01-01 to 2016-12-31
|
||||
- **Test**: 2017-01-01 to 2020-08-01
|
||||
- **🔄 Feedback Analysis**: Analyze backtest results.
|
||||
- **🔧 Hypothesis Refinement**: Refine hypotheses based on feedback and continue the cycle.
|
||||
|
||||
Scen2 Demo
|
||||
|
||||
Introduction
|
||||
~~~~~~~~~~~~
|
||||
In this scenario, our agent demonstrates the process of extracting factors from financial research reports, implementing these factors, and analyzing their performance through Qlib backtesting.
|
||||
This process continually expands and refines the factor library.
|
||||
|
||||
Here's an enhanced outline of the steps:
|
||||
|
||||
**Step 1 : Hypothesis Generation 🔍**
|
||||
|
||||
- Generate and propose initial hypotheses based on insights from financial reports with thorough reasoning and financial justification.
|
||||
|
||||
**Step 2 : Factor Creation ✨**
|
||||
|
||||
- Based on the hypothesis and financial reports, divide the tasks.
|
||||
- Each task involves developing, defining, and implementing a new financial factor, including its name, description, formulation, and variables.
|
||||
|
||||
**Step 3 : Factor Implementation 👨💻**
|
||||
|
||||
- Implement the factor code based on the description, evolving it as a developer would.
|
||||
- Quantitatively validate the newly created factors.
|
||||
|
||||
**Step 4 : Backtesting with Qlib 📉**
|
||||
|
||||
- Integrate the full dataset into the factor implementation code and prepare the factor library.
|
||||
- Perform backtesting using the Alpha158+ model in Qlib to assess the factor's effectiveness and performance.
|
||||
|
||||
+----------------+------------+----------------+----------------------------------------------------+
|
||||
| Dataset | Model | Factors | Data Split |
|
||||
+================+============+================+====================================================+
|
||||
| CSI300 | LGBModel | Alpha158 Plus | +-----------+--------------------------+ |
|
||||
| | | | | Train | 2008-01-01 to 2014-12-31 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
| | | | | Valid | 2015-01-01 to 2016-12-31 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
| | | | | Test | 2017-01-01 to 2020-08-01 | |
|
||||
| | | | +-----------+--------------------------+ |
|
||||
+----------------+------------+----------------+----------------------------------------------------+
|
||||
|
||||
|
||||
**Step 5 : Feedback Analysis 🔍**
|
||||
- Analyze backtest results.
|
||||
- Incorporate feedback to refine hypotheses.
|
||||
|
||||
**Step 6 : Knowledge Base Refinement ♻️**
|
||||
- Refine the knowledge base based on feedback and repeat the process.
|
||||
|
||||
Demo
|
||||
~~~~~~~~~~
|
||||
.. TODO
|
||||
|
||||
Scen2 Quick Start
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
To quickly start the factor extraction process, run the following command in your terminal within the 'rdagent' virtual environment:
|
||||
To quickly start the factor extraction process, run the following command in your terminal within the `rdagent` virtual environment:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
python rdagent/app/qlib_rd_loop/factor_from_report_sh.py
|
||||
python rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py.py
|
||||
|
||||
|
||||
Usage of modules
|
||||
|
||||
@@ -43,7 +43,7 @@ class QlibFactorScenario(Scenario):
|
||||
@property
|
||||
def rich_style_description(self) -> str:
|
||||
return """
|
||||
### R&D Agent-Qlib: Automated Quantitative Trading & Iterative Factor Evolution Demo
|
||||
### R&D Agent-Qlib: Automated Quantitative Trading & Iterative Factors Evolution Demo
|
||||
|
||||
#### [Overview](#_summary)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class QlibFactorFromReportScenario(QlibFactorScenario):
|
||||
@property
|
||||
def rich_style_description(self) -> str:
|
||||
return """
|
||||
### R&D Agent-Qlib: Automated Quantitative Trading & Factor Extraction from Financial Reports Demo
|
||||
### R&D Agent-Qlib: Automated Quantitative Trading & Factors Extraction from Financial Reports Demo
|
||||
|
||||
#### [Overview](#_summary)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user