]): if k in config: print(f"{k: <{max(map(len, keys)) + 2}} {config[k]}") print() ticks = await downloader.get_ticks(True) start_candidate = None if args.starting_configs != 'none': try: if os.path.isdir(args.starting_configs): start_candidate = [ json.load(open(f)) for f in glob.glob( os.path.join(args.starting_configs, '*.json')) ] print('Starting with all configurations in directory.') else: start_candidate = json.load(open(args.starting_configs)) print('Starting with specified configuration.') except Exception as e: print('Could not find specified configuration.', e) if start_candidate: analysis = backtest_tune(ticks, config, start_candidate) else: analysis = backtest_tune(ticks, config) save_results(analysis, config) plot_wrap(config, ticks, clean_result_config(analysis.best_config)) if __name__ == '__main__': asyncio.run(main())
if os.path.isdir(config['starting_configs']): start_candidate = [ load_live_config(f) for f in glob.glob( os.path.join(config['starting_configs'], '*.json')) ] print('Starting with all configurations in directory.') else: start_candidate = load_live_config(config['starting_configs']) print('Starting with specified configuration.') except Exception as e: print('Could not find specified configuration.', e) analysis = backtest_tune(data, config, start_candidate) if analysis: save_results(analysis, config) config.update(clean_result_config(analysis.best_config)) plot_wrap(pack_config(config), data) async def main(): parser = argparse.ArgumentParser(prog='Optimize', description='Optimize passivbot config.') parser.add_argument('-o', '--optimize_config', type=str, required=False, dest='optimize_config_path', default='configs/optimize/default.hjson', help='optimize config hjson file') parser.add_argument( '-t', '--start',