diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ce7e414..608d4f4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.12] - 2026-01-30 +### Fixed +[ExchangeConfigData] Don't use realtime timeframe if no realtime evaluator is configured + ## [2.5.11] - 2026-01-29 ### Fixed [PositionValueHolder] Fix futures open orders value calculation when using symbol instead of currency diff --git a/README.md b/README.md index 06743c065..861d306a2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OctoBot-Trading [2.5.11](https://github.com/Drakkar-Software/OctoBot-Trading/blob/master/CHANGELOG.md) +# OctoBot-Trading [2.5.12](https://github.com/Drakkar-Software/OctoBot-Trading/blob/master/CHANGELOG.md) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/903b6b22bceb4661b608a86fea655f69)](https://app.codacy.com/gh/Drakkar-Software/OctoBot-Trading?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot-Trading&utm_campaign=Badge_Grade_Dashboard) [![PyPI](https://img.shields.io/pypi/v/OctoBot-Trading.svg)](https://pypi.python.org/pypi/OctoBot-Trading/) [![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Trading/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Trading?branch=master) diff --git a/octobot_trading/__init__.py b/octobot_trading/__init__.py index a62a6319d..77faf3750 100644 --- a/octobot_trading/__init__.py +++ b/octobot_trading/__init__.py @@ -15,4 +15,4 @@ # License along with this library. PROJECT_NAME = "OctoBot-Trading" -VERSION = "2.5.11" # major.minor.revision +VERSION = "2.5.12" # major.minor.revision diff --git a/octobot_trading/exchanges/config/exchange_config_data.py b/octobot_trading/exchanges/config/exchange_config_data.py index 85f3fe007..4a021448b 100644 --- a/octobot_trading/exchanges/config/exchange_config_data.py +++ b/octobot_trading/exchanges/config/exchange_config_data.py @@ -81,6 +81,9 @@ def __init__(self, exchange_manager): # When False, cancelled orders won't be saved in trades history self.is_saving_cancelled_orders_as_trade: bool = True + # When True, short timeframes will be added for real-time evaluators + self.realtime_data_fetching: bool = False + self.backtesting_exchange_config = None async def initialize_impl(self): @@ -396,10 +399,12 @@ def _set_config_time_frame(self): for time_frame in time_frame_manager.get_config_time_frame(self.config): if self.exchange_manager.time_frame_exists(time_frame.value): self.available_required_time_frames.append(time_frame) - if ( - not self.exchange_manager.is_backtesting or - (self.exchange_manager.is_backtesting and self.exchange_manager.exchange.use_accurate_price_time_frame()) - ) or not self.available_required_time_frames: + if self.realtime_data_fetching and ( + ( + not self.exchange_manager.is_backtesting or + (self.exchange_manager.is_backtesting and self.exchange_manager.exchange.use_accurate_price_time_frame()) + ) or not self.available_required_time_frames + ): # add shortest time frame for realtime evaluators client_shortest_time_frame = time_frame_manager.find_min_time_frame( self.exchange_manager.client_time_frames, diff --git a/octobot_trading/exchanges/exchange_builder.py b/octobot_trading/exchanges/exchange_builder.py index c6ebe8096..5d4a14f0e 100644 --- a/octobot_trading/exchanges/exchange_builder.py +++ b/octobot_trading/exchanges/exchange_builder.py @@ -319,6 +319,10 @@ def set_auto_start_trading_modes(self, auto_start_trading_modes): self.auto_start_trading_modes = auto_start_trading_modes return self + def enable_realtime_data_fetching(self, enabled: bool = True): + self.exchange_manager.exchange_config.realtime_data_fetching = enabled + return self + def create_exchange_builder_instance(config, exchange_name): return ExchangeBuilder(config, exchange_name) diff --git a/octobot_trading/octobot_channel_consumer.py b/octobot_trading/octobot_channel_consumer.py index b91992c5e..61deb7b92 100644 --- a/octobot_trading/octobot_channel_consumer.py +++ b/octobot_trading/octobot_channel_consumer.py @@ -49,6 +49,7 @@ class OctoBotChannelTradingDataKeys(enum.Enum): BACKTESTING = "backtesting" MATRIX_ID = "matrix_id" TENTACLES_SETUP_CONFIG = "tentacles_setup_config" + ENABLE_REALTIME_DATA_FETCHING = "enable_realtime_data_fetching" async def octobot_channel_callback(bot_id, subject, action, data) -> None: @@ -70,6 +71,7 @@ async def _handle_creation(bot_id, action, data): config = data[OctoBotChannelTradingDataKeys.EXCHANGE_CONFIG.value] exchange_builder = exchanges.create_exchange_builder_instance(config, exchange_name) \ .has_matrix(data[OctoBotChannelTradingDataKeys.MATRIX_ID.value]) \ + .enable_realtime_data_fetching(data.get(OctoBotChannelTradingDataKeys.ENABLE_REALTIME_DATA_FETCHING.value, False)) \ .use_tentacles_setup_config(data[OctoBotChannelTradingDataKeys.TENTACLES_SETUP_CONFIG.value]) \ .set_bot_id(bot_id) try: diff --git a/tests/exchanges/test_exchange_config_data.py b/tests/exchanges/test_exchange_config_data.py index 963ba2af7..9de42d4f7 100644 --- a/tests/exchanges/test_exchange_config_data.py +++ b/tests/exchanges/test_exchange_config_data.py @@ -37,7 +37,7 @@ async def init_default(config=None): config = load_test_config() exchange_manager = ExchangeManager(config, TestExchangeConfig.EXCHANGE_NAME) - + exchange_manager.exchange_config.realtime_data_fetching = True await exchange_manager.initialize(exchange_config_by_exchange=None) return config, exchange_manager