Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:HKUDS AI Trader Frontend Cache Generation

From Leeroopedia


Knowledge Sources
Domains Web_Development, Data_Pipeline
Last Updated 2026-02-09 14:00 GMT

Overview

A pre-computation pattern that generates static JSON cache files from trading results for efficient web dashboard rendering.

Description

Frontend Cache Generation transforms trading results (position logs, portfolio values, metrics) into pre-computed JSON cache files that the web dashboard can load directly without server-side computation. Each cache file contains versioned agent performance data, portfolio time series, and computed metrics for a specific market.

This pattern addresses the performance constraint of serving trading results via a static GitHub Pages site: by pre-computing all derived data, the dashboard loads instantly without needing a backend server.

Usage

Use this principle after all agents have completed their backtesting runs and metrics have been calculated. The cache generation step is the bridge between the Python analysis pipeline and the JavaScript-based web dashboard.

Theoretical Basis

# Pseudocode for frontend cache generation
for each market in config["markets"]:
    cache = {
        "version": hash(agent_data),
        "generatedAt": timestamp,
        "market": market_config,
        "agentsData": {}
    }
    for each agent in market.agents:
        cache["agentsData"][agent.name] = {
            "portfolio_values": load_csv(agent.portfolio_values),
            "metrics": calculate_metrics(agent),
            "transactions": load_positions(agent)
        }
    save_json(cache, f"docs/data/{market_id}_cache.json")

Key properties:

  • Static output: JSON files served directly by GitHub Pages
  • Versioned: Hash-based versioning for cache invalidation
  • Market-segmented: Separate cache file per market (US, A-share, crypto)
  • Complete data: Includes portfolio values, metrics, and transaction history

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment