Rolling VWAP per symbol
You ask an AI to write a Python function to compute the volume-weighted average price (VWAP) of trades from a Pandas DataFrame. It returns `(df['price'] * df['volume']).sum() / df['volume'].sum()` — correct for one symbol. Your data has 40 symbols interleaved and an hour of trades, and you actually need a *rolling intraday* VWAP per symbol that resets each day. You re-prompt 'do it per symbol' and it adds a `groupby('symbol')` but it's still a single number per symbol, not the running series you need. How do you re-steer to the right shape?
rolling_vwap(symbols: list[str], days: list[str], prices: list[float], volumes: list[int]) → list[float][["AAPL","AAPL","MSFT","AAPL"],["2024-03-01","2024-03-01","2024-03-01","2024-03-02"],[10,20,5,30],[100,100,50,10]]out[10,15,5,30][["A","A"],["2024-01-01","2024-01-01"],[10,12],[100,300]]out[10,11.5][["A","A"],["2024-01-01","2024-01-02"],[10,20],[100,100]]out[10,20]Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.