Blended fill price per order
A parent order often executes as several partial fills at different prices. Given a list of fills as (order_id, price, size), compute the average execution price of each order, weighted by filled size:
fills = [("A", 50.0, 100), ("B", 20.0, 40), ("A", 51.0, 200)]
-> {"A": 50.6667, "B": 20.0} # (50*100 + 51*200) / 300
Return a dict mapping order id to blended fill price, in one pass.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.