You are given two tables.
tradesuser_id
(BIGINT)
trade_time
(TIMESTAMP) — timestamp of the trade
volume
(NUMERIC)
asset
(TEXT)
usersuser_id
(BIGINT, PK)
signup_date
(DATE)
Assumptions:
trade_time
is stored in UTC.
CURRENT_DATE
(or
CURRENT_TIMESTAMP
) in UTC.
Compute the percentage of active traders in the last 30 days who made at least 3 trades in the last 30 days.
Required output (single row):
active_users_30d
users_with_3plus_trades_30d
pct_users_with_3plus_trades_30d
Compute D7 retention by signup cohort where a user is considered retained on D7 if they made ≥ 1 trade exactly on calendar day signup_date + 7.
signup_date <= CURRENT_DATE - 7
(so D7 is observable).
Required output (one row per signup_date):
signup_date
cohort_size
retained_users_d7
d7_retention_rate