2024-05-21 22:48:41 +08:00
|
|
|
from pathlib import Path
|
2024-06-28 11:45:23 +08:00
|
|
|
from typing import Literal, Union
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-14 12:59:44 +08:00
|
|
|
from pydantic_settings import BaseSettings
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-14 12:59:44 +08:00
|
|
|
SELECT_METHOD = Literal["random", "scheduler"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FactorImplementSettings(BaseSettings):
|
2024-07-17 15:00:13 +08:00
|
|
|
class Config:
|
2024-08-09 13:27:33 +08:00
|
|
|
env_prefix = "FACTOR_CODER_"
|
|
|
|
|
"""Use `FACTOR_CODER_` as prefix for environment variables"""
|
2024-07-17 15:00:13 +08:00
|
|
|
|
|
|
|
|
coder_use_cache: bool = False
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Indicates whether to use cache for the coder"""
|
|
|
|
|
|
|
|
|
|
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)"""
|
|
|
|
|
|
|
|
|
|
cache_location: str = "git_ignore_folder/factor_implementation_execution_cache"
|
|
|
|
|
"""Path to the cache location"""
|
|
|
|
|
|
|
|
|
|
enable_execution_cache: bool = True
|
|
|
|
|
"""Indicates whether to enable the execution cache"""
|
2024-05-21 22:48:41 +08:00
|
|
|
|
|
|
|
|
# TODO: the factor implement specific settings should not appear in this settings
|
|
|
|
|
# Evolving should have a method specific settings
|
|
|
|
|
# evolving related config
|
|
|
|
|
fail_task_trial_limit: int = 20
|
|
|
|
|
|
|
|
|
|
v1_query_former_trace_limit: int = 5
|
|
|
|
|
v1_query_similar_success_limit: int = 5
|
|
|
|
|
|
|
|
|
|
v2_query_component_limit: int = 1
|
|
|
|
|
v2_query_error_limit: int = 1
|
|
|
|
|
v2_query_former_trace_limit: int = 1
|
|
|
|
|
v2_error_summary: bool = False
|
|
|
|
|
v2_knowledge_sampler: float = 1.0
|
|
|
|
|
|
2024-08-09 13:27:33 +08:00
|
|
|
file_based_execution_timeout: int = 120
|
|
|
|
|
"""Timeout in seconds for each factor implementation execution"""
|
|
|
|
|
|
|
|
|
|
select_method: str = "random"
|
|
|
|
|
"""Method for the selection of factors implementation"""
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-08-02 15:04:49 +08:00
|
|
|
select_threshold: int = 10
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Threshold for the number of factor selections"""
|
2024-06-14 12:59:44 +08:00
|
|
|
|
|
|
|
|
max_loop: int = 10
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Maximum number of task implementation loops"""
|
2024-06-14 12:59:44 +08:00
|
|
|
|
|
|
|
|
knowledge_base_path: Union[str, None] = None
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Path to the knowledge base"""
|
|
|
|
|
|
2024-09-23 03:24:26 -04:00
|
|
|
data_tables_knowledge_path: Union[str, None] = None
|
|
|
|
|
"""Path to the data tables knowledge"""
|
|
|
|
|
|
2024-08-03 10:17:01 +08:00
|
|
|
new_knowledge_base_path: Union[str, None] = None
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Path to the new knowledge base"""
|
2024-06-14 12:59:44 +08:00
|
|
|
|
2024-07-17 15:00:13 +08:00
|
|
|
python_bin: str = "python"
|
2024-08-09 13:27:33 +08:00
|
|
|
"""Path to the Python binary"""
|
2024-07-17 15:00:13 +08:00
|
|
|
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-18 11:50:03 +08:00
|
|
|
FACTOR_IMPLEMENT_SETTINGS = FactorImplementSettings()
|