Consolidated NBBO Historical Quotes


I am looking to build a footprint charting tool and trying to find imbalances. For backtesting when I tried to pull Historical Quotes, I see bids/asks at a micro-second level and have to process a lot of data manually to build the imbalance for a specific interval of the day. Is there an easy to roll up all the bids/asks at the interval level? For example - AAPL → 1Min interval → Array of bids/asks for each minute between provided start and end dates with limit. Appreciate your help on this.