def test_load_adjustments_from_sqlite(self):
        reader = SQLiteAdjustmentReader(self.db_path)
        columns = [USEquityPricing.close, USEquityPricing.volume]
        query_days = self.calendar_days_between(TEST_QUERY_START, TEST_QUERY_STOP)

        adjustments = reader.load_adjustments(columns, query_days, self.assets)

        close_adjustments = adjustments[0]
        volume_adjustments = adjustments[1]

        expected_close_adjustments, expected_volume_adjustments = self.expected_adjustments(
            TEST_QUERY_START, TEST_QUERY_STOP
        )
        for key in expected_close_adjustments:
            close_adjustment = close_adjustments[key]
            for j, adj in enumerate(close_adjustment):
                expected = expected_close_adjustments[key][j]
                self.assertEqual(adj.first_row, expected.first_row)
                self.assertEqual(adj.last_row, expected.last_row)
                self.assertEqual(adj.first_col, expected.first_col)
                self.assertEqual(adj.last_col, expected.last_col)
                assert_allclose(adj.value, expected.value)

        for key in expected_volume_adjustments:
            volume_adjustment = volume_adjustments[key]
            for j, adj in enumerate(volume_adjustment):
                expected = expected_volume_adjustments[key][j]
                self.assertEqual(adj.first_row, expected.first_row)
                self.assertEqual(adj.last_row, expected.last_row)
                self.assertEqual(adj.first_col, expected.first_col)
                self.assertEqual(adj.last_col, expected.last_col)
                assert_allclose(adj.value, expected.value)
    def test_load_adjustments_from_sqlite(self):
        reader = SQLiteAdjustmentReader(self.db_path)
        columns = [USEquityPricing.close, USEquityPricing.volume]
        query_days = self.calendar_days_between(
            TEST_QUERY_START,
            TEST_QUERY_STOP,
        )

        adjustments = reader.load_adjustments(
            columns,
            query_days,
            self.assets,
        )

        close_adjustments = adjustments[0]
        volume_adjustments = adjustments[1]

        expected_close_adjustments, expected_volume_adjustments = \
            self.expected_adjustments(TEST_QUERY_START, TEST_QUERY_STOP)
        self.assertEqual(close_adjustments, expected_close_adjustments)
        self.assertEqual(volume_adjustments, expected_volume_adjustments)
    def test_load_adjustments_from_sqlite(self):
        reader = SQLiteAdjustmentReader(self.db_path)
        columns = [USEquityPricing.close, USEquityPricing.volume]
        query_days = self.calendar_days_between(
            TEST_QUERY_START,
            TEST_QUERY_STOP,
        )

        adjustments = reader.load_adjustments(
            columns,
            query_days,
            self.assets,
        )

        close_adjustments = adjustments[0]
        volume_adjustments = adjustments[1]

        expected_close_adjustments, expected_volume_adjustments = \
            self.expected_adjustments(TEST_QUERY_START, TEST_QUERY_STOP)
        self.assertEqual(close_adjustments, expected_close_adjustments)
        self.assertEqual(volume_adjustments, expected_volume_adjustments)
Example #4
0
    def test_load_adjustments_from_sqlite(self):
        reader = SQLiteAdjustmentReader(self.db_path)
        columns = [USEquityPricing.close, USEquityPricing.volume]
        query_days = self.calendar_days_between(
            TEST_QUERY_START,
            TEST_QUERY_STOP,
        )

        adjustments = reader.load_adjustments(
            columns,
            query_days,
            self.assets,
        )

        close_adjustments = adjustments[0]
        volume_adjustments = adjustments[1]

        expected_close_adjustments, expected_volume_adjustments = \
            self.expected_adjustments(TEST_QUERY_START, TEST_QUERY_STOP)
        for key in expected_close_adjustments:
            close_adjustment = close_adjustments[key]
            for j, adj in enumerate(close_adjustment):
                expected = expected_close_adjustments[key][j]
                self.assertEqual(adj.first_row, expected.first_row)
                self.assertEqual(adj.last_row, expected.last_row)
                self.assertEqual(adj.first_col, expected.first_col)
                self.assertEqual(adj.last_col, expected.last_col)
                assert_allclose(adj.value, expected.value)

        for key in expected_volume_adjustments:
            volume_adjustment = volume_adjustments[key]
            for j, adj in enumerate(volume_adjustment):
                expected = expected_volume_adjustments[key][j]
                self.assertEqual(adj.first_row, expected.first_row)
                self.assertEqual(adj.last_row, expected.last_row)
                self.assertEqual(adj.first_col, expected.first_col)
                self.assertEqual(adj.last_col, expected.last_col)
                assert_allclose(adj.value, expected.value)