Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Community] add get_exchange_type_from_internal_name #2837

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions octobot/community/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
StrategyData,
get_exchange_type_from_availability,
to_bot_exchange_internal_name,
get_exchange_type_from_internal_name,
to_community_exchange_internal_name,
)
from octobot.community.supabase_backend import (
Expand Down Expand Up @@ -110,6 +111,7 @@
"StrategyData",
"get_exchange_type_from_availability",
"to_bot_exchange_internal_name",
"get_exchange_type_from_internal_name",
"to_community_exchange_internal_name",
"SyncConfigurationStorage",
"ASyncConfigurationStorage",
Expand Down
2 changes: 2 additions & 0 deletions octobot/community/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
format_portfolio_with_profitability,
get_exchange_type_from_availability,
to_bot_exchange_internal_name,
get_exchange_type_from_internal_name,
to_community_exchange_internal_name,
)
from octobot.community.models.community_public_data import (
Expand All @@ -71,6 +72,7 @@
"format_portfolio_with_profitability",
"get_exchange_type_from_availability",
"to_bot_exchange_internal_name",
"get_exchange_type_from_internal_name",
"to_community_exchange_internal_name",
"CommunityPublicData",
"StrategyData",
Expand Down
6 changes: 6 additions & 0 deletions octobot/community/models/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def to_bot_exchange_internal_name(community_exchange_internal_name: str) -> str:
return community_exchange_internal_name


def get_exchange_type_from_internal_name(community_exchange_internal_name: str) -> str:
if community_exchange_internal_name.endswith(FUTURES_INTERNAL_NAME_SUFFIX):
return commons_constants.CONFIG_EXCHANGE_FUTURE
return commons_constants.CONFIG_EXCHANGE_SPOT


def get_exchange_type_from_availability(exchange_availability: dict) -> str:
if not exchange_availability:
# use spot by default
Expand Down
Loading