Skip to content

Commit

Permalink
[Community] add get_exchange_type_from_internal_name
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Dec 27, 2024
1 parent 8443936 commit 8090ed1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
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

0 comments on commit 8090ed1

Please sign in to comment.