示例#1
0
    def request_data(self, count=100, style='dict'):
        count = min(count, self.MAX_COUNT)
        price_data = get_data_by_count(currency_pair=self.currency_pair,
                                       period=self.period,
                                       count=self._get_required_price_count(count),
                                       style='df')

        return self._create_moving_average(price_data, style)
示例#2
0
    def request_data(self, count=100, lowbd=2, upbd=2, style='dict'):
        count = min(count, self.MAX_COUNT)
        price_data = get_data_by_count(
            currency_pair=self.currency_pair,
            period=self.period,
            count=self._get_required_price_count(count),
            style='df')

        return self._create_bollinger_bands(price_data, lowbd, upbd, style)
示例#3
0
    def test_prices_count(self):
        currency_pair = 'xem_jpy'
        period = '4h'

        test_counts = [1, 3, 4]

        res_counts = []
        for count in test_counts:
            res_counts.append(len(zdp.get_data_by_count(currency_pair=currency_pair,
                                                        period=period,
                                                        count=count)))

        self.assertEqual(res_counts, test_counts)