Principle:HKUDS AI Trader Daily Trading Loop
| Knowledge Sources | |
|---|---|
| Domains | Trading_Systems, Backtesting |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
A backtesting orchestration pattern that iterates over trading dates to simulate daily agent-driven trading decisions.
Description
Daily Trading Loop is the outer orchestration layer that drives the backtesting simulation. It generates a list of valid trading dates between a start and end date (filtering for market-open days), then iterates through each date, running a complete trading session per day. Each session involves prompt construction, LLM reasoning, tool invocation, and outcome recording.
The loop handles the temporal progression of the simulation, ensuring that each day's decisions are based only on information available up to that point (no future data leakage).
Usage
Use this principle as the top-level execution loop for any backtesting simulation. It wraps the per-day trading session and manages the date progression, config updates, and retry logic for individual days.
Theoretical Basis
# Pseudocode for daily trading loop
trading_dates = get_trading_dates(init_date, end_date, market)
for date in trading_dates:
set_current_date(date)
set_agent_signature(signature)
try:
run_trading_session(date) # Inner reasoning loop
except Exception:
retry_session(date) # Retry on failure
record_outcome(date)
Key properties:
- Date filtering: Only iterates over valid trading days (skips weekends/holidays)
- Sequential: Each day completes before the next begins
- Fault tolerant: Individual day failures can be retried without restarting
- Config-driven: Date range from configuration, overridable by environment