Stripe interview question
Compute cash balance, holding values and total account value from trades
- Company:
- Stripe
- Type:
- Coding
- Difficulty:
- Easy
- Reported:
- November 15, 2026
Problem
You are given two inputs:
account: a dictionary withinitial_balance(cash) andtransactions, a list of trades. Each trade hassymbol,type("buy"or"sell"),price,quantityandday. Trades are applied in list order.current_price: a dictionary from symbol to its current price.
Compute the final account cash balance, how much each holding is worth at current prices, and the total account value (cash plus holdings).
Example 1
Input:
account = {"initial_balance": 200000, "transactions": [
{"symbol": "AAPL", "type": "buy", "price": 120, "quantity": 20, "day": 1},
{"symbol": "AAPL", "type": "sell", "price": 130, "quantity": 10, "day": 2}]}
current_price = {"AAPL": 200, "GOOG": 150}
Output: cash_balance = 198900, holdings = {"AAPL": 2000}, total_value = 200900
Cash: 200000 - 2400 + 1300; 10 AAPL shares remain, worth 10 x 200.
Constraints
- Not stated; ask the interviewer.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern