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

[Kucoin] differentiate spot and futures account ids #1401

Merged
merged 1 commit into from
Dec 29, 2024
Merged
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
5 changes: 5 additions & 0 deletions Trading/Exchange/kucoin/kucoin_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import octobot_commons.constants as commons_constants
import octobot_trading.constants as constants
import octobot_trading.enums as trading_enums
import octobot.community


def _kucoin_retrier(f):
Expand Down Expand Up @@ -176,6 +177,10 @@ async def get_account_id(self, **kwargs: dict) -> str:
else:
# only subaccounts have a subUserId: if this condition is True, we are on the main account
account_id = account["subName"]
if account_id and self.exchange_manager.is_future:
account_id = octobot.community.to_community_exchange_internal_name(
account_id, commons_constants.CONFIG_EXCHANGE_FUTURE
)
if subaccount_id:
# there is at least a subaccount: ensure the current account is the main account as there is no way
# to know the id of the current account (only a list of existing accounts)
Expand Down
Loading