INNER CODE UNIT · Python

render_decision_card

alex-jb/orallexa-ai-trading-agent · app.py:84

def render_decision_card(output: DecisionOutput):
    """Section B — highlighted decision output."""
    color      = DECISION_COLORS.get(output.decision, "#888")
    risk_color = RISK_COLORS.get(output.risk_level, "#888")
    confidence = output.confidence

    # Data freshness
    data_ts = st.session_state.get("data_timestamp")
    freshness_html = ""
    if data_ts is not None:
        try:
            ts = pd.Timestamp(data_ts)
            if ts.tzinfo is not None:
                age_min = (pd.Timestamp.now(tz=ts.tzinfo) - ts).total_seconds() / 60
            else:
                age_min = (pd.Timestamp.now() - ts).total_seconds() / 60
            ts_str = ts.strftime("%H:%M:%S")
            age_color = "#22c55e" if age_min < 5 else "#f59e0b" if age_min < 30 else "#ef4444"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…