Downsample data with different transforms on different series in one measurement


I have financial data and am looking to downsample and do some aggregation in the process.

My high frequency (nanosecond) data looks like this:
Price, Size, Type,Ticker
2200, 1,Trade, ES1

I’d like to aggregate it at the second and minute level with the following fields:
a. Number of Trades
b. Volume of Trades
c. Open Bid (this is the first Bid in the time interval)
d. Close Bid (the last Bid in the interval)
e. Open Ask
f. Close Ask

Not sure how to go about it. Any help would be much appreciated,