Skip to content

Commit

Permalink
Merge pull request #2430 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
Master merge
  • Loading branch information
GuillaumeDSM authored Sep 28, 2023
2 parents fc26f60 + b87a1ba commit 4a7bfe2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ 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)*

## [1.0.1] - 2023-09-28
### Fixed
- [Community] OctoBot account connection timeout error

## [1.0.0] - 2023-09-26
### Updated
- [Community] Migrate to the updated octobot.cloud. Full details on https://blog.octobot.online/introducing-the-new-octobot-cloud
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OctoBot [1.0.0](https://octobot.click/gh-changelog)
# OctoBot [1.0.1](https://octobot.click/gh-changelog)
[![PyPI](https://img.shields.io/pypi/v/OctoBot.svg?logo=pypi)](https://octobot.click/gh-pypi)
[![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://octobot.click/gh-dockerhub)
Expand Down
2 changes: 1 addition & 1 deletion octobot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

PROJECT_NAME = "OctoBot"
AUTHOR = "Drakkar-Software"
VERSION = "1.0.0" # major.minor.revision
VERSION = "1.0.1" # major.minor.revision
LONG_VERSION = f"{VERSION}"
12 changes: 11 additions & 1 deletion octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import octobot_commons.enums as commons_enums
import octobot_commons.authentication as authentication
import octobot_commons.configuration as commons_configuration
import octobot_trading.enums as trading_enums


def _bot_data_update(func):
Expand All @@ -41,6 +42,7 @@ async def wrapper(*args, **kwargs):
self.logger.debug(f"Skipping {func.__name__} update: no user selected bot.")
return
try:
self.logger.debug(f"bot_data_update: {func.__name__} initiated.")
return await func(*args, **kwargs)
except Exception as err:
self.logger.exception(err, True, f"Error when calling {func.__name__} {err}")
Expand All @@ -56,6 +58,7 @@ class CommunityAuthentication(authentication.Authenticator):
ALLOWED_TIME_DELAY = 1 * commons_constants.MINUTE_TO_SECONDS
NEW_ACCOUNT_INITIALIZE_TIMEOUT = 1 * commons_constants.MINUTE_TO_SECONDS
LOGIN_TIMEOUT = 20
MAX_UPLOADED_TRADES_COUNT = 100
BOT_NOT_FOUND_RETRY_DELAY = 1
AUTHORIZATION_HEADER = "authorization"
SESSION_HEADER = "X-Session"
Expand Down Expand Up @@ -489,7 +492,14 @@ async def update_trades(self, trades: list, exchange_name: str, reset: bool):
"""
if reset:
await self.supabase_client.reset_trades(self.user_account.bot_id)
if formatted_trades := formatters.format_trades(trades, exchange_name, self.user_account.bot_id):
trades_to_upload = trades if len(trades) <= self.MAX_UPLOADED_TRADES_COUNT else (
sorted(
trades,
key=lambda x: x[trading_enums.ExchangeConstantsOrderColumns.TIMESTAMP.value],
reverse=True
)[:self.MAX_UPLOADED_TRADES_COUNT]
)
if formatted_trades := formatters.format_trades(trades_to_upload, exchange_name, self.user_account.bot_id):
await self.supabase_client.upsert_trades(formatted_trades)

@_bot_data_update
Expand Down
4 changes: 3 additions & 1 deletion octobot/community/supabase_backend/supabase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU General Public
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
import asyncio
import contextlib
import typing
import storage3
Expand All @@ -22,6 +21,7 @@
import gotrue.errors
import postgrest
import supabase.lib.client_options

import octobot.community.supabase_backend.postgres_functions as postgres_functions
import octobot.community.supabase_backend.supabase_realtime_client as supabase_realtime_client

Expand All @@ -35,6 +35,7 @@ class AuthenticatedAsyncSupabaseClient(supabase.Client):
- realtime client
There should not be OctoBot specific code here
"""
REQUEST_TIMEOUT = 20 # default timeout is 5 which is sometimes not enough
def __init__(
self,
supabase_url: str,
Expand All @@ -43,6 +44,7 @@ def __init__(
loop=None,
):
self.options = options
self.options.postgrest_client_timeout = self.REQUEST_TIMEOUT
self.auth: gotrue.SyncGoTrueClient = None
self.postgrest: postgrest.AsyncPostgrestClient = None
super().__init__(supabase_url, supabase_key, options=options)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Drakkar-Software requirements
OctoBot-Commons==1.9.23
OctoBot-Trading==2.4.29
OctoBot-Trading==2.4.30
OctoBot-Evaluators==1.9.1
OctoBot-Tentacles-Manager==2.9.5
OctoBot-Services==1.6.2
Expand Down

0 comments on commit 4a7bfe2

Please sign in to comment.