Exemple #1
0
    def _log_global_report(self, exchange_manager):
        _, profitability, _, market_average_profitability, _ = trading_api.get_profitability_stats(
            exchange_manager)
        reference_market = trading_api.get_reference_market(
            self.backtesting_config)
        end_portfolio = trading_api.get_portfolio(exchange_manager)
        end_portfolio_value = trading_api.get_current_portfolio_value(
            exchange_manager)
        starting_portfolio = trading_api.get_origin_portfolio(exchange_manager)
        starting_portfolio_value = trading_api.get_origin_portfolio_value(
            exchange_manager)

        self.logger.info(
            f"[End portfolio]      value {round(end_portfolio_value, 5)} {reference_market} "
            f"Holdings: {pretty_printer.global_portfolio_pretty_print(end_portfolio, ' | ')}"
        )

        self.logger.info(
            f"[Starting portfolio] value {round(starting_portfolio_value, 5)} {reference_market} "
            f"Holdings: {pretty_printer.global_portfolio_pretty_print(starting_portfolio, ' | ')}"
        )

        self.logger.info(
            f"Global market profitability (vs {reference_market}) : "
            f"{market_average_profitability}% | Octobot : {profitability}%")

        self.logger.info(
            f"Simulation lasted "
            f"{round(backtesting_api.get_backtesting_duration(self.octobot_backtesting.backtesting), 3)} sec"
        )
Exemple #2
0
 async def get_dict_formatted_report(self):
     reference_market = trading_api.get_reference_market(self.backtesting_config)
     try:
         trading_mode = trading_api.get_activated_trading_mode(self.tentacles_setup_config).get_name()
     except errors.ConfigTradingError as e:
         self.logger.error(e)
         trading_mode = "Error when reading trading mode"
     report = self._get_exchanges_report(reference_market, trading_mode)
     return report
Exemple #3
0
    def __init__(self, octobot_api):
        self.octobot_api = octobot_api
        self.edited_config: configuration.Configuration = octobot_api.get_edited_config(
            dict_only=False)
        self.enabled = self.edited_config.get_metrics_enabled()
        self.bot_id = self._init_config_bot_id(self.edited_config.config)
        self.reference_market = trading_api.get_reference_market(
            self.edited_config.config)
        self.logger = logging.get_logger(self.__class__.__name__)
        self.current_config = None
        self.keep_running = True
        self.session = octobot_api.get_aiohttp_session()

        # these attributes will be set at the last moment to ensure relevance and let time for everything to startup
        self.has_real_trader = None
        self.has_simulator = None
        self.exchange_managers = None
def get_reference_market() -> str:
    # The reference market is the currency unit of the calculated quantity value
    return trading_api.get_reference_market(interfaces.get_global_config())