Пример #1
0
    def __init__(self,
                 exchanges=['sh', 'sz'],
                 entity_ids=None,
                 codes=None,
                 day_data=True,
                 batch_size=10,
                 force_update=True,
                 sleeping_time=0,
                 default_size=2000,
                 real_time=False,
                 fix_duplicate_way='ignore',
                 start_timestamp=None,
                 end_timestamp=None,
                 level=IntervalLevel.LEVEL_1WEEK,
                 kdata_use_begin_time=False,
                 close_hour=15,
                 close_minute=0,
                 one_day_trading_minutes=4 * 60) -> None:
        level = IntervalLevel(level)
        self.data_schema = get_kdata_schema(entity_type='index', level=level)
        self.jq_trading_level = to_jq_trading_level(level)

        super().__init__('index', exchanges, entity_ids, codes, day_data,
                         batch_size, force_update, sleeping_time, default_size,
                         real_time, fix_duplicate_way, start_timestamp,
                         end_timestamp, close_hour, close_minute, level,
                         kdata_use_begin_time, one_day_trading_minutes)

        get_token(zvt_config['jq_username'],
                  zvt_config['jq_password'],
                  force=True)
Пример #2
0
    def __init__(
        self,
        force_update=True,
        sleeping_time=10,
        exchanges=None,
        entity_id=None,
        entity_ids=None,
        code=None,
        codes=None,
        day_data=False,
        entity_filters=None,
        ignore_failed=True,
        real_time=False,
        fix_duplicate_way="ignore",
        start_timestamp=None,
        end_timestamp=None,
        level=IntervalLevel.LEVEL_1DAY,
        kdata_use_begin_time=False,
        one_day_trading_minutes=24 * 60,
        adjust_type=AdjustType.qfq,
    ) -> None:
        level = IntervalLevel(level)
        adjust_type = AdjustType(adjust_type)
        self.data_schema = get_kdata_schema(entity_type="stock",
                                            level=level,
                                            adjust_type=adjust_type)
        self.jq_trading_level = to_jq_trading_level(level)

        super().__init__(
            force_update,
            sleeping_time,
            exchanges,
            entity_id,
            entity_ids,
            code,
            codes,
            day_data,
            entity_filters,
            ignore_failed,
            real_time,
            fix_duplicate_way,
            start_timestamp,
            end_timestamp,
            level,
            kdata_use_begin_time,
            one_day_trading_minutes,
        )

        self.adjust_type = adjust_type

        get_token(zvt_config["jq_username"],
                  zvt_config["jq_password"],
                  force=True)
Пример #3
0
def jq_get_token(mob=None, pwd=None, force=True):
    try:
        return jq.get_token(mob=mob, pwd=pwd, force=force)
    except Exception as e:
        logger.error(f'jq_get_token, mob: {mob}, error: {e}')
    return None
Пример #4
0
def test_pass():
    try:
        print(get_token())
    except:
        assert False