def __init__(self, user_cookie=None): ''' 随机初始化 user_cookie 的值 Acc+4数字id+4位大小写随机 ''' self.setting = QA_Setting() self.portfolio_list = {} self.user_cookie = QA_util_random_with_topic( 'USER') if user_cookie is None else user_cookie
def get_config_SPE(): config = configparser.ConfigParser() return SPE_CONFIG( QA_Setting().get_config('SPE', 'uri', DEFAULT_SHIPANE_URL), QA_Setting().get_config('SPE', 'key', DEFAULT_SHIPANE_KEY))
class QA_User(): """QA_User User-->Portfolio-->Account/Strategy ::::::::::::::::::::::::::::::::::::::::::::::::: :: :: Portfolio 1 -- Account/Strategy 1 :: :: USER :: -- Account/Strategy 2 :: :: :: Portfolio 2 -- Account/Strategy 3 :: ::::::::::::::::::::::::::::::::::::::::::::::::: :: 需要增加对于QA_USER的支持 USER作为一个单位实体, 可以自由创建 组合Portfolio (需要被记录),修改 组合Portfolio @yutiansut 2018/05/08 @jerryw 添加注释,和 🛠todo list 2018/05/16 @royburns 1.根据指定的user_cookie创建user; 2.添加对应的测试代码; 3.添加注释 2018/05/18 """ def __init__(self, user_cookie=None): ''' 随机初始化 user_cookie 的值 Acc+4数字id+4位大小写随机 ''' self.setting = QA_Setting() self.portfolio_list = {} self.user_cookie = QA_util_random_with_topic( 'USER') if user_cookie is None else user_cookie def __repr__(self): return '< QA_USER {} with {} portfolio: {} >'.format(self.user_cookie, len(self.portfolio_list.keys()), self.portfolio_list) @property def table(self): return pd.concat([po.table for po in self.portfolio_list.values()], axis=1) def client(self): ''' 'user.client to connect database' :return: pymongo.MongoClient 数据库连接 ''' return self.setting.client def connect_database(self, ip='127.0.0.1', port=27017): ''' 'connect is also a way to change database from IP_A to IP_B :param ip: 连接mongodb ip :param port: 连接mongodb 端口 :return: None ''' self.setting.change(ip, port) def login(self, user_name, password): ''' login to a database 🛠todo: fix 返回 是否成功 :param user_name: 连接 mongodb 的用户名 :param password: 连接 mongodb 的密码 :return: Boolean 是否成功连接 ''' if self.setting.login(user_name, password): QA_util_log_info('✅SUCCESS') return True else: QA_util_log_info('FAILD') return False def new_portfolio(self, portfolio_cookie=None): ''' 根据 self.user_cookie 创建一个 portfolio :return: 如果存在 返回 新建的 QA_Portfolio 如果已经存在 不返回 None ''' _portfolio = QA_Portfolio( user_cookie=self.user_cookie, portfolio_cookie=portfolio_cookie) if _portfolio.portfolio_cookie not in self.portfolio_list.keys(): self.portfolio_list[_portfolio.portfolio_cookie] = _portfolio return _portfolio else: print(" prortfolio with user_cookie ", self.user_cookie, " already exist!!") def get_portfolio(self, portfolio): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: QA_Portfolio类型 :return: QA_Portfolio类型 ''' # return self.portfolio_list[portfolio] # fix here use cookie as key to find value in dict return self.portfolio_list[portfolio.portfolio_cookie] def get_portfolio_by_cookie(self, portfolio_cookie): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: porfolio_cookie string :return: QA_Portfolio类型 ''' return self.portfolio_list[portfolio_cookie] def generate_simpleaccount(self): """make a simple account with a easier way 如果当前user中没有创建portfolio, 则创建一个portfolio,并用此portfolio创建一个account 如果已有一个或多个portfolio,则使用第一个portfolio来创建一个account """ if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] ac = po.new_account() return ac, po def register_account(self, account, portfolio_cookie=None): ''' 注册一个account到portfolio组合中 account 也可以是一个策略类,实现其 on_bar 方法 :param account: 被注册的account :return: ''' # 查找 portfolio if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() elif portfolio_cookie is not None: po = self.portfolio_list[portfolio_cookie] else: po = list(self.portfolio_list.values())[0] # 把account 添加到 portfolio中去 po.add_account(account) return (po, account) def save(self): """ 将QA_USER的信息存入数据库 """ pass
QA_util_log_info() QA_util_log_debug() QA_util_log_expection() """ import configparser import datetime import os import sys from zenlog import logging from QUANTAXIS.QASetting.QALocalize import log_path, setting_path from QUANTAXIS.QAUtil.QASetting import QA_Setting """2019-01-03 升级到warning级别 不然大量别的代码的log会批量输出出来 """ os.makedirs(QA_Setting().get_config('LOG', 'path', log_path), exist_ok=True) try: _name = '{}{}quantaxis_{}-{}-.log'.format( QA_Setting().get_config('LOG', 'path', log_path), os.sep, os.path.basename(sys.argv[0]).split('.py')[0], str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))) except: _name = '{}{}quantaxis-{}-.log'.format( QA_Setting().get_config('LOG', 'path', log_path), os.sep, str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))) logging.basicConfig( level=logging.WARNING, format='%(asctime)s QUANTAXIS>>> %(message)s', datefmt='%H:%M:%S', filename=_name,
class QA_User(): """QA_User User-->Portfolio-->Account/Strategy ::::::::::::::::::::::::::::::::::::::::::::::::: :: :: Portfolio 1 -- Account/Strategy 1 :: :: USER :: -- Account/Strategy 2 :: :: :: Portfolio 2 -- Account/Strategy 3 :: ::::::::::::::::::::::::::::::::::::::::::::::::: :: 需要增加对于QA_USER的支持 USER作为一个单位实体, 可以自由创建 组合Portfolio (需要被记录),修改 组合Portfolio @yutiansut 2018/05/08 @jerryw 添加注释,和 🛠todo list 2018/05/16 @royburns 1.根据指定的user_cookie创建user; 2.添加对应的测试代码; 3.添加注释 2018/05/18 """ def __init__( self, user_cookie=None, username='******', phone='defalut', level='l1', utype='guests', password='******', coins=10000, money=0, ): """[summary] Keyword Arguments: user_cookie {[type]} -- [description] (default: {None}) 随机初始化 user_cookie 的值 Acc+4数字id+4位大小写随机 username {str} -- [description] (default: {'defalut'}) phone {str} -- [description] (default: {'defalut'}) level {str} -- [description] (default: {'l1'}) utype {str} -- [description] (default: {'guests'}) password {str} -- [description] (default: {'default'}) coins {int} -- [description] (default: {10000}) 关于积分系统: 积分系统用于订阅策略, 取消订阅策略是不会增加积分的 """ self.setting = QA_Setting() self.portfolio_list = {} # ============================== self.phone = phone self.level = level self.utype = utype self.password = password self.username = username self.user_cookie = QA_util_random_with_topic( 'USER') if user_cookie is None else user_cookie self.coins = coins # 积分 self.money = money # 钱 # ============================== self._subscribed_strategy = {} self._subscribed_code = [] self._signals = [] # 预期收到的信号 self._cash = [] self._history = [] # =============================== self.coins_history = [] self.coins_history_headers = [ 'cost_coins', 'strategy_id', 'start', 'last', 'strategy_uuid', 'event' ] self.sync() def __repr__(self): return '< QA_USER {} with {} portfolio: {} >'.format( self.user_cookie, len(self.portfolio_list.keys()), self.portfolio_list) @property def table(self): return pd.concat([po.table for po in self.portfolio_list.values()], axis=1) def add_coins(self, coins): """积分充值 Arguments: coins {[type]} -- [description] """ self.coins += int(coins) @property def coins_table(self): return pd.DataFrame(self.coins_history, columns=self.coins_history_headers) def subscribe_strategy(self, strategy_id: str, last: int, today=datetime.date.today(), cost_coins=10): """订阅一个策略 会扣减你的积分 Arguments: strategy_id {str} -- [description] last {int} -- [description] Keyword Arguments: today {[type]} -- [description] (default: {datetime.date.today()}) cost_coins {int} -- [description] (default: {10}) """ if self.coins > cost_coins: order_id = str(uuid.uuid1()) self._subscribed_strategy[strategy_id] = { 'lasttime': last, 'start': str(today), 'strategy_id': strategy_id, 'end': QA_util_get_next_day( QA_util_get_real_date(str(today), towards=1), last), 'status': 'running', 'uuid': order_id } self.coins -= cost_coins self.coins_history.append([ cost_coins, strategy_id, str(today), last, order_id, 'subscribe' ]) return True, order_id else: # return QAERROR. return False, 'Not Enough Coins' def unsubscribe_stratgy(self, strategy_id): today = datetime.date.today() order_id = str(uuid.uuid1()) if strategy_id in self._subscribed_strategy.keys(): self._subscribed_strategy[strategy_id]['status'] = 'canceled' self.coins_history.append( [0, strategy_id, str(today), 0, order_id, 'unsubscribe']) @property def subscribed_strategy(self): return pd.DataFrame(list(self._subscribed_strategy.values())) @property def subscribing_strategy(self): res = self.subscribed_strategy.assign( remains=self.subscribed_strategy.end.apply(lambda x: pd.Timestamp( x) - pd.Timestamp(datetime.date.today()))) #res['left'] = res['end_time'] # res['remains'] res.assign( status=res['remains'].apply(lambda x: 'running' if x > datetime. timedelta(days=0) else 'timeout')) return res.query('status=="running"') def sub_code(self, code): """关注的品种 """ self._subscribed_code.append(code) @property def subscribed_code(self): return list(set(self._subscribed_code)) @property def client(self): ''' 'user.client to connect database' :return: pymongo.MongoClient 数据库连接 ''' return self.setting.client.quantaxis.user def connect_database(self, ip='127.0.0.1', port=27017): ''' 'connect is also a way to change database from IP_A to IP_B :param ip: 连接mongodb ip :param port: 连接mongodb 端口 :return: None ''' self.setting.change(ip, port) def login(self, username, password): ''' login to a database 🛠todo: fix 返回 是否成功 :param username: 连接 mongodb 的用户名 :param password: 连接 mongodb 的密码 :return: Boolean 是否成功连接 ''' if self.setting.login(username, password): QA_util_log_info('SUCCESS') return True else: QA_util_log_info('FAILD') return False def new_portfolio(self, portfolio_cookie=None): ''' 根据 self.user_cookie 创建一个 portfolio :return: 如果存在 返回 新建的 QA_Portfolio 如果已经存在 不返回 None ''' _portfolio = QA_Portfolio(user_cookie=self.user_cookie, portfolio_cookie=portfolio_cookie) if _portfolio.portfolio_cookie not in self.portfolio_list.keys(): self.portfolio_list[_portfolio.portfolio_cookie] = _portfolio return _portfolio else: print(" prortfolio with user_cookie ", self.user_cookie, " already exist!!") def get_portfolio(self, portfolio): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: QA_Portfolio类型 :return: QA_Portfolio类型 ''' # return self.portfolio_list[portfolio] # fix here use cookie as key to find value in dict return self.portfolio_list[portfolio.portfolio_cookie] def get_portfolio_by_cookie(self, portfolio_cookie): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: porfolio_cookie string :return: QA_Portfolio类型 ''' return self.portfolio_list[portfolio_cookie] def generate_simpleaccount(self): """make a simple account with a easier way 如果当前user中没有创建portfolio, 则创建一个portfolio,并用此portfolio创建一个account 如果已有一个或多个portfolio,则使用第一个portfolio来创建一个account """ if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] ac = po.new_account() return ac, po def register_account(self, account, portfolio_cookie=None): ''' 注册一个account到portfolio组合中 account 也可以是一个策略类,实现其 on_bar 方法 :param account: 被注册的account :return: ''' # 查找 portfolio if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() elif portfolio_cookie is not None: po = self.portfolio_list[portfolio_cookie] else: po = list(self.portfolio_list.values())[0] # 把account 添加到 portfolio中去 po.add_account(account) return (po, account) @property def message(self): return { 'user_cookie': self.user_cookie, 'username': self.username, 'password': self.password, 'phone': self.phone, 'level': self.level, 'utype': self.utype, 'coins': self.coins, 'coins_history': self.coins_history, 'money': self.money, 'subuscribed_strategy': self._subscribed_strategy, 'subscribed_code': self.subscribed_code } def save(self): """ 将QA_USER的信息存入数据库 """ self.client.update( { 'username': self.username, 'password': self.password }, {'$set': self.message}, upsert=True) def sync(self): """基于账户/密码去sync数据库 """ res = self.client.find_one({ 'username': self.username, 'password': self.password }) if res is None: self.client.insert_one(self.message) else: self.reload(res) return self def reload(self, message): self.phone = message.get('phone') self.level = message.get('level') self.utype = message.get('utype') self.coins = message.get('coins') self.coins_history = message.get('coins_history') self.money = message.get('money') self._subscribed_strategy = message.get('subuscribed_strategy') self._subscribed_code = message.get('subscribed_code')
def __init__(self): self.setting = QA_Setting() self.portfolio_list = {} self.user_cookie = QA_util_random_with_topic('USER')
def __init__( self, user_cookie=None, username='******', phone='defalut', level='l1', utype='guests', password='******', coins=10000, wechat_id=None, money=0, ): """[summary] Keyword Arguments: user_cookie {[type]} -- [description] (default: {None}) 随机初始化 user_cookie 的值 Acc+4数字id+4位大小写随机 username {str} -- [description] (default: {'defalut'}) phone {str} -- [description] (default: {'defalut'}) level {str} -- [description] (default: {'l1'}) utype {str} -- [description] (default: {'guests'}) password {str} -- [description] (default: {'default'}) coins {int} -- [description] (default: {10000}) 关于积分系统: 积分系统用于订阅策略, 取消订阅策略是不会增加积分的 """ self.setting = QA_Setting() self.portfolio_list = {} # ============================== self.phone = phone self.level = level self.utype = utype self.password = password self.username = username self.wechat_id = wechat_id if wechat_id is not None: if self.username == 'default': """基于web的初始化 """ self.username = wechat_id self.password = '******' else: raise Exception self.user_cookie = QA_util_random_with_topic( 'USER') if user_cookie is None else user_cookie self.coins = coins # 积分 self.money = money # 钱 # ============================== self._subscribed_strategy = {} self._subscribed_code = [] self._signals = [] # 预期收到的信号 self._cash = [] self._history = [] # =============================== self.coins_history = [] self.coins_history_headers = [ 'cost_coins', 'strategy_id', 'start', 'last', 'strategy_uuid', 'event' ] self.sync()
def test_select_best_ip(self): best_ip = select_best_ip() ip = best_ip['stock']['ip'] port = best_ip['stock']['port'] self.assertTrue(isinstance(ip, str), '未获取到ip') self.assertTrue(isinstance(port, int), '未获取到端口号') self.assertTrue( ping(ip, port, 'stock') < datetime.timedelta(0, 1, 0), '地址ping不通: {} {} {}'.format(ip, port, ping(ip, port, 'stock'))) type = 'future' ip = best_ip[type]['ip'] port = best_ip[type]['port'] self.assertTrue( ping(ip, port, type) < datetime.timedelta(0, 1, 0), '地址ping不通: {} {} {}'.format(ip, port, ping(ip, port, 'stock'))) code = '000001' days = 300 start = datetime.datetime.now().date() - datetime.timedelta(days) end = datetime.datetime.now().date() - datetime.timedelta(10) data = QA_fetch_get_stock_day(code, start_date=start, end_date=end) # print(data) self.assertTrue( len(data) > (end - start).days / 2, '返回数据个数不匹配,数from time import time据长度:{},天数(包含节假日):{}'.format( len(data), (end - start).days / 2)) # 恢复初始化ip,重新测试ip default_ip = { 'stock': { 'ip': None, 'port': None }, 'future': { 'ip': None, 'port': None } } qasetting = QA_Setting() qasetting.set_config(section='IPLIST', option='default', default_value=default_ip) filenames = ['stock_ip_list', 'stock_ip_list_MP'] for filename in filenames: # 删除保存ip的pickle文件 filename = '{}{}{}.pickle'.format( qasetting.get_config(section='LOG', option='path', default_value=""), os.sep, filename) if os.path.isfile(filename): os.remove(filename) best_ip = select_best_ip() ip = best_ip['stock']['ip'] port = best_ip['stock']['port'] self.assertTrue(isinstance(ip, str), '未获取到ip') self.assertTrue(isinstance(port, int), '未获取到端口号') ip = best_ip['future']['ip'] port = best_ip['future']['port'] self.assertTrue(isinstance(ip, str), '未获取到ip') self.assertTrue(isinstance(port, int), '未获取到端口号') data = QA_fetch_get_stock_day(code, start, end) self.assertTrue( len(data) > (end - start).days / 2, '返回数据个数不匹配,数据长度:{},天数(包含节假日):{}'.format(len(data), (end - start).days / 2))
class QA_User(): """QA_User User--Portfolio--Account/Strategy """ def __init__(self): self.setting = QA_Setting() self.portfolio_list = {} self.user_cookie = QA_util_random_with_topic('USER') def __repr__(self): return '< QA_USER {} with {} portfolio >'.format(self.user_cookie, len(self.portfolio_list.keys())) @property def table(self): return pd.concat([po.table for po in self.portfolio_list.values()], axis=1) def client(self): 'user.client to connect database' return self.setting.client def connect_database(self, ip='127.0.0.1', port=27017): 'connect is also a way to change database from IP_A to IP_B' self.setting.change(ip, port) def login(self, user_name, password): 'login to a database' if self.setting.login(user_name, password): QA_util_log_info('SUCCESS') else: QA_util_log_info('FAILD') def new_portfolio(self): 'create a portfolio' _portfolio = QA_Portfolio(user_cookie=self.user_cookie) if _portfolio.portfolio_cookie not in self.portfolio_list.keys(): self.portfolio_list[_portfolio.portfolio_cookie] = _portfolio return _portfolio def get_portfolio(self, portfolio): 'get a portfolio' return self.portfolio_list[portfolio] def generate_simpleaccount(self): """make a simple account with a easier way 如果当前user中没有创建portfolio, 则创建一个portfolio,并用此portfolio创建一个account 如果已有一个或多个portfolio,则使用第一个portfolio来创建一个account """ if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] ac = po.new_account() return ac, po def register_account(self, account): if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] po.add_account(account) return (po, account)
def QA_SU_save_trade_date_all(): data = QATushare.QA_fetch_get_trade_date('', '') __setting = QA_Setting() coll = __setting.client.quantaxis.trade_date coll.insert_many(data)
""" import configparser import datetime import os import sys from zenlog import logging from QUANTAXIS.QASetting.QALocalize import log_path, setting_path from QUANTAXIS.QAUtil.QASetting import QA_Setting """2019-01-03 升级到warning级别 不然大量别的代码的log会批量输出出来 """ try: _name = os.path.join(os.path.abspath(QA_Setting().get_config('LOG','path', log_path)), 'quantaxis_{}-{}-.log'.format(os.path.basename(sys.argv[0]).split('.py')[0], str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')))) # _name = '{}{}quantaxis_{}-{}-.log'.format( # QA_Setting().get_config('LOG','path', log_path), # os.sep, # os.path.basename(sys.argv[0]).split('.py')[0], # str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) # ) except: _name = os.path.join(os.path.abspath(QA_Setting().get_config('LOG','path', log_path)), 'quantaxis-{}-.log'.format(str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')))) # _name = '{}{}quantaxis-{}-.log'.format( # QA_Setting().get_config('LOG','path', log_path),
# -*- coding: utf-8 -*- """ Created on Sat Jun 6 22:40:26 2020 @author: Administrator """ from QUANTAXIS.QAUtil.QASetting import QA_Setting QASETTING = QA_Setting() DATABASE = QASETTING.client.quantzsl DATABASE_ASYNC = QASETTING.client_async.quantzsl
class QA_User(): """QA_User User-->Portfolio-->Account/Strategy :: 需要增加对于QA_USER的支持 USER作为一个单位实体, 可以自由创建 组合Portfolio (需要被记录),修改 组合Portfolio @yutiansut 2018/05/08 @jerryw 添加注释,和 todo list 2018/05/16 """ def __init__(self): ''' 随机初始化 user_cookie 的值 Acc+4数字id+4位大小写随机 ''' self.setting = QA_Setting() self.portfolio_list = {} self.user_cookie = QA_util_random_with_topic('USER') def __repr__(self): return '< QA_USER {} with {} portfolio: {} >'.format(self.user_cookie, len(self.portfolio_list.keys()), self.portfolio_list) @property def table(self): return pd.concat([po.table for po in self.portfolio_list.values()], axis=1) def client(self): ''' 'user.client to connect database' :return: pymongo.MongoClient 数据库连接 ''' return self.setting.client def connect_database(self, ip='127.0.0.1', port=27017): ''' 'connect is also a way to change database from IP_A to IP_B :param ip: 连接mongodb ip :param port: 连接mongodb 端口 :return: None ''' self.setting.change(ip, port) def login(self, user_name, password): ''' login to a database todo: fix 返回 是否成功 :param user_name: 连接 mongodb 的用户名 :param password: 连接 mongodb 的密码 :return: Boolean 是否成功连接 ''' if self.setting.login(user_name, password): QA_util_log_info('SUCCESS') return True else: QA_util_log_info('FAILD') return False def new_portfolio(self): ''' 根据 self.user_cookie 创建一个 portfolio :return: 如果存在 返回 新建的 QA_Portfolio 如果已经存在 不返回 None ''' _portfolio = QA_Portfolio(user_cookie=self.user_cookie) if _portfolio.portfolio_cookie not in self.portfolio_list.keys(): self.portfolio_list[_portfolio.portfolio_cookie] = _portfolio return _portfolio else: print(" prortfolio with user_cookie ", self.user_cookie , " already exist!!") def get_portfolio(self, portfolio): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: QA_Portfolio类型 :return: QA_Portfolio类型 ''' #return self.portfolio_list[portfolio] return self.portfolio_list[portfolio.portfolio_cookie] #fix here use cookie as key to find value in dict def get_portfolio_by_cookie(self, portfolio_cookie): ''' 'get a portfolio' 从 portfolio_list dict字典中 根据 portfolio key 获取 :param portfolio: porfolio_cookie string :return: QA_Portfolio类型 ''' return self.portfolio_list[portfolio_cookie] def generate_simpleaccount(self): """make a simple account with a easier way 如果当前user中没有创建portfolio, 则创建一个portfolio,并用此portfolio创建一个account 如果已有一个或多个portfolio,则使用第一个portfolio来创建一个account """ if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] ac = po.new_account() return ac, po def register_account(self, account): ''' 注册一个account到portfolio组合中 :param account: 被注册的account :return: ''' if len(self.portfolio_list.keys()) < 1: po = self.new_portfolio() else: po = list(self.portfolio_list.values())[0] po.add_account(account) return (po, account) def save(self): """ 将QA_USER的信息存入数据库 """ pass
""" import configparser import datetime import os import sys from zenlog import logging from QUANTAXIS.QASetting.QALocalize import log_path, setting_path from QUANTAXIS.QAUtil.QASetting import QA_Setting """2019-01-03 升级到warning级别 不然大量别的代码的log会批量输出出来 """ try: _name = '{}{}quantaxis_{}-{}-.log'.format( QA_Setting().get_config('LOG','path', log_path), os.sep, os.path.basename(sys.argv[0]).split('.py')[0], str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) ) except: _name = '{}{}quantaxis-{}-.log'.format( QA_Setting().get_config('LOG','path', log_path), os.sep, str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) ) logging.basicConfig( level=logging.WARNING, format='%(asctime)s QUANTAXIS>>> %(message)s', datefmt='%H:%M:%S',