fix(quant): eliminate all synthetic market/timeseries data, use 100% real exchange bars, and report 'No data available' when absent (v2.0.23)
This commit is contained in:
1 parent
9716a0ab61
commit
922f485388
27 files changed
+24021
-17509
No files matched your search
+57
-14
@@ -176,19 +176,36 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
cid = compute_dag_json_cidv1({"a": 1, "b": 2})
|
||||
assert cid.startswith("baguqeera")
|
||||
|
||||
# 2. Quantitative Financial Telemetry Collector
|
||||
q_harvest = build_financial_quant_harvest()
|
||||
# 2. Quantitative Financial Telemetry Collector (100% Real Exchange Observations — Zero Synthesized Data)
|
||||
from hyperstitionstud_io.quant.collector import CANONICAL_WATCHLIST_24, NO_DATA_AVAILABLE
|
||||
|
||||
assert all("close_usd" not in item for item in CANONICAL_WATCHLIST_24), "Watchlist metadata must not hardcode fake prices"
|
||||
q_harvest = build_financial_quant_harvest(live_fetch=False)
|
||||
assert q_harvest["harvest_mode"] == "us-closing-bell"
|
||||
assert q_harvest["synthetic_data_eliminated"] is True
|
||||
assert q_harvest["regime_summary"]["instrument_count"] == 24
|
||||
assert q_harvest["regime_summary"]["total_contingent_locks"] >= 20
|
||||
assert q_harvest["regime_summary"]["instruments_with_data_count"] == 23
|
||||
assert q_harvest["regime_summary"]["instruments_without_data"] == ["ANTHR-PVT"]
|
||||
assert q_harvest["isolation_receipt"]["all_unchanged"] is True
|
||||
assert q_harvest["ipld_dag_json_cidv1"]["/"].startswith("baguqeera")
|
||||
nvda_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "NVDA")
|
||||
assert nvda_inst["quant_encodings"]["close_spoken_ing"] == "wuhn huhndrad therdee sevan"
|
||||
assert nvda_inst["quant_encodings"]["scaled_cap_spoken_ing"] == "three point three faiv trilyan"
|
||||
assert any(l["scope"] == "SCOPE1_INTRA_INSTRUMENT_SELF_LOCK" for l in nvda_inst["contingent_locks"])
|
||||
|
||||
q_rollover = build_financial_quant_harvest(harvest_mode="utc-rollover")
|
||||
anthr_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "ANTHR-PVT")
|
||||
assert anthr_inst["data_available"] is False
|
||||
assert NO_DATA_AVAILABLE in anthr_inst["status"]
|
||||
assert anthr_inst["metrics"]["close_usd"] is None
|
||||
assert anthr_inst["quant_encodings"]["close_spoken_ing"] == NO_DATA_AVAILABLE
|
||||
|
||||
nvda_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "NVDA")
|
||||
assert nvda_inst["data_available"] is True
|
||||
assert nvda_inst["metrics"]["close_usd"] == 150.49
|
||||
assert nvda_inst["metrics"]["market_cap_str"] == NO_DATA_AVAILABLE
|
||||
|
||||
sol_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "SOL-USD")
|
||||
assert sol_inst["data_available"] is True
|
||||
assert sol_inst["metrics"]["close_usd"] == 71.71
|
||||
assert sol_inst["metrics"]["market_cap_str"] == "$43B"
|
||||
|
||||
q_rollover = build_financial_quant_harvest(harvest_mode="utc-rollover", live_fetch=False)
|
||||
assert q_rollover["harvest_mode"] == "utc-rollover"
|
||||
assert q_rollover["isolation_receipt"]["all_unchanged"] is True
|
||||
|
||||
@@ -240,13 +257,38 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle
|
||||
|
||||
ts_full = build_quant_timeseries_bundle(write_files=False)
|
||||
assert ts_full["synthetic_data_eliminated"] is True
|
||||
assert ts_full["periodicity_gate"]["enforced"] is True
|
||||
assert ts_full["periodicity_gate"]["non_periodic_records_ingested"] == 0
|
||||
assert ts_full["periodicity_gate"]["dated_news_dossiers_ingested"] >= 20
|
||||
assert len(ts_full["dates_utc"]) == 30
|
||||
assert all(re.match(r"^\d{4}-\d{2}-\d{2}$", d) for d in ts_full["dates_utc"])
|
||||
assert len(ts_full["instruments"]) == 24
|
||||
|
||||
anthr_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "ANTHR-PVT")
|
||||
assert anthr_ts["data_available"] is False
|
||||
assert anthr_ts["available_trading_days"] == 0
|
||||
assert all(b["data_available"] is False and b["status"] == NO_DATA_AVAILABLE and b["close_usd"] is None for b in anthr_ts["bars"])
|
||||
assert all(b["contingent_points"] is None for b in anthr_ts["bars"] if not b["co_present_in_news_wire"])
|
||||
assert anthr_ts["timeseries_moments"]["ts_duty_cycle_pct"] is None
|
||||
assert anthr_ts["timeseries_moments"]["ts_weighted_resonance"] is None
|
||||
assert anthr_ts["timeseries_moments"]["ts_excess_over_replacement"] is None
|
||||
assert anthr_ts["timeseries_moments"]["ts_optimal_lag_days"] is None
|
||||
assert anthr_ts["timeseries_moments"]["ts_sparkline_30d"] is None
|
||||
assert anthr_ts["timeseries_moments"]["ts_quantile_profile"]["p20_floor"] is None
|
||||
assert all(v is None for v in anthr_ts["timeseries_moments"]["ts_lag_correlation_curve"].values())
|
||||
assert all(v is None for v in anthr_ts["timeseries_moments"]["ts_regime_splits"].values())
|
||||
assert anthr_ts["pokedex_profile"]["level"] is None
|
||||
assert anthr_ts["pokedex_profile"]["nature"] is None
|
||||
|
||||
pltr_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "PLTR")
|
||||
assert pltr_ts["data_available"] is True
|
||||
assert any("CLOSE_SELF_LOCK (159==palanter)" in (b["scope1_locks"] or []) for b in pltr_ts["bars"])
|
||||
|
||||
nvda_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "NVDA")
|
||||
assert nvda_ts["data_available"] is True
|
||||
assert nvda_ts["available_trading_days"] == 19
|
||||
assert sum(1 for b in nvda_ts["bars"] if not b["data_available"] and b["status"] == NO_DATA_AVAILABLE) == 11
|
||||
assert nvda_ts["tradingview_symbol"] == "NASDAQ:NVDA"
|
||||
assert "tradingview.com/chart/?symbol=NASDAQ%3ANVDA" in nvda_ts["tradingview_url"]
|
||||
assert "doc_references" in nvda_ts
|
||||
@@ -398,13 +440,14 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
fts_res = query_fts_catalog("envideea", db_path=cat_db)
|
||||
assert fts_res["match_count"] >= 1
|
||||
|
||||
coord_137 = query_coordinate_join(137, db_path=cat_db)
|
||||
assert coord_137["coordinate_aq"] == 137
|
||||
assert len(coord_137["kg_nodes"]) >= 1
|
||||
assert len(coord_137["quant_timeseries_bars"]) >= 1
|
||||
coord_163 = query_coordinate_join(163, db_path=cat_db)
|
||||
assert coord_163["coordinate_aq"] == 163
|
||||
assert len(coord_163["kg_nodes"]) >= 1
|
||||
assert len(coord_163["quant_timeseries_bars"]) >= 1
|
||||
|
||||
nvda_bars = query_timeseries_bars(symbol="NVDA", min_points=1.0, db_path=cat_db)
|
||||
assert len(nvda_bars) >= 1 and all(b["symbol"] == "NVDA" for b in nvda_bars)
|
||||
nvda_bars = query_timeseries_bars(symbol="NVDA", min_points=None, db_path=cat_db)
|
||||
assert len(nvda_bars) == 30 and sum(1 for b in nvda_bars if b["data_available"] == 1) == 19
|
||||
assert any(b["contingent_points"] is None for b in nvda_bars if b["data_available"] == 0)
|
||||
|
||||
# Verify MCP and REST API calls automatically populate the SQLite REST API metadata database
|
||||
prev_tel_env = os.environ.get("HYPERSTITION_TELEMETRY_DB_PATH")
|
||||
|
||||
Reference in new issue
Block a user