Loading...

Portfolio Profit Calculator

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
staff

Problem

Our portfolio analytics dashboard needs a P&L calculator. Given a list of stock purchases (each with date and share count) and a dictionary of daily prices, compute the total profit or loss by comparing total cost of all purchases against the value of all shares at the most recent price.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.