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