Exemplo n.º 1
0
    def notify_state_changed(self, final_eval, crypto_currency_evaluator,
                             symbol, trader, result, matrix):
        if self.gmail_notification_available():
            profitability, profitability_percent, _ = trader.get_trades_manager(
            ).get_profitability()

            self.gmail_notification_factory(
                "CRYPTO BOT ALERT : {0} / {1}".format(
                    crypto_currency_evaluator.crypto_currency, result),
                "CRYPTO BOT ALERT : {0} / {1} \n {2} \n Current portfolio "
                "profitability : {3} "
                "{4} ({5}%)".format(
                    crypto_currency_evaluator.crypto_currency, result,
                    pprint.pformat(matrix), round(profitability, 2),
                    TradesManager.get_reference_market(self.config),
                    round(profitability_percent, 2)))

        alert_content = PrettyPrinter.cryptocurrency_alert(
            crypto_currency_evaluator.crypto_currency, symbol, result,
            final_eval)

        if self.twitter_notification_available():
            self.tweet_instance = self.twitter_notification_factory(
                alert_content)

        if self.telegram_notification_available():
            self.telegram_notification_factory(alert_content)

        return self
Exemplo n.º 2
0
    def notify_alert(self, final_eval, crypto_currency_evaluator, symbol, trader, result, matrix):
        title = f"OCTOBOT ALERT : {crypto_currency_evaluator.crypto_currency} / {result}"

        if self.gmail_notification_available(CONFIG_NOTIFICATION_PRICE_ALERTS):
            profitability, profitability_percent, _, _ = trader.get_trades_manager().get_profitability()

            self.gmail_notification_factory(
                title,
                "OCTOBOT ALERT : {0} / {1} \n {2} \n Current portfolio "
                "profitability : {3} "
                "{4} ({5}%)".format(
                    crypto_currency_evaluator.crypto_currency,
                    result,
                    pprint.pformat(matrix),
                    round(profitability, 2),
                    TradesManager.get_reference_market(self.config),
                    round(profitability_percent, 2)))

        alert_content = PrettyPrinter.cryptocurrency_alert(
            crypto_currency_evaluator.crypto_currency,
            symbol,
            result,
            final_eval)

        self.tweet_instance = self.send_twitter_notification_if_necessary(alert_content,
                                                                          CONFIG_NOTIFICATION_PRICE_ALERTS)

        self.send_telegram_notification_if_necessary(alert_content, CONFIG_NOTIFICATION_PRICE_ALERTS)

        self.send_web_notification_if_necessary(InterfaceLevel.INFO, title, alert_content,
                                                CONFIG_NOTIFICATION_PRICE_ALERTS)

        return self
Exemplo n.º 3
0
    async def notify_alert(self, final_eval, crypto_currency_evaluator, symbol,
                           trader, result, matrix):
        title = f"OCTOBOT ALERT : {crypto_currency_evaluator.crypto_currency} / {result}"
        try:

            alert_content, alert_content_markdown = PrettyPrinter.cryptocurrency_alert(
                crypto_currency_evaluator.crypto_currency, symbol, result,
                final_eval)

            self.tweet_instance = await self.send_twitter_notification_if_necessary(
                alert_content, CONFIG_NOTIFICATION_PRICE_ALERTS)

            await self.send_telegram_notification_if_necessary(
                alert_content_markdown,
                CONFIG_NOTIFICATION_PRICE_ALERTS,
                markdown=True)

            await self.send_web_notification_if_necessary(
                InterfaceLevel.INFO, title, alert_content,
                CONFIG_NOTIFICATION_PRICE_ALERTS)
        except Exception as e:
            self.logger.error(f"Error when sending alert [{title}] error: {e}")
            self.logger.exception(e)

        return self
Exemplo n.º 4
0
    def notify_state_changed(self, final_eval, crypto_currency_evaluator, symbol, trader, result, matrix):
        if self.gmail_notification_available():
            profitability, profitability_percent, _ = trader.get_trades_manager().get_profitability()

            self.gmail_notification_factory(
                "CRYPTO BOT ALERT : {0} / {1}".format(crypto_currency_evaluator.crypto_currency,
                                                      result),
                "CRYPTO BOT ALERT : {0} / {1} \n {2} \n Current portfolio "
                "profitability : {3} "
                "{4} ({5}%)".format(
                    crypto_currency_evaluator.crypto_currency,
                    result,
                    pprint.pformat(matrix),
                    round(profitability, 2),
                    TradesManager.get_reference_market(self.config),
                    round(profitability_percent, 2)))

        alert_content = PrettyPrinter.cryptocurrency_alert(
                    crypto_currency_evaluator.crypto_currency,
                    symbol,
                    result,
                    final_eval)

        if self.twitter_notification_available():
            self.tweet_instance = self.twitter_notification_factory(alert_content)

        if self.telegram_notification_available():
            self.telegram_notification_factory(alert_content)

        return self
    async def notify_alert(self, final_eval, crypto_currency_evaluator, symbol,
                           trader, result, matrix):
        title = f"OCTOBOT ALERT : {crypto_currency_evaluator.crypto_currency} / {result}"

        alert_content = PrettyPrinter.cryptocurrency_alert(
            crypto_currency_evaluator.crypto_currency, symbol, result,
            final_eval)

        self.tweet_instance = await self.send_twitter_notification_if_necessary(
            alert_content, CONFIG_NOTIFICATION_PRICE_ALERTS)

        await self.send_telegram_notification_if_necessary(
            alert_content, CONFIG_NOTIFICATION_PRICE_ALERTS)

        await self.send_web_notification_if_necessary(
            InterfaceLevel.INFO, title, alert_content,
            CONFIG_NOTIFICATION_PRICE_ALERTS)

        await self.send_notifier_notification_if_necessary(
            alert_content, CONFIG_NOTIFICATION_PRICE_ALERTS)

        return self