Esempio n. 1
0
    def __init__(self, dataSeries, frequency):
        if not resamplebase.is_valid_frequency(frequency):
            raise Exception("Unsupported frequency")

        self.__frequency = frequency
        self.__grouper = None
        self.__range = None

        dataSeries.getNewValueEvent().subscribe(self.__onNewValue)
Esempio n. 2
0
    def __init__(self, dataSeries, frequency, maxLen=dataseries.DEFAULT_MAX_LEN):
        bards.BarDataSeries.__init__(self, maxLen)

        if not isinstance(dataSeries, bards.BarDataSeries):
            raise Exception("dataSeries must be a dataseries.bards.BarDataSeries instance")

        if not resamplebase.is_valid_frequency(frequency):
            raise Exception("Unsupported frequency")

        self.__frequency = frequency
        self.__grouper = None
        self.__range = None

        dataSeries.getNewValueEvent().subscribe(self.__onNewValue)
Esempio n. 3
0
    def __init__(self, barFeed, frequency, maxLen=None):
        super(ResampledBarFeed, self).__init__(frequency, maxLen)

        if not isinstance(barFeed, barfeed.BaseBarFeed):
            raise Exception("barFeed must be a barfeed.BaseBarFeed instance")

        if not resamplebase.is_valid_frequency(frequency):
            raise Exception("Unsupported frequency")

        # Register the same instruments as in the underlying barfeed.
        for instrument in barFeed.getRegisteredInstruments():
            self.registerInstrument(instrument)

        self.__values = []
        self.__barFeed = barFeed
        self.__grouper = None
        self.__range = None

        barFeed.getNewValuesEvent().subscribe(self.__onNewValues)
Esempio n. 4
0
    def __init__(self, barFeed, frequency, maxLen=None):
        super(ResampledBarFeed, self).__init__(frequency, maxLen)

        if not isinstance(barFeed, barfeed.BaseBarFeed):
            raise Exception("barFeed must be a barfeed.BaseBarFeed instance")

        if not resamplebase.is_valid_frequency(frequency):
            raise Exception("Unsupported frequency")

        # Register the same instruments as in the underlying barfeed.
        for instrument in barFeed.getRegisteredInstruments():
            self.registerInstrument(instrument, frequency)

        self.__values = []
        self.__barFeed = barFeed
        self.__grouper = None
        self.__range = None

        barFeed.getNewValuesEvent().subscribe(self.__onNewValues)