示例#1
0
def set_token(token=None):
    try:
        if token is None:
            token = QASETTING.get_config('TSPRO', 'token', None)
        else:
            QASETTING.set_config('TSPRO', 'token', token)
        ts.set_token(token)
    except:
        print('请升级tushare 至最新版本 pip install tushare -U')
示例#2
0
def set_token(token=None):
    try:
        if token is None:
            # 从~/.quantaxis/setting/config.ini中读取配置
            token = QASETTING.get_config('TSPRO', 'token', None)
        else:
            QASETTING.set_config('TSPRO', 'token', token)
        ts.set_token(token)
    except:
        if token is None:
            print('请设置tushare的token')
        else:
            print('请升级tushare 至最新版本 pip install tushare -U')
示例#3
0
def set_token(token=None):
    try:
        if token is None:
            # 从~/.quantaxis/setting/config.ini中读取配置
            token = QASETTING.get_config('TSPRO', 'token', None)
        else:
            QASETTING.set_config('TSPRO', 'token', token)
        ts.set_token(token)
    except:
        if token is None:
            print('请设置tushare的token')
        else:
            print('请升级tushare 至最新版本 pip install tushare -U')
示例#4
0
def set_token(token=DEFAULT_TUSHARE_TOKEN):
    try:
        if token is None:
            # 从~/.quantaxis/setting/config.ini中读取配置
            token = QASETTING.get_config('TSPRO', 'token', None)
            if token == 'null':
                token = DEFAULT_TUSHARE_TOKEN
                QASETTING.set_config('TSPRO', 'token', DEFAULT_TUSHARE_TOKEN)
        else:
            QASETTING.set_config('TSPRO', 'token', token)
        ts.set_token(token)
    except:
        print('请升级tushare 至最新版本 pip install tushare -U')
示例#5
0
def set_token(token=None):
    try:
        if token is None:
            # 从~/.quantaxis/setting/config.ini中读取配置
            # token = QASETTING.get_config('TSPRO', 'token', None)
            token = config_service.getProperty(section_name=config_service.TOKEN_SECTION_NAME,
                                               property_name=config_service.TS_TOKEN_NAME)
        else:
            QASETTING.set_config('TSPRO', 'token', token)
        ts.set_token(token)
    except:
        if token is None:
            print('请设置tushare的token')
        else:
            print('请升级tushare 至最新版本 pip install tushare -U')
示例#6
0
def get_config(account=None, password=None, remember=False):
    try:
        if account is None:
            account = QASETTING.get_config('JQDATA', 'account', None)
            if account == None:
                QASETTING.set_config('JQDATA', 'account', DEFAULT_ACCOUNT)
                account = DEFAULT_ACCOUNT
        else:
            if remember: QASETTING.set_config('JQDATA', 'account', account)

        if password is None:
            password = QASETTING.get_config('JQDATA', 'password', None)
            if password == None:
                QASETTING.set_config('JQDATA', 'password', DEFAULT_PASSWORD)
                password = DEFAULT_PASSWORD
        else:
            if remember: QASETTING.set_config('JQDATA', 'password', password)

        jqdatasdk.auth(account, password)
        return (account, password)
    except:
        print('请升级jqdatasdk 至最新版本 pip install jqdatasdk -U')
示例#7
0
def reset_config():
    QASETTING.set_config('JQDATA', 'account', DEFAULT_ACCOUNT)
    QASETTING.set_config('JQDATA', 'password', DEFAULT_PASSWORD)