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)
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)