diff --git a/octobot/community/authentication.py b/octobot/community/authentication.py index 26be90680..41904e0df 100644 --- a/octobot/community/authentication.py +++ b/octobot/community/authentication.py @@ -16,6 +16,7 @@ import asyncio import contextlib import json +import typing import octobot.constants as constants import octobot.community.errors as errors @@ -156,7 +157,7 @@ async def get_gpt_signal( return await self.supabase_client.fetch_gpt_signal(exchange, symbol, time_frame, candle_open_time, version) async def get_gpt_signals_history( - self, exchange: str, symbol: str, time_frame: commons_enums.TimeFrames, + self, exchange: typing.Union[str, None], symbol: str, time_frame: commons_enums.TimeFrames, first_open_time: float, last_open_time: float, version: str ) -> dict: return await self.supabase_client.fetch_gpt_signals_history( diff --git a/octobot/community/supabase_backend/community_supabase_client.py b/octobot/community/supabase_backend/community_supabase_client.py index e04d18a2d..bedcdba23 100644 --- a/octobot/community/supabase_backend/community_supabase_client.py +++ b/octobot/community/supabase_backend/community_supabase_client.py @@ -420,19 +420,21 @@ async def fetch_gpt_signal( return "" async def fetch_gpt_signals_history( - self, exchange: str, symbol: str, time_frame: commons_enums.TimeFrames, + self, exchange: typing.Union[str, None], symbol: str, time_frame: commons_enums.TimeFrames, first_open_time: float, last_open_time: float, version: str ) -> dict: + matcher = { + "symbol": symbol, + "time_frame": time_frame.value, + "metadata->>version": version, + } + if exchange: + matcher["exchange_internal_name"] = exchange historical_signals = await self._fetch_paginated_history( await self.get_production_anon_client(), "temp_chatgpt_signals", "timestamp, signal", - { - "exchange_internal_name": exchange, - "symbol": symbol, - "time_frame": time_frame.value, - "metadata->>version": version, - }, + matcher, commons_enums.TimeFramesMinutes[time_frame] * commons_constants.MINUTE_TO_SECONDS, first_open_time, last_open_time