'Builds a resampled barfeed that groups bars by a certain frequency.
:param frequency: The grouping frequency in seconds. Must be > 0.
:param callback: A function similar to onBars that will be called when new bars are available.
:rtype: :class:`pyalgotrade.barfeed.BaseBarFeed`.'

def resampleBarFeed(self, frequency, callback):

    ret = resampled.ResampledBarFeed(self.getFeed(), frequency)
    ret.getNewValuesEvent().subscribe(callback)
    self.getDispatcher().addSubject(ret)
    self.__resampledBarFeeds.append(ret)
    return ret
