Principle:HKUDS AI Trader Frontend Configuration Loading
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Configuration, YAML |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
Principle of centralizing all dashboard display settings, market definitions, and agent configurations in a single YAML file loaded at runtime.
Description
Frontend configuration loading externalizes all dashboard parameters into a human-readable YAML file rather than hardcoding them in JavaScript. This separation of configuration from code enables non-developers to add markets, enable/disable agents, change chart settings, and modify UI behavior without touching source code. The YAML is fetched via HTTP and parsed client-side with the js-yaml library. A singleton ConfigLoader object provides typed accessor methods so other modules never parse raw YAML directly.
Usage
Apply this principle when the dashboard needs to be configurable without code changes. The YAML config file should be the first thing loaded on any dashboard page.
Theoretical Basis
The configuration loading follows the externalized configuration pattern:
# Abstract configuration flow
# 1. External YAML defines all tunable parameters
config = {
markets: {market_id: {agents, benchmark, currency, ...}},
chart: {scale, colors, sizes},
ui: {initial_value, date_formats},
cache: {enabled, max_age}
}
# 2. Singleton loader provides typed access
class ConfigLoader:
def get_market_config(market_id) -> MarketConfig
def get_enabled_agents(market_id) -> List[AgentConfig]
def get_chart_config() -> ChartConfig
# 3. All other modules depend on ConfigLoader, never on raw YAML