Ejemplo n.º 1
0
def job_once_global_tick(ts):
    """
    获取全部商品分笔数据
    :param ts:
    :return:
    """
    global is_closing
    df = ts.get_stock_basics()
    if df is None:
        return
    cont = False
    #lastsymbol = '300598'
    for symbol in df['name'].index.values:
        # if symbol == lastsymbol:
        #     cont = True
        # if not cont:
        #     continue
        for ndays in range(1, 2, 1):
            if not is_closing:
                day = DateUtil.getDatetimePastStr(DateUtil.getDatetimeToday(),
                                                  ndays)
                if not is_holiday(day):
                    ts.get_tick_data(symbol, day)
                    time.sleep(1)
                else:
                    logging.info('is holiday')
        if not is_closing:
            time.sleep(2)
Ejemplo n.º 2
0
def job_realtime_custom(ts):
    ts.get_today_ticks(AppConfig.custom_stocks)
    ts.get_realtime_quotes(AppConfig.custom_stocks)
    ts.get_realtime_quotes(AppConfig.custom_indexes)
    for symbol in AppConfig.custom_stocks:
        ts.get_tick_data(
            symbol,
            DateUtil.getDatetimeYesterdayStr(DateUtil.getDatetimeToday()))
Ejemplo n.º 3
0
def job_realtime_global(ts):
    """
    交易日里读取指数信息和全盘Snap(20秒左右)
    :param ts:
    :return:
    """
    global is_closing
    today = DateUtil.getDatetimeToday()
    while not is_closing and not is_holiday(DateUtil.date_toString(today)):
        ts.get_index()
        time.sleep(3)
        ts.get_today_all()
        time.sleep(5)
Ejemplo n.º 4
0
def job_realtime_custom(ts):
    """
    1.获取定制商品的实时数据,tick, quote
    2.TODO 全部商品需要分布式环境,有调度任务获取
    :param ts:
    :return:
    """
    global is_closing
    while not is_closing:
        ts.get_today_ticks(AppConfig.custom_stocks)
        ts.get_realtime_quotes(AppConfig.custom_stocks)
        ts.get_realtime_quotes(AppConfig.custom_indexes)
        for symbol in AppConfig.custom_stocks:
            ts.get_tick_data(
                symbol,
                DateUtil.getDatetimeYesterdayStr(DateUtil.getDatetimeToday()))
            time.sleep(1)
        time.sleep(5)