Principle:HKUDS AI Trader Price Data Fetching
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, Financial_Data |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
A data acquisition technique that retrieves historical OHLCV (Open, High, Low, Close, Volume) price data from external financial APIs for backtesting trading agents.
Description
Price Data Fetching is the foundational data acquisition step in any quantitative trading pipeline. It addresses the need for historical market data by querying REST APIs provided by financial data vendors. The fetched data includes daily or intraday OHLCV candles for each traded instrument, which are subsequently stored as JSON files for downstream processing.
In the context of LLM-powered trading agents, accurate and complete price data is essential because the agent's system prompt is populated with real market prices to make trading decisions. Without reliable data fetching, the entire backtesting simulation becomes invalid.
Usage
Use this principle when building a trading backtesting system that requires historical market data. It applies specifically to US equity markets (e.g., NASDAQ-100 constituents) where daily OHLCV data is needed from a REST-based financial data provider. The fetching step must run before any data merging or agent execution steps.
Theoretical Basis
The data acquisition follows a straightforward REST API pattern:
# Pseudocode for price data fetching
for each symbol in universe:
response = HTTP_GET(api_url, params={symbol, api_key, function="TIME_SERIES_DAILY"})
parse JSON response
save to file: daily_prices_{symbol}.json
Key properties:
- Idempotent: Re-fetching the same symbol overwrites the file with identical or updated data
- Rate-limited: External APIs impose call limits (e.g., 5 calls/minute for free tier)
- Schema-dependent: The output JSON structure is defined by the API provider