Skip to content

Kucoin - Your strategies specifies a trading account that doesn't exist #786

@sebasira

Description

@sebasira

Release number
Cassandre v5.0.5

Describe the bug
I'm trying to learn how to use this so I started with the Quick Start. First I setup a Binance account with no issue. Then I try with Kucoin (real thing, not the sandbox) and I get:

***************************
APPLICATION FAILED TO START
***************************

Description:

Your strategies specifies a trading account that doesn't exist

Action:

Check your getTradeAccount(Set<AccountDTO> accounts) method as it returns an empty result - Strategies in error : class ar.com.sebasira.anttrader.strategy.MyFirstStrategy

I place a breakpoint inside the method getTradeAccount, this is it's body:

@Override
public Optional<AccountDTO> getTradeAccount(Set<AccountDTO> accounts) {
    // From all the accounts we have on the exchange, we must return the one we use for trading.
    if (accounts.size() == 1) {
        return accounts.stream().findAny();
    } else {
        return accounts.stream()
                .filter(a -> "trade".equals(a.getName()))
                .findFirst();
    }
}

And I can see that the accounts is empty, so that triggers the error. What I do not know is why are they empty. It's a newly created account (Kucoin) I've create just to test it. It has zero balance, but in the kucoin site I can see there are: Main account, Trading Account, and Pool-X Account

To Reproduce
The demo in the QuickStart with Cassanfre v5.0.5 and XChange v5.0.8 or v5.0.9 (for newer version of XChange I get another issue)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions