FunctionRacerProblemsRace

Net Position

EasySQLSQLite

A buy adds its qty to the position in a symbol and a sell takes its qty away. Return each symbol once with its position after all trades, in alphabetical order of symbol.

Example 1

trades
idsymbolsideqtyprice
1MSFTbuy10410.0
2AAPLsell4191.0
3MSFTsell3412.0
4AAPLbuy4189.0
returns
symbolposition
AAPL0
MSFT7

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