コード例 #1
0
 def handle_data(context, data):
     results = pipeline_output('test')
     date = get_datetime().normalize()
     for asset in self.assets:
         # Assets should appear iff they exist today and yesterday.
         exists_today = self.exists(date, asset)
         existed_yesterday = self.exists(date - self.trading_day, asset)
         if exists_today and existed_yesterday:
             latest = results.loc[asset, 'close']
             self.assertEqual(latest, self.expected_close(date, asset))
         else:
             self.assertNotIn(asset, results.index)
コード例 #2
0
 def handle_data(context, data):
     results = pipeline_output('test')
     date = get_datetime().normalize()
     for asset in self.assets:
         # Assets should appear iff they exist today and yesterday.
         exists_today = self.exists(date, asset)
         existed_yesterday = self.exists(date - self.trading_day, asset)
         if exists_today and existed_yesterday:
             latest = results.loc[asset, 'close']
             self.assertEqual(latest, self.expected_close(date, asset))
         else:
             self.assertNotIn(asset, results.index)
コード例 #3
0
        def handle_data(context, data):
            today = normalize_date(get_datetime())
            results = pipeline_output('test')
            expect_over_300 = {
                AAPL: today < self.AAPL_split_date,
                MSFT: False,
                BRK_A: True,
            }
            for asset in assets:
                should_pass_filter = expect_over_300[asset]
                if set_screen and not should_pass_filter:
                    self.assertNotIn(asset, results.index)
                    continue

                asset_results = results.loc[asset]
                self.assertEqual(asset_results['filter'], should_pass_filter)
                for length in vwaps:
                    computed = results.loc[asset, vwap_key(length)]
                    expected = vwaps[length][asset].loc[today]
                    # Only having two places of precision here is a bit
                    # unfortunate.
                    assert_almost_equal(computed, expected, decimal=2)
コード例 #4
0
        def handle_data(context, data):
            today = normalize_date(get_datetime())
            results = pipeline_output('test')
            expect_over_300 = {
                AAPL: today < self.AAPL_split_date,
                MSFT: False,
                BRK_A: True,
            }
            for asset in assets:
                should_pass_filter = expect_over_300[asset]
                if set_screen and not should_pass_filter:
                    self.assertNotIn(asset, results.index)
                    continue

                asset_results = results.loc[asset]
                self.assertEqual(asset_results['filter'], should_pass_filter)
                for length in vwaps:
                    computed = results.loc[asset, vwap_key(length)]
                    expected = vwaps[length][asset].loc[today]
                    # Only having two places of precision here is a bit
                    # unfortunate.
                    assert_almost_equal(computed, expected, decimal=2)
コード例 #5
0
ファイル: dual_vwap.py プロジェクト: jbelke/catalyst
def before_trading_start(context, data):
    context.pipeline_data = pipeline_output('vwap_pipeline')
コード例 #6
0
 def before_trading_start(context, data):
     pipeline_output('not_test')
     raise AssertionError("Shouldn't make it past pipeline_output!")
コード例 #7
0
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
     pipeline_output('test')
     raise AssertionError("Shouldn't make it past pipeline_output()")
コード例 #8
0
 def before_trading_start(context, data):
     context.results = pipeline_output('test')
     self.assertTrue(context.results.empty)
     count[0] += 1
コード例 #9
0
 def before_trading_start(context, data):
     context.results = pipeline_output('test')
     self.assertTrue(context.results.empty)
     count[0] += 1
コード例 #10
0
 def before_trading_start(context, data):
     pipeline_output('not_test')
     raise AssertionError("Shouldn't make it past pipeline_output!")
コード例 #11
0
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
     pipeline_output('test')
     raise AssertionError("Shouldn't make it past pipeline_output()")