Code RoomRolling VWAP per symbol
MediumPrep Room Coding #4050

Rolling VWAP per symbol

Vibe & agenticAlgorithms & data structuresMid–Senior~18 min

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?

Implement
rolling_vwap(symbols: list[str], days: list[str], prices: list[float], volumes: list[int]) → list[float]
Examples
in[["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]
in[["A","A"],["2024-01-01","2024-01-01"],[10,12],[100,300]]out[10,11.5]
in[["A","A"],["2024-01-01","2024-01-02"],[10,20],[100,100]]out[10,20]
What a strong answer looks like

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.

0:00 of about 18 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.