Skip to content

Commit

Permalink
Merge pull request #2492 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
Dev merge
  • Loading branch information
GuillaumeDSM authored Dec 19, 2023
2 parents f52c426 + 57919df commit b29ff00
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 33 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ 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.5] - 2023-12-19
### Added
- [GPTEvaluator] Settings to limit used tokens and disable re-evaluation
### Updated
- [WebInterface] Improve home display on smaller screens
### Fixed
- [Telegram] Fixed multiple telegram commands issues
- [TradingViewSignalsTradingMode] Fixed buy orders quantity issues
- [WebInterface] Fixed logs issues
- [GoogleTrends] Fixed issues with crypto in multiple words
- [Exchanges] Rare candles fetch error

## [1.0.4] - 2023-12-10
### Added
- [Strategies] OctoBot cloud strategies can now be downloaded and used as regular OctoBot profiles
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.4](https://octobot.click/gh-changelog)
# OctoBot [1.0.5](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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class AbstractAuthenticatedExchangeTester:
# set true when cancelling any bundled order on exchange would automatically cancel the other(s)
CANCEL_DOUBLE_BUNDLED_ORDERS_TOGETHER = True
IGNORE_EXCHANGE_TRADE_ID = False # set True when trade.exchange_trade_id can't be set
MAX_TRADE_USD_VALUE = decimal.Decimal(8000)
MIN_TRADE_USD_VALUE = decimal.Decimal("0.1")

# Implement all "test_[name]" methods, call super() to run the test, pass to ignore it.
# Override the "inner_test_[name]" method to override a test content.
Expand Down Expand Up @@ -524,6 +526,8 @@ def check_parsed_closed_order(
self.check_theoretical_cost(
symbols.parse_symbol(order.symbol), order.origin_quantity, order.origin_price, order.total_cost
)
if "USD" in order.market:
assert self.MIN_TRADE_USD_VALUE < order.total_cost < self.MAX_TRADE_USD_VALUE

def check_raw_trades(self, trades):
self.check_duplicate(trades)
Expand Down Expand Up @@ -553,6 +557,8 @@ def check_parsed_trade(self, trade: personal_data.Trade):
symbols.parse_symbol(trade.symbol), trade.executed_quantity,
trade.executed_price, trade.total_cost
)
if "USD" in trade.market:
assert self.MIN_TRADE_USD_VALUE < trade.total_cost < self.MAX_TRADE_USD_VALUE

def check_theoretical_cost(self, symbol, quantity, price, cost):
theoretical_cost = quantity * price
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.4" # major.minor.revision
VERSION = "1.0.5" # major.minor.revision
LONG_VERSION = f"{VERSION}"
4 changes: 0 additions & 4 deletions octobot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def call_tentacles_manager(command_args):
octobot_logger.init_logger()
tentacles_urls = [
configuration_manager.get_default_tentacles_url(),
# tentacles_manager_api.get_compiled_tentacles_url(
# constants.DEFAULT_COMPILED_TENTACLES_URL,
# constants.TENTACLES_REQUIRED_VERSION
# )
]
sys.exit(tentacles_manager_cli.handle_tentacles_manager_command(command_args,
tentacles_urls=tentacles_urls,
Expand Down
15 changes: 7 additions & 8 deletions octobot/community/community_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
import octobot_commons.logging as logging
import octobot_commons.constants as commons_constants
import octobot.constants as constants
import octobot.community.identifiers_provider as identifiers_provider


async def get_current_octobots_stats():
bot_metrics_url = f"{commons_constants.METRICS_URL}metrics/community/count/"
return await _get_stats({
"daily": f"{bot_metrics_url}0/0/-1",
"monthly": f"{bot_metrics_url}0/-1/0",
"all": f"{bot_metrics_url}0/0/0"
})
bot_metrics_url = f"{identifiers_provider.IdentifiersProvider.COMMUNITY_API_URL}/stats"
return await _get_stats({"total_bots": bot_metrics_url})


async def _ensure_closed_sockets():
Expand All @@ -50,8 +47,8 @@ async def get_stats(url, stats_key):
logger.error(f"Error when getting community status : error code={resp.status}")
else:
json_resp = await resp.json()
if "total" in json_resp:
bots_stats[stats_key] = json_resp["total"]
if any("total" in key for key in json_resp):
bots_stats[stats_key] = json_resp[stats_key]
else:
bots_stats[stats_key] = _format_top_elements(json_resp)
except Exception as e:
Expand All @@ -67,6 +64,8 @@ async def get_stats(url, stats_key):


async def get_community_metrics():
# todo migrate with new metrics
return {}
bot_count_metrics_url = f"{commons_constants.METRICS_URL}metrics/community/count/"
bot_top_metrics_url = f"{commons_constants.METRICS_URL}metrics/community/top/"
one_month_time = int(time.time() - 30 * commons_constants.DAYS_TO_SECONDS)
Expand Down
4 changes: 2 additions & 2 deletions octobot/community/community_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ async def start_community_task(self):
# first ensure this session is not just a configuration test: register after a timer
await asyncio.sleep(common_constants.TIMER_BEFORE_METRICS_REGISTRATION_SECONDS)
self._init_community_config()
await self.register_session()
# await self.register_session() # waiting for metrics migration
await self._update_authenticated_bot()
while self.keep_running:
# send a keepalive at periodic intervals
await asyncio.sleep(common_constants.TIMER_BETWEEN_METRICS_UPTIME_UPDATE)
try:
await self._update_session()
# await self._update_session() # waiting for metrics migration
await self._update_authenticated_bot()
except Exception as e:
self.logger.debug(f"Exception when handling community data : {e}")
Expand Down
3 changes: 3 additions & 0 deletions octobot/community/identifiers_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class IdentifiersProvider:
ENABLED_ENVIRONMENT: str = None
COMMUNITY_LANDING_URL: str = None
COMMUNITY_API_URL: str = None
COMMUNITY_URL: str = None
FRONTEND_PASSWORD_RECOVER_URL: str = None
BACKEND_URL: str = None
Expand All @@ -31,6 +32,7 @@ class IdentifiersProvider:
def use_production():
IdentifiersProvider.COMMUNITY_URL = constants.OCTOBOT_COMMUNITY_URL
IdentifiersProvider.COMMUNITY_LANDING_URL = constants.OCTOBOT_COMMUNITY_LANDING_URL
IdentifiersProvider.COMMUNITY_API_URL = constants.OCTOBOT_COMMUNITY_API_URL
IdentifiersProvider.FRONTEND_PASSWORD_RECOVER_URL = constants.OCTOBOT_COMMUNITY_RECOVER_PASSWORD_URL
IdentifiersProvider.BACKEND_URL = constants.COMMUNITY_BACKEND_URL
IdentifiersProvider.BACKEND_KEY = constants.COMMUNITY_BACKEND_KEY
Expand All @@ -40,6 +42,7 @@ def use_production():
def use_staging():
IdentifiersProvider.COMMUNITY_URL = constants.STAGING_OCTOBOT_COMMUNITY_URL
IdentifiersProvider.COMMUNITY_LANDING_URL = constants.STAGING_OCTOBOT_COMMUNITY_LANDING_URL
IdentifiersProvider.COMMUNITY_API_URL = constants.STAGING_OCTOBOT_COMMUNITY_API_URL
IdentifiersProvider.FRONTEND_PASSWORD_RECOVER_URL = constants.STAGING_COMMUNITY_RECOVER_PASSWORD_URL
IdentifiersProvider.BACKEND_URL = constants.STAGING_COMMUNITY_BACKEND_URL
IdentifiersProvider.BACKEND_KEY = constants.STAGING_COMMUNITY_BACKEND_KEY
Expand Down
15 changes: 2 additions & 13 deletions octobot/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def get_default_tentacles_url(version=None):
if constants.TENTACLES_REQUIRED_VERSION else constants.LONG_VERSION
return os.getenv(
constants.ENV_TENTACLES_URL,
f"{constants.STATIC_OCTOBOT_ONLINE}/"
f"{tentacles_repository}/"
f"https://{tentacles_repository}."
f"{constants.OCTOBOT_ONLINE}/"
f"{os.getenv(constants.ENV_TENTACLES_PACKAGES_SOURCE, constants.OFFICIALS)}/"
f"{os.getenv(constants.ENV_TENTACLES_PACKAGES_TYPE, constants.TENTACLE_PACKAGES)}/"
f"{os.getenv(constants.ENV_TENTACLE_CATEGORY, constants.TENTACLE_CATEGORY)}/"
Expand All @@ -165,17 +165,6 @@ def get_default_tentacles_url(version=None):
)


def get_default_compiled_tentacles_url():
return os.getenv(
constants.ENV_COMPILED_TENTACLES_URL,
f"{constants.STATIC_OCTOBOT_ONLINE}/{constants.TENTACLES_REPOSITORY}/"
f"{os.getenv(constants.ENV_TENTACLES_PACKAGES_SOURCE, constants.OFFICIALS)}/"
f"{os.getenv(constants.ENV_COMPILED_TENTACLES_PACKAGES_TYPE, constants.TENTACLE_PACKAGES)}/"
f"{os.getenv(constants.ENV_COMPILED_TENTACLES_CATEGORY, constants.COMPILED_TENTACLE_CATEGORY)}/"
f"{os.getenv(constants.ENV_COMPILED_TENTACLES_SUBCATEGORY, '')}"
)


def get_user_local_config_file():
try:
import octobot_commons.constants as commons_constants
Expand Down
4 changes: 3 additions & 1 deletion octobot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
OCTOBOT_DOCS_URL = os.getenv("DOCS_OCTOBOT_ONLINE_URL", "https://www.octobot.cloud/guides")
EXCHANGES_DOCS_URL = os.getenv("DOCS_OCTOBOT_ONLINE_URL", "https://www.octobot.cloud/guides/exchanges/")
DEVELOPER_DOCS_URL = os.getenv("DOCS_OCTOBOT_ONLINE_URL", "https://www.octobot.cloud/guides/developers/")
STATIC_OCTOBOT_ONLINE = os.getenv("TENTACLES_OCTOBOT_ONLINE_URL", "https://static.octobot.online")
OCTOBOT_ONLINE = os.getenv("TENTACLES_OCTOBOT_ONLINE_URL", "octobot.online")
OCTOBOT_FEEDBACK = os.getenv("FEEDBACK_OCTOBOT_ONLINE_URL", "https://feedback.octobot.cloud/")
TENTACLES_REPOSITORY = "tentacles"
BETA_TENTACLES_REPOSITORY = "dev-tentacles"
Expand All @@ -62,6 +62,7 @@

# production env SHOULD ONLY BE USED THROUGH CommunityIdentifiersProvider
OCTOBOT_COMMUNITY_LANDING_URL = os.getenv("COMMUNITY_SERVER_URL", "https://octobot.cloud")
OCTOBOT_COMMUNITY_API_URL = os.getenv("COMMUNITY_SERVER_URL", f"{OCTOBOT_COMMUNITY_LANDING_URL}/api/community")
OCTOBOT_COMMUNITY_URL = os.getenv("COMMUNITY_SERVER_URL", "https://app.octobot.cloud")
OCTOBOT_COMMUNITY_RECOVER_PASSWORD_URL = OCTOBOT_COMMUNITY_URL
# default env
Expand All @@ -70,6 +71,7 @@

# staging env SHOULD ONLY BE USED THROUGH CommunityIdentifiersProvider
STAGING_OCTOBOT_COMMUNITY_LANDING_URL = os.getenv("COMMUNITY_SERVER_URL", "https://beta.octobot.cloud")
STAGING_OCTOBOT_COMMUNITY_API_URL = os.getenv("COMMUNITY_SERVER_URL", f"{STAGING_OCTOBOT_COMMUNITY_LANDING_URL}/api/community")
STAGING_OCTOBOT_COMMUNITY_URL = os.getenv("COMMUNITY_SERVER_URL", "https://app-beta.octobot.cloud/")
STAGING_COMMUNITY_RECOVER_PASSWORD_URL = STAGING_OCTOBOT_COMMUNITY_URL
STAGING_COMMUNITY_BACKEND_URL = os.getenv("COMMUNITY_BACKEND_URL", "https://wmfkgvgzokyzhvxowbyg.supabase.co")
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Drakkar-Software requirements
OctoBot-Commons==1.9.34
OctoBot-Trading==2.4.46
OctoBot-Commons==1.9.35
OctoBot-Trading==2.4.48
OctoBot-Evaluators==1.9.3
OctoBot-Tentacles-Manager==2.9.6
OctoBot-Services==1.6.5
OctoBot-Services==1.6.6
OctoBot-Backtesting==1.9.7
Async-Channel==2.2.1
trading-backend==1.2.11
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/community/test_community_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
@pytest.mark.asyncio
async def test_get_community_metrics():
metrics = await community_analysis.get_community_metrics()
assert metrics == {}
return # todo migrate with new metrics
assert len(metrics) == 9
# ensure metrics are not empty
assert all(content for content in metrics.values())

0 comments on commit b29ff00

Please sign in to comment.