Example #1
0
def commands(cmd=None):
    if cmd == "update":
        Commands.update(logger, catch=True)
        return jsonify("Success")

    elif cmd == "restart":
        Commands.restart_bot()
        return jsonify("Success")

    elif cmd == "stop":
        Commands.stop_bot(get_bot())
        return jsonify("Success")

    return render_template('commands.html', cmd=cmd)
Example #2
0
    # Version
    logger.info("Version : {0}".format(LONG_VERSION))

    logger.info("Loading config files...")
    config = load_config()

    # Handle utility methods before bot initializing if possible
    if args.packager:
        Commands.package_manager(config, args.packager)

    elif args.creator:
        Commands.tentacle_creator(config, args.creator)

    elif args.update:
        Commands.update(logger)

    else:
        # In those cases load OctoBot
        from octobot import OctoBot

        config[CONFIG_EVALUATOR] = load_config(CONFIG_EVALUATOR_FILE_PATH,
                                               False)

        TelegramApp.enable(config, args.telegram)

        WebService.enable(config, args.web)

        bot = OctoBot(config)

        import interfaces
Example #3
0
def start_octobot(starting_args):
    if starting_args.pause_time is not None:
        sleep(starting_args.pause_time)

    fileConfig('config/logging_config.ini')

    logger = logging.getLogger("OctoBot Launcher")

    # Force new log file creation not to log at the previous one's end.
    logger.parent.handlers[1].doRollover()

    sys.excepthook = _log_uncaught_exceptions

    # Version
    logger.info("Version : {0}".format(LONG_VERSION))

    # Test update
    if starting_args.update:
        Commands.update(logger)
    else:
        Commands.check_bot_update(logger)

        logger.info("Loading config files...")
        config = load_config()

        # Handle utility methods before bot initializing if possible
        if starting_args.packager:
            Commands.package_manager(config, starting_args.packager)

        elif starting_args.creator:
            Commands.tentacle_creator(config, starting_args.creator)

        else:
            # In those cases load OctoBot
            from octobot import OctoBot

            config[CONFIG_EVALUATOR] = load_config(CONFIG_EVALUATOR_FILE_PATH,
                                                   False)

            TelegramApp.enable(config, starting_args.telegram)

            WebService.enable(config, starting_args.web)

            bot = OctoBot(config)

            import interfaces

            interfaces.__init__(bot, config)

            if starting_args.data_collector:
                Commands.data_collector(config)

            # start crypto bot options
            else:
                if starting_args.backtesting:
                    import backtesting

                    backtesting.__init__(bot)

                    config[CONFIG_BACKTESTING][CONFIG_ENABLED_OPTION] = True
                    config[CONFIG_CATEGORY_NOTIFICATION][
                        CONFIG_ENABLED_OPTION] = False

                    config[CONFIG_TRADER][CONFIG_ENABLED_OPTION] = False
                    config[CONFIG_SIMULATOR][CONFIG_ENABLED_OPTION] = True

                if starting_args.simulate:
                    config[CONFIG_TRADER][CONFIG_ENABLED_OPTION] = False
                    config[CONFIG_SIMULATOR][CONFIG_ENABLED_OPTION] = True

                if starting_args.risk is not None and 0 < starting_args.risk <= 1:
                    config[CONFIG_TRADER][
                        CONFIG_TRADER_RISK] = starting_args.risk

                if starting_args.start:
                    Commands.start_bot(bot, logger)