Пример #1
0
def start(start_date=None, end_date=None):  # 公告开始日期, 公告结束日期
    """
    :param start_date:  公告开始日期
    :param end_date:  公告结束日期
    Nonte:
        公告日期写当天的话, 有可能数据查不到, 所以写一段时间, 有新数据就全量替换
    """
    if end_date is None:
        end_date = datetime.datetime.now()
        end_date = datetime.datetime(end_date.year, end_date.month,
                                     end_date.day)

    if start_date is None:
        start_date = end_date - datetime.timedelta(days=360)

    end_day = calendar.monthrange(end_date.year, end_date.month)[1]
    if end_date.day == end_day:
        ts_code_list = get_ts_code_list()

        for ts_code in ts_code_list:
            try:
                holder_number = get_holder_number(ts_code, start_date,
                                                  end_date)
                db_holder_number = get_db_holder_number(
                    ts_code, start_date, end_date)
                update_holder_number(holder_number, db_holder_number, ts_code,
                                     start_date, end_date)
            except Exception as e:
                store_failed_message("", "stock_holder_number_data", str(e),
                                     end_date)
Пример #2
0
def start(date_now=None):
    date_now = datetime.datetime.now() if date_now is None else date_now
    date_now = datetime.datetime(date_now.year, date_now.month, date_now.day)

    try:
        future_main_code_data = get_future_main_code_data(convert_datetime_to_str(date_now))
        store_future_main_code_data(future_main_code_data)
    except Exception as e:
        store_failed_message("", "future_main_code_data", str(e), date_now)
Пример #3
0
def start(date_now=None):
    date_now = datetime.datetime.now() if date_now is None else date_now
    date_now = datetime.datetime(date_now.year, date_now.month, date_now.day)

    if Date().is_workday(date_now):
        try:
            all_security_daily_basic = get_all_security_daily_basic(convert_datetime_to_str(date_now))
            store_security_daily_basic(all_security_daily_basic)
        except Exception as e:
            store_failed_message("", "security_daily_basic_data", str(e), date_now)
def start(date_now=None):
    date_now = datetime.datetime.now() if date_now is None else date_now
    date_now = datetime.datetime(date_now.year, date_now.month, date_now.day)

    if Date().is_workday(date_now):
        try:
            all_future_daily_point_data = get_all_future_daily_point_data(convert_datetime_to_str(date_now))
            store_future_daily_point_data(all_future_daily_point_data)
        except Exception as e:
            store_failed_message("", "future_daily_point_data", str(e), date_now)
def start():
    date_now = datetime.datetime.now()
    date_now = datetime.datetime(date_now.year, date_now.month, date_now.day)

    delete_old_data()
    for exchange in FUTURE_EXCHANGE_CODE_LIST:
        try:
            future_basic_info_data = get_future_basic_info_data(exchange)
            store_future_basic_info_data(future_basic_info_data, exchange)
        except Exception as e:
            store_failed_message("", "future_basic_info_data", str(e),
                                 date_now)
Пример #6
0
def start(date_now=None):
    date_now = datetime.datetime.now() if date_now is None else date_now
    date_now = datetime.datetime(date_now.year, date_now.month, date_now.day)

    if Date().is_workday(date_now):
        delete_future_holding_data(date_now)
        for exchange in FUTURE_EXCHANGE_CODE_LIST:
            try:
                future_holding_data = get_future_holding_data(
                    convert_datetime_to_str(date_now), exchange)
                store_future_holding_data(future_holding_data)
            except Exception as e:
                store_failed_message("", "future_main_holding_data", str(e),
                                     date_now)