Skip to content

Commit

Permalink
Merge pull request #2444 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
Development merge
  • Loading branch information
GuillaumeDSM authored Oct 14, 2023
2 parents b8d3ce7 + e892335 commit 937a9f3
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:

- name: Publish package
run: |
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/*
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing dist/*
notify:
if: ${{ failure() }}
Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Contribute to OctoBot

Feel like our bot is missing a feature? We welcome your pull requests! Few pointers for contributions:
Feel like OctoBot is missing a feature? We welcome your pull requests!

Create your PR against the develop branch, not master.
New features need to contain unit tests and must be PEP8 conformant (max-line-length = 100).
Few pointers for contributions:

- Create your PR against the dev branch, not master.
- New features need to contain unit tests and must be PEP8 compliant (max-line-length = 100).

# OctoBot additional coding style

Expand Down
15 changes: 14 additions & 1 deletion octobot/community/supabase_backend/community_supabase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,24 @@ async def fetch_bot_profile_data(self, bot_config_id: str) -> commons_profiles.P
if not bot_config_id:
raise errors.MissingBotConfigError(f"bot_config_id is '{bot_config_id}'")
bot_config = (await self.table("bot_configs").select(
"bot_id, options, exchanges, product_config:product_configs(config, version)"
"bot_id, "
"options, "
"exchanges, "
"product_config:product_configs("
" config, "
" version, "
" product:products!product_id(attributes)"
")"
).eq(enums.BotConfigKeys.ID.value, bot_config_id).execute()).data[0]
profile_data = commons_profiles.ProfileData.from_dict(
bot_config["product_config"][enums.ProfileConfigKeys.CONFIG.value]
)
profile_data.trading.minimal_funds = [
commons_profiles.MinimalFund.from_dict(minimal_fund)
for minimal_fund in bot_config["product_config"]["product"][
enums.ProductKeys.ATTRIBUTES.value
].get("minimal_funds", [])
] if bot_config[enums.BotConfigKeys.EXCHANGES.value] else []
profile_data.profile_details.version = bot_config["product_config"][enums.ProfileConfigKeys.VERSION.value]
profile_data.exchanges = [
commons_profiles.ExchangeData.from_dict(exchange_data)
Expand Down
23 changes: 18 additions & 5 deletions octobot/community/supabase_backend/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class BotDeploymentKeys(enum.Enum):
TYPE = "type"
METADATA = "metadata"
ERROR_STATUS = "error_status"
ACTIVITIES = "activities"


class BotDeploymentActivitiesKeys(enum.Enum):
LAST_ACTIVITY = "last_activity"
NEXT_ACTIVITY = "next_activity"


class BotDeploymentURLKeys(enum.Enum):
Expand Down Expand Up @@ -83,9 +89,16 @@ class BotDeploymentErrorsStatuses(enum.Enum):
INVALID_CONFIG = "invalid_config"
INVALID_EXCHANGE_CREDENTIALS = "invalid_exchange_credentials"
ALREADY_USED_EXCHANGE_ACCOUNT = "already_used_exchange_account"
MISSING_MINIMAL_FUNDS = "missing_minimal_funds"
MISSING_CONFIG = "missing_config"


class ExchangeAccountStatuses(enum.Enum):
NO_STATUS = None
PENDING_PORTFOLIO_REFRESH = "pending_portfolio_refresh"
NO_PENDING_ACTION = "no_pending_action"


class SignalKeys(enum.Enum):
ID = "id"
TIME = "time"
Expand All @@ -104,12 +117,12 @@ class ProductKeys(enum.Enum):
AUTHOR_ID = "author_id"
LOGO_URL = "logo_url"
DOWNLOAD_URL = "download_url"
CATEGORY_ID= "category_id"
ATTRIBUTES= "attributes"
CATEGORY_ID = "category_id"
ATTRIBUTES = "attributes"
METADATA = "metadata"
PARENT_ID="parent_id"
VISIBILITY="visibility"
CURRENT_RESULT_ID="current_result_id"
PARENT_ID = "parent_id"
VISIBILITY = "visibility"
CURRENT_RESULT_ID = "current_result_id"


class TradeKeys(enum.Enum):
Expand Down
10 changes: 10 additions & 0 deletions octobot/strategy_optimizer/strategy_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import octobot_commons.tentacles_management as tentacles_management
import octobot_commons.logging as common_logging
import octobot_commons.constants as commons_constants
import octobot_commons.errors as commons_errors

import octobot.constants as constants
import octobot.strategy_optimizer as strategy_optimizer
Expand Down Expand Up @@ -53,6 +54,10 @@ def __init__(self, config, tentacles_setup_config, strategy_name):
self.config = config
self.tentacles_setup_config = copy.deepcopy(tentacles_setup_config)
self.trading_mode = trading_modes.get_activated_trading_mode(tentacles_setup_config)
if self.trading_mode.get_name() not in self._get_compatible_trading_modes():
raise commons_errors.ConfigTradingError(
f"{self.trading_mode.get_name()} is not supported trading mode for the {self.get_name()}"
)
self.strategy_class = tentacles_management.get_class_from_string(
strategy_name, evaluators.StrategyEvaluator,
tentacles_Evaluator.Strategies, tentacles_management.evaluator_parent_inspection)
Expand Down Expand Up @@ -334,3 +339,8 @@ def _get_all_TA(self):
in tentacles_manager_api.get_tentacles_activation(self.tentacles_setup_config)[
tentacles_manager_constants.TENTACLES_EVALUATOR_PATH].items()
if activated and StrategyOptimizer._is_relevant_evaluation_config(evaluator)]

def _get_compatible_trading_modes(self):
# Lazy import of tentacles to let tentacles manager handle imports
import tentacles.Trading.Mode as modes
return [modes.DailyTradingMode.get_name()]
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.23
OctoBot-Trading==2.4.30
OctoBot-Commons==1.9.28
OctoBot-Trading==2.4.33
OctoBot-Evaluators==1.9.1
OctoBot-Tentacles-Manager==2.9.5
OctoBot-Services==1.6.3
OctoBot-Services==1.6.4
OctoBot-Backtesting==1.9.2
Async-Channel==2.2.1
trading-backend==1.2.9
Expand Down

0 comments on commit 937a9f3

Please sign in to comment.