From 425290fb2aeb158bfeba47c88db7ba4db2badccd Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Mon, 15 Jul 2024 00:39:25 +0200 Subject: [PATCH 1/6] [OS] add WATCH_RAM env var --- octobot/constants.py | 1 + octobot/octobot.py | 1 + 2 files changed, 2 insertions(+) diff --git a/octobot/constants.py b/octobot/constants.py index afeff1dc3..51d6775c2 100644 --- a/octobot/constants.py +++ b/octobot/constants.py @@ -164,6 +164,7 @@ # system ENABLE_CLOCK_SYNCH = os_util.parse_boolean_environment_var("ENABLE_CLOCK_SYNCH", "True") ENABLE_SYSTEM_WATCHER = os_util.parse_boolean_environment_var("ENABLE_SYSTEM_WATCHER", "True") +WATCH_RAM = os_util.parse_boolean_environment_var("WATCH_RAM", "False") DUMP_USED_RESOURCES = os_util.parse_boolean_environment_var("DUMP_USED_RESOURCES", "False") USED_RESOURCES_OUTPUT = os.getenv("USED_RESOURCES_OUTPUT", "system_resources.csv") diff --git a/octobot/octobot.py b/octobot/octobot.py index 44270f9af..e37dfe46b 100644 --- a/octobot/octobot.py +++ b/octobot/octobot.py @@ -262,6 +262,7 @@ async def _ensure_watchers(self): if constants.ENABLE_SYSTEM_WATCHER: await system_resources_watcher.start_system_resources_watcher( constants.DUMP_USED_RESOURCES, + constants.WATCH_RAM, constants.USED_RESOURCES_OUTPUT ) From e60bab3459f365325f062edb72bf82ed2901b382 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Mon, 15 Jul 2024 00:42:05 +0200 Subject: [PATCH 2/6] [Requirements] bump --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 82d666b4c..a63573f05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Drakkar-Software requirements -OctoBot-Commons==1.9.49 -OctoBot-Trading==2.4.91 +OctoBot-Commons==1.9.50 +OctoBot-Trading==2.4.92 OctoBot-Evaluators==1.9.5 OctoBot-Tentacles-Manager==2.9.15 OctoBot-Services==1.6.15 From 92c03b8f30a7bed90ea775ba7b8da761014b035f Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Mon, 15 Jul 2024 11:06:12 +0200 Subject: [PATCH 3/6] [Tests] fix open orders check test --- .../abstract_authenticated_exchange_tester.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py index 87b73efec..88aa01dc1 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py @@ -1016,7 +1016,9 @@ async def order_in_fetched_orders(self, method, previous_orders, order, symbol=N print(f"=> {self.exchange_manager.exchange_name} {order.order_type} Order found in {len(fetched_orders)} " f"{method.__name__} after after {time.time() - t0} seconds and {iterations} iterations. " f"Order: [{order}].") - assert len(fetched_orders) == len(previous_orders) + 1 + # use in as exchanges can have a max amount of fetched elements + assert len(fetched_orders) in (len(previous_orders), len(previous_orders) + 1), \ + f"{len(fetched_orders)} not in {len(previous_orders), len(previous_orders) + 1}" return True else: # check order not in open orders @@ -1039,7 +1041,7 @@ async def order_in_fetched_orders(self, method, previous_orders, order, symbol=N f" in {len(fetched_orders)} {method.__name__} after after {time.time() - t0} seconds " f"and {iterations} iterations. " f"Order: [{order}].") - assert len(fetched_orders) == max(len(previous_orders) - 1, 0) + assert len(fetched_orders) <= len(previous_orders), f"{len(fetched_orders)} !<= {len(previous_orders)}" # order not found return True await asyncio.sleep(1) From 512fa795fae4a998e51c5f80b127fdf1a8e9ece6 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Tue, 16 Jul 2024 09:56:41 +0200 Subject: [PATCH 4/6] [Tests] add orders precision tests --- .../abstract_authenticated_exchange_tester.py | 18 ++++++++++++++++++ additional_tests/exchanges_tests/test_bingx.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py index 88aa01dc1..440a44c7e 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py @@ -195,6 +195,7 @@ async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlemen size = self.get_order_size( await self.get_portfolio(), price, symbol=symbol, settlement_currency=settlement_currency ) + self.check_order_size_and_price(size, price) # # DEBUG tools, uncomment to create specific orders # symbol = "BTC/USD:BTC" # market_status = self.exchange_manager.exchange.get_market_status(symbol) @@ -832,6 +833,23 @@ def get_order_size(self, portfolio, price, symbol=None, order_size=None, settlem order_quantity ) + def check_order_size_and_price(self, size, price, symbol=None): + market_status = self.exchange_manager.exchange.get_market_status(str(symbol or self.SYMBOL)) + precision_amount = market_status[ + trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION.value + ].get(trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION_AMOUNT.value, 0) + assert 0 <= precision_amount < 10 # is really the number of digits + assert int(precision_amount) == precision_amount # is an int + precision_price = market_status[ + trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION.value + ].get(trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION_PRICE.value, 0) + assert 0 < precision_price < 10 # is really the number of digits + assert int(precision_price) == precision_price # is an int + + assert personal_data_orders.decimal_trunc_with_n_decimal_digits(size, precision_amount) == size + assert personal_data_orders.decimal_trunc_with_n_decimal_digits(price, precision_price) == price + + def get_sell_size_from_buy_order(self, buy_order): sell_size = buy_order.origin_quantity if buy_order.fee and buy_order.fee[trading_enums.FeePropertyColumns.CURRENCY.value] == self.ORDER_CURRENCY: diff --git a/additional_tests/exchanges_tests/test_bingx.py b/additional_tests/exchanges_tests/test_bingx.py index 52b23eab6..6d87a2054 100644 --- a/additional_tests/exchanges_tests/test_bingx.py +++ b/additional_tests/exchanges_tests/test_bingx.py @@ -35,7 +35,7 @@ class TestBingxAuthenticatedExchange( USE_ORDER_OPERATION_TO_CHECK_API_KEY_RIGHTS = True EXPECT_MISSING_FEE_IN_CANCELLED_ORDERS = False - VALID_ORDER_ID = "1777764898965454838" + VALID_ORDER_ID = "1812980957928929280" async def test_get_portfolio(self): await super().test_get_portfolio() From 1f9ebf2c8dac2f2af8a88476b936cc9c049047b5 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Tue, 16 Jul 2024 11:42:14 +0200 Subject: [PATCH 5/6] [Community] add bot update logs --- octobot/community/authentication.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/octobot/community/authentication.py b/octobot/community/authentication.py index a977b3fa9..d75e657be 100644 --- a/octobot/community/authentication.py +++ b/octobot/community/authentication.py @@ -716,6 +716,7 @@ async def update_orders(self, orders: list, exchange_name: str): """ formatted_orders = formatters.format_orders(orders, exchange_name) await self.supabase_client.update_bot_orders(self.user_account.bot_id, formatted_orders) + self.logger.info(f"Bot orders updated: using {len(orders)} orders") @_bot_data_update async def update_portfolio(self, current_value: dict, initial_value: dict, profitability: float, @@ -729,16 +730,24 @@ async def update_portfolio(self, current_value: dict, initial_value: dict, profi current_value, initial_value, profitability, unit, content, price_by_asset, self.user_account.bot_id ) if reset or self.user_account.get_selected_bot_current_portfolio_id() is None: + self.logger.info(f"Switching bot portfolio") await self.supabase_client.switch_portfolio(formatted_portfolio) await self.refresh_selected_bot() formatted_portfolio[backend_enums.PortfolioKeys.ID.value] = \ self.user_account.get_selected_bot_current_portfolio_id() await self.supabase_client.update_portfolio(formatted_portfolio) + self.logger.info( + f"Bot portfolio [{formatted_portfolio[backend_enums.PortfolioKeys.ID.value]}] " + f"updated with content: {formatted_portfolio[backend_enums.PortfolioKeys.CONTENT.value]}" + ) if formatted_histories := formatters.format_portfolio_history( history, unit, self.user_account.get_selected_bot_current_portfolio_id() ): await self.supabase_client.upsert_portfolio_history(formatted_histories) + self.logger.info( + f"Bot portfolio [{formatted_portfolio[backend_enums.PortfolioKeys.ID.value]}] history updated" + ) except KeyError as err: self.logger.debug(f"Error when updating community portfolio {err} (missing reference market value)") From e01e05cb10b9984ddd69f8610eeaffd3f872275d Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Wed, 17 Jul 2024 09:27:59 +0200 Subject: [PATCH 6/6] [Version] v2.0.2 --- CHANGELOG.md | 8 ++++++++ README.md | 2 +- octobot/__init__.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1363360b..61ea1f44d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *It is strongly advised to perform an update of your tentacles after updating OctoBot. (start.py tentacles --install --all)* +## [2.0.2] - 2024-07-17 +### Updated +- [WebInterface] Improve light & dark themes display +### Fixed +- [WebInterface] Fix extension checkout +- [RAM] Reduce required RAM when loading a large amount of trades +- [BingX] Fix order sizing issues + ## [2.0.1] - 2024-07-09 ### Updated - [WebInterface] Add contact on extension page diff --git a/README.md b/README.md index d3d251a8d..05e6b3678 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OctoBot [2.0.1](https://github.com/Drakkar-Software/OctoBot/blob/master/CHANGELOG.md) +# OctoBot [2.0.2](https://github.com/Drakkar-Software/OctoBot/blob/master/CHANGELOG.md) [![PyPI](https://img.shields.io/pypi/v/OctoBot.svg?logo=pypi)](https://pypi.org/project/OctoBot) [![Downloads](https://pepy.tech/badge/octobot/month)](https://pepy.tech/project/octobot) [![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot.svg?logo=docker)](https://hub.docker.com/r/drakkarsoftware/octobot) diff --git a/octobot/__init__.py b/octobot/__init__.py index 031c5ba5c..0f329eb14 100644 --- a/octobot/__init__.py +++ b/octobot/__init__.py @@ -16,5 +16,5 @@ PROJECT_NAME = "OctoBot" AUTHOR = "Drakkar-Software" -VERSION = "2.0.1" # major.minor.revision +VERSION = "2.0.2" # major.minor.revision LONG_VERSION = f"{VERSION}"