Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Trading Days by Volume

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Top Trading Days by Volume. Start with the requirements and the two tables on the right.

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.

Problem

Deutsche Börse Group wants to monitor peak activity on the Xetra trading venue. Write a PostgreSQL query that identifies the highest-volume trading day or days in each calendar month.

Requirements

  1. Join trades to instruments and include only trades for valid instruments.
  2. Consider only EXECUTED trades on Xetra with a non-null volume.
  3. Aggregate total volume by calendar month and trading date.
  4. Return every day tied for the highest volume in its month, using a window function. Sort by month and trading date.

Schema

trades
ColumnTypeDescription
trade_idPKINTEGERUnique trade identifier
instrument_idINTEGERReferenced instrument identifier
executed_atTIMESTAMPTimestamp when the trade was executed
volumeBIGINTNumber of units traded
trade_statusVARCHAR(20)Trade lifecycle status
venueVARCHAR(30)Trading venue
instruments
ColumnTypeDescription
instrument_idPKINTEGERUnique instrument identifier
symbolVARCHAR(20)Instrument trading symbol
product_nameVARCHAR(100)Instrument product name
asset_classVARCHAR(30)Instrument asset class
Tablestradesinstruments
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results