Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Top Assets Over Rolling 30 Days
00:00
5 left

Top Assets Over Rolling 30 Days

MediumSQL · PostgreSQL

Problem

Write a query to identify top-performing assets based on user transaction volume over a rolling 30-day window at Robinhood.

Use completed transactions and define the rolling window as the 30-day period ending at the latest transaction timestamp. Return the top three transaction-volume ranks, including ties.

Output

  1. One row per included asset with asset_id, symbol, transaction_count, active_users, total_notional, and volume_rank.
  2. Include only completed transactions in the rolling window, and include all assets tied within the top three ranks.
  3. Order by volume_rank, transaction_count descending, total_notional descending, and asset_id.

Schema

assets
ColumnTypeDescription
asset_idPKVARCHAR(20)Unique Robinhood asset identifier
symbolVARCHAR(12)Tradable asset symbol
asset_nameVARCHAR(100)Display name of the asset
asset_classVARCHAR(30)Asset classification
transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
user_idINTRobinhood user who placed the transaction
asset_idVARCHAR(20)Asset involved in the transaction
executed_atTIMESTAMPTimestamp when the transaction was executed or recorded
statusVARCHAR(20)Transaction processing status
notional_valueNUMERIC(14,2)Transaction value in US dollars
Tablesassetstransactions
Interviewer

Your question is Top Assets Over Rolling 30 Days. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.