示例#1
0
def update_bundle(data_bundle_path, rqdatac_uri, compression, concurrency):
    try:
        import rqdatac
    except ImportError:
        click.echo(
            _('rqdatac is required to update bundle. '
              'you can visit https://www.ricequant.com/welcome/rqdata to get rqdatac, '
              'or use "rqalpha download-bundle" to download monthly updated bundle.'
              ))
        return 1

    try:
        init_rqdatac_env(rqdatac_uri)
        rqdatac.init()
    except ValueError as e:
        click.echo(_('rqdatac init failed with error: {}').format(e))
        return 1

    if not os.path.exists(os.path.join(data_bundle_path, 'bundle')):
        click.echo(
            _('bundle not exist, use "rqalpha create-bundle" command instead'))
        return 1

    from rqalpha.data.bundle import update_bundle as update_bundle_
    update_bundle_(os.path.join(data_bundle_path, 'bundle'), False,
                   compression, concurrency)
示例#2
0
def init_rqdatac(rqdatac_uri):
    try:
        import rqdatac
    except ImportError:
        return

    try:
        init_rqdatac_env(rqdatac_uri)
        rqdatac.init()
    except Exception as e:
        system_log.warn(_('rqdatac init failed, some apis will not function properly: {}').format(str(e)))
示例#3
0
文件: main.py 项目: yushu9/rqalpha
def init_rqdatac(rqdatac_uri):
    try:
        import rqdatac
    except ImportError:
        return

    import warnings

    try:
        init_rqdatac_env(rqdatac_uri)
        with warnings.catch_warnings(record=True):
            rqdatac.init()
    except Exception as e:
        system_log.warn(
            _('rqdatac init failed, some apis will not function properly: {}').
            format(str(e)))
示例#4
0
def init_rqdatac(rqdatac_uri):
    try:
        import rqdatac
    except ImportError:
        system_log.info(
            _('rqdatac is not available, some apis will not function properly')
        )
        return

    try:
        init_rqdatac_env(rqdatac_uri)
        rqdatac.init()
    except ValueError as e:
        system_log.warn(
            _('rqdatac init failed, some apis will not function properly: {}').
            format(str(e)))
示例#5
0
文件: bundle.py 项目: yushu9/rqalpha
def create_bundle(data_bundle_path, rqdatac_uri, compression, concurrency):
    """create bundle using rqdatac"""
    try:
        import rqdatac
    except ImportError:
        click.echo(
            _('rqdatac is required to create bundle. '
              'you can visit https://www.ricequant.com/welcome/rqdata to get rqdatac, '
              'or use "rqalpha download-bundle" to download monthly updated bundle.'
              ))
        return 1

    try:
        init_rqdatac_env(rqdatac_uri)
        rqdatac.init()
    except ValueError as e:
        click.echo(_('rqdatac init failed with error: {}').format(e))
        return 1

    os.makedirs(os.path.join(data_bundle_path, 'bundle'), exist_ok=True)
    from rqalpha.data.bundle import update_bundle as update_bundle_
    update_bundle_(os.path.join(data_bundle_path, 'bundle'), True, compression,
                   concurrency)