Principle:HKUDS AI Trader Frontend Data Loading
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Data_Loading, ETL |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
Principle of loading, processing, and aggregating multi-agent trading data and market prices in the browser for dashboard visualization.
Description
Frontend data loading implements the client-side ETL (Extract-Transform-Load) pipeline that transforms raw JSONL position logs and JSON/JSONL price files into structured agent performance data suitable for chart rendering. The loader handles market-specific data formats (individual JSON files for US stocks, merged JSONL for A-shares), computes daily asset value histories by combining positions with market prices, and calculates portfolio returns. It supports dynamic market switching and integrates with the cache layer for performance optimization.
Usage
Apply this principle when building any dashboard page that displays agent performance data. The DataLoader is the central data access point that all visualization components depend on.
Theoretical Basis
The data loading pipeline follows a three-stage process:
# Abstract data loading algorithm
# Stage 1: Discover agents
agents = config.get_enabled_agents(market)
# Stage 2: Load position data per agent
for agent in agents:
positions = parse_jsonl(f"{data_dir}/{agent}/position/position.jsonl")
# Stage 3: Compute asset history
asset_history = []
for position in positions:
total_value = position.cash
for symbol, shares in position.holdings.items():
price = load_price(symbol, position.date)
total_value += shares * price
asset_history.append({date: position.date, value: total_value})