예제 #1
0
 def __init__(self):
     conn = sqlite3_connect(':memory:')
     writer = SQLiteAdjustmentWriter(conn)
     empty = DataFrame({
         'sid': array([], dtype=uint32),
         'effective_date': array([], dtype=uint32),
         'ratio': array([], dtype=float),
     })
     writer.write(splits=empty, mergers=empty, dividends=empty)
     super(NullAdjustmentReader, self).__init__(conn)
예제 #2
0
 def __init__(self):
     conn = sqlite3_connect(':memory:')
     writer = SQLiteAdjustmentWriter(conn)
     empty = DataFrame({
         'sid': array([], dtype=uint32),
         'effective_date': array([], dtype=uint32),
         'ratio': array([], dtype=float),
     })
     writer.write(splits=empty, mergers=empty, dividends=empty)
     super(NullAdjustmentReader, self).__init__(conn)
예제 #3
0
    def setUpClass(cls):
        cls.test_data_dir = TempDirectory()
        cls.db_path = cls.test_data_dir.getpath("adjustments.db")
        writer = SQLiteAdjustmentWriter(cls.db_path)
        writer.write(SPLITS, MERGERS, DIVIDENDS)

        cls.assets = TEST_QUERY_ASSETS
        all_days = TradingEnvironment().trading_days
        cls.calendar_days = all_days[all_days.slice_indexer(TEST_CALENDAR_START, TEST_CALENDAR_STOP)]

        cls.asset_info = EQUITY_INFO
        cls.bcolz_writer = SyntheticDailyBarWriter(cls.asset_info, cls.calendar_days)
        cls.bcolz_path = cls.test_data_dir.getpath("equity_pricing.bcolz")
        cls.bcolz_writer.write(cls.bcolz_path, cls.calendar_days, cls.assets)
    def setUpClass(cls):
        cls.test_data_dir = TempDirectory()
        cls.db_path = cls.test_data_dir.getpath('adjustments.db')
        writer = SQLiteAdjustmentWriter(cls.db_path)
        writer.write(SPLITS, MERGERS, DIVIDENDS)

        cls.assets = TEST_QUERY_ASSETS
        all_days = TradingEnvironment.instance().trading_days
        cls.calendar_days = all_days[all_days.slice_indexer(
            TEST_CALENDAR_START, TEST_CALENDAR_STOP)]

        cls.asset_info = EQUITY_INFO
        cls.bcolz_writer = SyntheticDailyBarWriter(
            cls.asset_info,
            cls.calendar_days,
        )
        cls.bcolz_path = cls.test_data_dir.getpath('equity_pricing.bcolz')
        cls.bcolz_writer.write(cls.bcolz_path, cls.calendar_days, cls.assets)
예제 #5
0
 def create_adjustment_reader(cls, tempdir):
     dbpath = tempdir.getpath('adjustments.sqlite')
     writer = SQLiteAdjustmentWriter(dbpath)
     splits = DataFrame.from_records([{
         'effective_date':
         str_to_seconds('2014-06-09'),
         'ratio': (1 / 7.0),
         'sid':
         cls.AAPL,
     }])
     mergers = dividends = DataFrame(
         {
             # Hackery to make the dtypes correct on an empty frame.
             'effective_date': array([], dtype=int),
             'ratio': array([], dtype=float),
             'sid': array([], dtype=int),
         },
         index=DatetimeIndex([], tz='UTC'),
         columns=['effective_date', 'ratio', 'sid'],
     )
     writer.write(splits, mergers, dividends)
     return SQLiteAdjustmentReader(dbpath)
 def create_adjustment_reader(cls, tempdir):
     dbpath = tempdir.getpath('adjustments.sqlite')
     writer = SQLiteAdjustmentWriter(dbpath)
     splits = DataFrame.from_records([
         {
             'effective_date': str_to_seconds('2014-06-09'),
             'ratio': (1 / 7.0),
             'sid': cls.AAPL,
         }
     ])
     mergers = dividends = DataFrame(
         {
             # Hackery to make the dtypes correct on an empty frame.
             'effective_date': array([], dtype=int),
             'ratio': array([], dtype=float),
             'sid': array([], dtype=int),
         },
         index=DatetimeIndex([], tz='UTC'),
         columns=['effective_date', 'ratio', 'sid'],
     )
     writer.write(splits, mergers, dividends)
     return SQLiteAdjustmentReader(dbpath)