35 lines
856 B
Python
35 lines
856 B
Python
|
|
import tradingagents.default_config as default_config
|
|
|
|
# Use default config but allow it to be overridden
|
|
_config: dict | None = None
|
|
DATA_DIR: str | None = None
|
|
|
|
|
|
def initialize_config():
|
|
"""Initialize the configuration with default values."""
|
|
global _config, DATA_DIR
|
|
if _config is None:
|
|
_config = default_config.DEFAULT_CONFIG.copy()
|
|
DATA_DIR = _config["data_dir"]
|
|
|
|
|
|
def set_config(config: dict):
|
|
"""Update the configuration with custom values."""
|
|
global _config, DATA_DIR
|
|
if _config is None:
|
|
_config = default_config.DEFAULT_CONFIG.copy()
|
|
_config.update(config)
|
|
DATA_DIR = _config["data_dir"]
|
|
|
|
|
|
def get_config() -> dict:
|
|
"""Get the current configuration."""
|
|
if _config is None:
|
|
initialize_config()
|
|
return _config.copy()
|
|
|
|
|
|
# Initialize with default config
|
|
initialize_config()
|