def setUp(self):
     # Fixture Setup
     data = TestDataProvider.gbpusd_1min_bid()[:1000]
     bar_type = TestStubs.bartype_gbpusd_1min_bid()
     self.bar_builder = BarDataWrangler(
         bar_type=bar_type,
         price_precision=5,
         size_precision=1,
         data=data,
     )
class BarDataWranglerTests(unittest.TestCase):
    def setUp(self):
        # Fixture Setup
        data = TestDataProvider.gbpusd_1min_bid()[:1000]
        bar_type = TestStubs.bartype_gbpusd_1min_bid()
        self.bar_builder = BarDataWrangler(
            bar_type=bar_type,
            price_precision=5,
            size_precision=1,
            data=data,
        )

    def test_build_bars_all(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_all()

        # Assert
        self.assertEqual(1000, len(bars))

    def test_build_bars_range_with_defaults(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_range()

        # Assert
        self.assertEqual(999, len(bars))

    def test_build_bars_range_with_param(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_range(start=500)

        # Assert
        self.assertEqual(499, len(bars))

    def test_build_bars_from_with_defaults(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_from()

        # Assert
        self.assertEqual(1000, len(bars))

    def test_build_bars_from_with_param(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_from(index=500)

        # Assert
        self.assertEqual(500, len(bars))
Exemple #3
0
class BarDataWranglerTests(unittest.TestCase):

    def setUp(self):
        # Fixture Setup
        data = TestDataProvider.gbpusd_1min_bid()[:1000]
        self.bar_builder = BarDataWrangler(5, 1, data)

    def test_build_bars_all(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_all()

        # Assert
        self.assertEqual(1000, len(bars))

    def test_build_bars_range_with_defaults(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_range()

        # Assert
        self.assertEqual(999, len(bars))

    def test_build_bars_range_with_param(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_range(start=500)

        # Assert
        self.assertEqual(499, len(bars))

    def test_build_bars_from_with_defaults(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_from()

        # Assert
        self.assertEqual(1000, len(bars))

    def test_build_bars_from_with_param(self):
        # Arrange
        # Act
        bars = self.bar_builder.build_bars_from(index=500)

        # Assert
        self.assertEqual(500, len(bars))
 def setUp(self):
     # Fixture Setup
     data = TestDataProvider.gbpusd_1min_bid()[:1000]
     self.bar_builder = BarDataWrangler(5, 1, data)