Files
NexQuant/rdagent/components/coder/factor_coder/config.py
T
Roland Minrui f3cb3f8870 feat: add previous runner loops to runner history (#1142)
* add prev loops to runner history

* fix evolving history

* fix bug on initializing feedback without final decision

* reformat

* refine

* add comments

* fix ci

* a little refinement

* fix CI

---------

Co-authored-by: Xu <v-xuminrui@microsoft.com>
Co-authored-by: Xu Yang <peteryang@vip.qq.com>
2025-08-04 17:38:27 +08:00

50 lines
1.6 KiB
Python

import os
from typing import Optional
from pydantic_settings import SettingsConfigDict
from rdagent.components.coder.CoSTEER.config import CoSTEERSettings
from rdagent.utils.env import CondaConf, Env, LocalEnv
class FactorCoSTEERSettings(CoSTEERSettings):
model_config = SettingsConfigDict(env_prefix="FACTOR_CoSTEER_")
data_folder: str = "git_ignore_folder/factor_implementation_source_data"
"""Path to the folder containing financial data (default is fundamental data in Qlib)"""
data_folder_debug: str = "git_ignore_folder/factor_implementation_source_data_debug"
"""Path to the folder containing partial financial data (for debugging)"""
simple_background: bool = False
"""Whether to use simple background information for code feedback"""
file_based_execution_timeout: int = 3600
"""Timeout in seconds for each factor implementation execution"""
select_method: str = "random"
"""Method for the selection of factors implementation"""
python_bin: str = "python"
"""Path to the Python binary"""
def get_factor_env(
conf_type: Optional[str] = None,
extra_volumes: dict = {},
running_timeout_period: int = 600,
enable_cache: Optional[bool] = None,
) -> Env:
conf = FactorCoSTEERSettings()
if hasattr(conf, "python_bin"):
env = LocalEnv(conf=(CondaConf(conda_env_name=os.environ.get("CONDA_DEFAULT_ENV"))))
env.conf.extra_volumes = extra_volumes.copy()
env.conf.running_timeout_period = running_timeout_period
if enable_cache is not None:
env.conf.enable_cache = enable_cache
env.prepare()
return env
FACTOR_COSTEER_SETTINGS = FactorCoSTEERSettings()