From db36a9c932025a29aa5acbf76a8717d263fc9467 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sat, 12 Oct 2024 19:35:01 +0200 Subject: [PATCH 1/6] [Community] add exchange_id --- .../supabase_backend/community_supabase_client.py | 9 ++++++--- octobot/community/supabase_backend/enums.py | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/octobot/community/supabase_backend/community_supabase_client.py b/octobot/community/supabase_backend/community_supabase_client.py index 53b53081f..636980a99 100644 --- a/octobot/community/supabase_backend/community_supabase_client.py +++ b/octobot/community/supabase_backend/community_supabase_client.py @@ -449,14 +449,17 @@ async def fetch_bot_profile_data(self, bot_config_id: str) -> commons_profiles.P if profile_data.trader_simulator.enabled: # attempt 1: set exchange using exchange_id when set in bot_config exchange_ids = [ - config["exchange_id"] + config[enums.ExchangeKeys.EXCHANGE_ID.value] for config in bot_config["exchanges"] - if config.get("exchange_id", None) + if config.get(enums.ExchangeKeys.EXCHANGE_ID.value, None) ] if exchange_ids: exchanges = await self.fetch_exchanges(exchange_ids) exchanges_config = [ - {enums.ExchangeKeys.INTERNAL_NAME.value: exchange[enums.ExchangeKeys.INTERNAL_NAME.value]} + { + enums.ExchangeKeys.INTERNAL_NAME.value: exchange[enums.ExchangeKeys.INTERNAL_NAME.value], + enums.ExchangeKeys.EXCHANGE_ID.value: exchange[enums.ExchangeKeys.ID.value], + } for exchange in exchanges ] else: diff --git a/octobot/community/supabase_backend/enums.py b/octobot/community/supabase_backend/enums.py index 6b49cbdc0..5770f5bac 100644 --- a/octobot/community/supabase_backend/enums.py +++ b/octobot/community/supabase_backend/enums.py @@ -109,6 +109,8 @@ class ExchangeAccountStatuses(enum.Enum): class ExchangeKeys(enum.Enum): ID = "id" INTERNAL_NAME = "internal_name" + EXCHANGE_CREDENTIAL_ID = "exchange_credential_id" + EXCHANGE_ID = "exchange_id" class SignalKeys(enum.Enum): From 0762a861b0bd3f720b3cc48afbfb7bec262a203c Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sat, 12 Oct 2024 19:37:37 +0200 Subject: [PATCH 2/6] [Requirements] bump --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4e9af4e32..ea079a3dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Drakkar-Software requirements -OctoBot-Commons==1.9.59 +OctoBot-Commons==1.9.60 OctoBot-Trading==2.4.114 OctoBot-Evaluators==1.9.7 OctoBot-Tentacles-Manager==2.9.16 From 7c398797a9133d918c9461c6170c571c99a4767d Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Mon, 21 Oct 2024 20:21:29 +0200 Subject: [PATCH 3/6] [Requirements] bump --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index ea079a3dc..74f906adf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ # Drakkar-Software requirements OctoBot-Commons==1.9.60 -OctoBot-Trading==2.4.114 +OctoBot-Trading==2.4.115 OctoBot-Evaluators==1.9.7 OctoBot-Tentacles-Manager==2.9.16 -OctoBot-Services==1.6.20 +OctoBot-Services==1.6.21 OctoBot-Backtesting==1.9.7 Async-Channel==2.2.1 trading-backend==1.2.29 From ece391bae8b3d48974a3c5b3ed6b84fbcf5a9c90 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Wed, 23 Oct 2024 15:30:07 +0200 Subject: [PATCH 4/6] [Requirements] bump --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 74f906adf..75457b17f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Drakkar-Software requirements -OctoBot-Commons==1.9.60 -OctoBot-Trading==2.4.115 +OctoBot-Commons==1.9.61 +OctoBot-Trading==2.4.116 OctoBot-Evaluators==1.9.7 OctoBot-Tentacles-Manager==2.9.16 OctoBot-Services==1.6.21 From 86a34c3e1fb5f49111e696ae8f075d6d7cd330be Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Fri, 25 Oct 2024 10:57:34 +0200 Subject: [PATCH 5/6] [Requirements] bump --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 75457b17f..252b56a4f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Drakkar-Software requirements OctoBot-Commons==1.9.61 -OctoBot-Trading==2.4.116 +OctoBot-Trading==2.4.117 OctoBot-Evaluators==1.9.7 OctoBot-Tentacles-Manager==2.9.16 OctoBot-Services==1.6.21 From ffb69f7273b023757d1ea1573d22c8f3c0011e0b Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sat, 26 Oct 2024 10:37:44 +0200 Subject: [PATCH 6/6] [Community] make community auth error clearer --- .../supabase_backend/community_supabase_client.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/octobot/community/supabase_backend/community_supabase_client.py b/octobot/community/supabase_backend/community_supabase_client.py index 636980a99..370d7ca02 100644 --- a/octobot/community/supabase_backend/community_supabase_client.py +++ b/octobot/community/supabase_backend/community_supabase_client.py @@ -99,7 +99,7 @@ async def sign_in(self, email: str, password: str) -> None: if "email" in str(err).lower(): # AuthApiError('Email not confirmed') raise errors.EmailValidationRequiredError(err) from err - raise authentication.FailedAuthentication(err) from err + raise authentication.FailedAuthentication(f"Community auth error: {err}") from err async def sign_up(self, email: str, password: str) -> None: try: @@ -117,7 +117,7 @@ async def sign_up(self, email: str, password: str) -> None: if self._requires_email_validation(resp.user): raise errors.EmailValidationRequiredError() except gotrue.errors.AuthError as err: - raise authentication.AuthenticationError(err) from err + raise authentication.AuthenticationError(f"Community auth error: {err}") from err async def sign_out(self, options: gotrue.types.SignOutOptions) -> None: try: @@ -132,13 +132,13 @@ async def restore_session(self): self.event_loop = asyncio.get_event_loop() await self.auth.initialize_from_storage() if not self.is_signed_in(): - raise authentication.FailedAuthentication() + raise authentication.FailedAuthentication(f"Community auth error: restoring session failed") async def refresh_session(self, refresh_token: typing.Union[str, None] = None): try: await self.auth.refresh_session(refresh_token=refresh_token) except gotrue.errors.AuthError as err: - raise authentication.AuthenticationError(err) from err + raise authentication.AuthenticationError(f"Community auth error: {err}") from err async def sign_in_with_otp_token(self, token): self.event_loop = asyncio.get_event_loop() @@ -156,7 +156,7 @@ async def sign_in_with_otp_token(self, token): except gotrue.errors.AuthImplicitGrantRedirectError as err: if saved_session: await self.auth._storage.set_item(self.auth._storage_key, saved_session) - raise authentication.AuthenticationError(err) from err + raise authentication.AuthenticationError(f"Community auth error: {err}") from err def is_signed_in(self) -> bool: # is signed in when a user auth key is set @@ -201,7 +201,7 @@ async def get_otp_with_auth_key(self, user_email: str, auth_key: str) -> str: ) return json.loads(resp)["token"] except Exception: - raise authentication.AuthenticationError(f"Invalid auth key authentication details") + raise authentication.AuthenticationError(f"Community auth error: invalid auth key authentication details") async def fetch_extensions(self, mqtt_uuid: typing.Optional[str]) -> dict: resp = await self.functions.invoke(