Two separate queries produce these results:
There are 48 periods per day.
select a.mydate, a.myperiod, a.mycode, a.buysell, SUM(a.myvalue) from dbo.mytable a
where a.mydate = '2006-03-01' and a.buysell = 'Buy'
group by a.mydate, a.myperiod, a.mynode, a.buysell
2006-03-01 1 AAA...