Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(loaders): Eastmoney and AKShare A-share qfq are additive too (#1497)

Haozhe Wub658a206d09e
diff --git a/agent/backtest/loaders/registry.py b/agent/backtest/loaders/registry.py
index 5997b99b2..475945f7c 100644
--- a/agent/backtest/loaders/registry.py
+++ b/agent/backtest/loaders/registry.py
@@ -284,6 +284,14 @@ PRICE_CALIBER_BY_SOURCE_MARKET: dict[tuple[str, str], str] = {
# eastmoney, whose adjusted HK series does differ from its raw one, so the
# actions exist and are simply not served here (#1493).
("tencent", "hk_equity"): "raw",
+ # Eastmoney's A-share fqt=1 is additive in the same way, with the same
+ # offsets: 600519.SH fqt=1 - fqt=0 takes five values (-103.46 / -79.58 /
+ # -51.98 / -28.02 / 0) over 500 bars against 367 distinct ratios, and
+ # 601398.SH five against 253 (measured 2026-09-21). akshare's
+ # stock_zh_a_hist(adjust="qfq") requests that endpoint with fqt=1. Their HK
+ # and US series are not measured and keep the per-source label.
+ ("eastmoney", "a_share"): "split_dividend_additive",
+ ("akshare", "a_share"): "split_dividend_additive",
}
#: Markets with no corporate-action adjustment concept. Their sources stamp
diff --git a/agent/mcp_server.py b/agent/mcp_server.py
index c600293b2..3a3e5fed0 100644
--- a/agent/mcp_server.py
+++ b/agent/mcp_server.py
@@ -1827,7 +1827,7 @@ def get_market_data(
symbol's ``_provenance.adjustment`` states the caliber ("raw" / "split" /
"split_dividend" / "split_dividend_additive" / "na" / "unknown") — read it
before comparing price levels across symbols. Note that
- ``split_dividend_additive`` (Tencent's A-share qfq) adjusts dividends by
+ ``split_dividend_additive`` (the A-share qfq of Tencent, Eastmoney and AKShare) adjusts dividends by
shifting the price level rather than scaling it, so it is not on the same
scale as ``split_dividend`` even though both account for dividends.
"""
diff --git a/agent/src/tools/market_data_tool.py b/agent/src/tools/market_data_tool.py
index 7a79521fb..d3504e9cf 100644
--- a/agent/src/tools/market_data_tool.py
+++ b/agent/src/tools/market_data_tool.py
@@ -100,7 +100,7 @@ class MarketDataTool(BaseTool):
"is source-dependent too (some sources adjust for splits/dividends, others serve "
"raw quotes); read _provenance.adjustment ('raw' / 'split' / 'split_dividend' / "
"'split_dividend_additive' / 'na' / 'unknown') before comparing price levels "
- "across symbols. 'split_dividend_additive' (Tencent's A-share qfq) adjusts "
+ "across symbols. 'split_dividend_additive' (the A-share qfq of Tencent, Eastmoney and AKShare) adjusts "
"dividends by shifting the price level rather than scaling it, so it is not on "
"the same scale as 'split_dividend'."
)
diff --git a/agent/tests/test_price_caliber.py b/agent/tests/test_price_caliber.py
index 731c8ac4e..a867d663d 100644
--- a/agent/tests/test_price_caliber.py
+++ b/agent/tests/test_price_caliber.py
@@ -104,6 +104,26 @@ def test_tencent_a_share_basket_warns_against_multiplicative_sources() -> None:
assert "split_dividend_additive" in msg and "split_dividend" in msg
+def test_eastmoney_and_akshare_a_share_are_additive_too() -> None:
+ """The same endpoint family: eastmoney fqt=1 has tencent's five offsets on
+ 600519.SH, and akshare's stock_zh_a_hist(adjust="qfq") calls it."""
+ assert price_caliber("eastmoney", "a_share") == "split_dividend_additive"
+ assert price_caliber("akshare", "a_share") == "split_dividend_additive"
+ # unmeasured markets keep the per-source label
+ assert price_caliber("eastmoney", "hk_equity") == "split_dividend"
+ assert price_caliber("akshare", "us_equity") == "split_dividend"
+
+
+def test_tencent_and_eastmoney_a_share_basket_is_not_a_mix() -> None:
+ """Both additive with the same offsets: warning them apart was a false positive."""
+ stamps = {
+ "600519.SH": ("tencent", price_caliber("tencent", "a_share")),
+ "000001.SZ": ("eastmoney", price_caliber("eastmoney", "a_share")),
+ }
+ assert mixed_caliber_warning(stamps) is None
+ assert additive_caliber_warning(stamps) is not None
+
+
def test_tencent_only_basket_stays_silent() -> None:
"""One additive source is not a mix, so nothing to warn about."""
assert (