DB - global_settings

abstract

Singleton configuration table (always one row with id=1) storing system-wide toggles — maintenance interval, confidence threshold, news filter, and agent pipeline flags.

Table Info

PropertyValue
Table Nameglobal_settings
SQLAlchemy Modelbackend/db/models.py :: GlobalSettings
Pydantic Schemabackend/api/routes/settings.py :: GlobalSettingsModel
Migration Filealembic/versions/
TimescaleDB HypertableNo
Partition Column

Columns

ColumnSQLAlchemy TypeNullableDefaultDescription
idIntegerNo1Primary key (always 1 — singleton row)
maintenance_interval_minutesIntegerNo60How often the maintenance agent runs (minutes)
maintenance_task_enabledBooleanNoTrueEnable/disable maintenance agent globally
llm_confidence_thresholdFloatNo0.70Minimum confidence score to execute a trade
news_enabledBooleanNoFalseEnable news filter (skip trading during high-impact news)
enable_agent_pipelineBooleanNoFalseEnable multi-agent pipeline instead of single LLM call
enable_indicator_agentBooleanNoTrueEnable indicator analysis agent
enable_pattern_agentBooleanNoTrueEnable pattern recognition agent
enable_trend_agentBooleanNoTrueEnable trend analysis agent
updated_atDateTime(timezone=True)Nodatetime.now(UTC)Last update timestamp

Constraints & Indexes

NameTypeColumnsPurpose
pk_global_settingsPRIMARY KEYidSingleton enforcement (only id=1 exists)

Entity Relationships

SQLAlchemy Model (reference snapshot)

class GlobalSettings(Base):
    __tablename__ = "global_settings"
 
    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    maintenance_interval_minutes: Mapped[int] = mapped_column(Integer, default=60)
    maintenance_task_enabled: Mapped[bool] = mapped_column(Boolean, default=True)
    llm_confidence_threshold: Mapped[float] = mapped_column(Float, default=0.70)
    news_enabled: Mapped[bool] = mapped_column(Boolean, default=False)
    enable_agent_pipeline: Mapped[bool] = mapped_column(Boolean, default=False)
    enable_indicator_agent: Mapped[bool] = mapped_column(Boolean, default=True)
    enable_pattern_agent: Mapped[bool] = mapped_column(Boolean, default=True)
    enable_trend_agent: Mapped[bool] = mapped_column(Boolean, default=True)
    updated_at: Mapped[datetime] = mapped_column(
        DateTime(timezone=True),
        default=lambda: datetime.now(UTC),
        onupdate=lambda: datetime.now(UTC),
    )

Service Layer

LayerFilePurpose
Routerbackend/api/routes/settings.pyGET/PUT settings
Startupbackend/main.py (lifespan)Loads row into core.config.settings object on startup
AI Pipelinebackend/ai/Reads settings.llm_confidence_threshold before execution
RoleLink
API EndpointAPI-POST-v1-Settings
Frontend PagePage - Settings
Related TableDB - telegram_settings
Related TableDB - llm_provider_configs