예제 #1
0
def test_1h_kdata_recorder():
    start_timestamp = day_offset_today(-5)
    recorder = JQChinaStockKdataRecorder(codes=SAMPLE_STOCK_CODES, sleeping_time=0, level=IntervalLevel.LEVEL_1HOUR,
                                         start_timestamp=start_timestamp, one_shot=True)
    try:
        recorder.run()
    except:
        assert False
예제 #2
0
    def init_entities(self):
        if self.entity_provider == self.provider and self.entity_schema == self.data_schema:
            self.entity_session = self.session
        else:
            self.entity_session = get_db_session(
                provider=self.entity_provider, data_schema=self.entity_schema)

        # init the entity list
        self.entities = get_entities(
            session=self.entity_session,
            entity_type=self.entity_type,
            entity_ids=self.entity_ids,
            codes=self.codes,
            return_type='domain',
            provider=self.entity_provider,
            # 最近7天更新过的跳过
            filters=[(GithubUser.updated_timestamp < day_offset_today(-7)) |
                     (GithubUser.updated_timestamp.is_(None))],
            start_timestamp=self.start_timestamp,
            end_timestamp=self.end_timestamp)