INNER CODE UNIT · Python

s

jialuechen/flowforge · flowforge/diagnostics/flow.py:29

        s = s - s.mean()
        denom = float(np.dot(s, s))
        if denom <= 0:
            continue
        for lag in range(1, min(max_lag, len(s) - 1) + 1):
            acfs[lag].append(float(np.dot(s[:-lag], s[lag:]) / denom))
    rows = [
        {"lag": lag, "autocorr": float(np.mean(v)), "n_assets": len(v)}
        for lag, v in acfs.items()
        if v
    ]
    return pd.DataFrame(rows)


def participation_stats(orders: pd.DataFrame) -> dict:
    """Cross-sectional relations used to validate simulated flow realism.

    Returns Spearman correlations of order notional (%ADV) with

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…