FunctionRacerProblemsRace

Daily Bars

HardSQLSQLite

A price chart sums a day up in four numbers. trades lists every trade of several days, in order of id. Return one row per day, earliest first, with open (the price of the day's first trade), high (its highest price), low (its lowest) and close (the price of its last trade).

Example 1

trades
iddayprice
12026-01-0210.0
22026-01-0212.5
32026-01-029.0
42026-01-0211.0
52026-01-0511.5
62026-01-0514.0
returns
dayopenhighlowclose
2026-01-0210.012.59.011.0
2026-01-0511.514.011.514.0

Constraints

Race itor take your time

Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.

More SQL problems