FunctionRacerProblemsRace

Open Positions

MediumSQLSQLite

A buy adds its qty to the position in a symbol and a sell takes it away. Return each symbol whose position after all trades is not zero, with that position (negative when more was sold than bought), in alphabetical order of symbol.

Example 1

trades
idsymbolsideqtyprice
1MSFTbuy10410.0
2AAPLsell4191.0
3MSFTsell10412.0
4AAPLbuy1189.0
5KObuy761.0
returns
symbolposition
AAPL-3
KO7

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