@author: shiyunchao """ import os import pandas as pd from time import strftime, localtime import uqer from uqer import DataAPI from xutils.custom_logger import CustomLogger from xutils.decorators import handle_exception import numpy as np client = uqer.Client( token='811e6680b27759e045ed16e2ed9b408dc8a0cbffcf14e4bb755144dd45fa5ea0') LOGGER = CustomLogger(logger_name='updateLogger', log_level='info', log_file='update.log') class Barra_data(): def __init__(self, start, end, dirpath, fre='month', fre_type='short'): ###----传入参数---- self.start = start # 开始时间 self.end = end # 结束时间 self.fre = fre # 数据频率,日度,周度,月度三个选择 self.fre_type = fre_type self.trade_day = self.getTradeday().iloc[:-1] #### 第一次运行获取截止到前一天 # self.today = '20170829' # self.today = strftime("%Y%m%d",localtime()) self.today = self.trade_day.iloc[-1] ## 改成更新到前一天 self.day_before = self.trade_day.iloc[
from time import strftime, localtime import sys import datetime as dt import yaml import os import warnings from tools.LogManager import record from tools.EmailSender import send warnings.filterwarnings("ignore") from xutils.custom_logger import CustomLogger from xutils.decorators import handle_exception LOGGER = CustomLogger(logger_name='Update_error_log', log_level='info', log_file='F:/logger_file/Update_error.log') logger123 = CustomLogger(logger_name='log_update', log_level='info', log_file='F:/logger_file/log%s.log' % strftime("%Y%m%d", localtime())) from xutils import (Date, Calendar, Period) cal = Calendar('China.SSE') sys.path.append("F:/QUANT/factor_daily/Suspension/") reload(sys) import get_suspension
# -*- coding: utf-8 -*- import json import socket from xutils.job_runner.job import JobBase from xutils.custom_logger import CustomLogger from xutils.decorators import handle_exception from xutils.config_utils import find_and_parse_config try: from urllib.parse import (quote, unquote) except ImportError: from urllib import (quote, unquote) socket_logger = CustomLogger('SocketLogger') class SocketJob(JobBase): def __init__(self, job_config='socket_job.yaml'): super(SocketJob, self).__init__() self.job_config = job_config @classmethod def meta_info(cls): return { 'job_class_string': '%s.%s' % (cls.__module__, cls.__name__), 'notes': '配置任务信息', 'arguments': [ # argument1
# -*- coding: utf-8 -*- from xutils.custom_logger import CustomLogger from xutils.decorators import handle_exception LOGGER = CustomLogger(logger_name='TestLogger', log_level='info', log_file='test.log') @handle_exception(logger=LOGGER) def test_exception(): raise ValueError('Error here blabla') @handle_exception(logger=LOGGER, subject=u"[更新失败!!]", sender='xxxx', username='******', password='******', host='mail.xxx.com', receiver=['*****@*****.**']) def test_exception_with_email(): raise ValueError('Error here blabla') if __name__ == '__main__': test_exception_with_email()
# -*- coding: utf-8 -*- from xutils.custom_logger import CustomLogger LOGGER = CustomLogger(logger_name='TestLogger', log_level='info', log_file='test.log') LOGGER.info('Hello world') LOGGER.set_level('critical') LOGGER.info('Hello world')