Snapshot PINK DITAv2 system + Sprint 0 flaw-fix verification
First commit of the previously-untracked PINK-on-DITAv2 migration system (execution moves to the Rust kernel; policy stays on legacy DITA, so Alpha Engine algorithmic integrity is preserved). BLUE is untouched. Sprint 0 (safety snapshot + flaw-fix verification, MARKET single-leg scope): - Verified Rust FSM fixes (flaws 2,4,10,11,13) by source read of lib.rs. - Hardened 5 vacuous/guarded assertions in test_flaws.py so each flaw test genuinely exercises its fix. Most important: Flaw 5 now asserts capital moves by EXACTLY realized PnL (was entering/exiting at the same price). - Offline suites: 533 passed, 0 failed (35 flaws + 402 kernel/accounting/ bridge + 96 runtime/persistence/multi-exit/restart/seams). - GATE PASS: MARKET-path-critical flaws 1,2,5 confirmed fixed + green. - Added SPRINT0_FLAW_VERIFICATION.md report and _rust_kernel/.gitignore (excludes Rust target/ build artifacts). LIMIT/partial-fill remain explicitly out of scope (MARKET-only bring-up). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
53
prod/tests/test_pink_hazelcast_feed.py
Normal file
53
prod/tests/test_pink_hazelcast_feed.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from prod.clean_arch.adapters.hazelcast_feed import HazelcastDataFeed
|
||||
|
||||
|
||||
class _FakeMap:
|
||||
def __init__(self, payload: str) -> None:
|
||||
self.payload = payload
|
||||
|
||||
def get(self, key: str):
|
||||
if key == "latest_eigen_scan":
|
||||
return self.payload
|
||||
return None
|
||||
|
||||
def size(self) -> int:
|
||||
return 1
|
||||
|
||||
|
||||
def test_single_result_scan_schema_is_accepted() -> None:
|
||||
payload = json.dumps(
|
||||
{
|
||||
"scan_number": 2576,
|
||||
"timestamp": 1779805956.9522693,
|
||||
"target_asset": "BTCUSDT",
|
||||
"result": {
|
||||
"asset": "BTCUSDT",
|
||||
"price": 77599.64,
|
||||
"eigenvalue_tracking": {"lambda_max": 24.6, "lambda_max_velocity": -0.0053},
|
||||
"multi_window_results": {
|
||||
"50": {"tracking_data": {"lambda_max_velocity": -0.19346329413310556}},
|
||||
"750": {"tracking_data": {"lambda_max_velocity": -0.0001833266579540457}},
|
||||
},
|
||||
"confidence": 0.79,
|
||||
},
|
||||
}
|
||||
)
|
||||
feed = HazelcastDataFeed({"hazelcast": {"cluster": "dolphin", "host": "localhost:5701"}})
|
||||
feed.features_map = _FakeMap(payload)
|
||||
|
||||
snapshot = asyncio.run(feed.get_latest_snapshot("BTCUSDT"))
|
||||
|
||||
assert snapshot is not None
|
||||
assert snapshot.symbol == "BTCUSDT"
|
||||
assert snapshot.price == 77599.64
|
||||
assert snapshot.velocity_divergence == pytest.approx(-0.19327996747515153)
|
||||
assert snapshot.irp_alignment == 0.79
|
||||
assert snapshot.scan_number == 2576
|
||||
Reference in New Issue
Block a user