Reworked the portfolio benchmark function to work with indexes.

IB historical trades bar data can sometimes have large gaps for
equities and ETFs, but trades bar data is the only data for indexes.
However, bid_ask data is almost always available for equities and
ETFs, thus we would build a portfolio using bid_ask bars but use as a
benchmark the trades from an index. This functionality was split
among several other sql functions.