def plot_yesterday_zt(type_name='zrzt', current=datetime.datetime.now().strftime('%Y%m%d')):
    engine = get_engine('db_zdt')
    table_name = type_name
    table = '{}{}'.format(current, table_name)
    try:
        df = pd.read_sql(table, engine)
    except Exception as e:
        logger.error(e)
        return

    for i in range(len(df)):
        code = df.iloc[i]['代码']
        name = df.iloc[i]['名称']
        plot_stock_line(api,code, name, table_name=table_name, current=current, start='2018-07-01', save=True)
Beispiel #2
0
def plot_yesterday_zt(type_name='zrzt', current=datetime.datetime.now().strftime('%Y%m%d')):
    engine = get_engine('db_zdt')
    table_name = type_name
    table = '{}{}'.format(current, table_name)
    try:
        df = pd.read_sql(table, engine)
    except Exception as e:
        logger.error('table_name >>> {}{}'.format(current,table_name))
        logger.error(e)
        return

    for i in range(len(df)):
        code = df.iloc[i]['代码']
        name = df.iloc[i]['名称']
        plot_stock_line(api,code, name, table_name=table_name, current=current, start='2018-07-01', save=True)
Beispiel #3
0
    def plot_yesterday_zt(self,
                          api,
                          type_name='zrzt',
                          current=datetime.datetime.now().strftime('%Y%m%d')):

        start_data = datetime.datetime.now() + datetime.timedelta(days=-200)
        start_data = start_data.strftime('%Y-%m-%d')
        table = f'{current}{type_name}'

        df = self.get_data(table)

        for i in range(len(df)):
            code = df.iloc[i]['代码']
            name = df.iloc[i]['名称']
            plot_stock_line(api,
                            code,
                            name,
                            table_type=type_name,
                            current=current,
                            root_path=self.image_path,
                            start=start_data,
                            save=True)
Beispiel #4
0
def plot_yesterday_zt(type_name='zrzt',
                      current=datetime.datetime.now().strftime('%Y%m%d')):
    engine = DB.get_engine('db_zdt', 'qq')
    table_name = type_name
    table = '{}{}'.format(current, table_name)
    try:
        df = pd.read_sql(table, engine)
    except Exception as e:
        logger.error('table_name >>> {}{}'.format(current, table_name))
        logger.error(e)
        return
    start_data = datetime.datetime.now() + datetime.timedelta(days=-200)
    start_data = start_data.strftime('%Y-%m-%d')
    for i in range(len(df)):
        code = df.iloc[i]['代码']
        name = df.iloc[i]['名称']

        plot_stock_line(api,
                        code,
                        name,
                        table_name=table_name,
                        current=current,
                        start=start_data,
                        save=True)
Beispiel #5
0
'''


def plot_yesterday_zt():
    engine = get_engine('db_zdt')
    table_name = 'zrzt'
    table = '{}{}'.format(datetime.datetime.now().strftime('%Y%m%d'),
                          table_name)
    try:
        df = pd.read_sql(table, engine)
    except Exception, e:
        print e
        return

    for i in range(len(df)):
        code = df.iloc[i][u'代码']
        name = df.iloc[i][u'名称']
        plot_stock_line(code,
                        name,
                        table_name=table_name,
                        start='2018-01-01',
                        save=True)


if __name__ == '__main__':
    current = datetime.datetime.now().strftime('%Y%m%d')
    path = os.path.join(os.path.dirname(__file__), 'data', current)
    if not os.path.exists(path):
        os.mkdir(path)
    os.chdir(path)
    plot_yesterday_zt()