Monthly Retention Cohorts for First-Time Crypto Traders
Last updated: November 29, 2026
Quick Overview
From a trades table, group users by the month of their first completed trade and compute, for months 0 through 6 after that, the share of each cohort that completed at least one trade.
Coinbase
November 29, 20260
0
0 solved
From a trades table, group users by the month of their first completed trade and compute, for months 0 through 6 after that, the share of each cohort that completed at least one trade.
Coinbase's retail activity swings with crypto prices, so cohort tables are how teams tell whether new users from a bull run stick around. The interviewer checks cohort definition, month arithmetic and the denominator, plus awareness of how market cycles bias the picture.
What the Interviewer Expects
- Define the cohort by the first completed trade, excluding failed ones
- Deduplicate to one row per user per month before counting
- Compute month offsets correctly across year boundaries
- Use cohort size as the denominator for every offset
- Discuss incomplete recent cohorts and seasonality from price cycles
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you show dollar retention (trading volume) instead of user retention?
- How would you separate the effect of market price swings from product changes?
- How do you handle users whose account was closed for compliance reasons?
- How would you produce this as a pivot with offsets as columns?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
trades(trade_id, user_id, traded_at, status). Only status = 'completed' counts, both for defining the cohort and for activity. A user is retained in month k if they completed any trade in calendar...
Approach
- Reduce trades to distinct (user, month). 2) Cohort month is the minimum month per user. 3) Join back to get every active month and its offset from the cohort month, computed as 12 times the year di...