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

Huobi PRO empty fetchBalance return #328

Closed
gavin369 opened this issue Oct 17, 2017 · 11 comments
Closed

Huobi PRO empty fetchBalance return #328

gavin369 opened this issue Oct 17, 2017 · 11 comments
Assignees

Comments

@gavin369
Copy link

gavin369 commented Oct 17, 2017

I'm a beginner. I want to be a bot. I want to ask you something! I don't show my account balance with console.log (await huobipro.fetchBalance ()),
image

image

but actually there is a balance,

image

excuse me, what did I make wrong? Thank you

@kroitor kroitor self-assigned this Oct 17, 2017
@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

Hi, @gavin369 ! Can you add the following line please to see what huobi actually returned to ccxt?

let huobipro = new ccxt.huobipro ({
    apiKey: 'YOUR_KEY',
    secret: 'YOUR_SECRET',
    verbose: true, // ←---------------------- this line added to see more verbose info
})

// ... then call the balance like you did in your code and check the onscreen output

Paste the output here, please. Use triple backticks + JavaScript keyword in the beginning when pasting code for more readability, like below:

```JavaScript
code
```

@gavin369
Copy link
Author

gavin369 commented Oct 17, 2017

'use strict';
var ccxt = require ('ccxt');
var async = require('async');
console.log ('添加交易所名称',ccxt.exchanges[56] )
console.log ('添加交易所个数',ccxt.exchanges.length)
var start = async function () {
    // 在这里使用起来就像同步代码那样直观
    let huobipro = new ccxt.huobipro ({
        apiKey: 'key',
        secret: 'secret',
    })
    while (true){
        ticker = (await huobipro.fetchTicker('LTC/BTC')).info;
        Balance = await huobipro.fetchBalance ();
        console.log (Balance)
        //console.log ('买1价',ticker.ask[0],'卖1价',ticker.bid[0],'买1深度',ticker.ask[1],'卖1深度',ticker.bid[1]);
        //console.log (Balance)
        await sleep(3000);
    }
};
start();

@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

The code is ok, but please paste the verbose output as in my previous post. We need you to add that verbose: true line and run your code again, then paste the output here.

'use strict';
var ccxt = require ('ccxt');
var async = require('async');
console.log ('添加交易所名称',ccxt.exchanges[56] )
console.log ('添加交易所个数',ccxt.exchanges.length)
var start = async function () {
    // 在这里使用起来就像同步代码那样直观
    let huobipro = new ccxt.huobipro ({
        apiKey: 'key',
        secret: 'secret',
        verbose: true, // ←-------------------------- add this and copy results here
    })
    while (true){
        ticker = (await huobipro.fetchTicker('LTC/BTC')).info;
        Balance = await huobipro.fetchBalance ();
        console.log (Balance)
        //console.log ('买1价',ticker.ask[0],'卖1价',ticker.bid[0],'买1深度',ticker.ask[1],'卖1深度',ticker.bid[1]);
        //console.log (Balance)
        await sleep(3000);
    }
};
start();

@gavin369
Copy link
Author

Okay, I got it. First contact with GitHub. sorry!

@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

@gavin369 no problem at all ) Welcome ) We will stand by to see your verbose output (add verbose: true above and run again).

@kroitor kroitor changed the title Ask for advice Huobi PRO empty fetchBalance return Oct 17, 2017
@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

@gavin369 did you manage to get verbose output? We will be waiting to see your output in verbose mode, like written above.

@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

@gavin369 alternatively, after you fetch the balance you can simply do:

console.log (Balance['info']); 

... and paste the output here.

@gavin369
Copy link
Author

Now I'm not using console.log, but it's also printing information!

'use strict';
var ccxt = require ('ccxt');
var async = require('async');
verbose: true
console.log ('添加交易所名称',ccxt.exchanges[56] )
console.log ('添加交易所个数',ccxt.exchanges.length)
var start = async function () {
    // 在这里使用起来就像同步代码那样直观
    let huobipro = new ccxt.huobipro ({
        apiKey: 'apiKey',
        secret: 'secret',
        verbose : true,
    })

    while (true){
        //ticker = (await huobipro.fetchTicker('LTC/BTC')).info;
        Balance = await huobipro.fetchBalance();
        //console.log (Balance);
        //console.log (Balance)
        //console.log ('买1价',ticker.ask[0],'卖1价',ticker.bid[0],'买1深度',ticker.ask[1],'卖1深度',ticker.bid[1]);
        //console.log (Balance)
        await sleep(3000);
    }

};

image

@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

@gavin369 ok, thank you for the info! I will now debug it a little and will get back to you shortly.

@kroitor
Copy link
Member

kroitor commented Oct 17, 2017

@gavin369 ok, this was a bug in balance parsing for Huobi, but now it's fixed and Huobi should be working normally. Please don't forget to update the ccxt library to version 1.9.163+ (npm update ccxt in your package folder) and retry again. We will be happy if you report whether it works for you or not. Thx again for your participation!

P.S. Next time don't paste text in images and screenshots, paste code and verbose output in text enclosed with 3 backticks (`) for all text information. When we are programming, it is much better and much easier to read, search and edit, if both the code and the output are copied and pasted in text, not as an image. Anyway, thanks for your help! ;) Let us know if you have any other questions or difficulties with it. The library is under heavy development and we really appreciate your feedback! )

@gavin369
Copy link
Author

Okay,i know! Thank you very much.

academe-01 pushed a commit to academe-01/ccxt that referenced this issue Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants