Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:HKUDS AI Trader A Share Data Fetching

From Leeroopedia


Knowledge Sources
Domains Data_Engineering, Financial_Data, Chinese_Markets
Last Updated 2026-02-09 14:00 GMT

Overview

A data acquisition technique for retrieving Chinese A-share stock and index data from domestic financial APIs with support for SSE-50 constituent resolution.

Description

A-Share Data Fetching extends the general price fetching concept to the Chinese equity market, which has distinct data sources (Tushare vs. Alpha Vantage), different symbol conventions (6-digit codes with exchange suffixes like "600519.SH"), and unique index composition requirements. The SSE-50 index constituents are resolved dynamically via the Tushare API, and individual stock daily prices are fetched with retry logic and rate limiting.

This principle addresses the challenge of obtaining reliable Chinese market data, where API rate limits are stricter and data schemas differ from Western financial data providers.

Usage

Use this principle when building a backtesting pipeline targeting the Chinese A-share market, specifically the SSE-50 index constituents. It is the data acquisition step for the A-share variant of the trading agent pipeline.

Theoretical Basis

# Pseudocode for A-share data acquisition
constituents = tushare_api.index_weight(index_code="000016.SH")
for each stock_code in constituents:
    daily_data = tushare_api.daily(ts_code=stock_code, start_date=start)
    convert to Alpha Vantage-compatible JSON format
    save to file: daily_prices_{CODE}.json
# Also fetch index-level daily data for benchmark
index_data = tushare_api.index_daily(ts_code=index_code)

Key differences from US fetching:

  • Dynamic universe: SSE-50 constituents are resolved at runtime via API
  • Dual-source: Can use either Tushare or Alpha Vantage (with different schemas)
  • Batch processing: Tushare supports batch queries with configurable batch sizes
  • Retry logic: Built-in exponential backoff for API reliability

Related Pages

Implemented By

Page Connections

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