GoshawkVortexAI's picture
Create veto.py
c24b1eb verified
raw
history blame
942 Bytes
from typing import Dict, Any, Tuple
from config import (
VETO_VOLUME_MIN_SCORE,
VETO_VOLATILITY_MAX,
VETO_STRUCTURE_MIN_SCORE,
)
def apply_veto(
regime_data: Dict[str, Any],
volume_data: Dict[str, Any],
structure_score: float,
) -> Tuple[bool, str]:
reasons = []
volume_score = volume_data.get("volume_score", 0.0)
if volume_score < VETO_VOLUME_MIN_SCORE:
reasons.append(f"volume_weak (score={volume_score:.2f})")
vol_ratio = regime_data.get("vol_ratio", 1.0)
if vol_ratio > VETO_VOLATILITY_MAX:
reasons.append(f"volatility_extreme (ratio={vol_ratio:.2f})")
if structure_score < VETO_STRUCTURE_MIN_SCORE:
reasons.append(f"structure_conflicting (score={structure_score:.2f})")
climax = volume_data.get("climax", False)
if climax:
reasons.append("climax_volume_detected")
if reasons:
return True, "; ".join(reasons)
return False, ""