Skip to content

"Vibe-Trading: Your Personal Trading Agent"

test(caliber): read the caliber from the source that served in the new serving-source test

cgycorey0424edca32e8
diff --git a/agent/tests/test_market_data_serving_source.py b/agent/tests/test_market_data_serving_source.py
index 685fb4b06..1584e81f9 100644
--- a/agent/tests/test_market_data_serving_source.py
+++ b/agent/tests/test_market_data_serving_source.py
@@ -62,7 +62,13 @@ def test_real_registry_substitution_reports_serving_source(monkeypatch, requeste
assert provenance["requested_source"] == requested
assert provenance["fallback_used"] is (not available)
assert provenance["volume_unit"] == ("lots" if available else "shares")
- assert provenance["adjustment"] == ("raw" if available and requested == "sina" else "split_dividend")
+ # The caliber follows the source that actually served, not the one requested.
+ caliber_by_source = {
+ "sina": "raw",
+ "baostock": "split_dividend",
+ "tencent": "split_dividend_additive",
+ }
+ assert provenance["adjustment"] == caliber_by_source[provenance["source"]]
def test_substituted_partial_batch_keeps_each_serving_source():
@@ -94,5 +100,9 @@ def test_substituted_partial_batch_keeps_each_serving_source():
)
assert calls == [("tencent", ["600519.SH", "000001.SZ"]), ("sina", ["000001.SZ"])]
first, second = (out["_provenance"][code] for code in ["600519.SH", "000001.SZ"])
- assert (first["source"], first["adjustment"], first["fallback_used"]) == ("tencent", "split_dividend", True)
+ assert (first["source"], first["adjustment"], first["fallback_used"]) == (
+ "tencent",
+ "split_dividend_additive",
+ True,
+ )
assert (second["source"], second["adjustment"], second["fallback_used"]) == ("sina", "raw", True)
diff --git a/agent/tests/test_price_caliber.py b/agent/tests/test_price_caliber.py
index d0dfc407d..c14b35059 100644
--- a/agent/tests/test_price_caliber.py
+++ b/agent/tests/test_price_caliber.py
@@ -81,10 +81,12 @@ def test_tencent_a_share_caliber_is_additive_not_multiplicative() -> None:
def test_tencent_hk_series_is_unadjusted() -> None:
- """Tencent's HK qfq and hfq are identical to its own day series (measured on
- 00939.HK and 00700.HK), so HK stamps raw. The actions are real — eastmoney's
- adjusted HK series differs from raw over the same window — this source just
- does not apply them."""
+ """Tencent serves no adjusted HK series at all: its fqkline reply carries only
+ "day" for HK symbols (never "qfqday"/"hfqday"), so the loader's ``qfqday or
+ day`` fallback silently serves unadjusted bars and the `,qfq` request
+ parameter changes nothing. The actions are real — eastmoney's adjusted HK
+ series differs from raw over the same window — this source just does not
+ apply them."""
assert price_caliber("tencent", "hk_equity") == "raw"