Release v2.17.1: Backfill full 1-month completed closing-bell series (2026-11-30 & 2026-12-01 across all 23 public tickers), add lossless VPS telemetry snapshot/reconciliation, and enforce read-only VPS closeups/readme sync in Gate D4
This commit is contained in:
1 parent
5eca430cce
commit
52153e76f0
20 files changed
+3590
-3794
No files matched your search
@@ -319,15 +319,56 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
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
|
||||
|
||||
# Strict regression check: Ensure all dates present in real market history are fully covered in dates_utc
|
||||
# Strict regression check: Ensure all dates present in real market history are fully covered in dates_utc,
|
||||
# timeseries.py contains 0 hardcoded year/month date generators, and telemetry snapshot reconciliation is lossless & zero-churn
|
||||
import tempfile
|
||||
from hyperstitionstud_io.quant.collector import (
|
||||
latest_completed_closing_bell_date_utc,
|
||||
reconcile_telemetry_snapshot,
|
||||
snapshot_local_telemetry,
|
||||
)
|
||||
from hyperstitionstud_io.quant.timeseries import _load_real_market_history_bars
|
||||
cfg_test = load_workspace_config()
|
||||
ts_py_src = (cfg_test.core_dir / "src" / "hyperstitionstud_io" / "quant" / "timeseries.py").read_text(encoding="utf-8")
|
||||
assert 'f"2026-' not in ts_py_src and 'startswith("2026-")' not in ts_py_src
|
||||
real_hist_test = _load_real_market_history_bars(cfg_test)
|
||||
history_dates = set()
|
||||
for sym_obj in real_hist_test.values():
|
||||
history_dates.update(sym_obj.keys())
|
||||
for d in history_dates:
|
||||
assert d in ts_full["dates_utc"], f"Regression: Real history date {d} missing from timeseries dates_utc!"
|
||||
max_closed_dt = latest_completed_closing_bell_date_utc()
|
||||
assert all(d <= max_closed_dt for d in history_dates), f"Premature unclosed date found in real market history (> {max_closed_dt})"
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_reconcile_dir:
|
||||
tmp_r = Path(tmp_reconcile_dir)
|
||||
snap_d = tmp_r / "snap"
|
||||
cur_d = tmp_r / "cur"
|
||||
snap_res = snapshot_local_telemetry(snap_d)
|
||||
assert snap_res["ok"] is True and "real-market-history.json" in snap_res["saved_files"]
|
||||
snapshot_local_telemetry(cur_d)
|
||||
cur_hist_file = cur_d / "real-market-history.json"
|
||||
pre_bytes = cur_hist_file.read_bytes()
|
||||
# 1. When cur_d already has all completed bars (even if snap_d has a premature future date), 0 writes occur
|
||||
snap_doc = json.loads((snap_d / "real-market-history.json").read_text(encoding="utf-8"))
|
||||
snap_doc["instruments"]["BTC-USD"]["bars_by_date"]["2099-12-31"] = {
|
||||
"date_utc": "2099-12-31",
|
||||
"close_usd": 99999.0,
|
||||
}
|
||||
(snap_d / "real-market-history.json").write_text(json.dumps(snap_doc), encoding="utf-8")
|
||||
noop_rec = reconcile_telemetry_snapshot(snap_d, quant_dir=cur_d, max_date_utc=max_closed_dt, recompile_bundles=False)
|
||||
assert noop_rec["reconciled_new_data"] is False and noop_rec["merged_bars_count"] == 0
|
||||
assert cur_hist_file.read_bytes() == pre_bytes
|
||||
# 2. When cur_d is missing a completed bar that exists in snap_d, reconcile_telemetry_snapshot losslessly restores it
|
||||
cur_doc = json.loads(cur_hist_file.read_text(encoding="utf-8"))
|
||||
nvda_bars_map = cur_doc["instruments"]["NVDA"]["bars_by_date"]
|
||||
latest_nvda_dt = sorted(nvda_bars_map.keys())[-1]
|
||||
removed_bar = nvda_bars_map.pop(latest_nvda_dt)
|
||||
cur_hist_file.write_text(json.dumps(cur_doc), encoding="utf-8")
|
||||
merge_rec = reconcile_telemetry_snapshot(snap_d, quant_dir=cur_d, max_date_utc=max_closed_dt, recompile_bundles=False)
|
||||
assert merge_rec["reconciled_new_data"] is True and merge_rec["merged_bars_count"] == 1
|
||||
restored_doc = json.loads(cur_hist_file.read_text(encoding="utf-8"))
|
||||
assert restored_doc["instruments"]["NVDA"]["bars_by_date"][latest_nvda_dt]["close_usd"] == removed_bar["close_usd"]
|
||||
|
||||
anthr_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "ANTHR-PVT")
|
||||
assert anthr_ts["data_available"] is False
|
||||
|
||||
Reference in new issue
Block a user