How to use the octobot.community.community_fields.CommunityFields.CURRENT_SESSION function in OctoBot

To help you get started, we’ve selected a few OctoBot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Drakkar-Software / OctoBot / octobot / community / community_manager.py View on Github external
def _get_bot_community(self):
        return {
            CommunityFields.ID.value: self.bot_id,
            CommunityFields.CURRENT_SESSION.value: {
                CommunityFields.STARTED_AT.value: int(self.octobot_api.get_start_time()),
                CommunityFields.UP_TIME.value: int(time.time() - self.octobot_api.get_start_time()),
                CommunityFields.SIMULATOR.value: self.has_simulator,
                CommunityFields.TRADER.value: self.has_real_trader,
                CommunityFields.EVAL_CONFIG.value: self._get_eval_config(),
                CommunityFields.PAIRS.value: self._get_traded_pairs(),
                CommunityFields.EXCHANGES.value: list(get_exchange_names()),
                CommunityFields.NOTIFICATIONS.value: self._get_notification_types(),
                CommunityFields.TYPE.value: get_octobot_type(),
                CommunityFields.PLATFORM.value: get_current_platform(),
                CommunityFields.REFERENCE_MARKET.value: self.reference_market,
                CommunityFields.PORTFOLIO_VALUE.value: self._get_real_portfolio_value(),
                CommunityFields.PROFITABILITY.value: self._get_profitability()
            }
github Drakkar-Software / OctoBot / octobot / community / community_manager.py View on Github external
async def _update_uptime_and_profitability(self, retry_on_error=True):
        self.current_config[CommunityFields.CURRENT_SESSION.value][CommunityFields.UP_TIME.value] = \
            int(time.time() - self.octobot_api.get_start_time())
        self.current_config[CommunityFields.CURRENT_SESSION.value][CommunityFields.PROFITABILITY.value] = \
            self._get_profitability()
        await self._post_community_data(METRICS_ROUTE_UPTIME, self.current_config, retry_on_error)