question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetchBalance from Kucoin for sub-account returns nothing

See original GitHub issue
  • OS: Ubuntu
  • Programming Language version: nodejs
  • CCXT version: 1.73.49
  async getBalance(id: ObjectID): Promise<any> {
    const bot = await this.findOne(id);
    const criteria: any = {
      apiKey: bot.apiKey,
      secret: bot.secret,
    };
    if (_.keys(bot.headers).length > 0) {
      criteria.headers = bot.headers;
    }
    if (bot.password) {
      criteria.password = bot.password;
    }

    // console.log(criteria);
    const balance = await this.exchangesService.getBalance(
      bot.exchangeClassName.toLowerCase() as ExchangeId,
      criteria,
    );
    console.log(balance);
    return balance;
  }
  
 // ExchangeService
 
  async getBalance(exchangeId: ExchangeId, criteria: any) {

    const ex = this.instantiateExchange(exchangeId, criteria)

    const balance = await ex.fetchBalance();

    return balance
  }
  
  private instantiateExchange(id: ExchangeId, criteria?: any) {

    return new ccxt[id]({
      timeout: 30000,
      enableRateLimit: true,
      ...(criteria || {})
    });
  }
// Sub-account
{
  info: { code: '200000', data: [] },
  timestamp: undefined,
  datetime: undefined,
  free: {},
  used: {},
  total: {}
}
// Main-account
{
  info: {
    code: '200000',
    data: [
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object]
    ]
  },
  timestamp: undefined,
  datetime: undefined,
  // .....

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Feb 21, 2022

@mak1986 thx for reporting back, i’m sure it will help other users.

1reaction
mak1986commented, Feb 21, 2022

I’m sorry I wasted your time. I just needed to transfer the funds to the trading account.

Read more comments on GitHub >

github_iconTop Results From Across the Web

kukoin not fetching amount for all accounts · Issue #5849 · ccxt ...
OS: React native Programming Language version: js CCXT version: 1.18.1176 Exchange: kukoin Method:fetchBalance I got a few users asking why ...
Read more >
Sub-Accounts - KuCoin
KuCoin allows you to create up to 100 Sub-Accounts under one Master Account to improve the efficiency of account management.
Read more >
Announcement on the Adjustment of Sub-account Functions
Dear Users: We have recently upgraded our sub-accounts system. Updates to our sub-account related features are described below: 1.
Read more >
KuCoin Has Upgraded the Sub-Account Function
Dear KuCoin Users,In order to provide users with a feature-rich trading environment, KuCoin has now upgraded the sub-account function.
Read more >
KuCoin API Documentation: General
Unless otherwise specified, all timestamps from API are returned in ... //Available assets of a currency "holds": "0" //Hold assets of a currency...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found