Files
NexQuant/rdagent/scenarios/qlib/experiment/factor_experiment.py
T
Xu Yang f2745c3cc0 Align factor coder into new framework (#47)
* use CoSTEER as component name

* rename factorimplementation to avoid confusion

* rename modelimplementation

* align benchmark and evolving evaluators

* add scenario to evaluator init function

* rename all factorimplementationknowledge in CoSTEER

* remove all scenario related information in component

* remove useless code

---------

Co-authored-by: xuyang1 <xuyang1@microsoft.com>
2024-07-05 17:42:00 +08:00

46 lines
1.3 KiB
Python

from pathlib import Path
from rdagent.components.coder.factor_coder.factor import FactorExperiment
from rdagent.components.coder.factor_coder.utils import get_data_folder_intro
from rdagent.core.prompts import Prompts
from rdagent.core.scenario import Scenario
prompt_dict = Prompts(file_path=Path(__file__).parent / "prompts.yaml")
QlibFactorExperiment = FactorExperiment
class QlibFactorScenario(Scenario):
@property
def background(self) -> str:
return prompt_dict["qlib_factor_background"]
@property
def source_data(self) -> str:
return get_data_folder_intro()
@property
def output_format(self) -> str:
return prompt_dict["qlib_factor_output_format"]
@property
def interface(self) -> str:
return prompt_dict["qlib_factor_interface"]
@property
def simulator(self) -> str:
return prompt_dict["qlib_factor_simulator"]
def get_scenario_all_desc(self) -> str:
return f"""Background of the scenario:
{self.background}
The source data you can use:
{self.source_data}
The interface you should follow to write the runnable code:
{self.interface}
The output of your code should be in the format:
{self.output_format}
The simulator user can use to test your factor:
{self.simulator}
"""