Skip to content

Commit

Permalink
[Community] allow any exchange gpt history
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Dec 11, 2023
1 parent 6b3abb8 commit 1fd5142
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import asyncio
import contextlib
import json
import typing

import octobot.constants as constants
import octobot.community.errors as errors
Expand Down Expand Up @@ -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(
Expand Down
16 changes: 9 additions & 7 deletions octobot/community/supabase_backend/community_supabase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fd5142

Please sign in to comment.