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

Rest v2 wallets available balance is null #321

Closed
askmike opened this issue May 3, 2018 · 2 comments
Closed

Rest v2 wallets available balance is null #321

askmike opened this issue May 3, 2018 · 2 comments

Comments

@askmike
Copy link
Contributor

askmike commented May 3, 2018

Problem:

const bfx = new Bitfinex.RESTv2({apiKey: 'x', apiSecret: 'y', transform: true});
bfx.wallets(console.log);

outputs:

{ err: null,
  data: 
   [ Wallet {
       domain: null,
       _events: {},
       _eventsCount: 0,
       _maxListeners: undefined,
       type: 'funding',
       currency: 'BTC',
       balance: 0.01511371,
       unsettledInterest: 0,
       balanceAvailable: null },
     Wallet {
       domain: null,
       _events: {},
       _eventsCount: 0,
       _maxListeners: undefined,
       type: 'exchange',
       currency: 'NEO',
       balance: 0.00494487,
       unsettledInterest: 0,
       balanceAvailable: null },
     Wallet {
       domain: null,
       _events: {},
       _eventsCount: 0,
       _maxListeners: undefined,
       type: 'exchange',
       currency: 'USD',
       balance: 13.97576373,
       unsettledInterest: 0,
       balanceAvailable: null } ] }

with balanceAvailable set to null, which is not true. The v1 API correctly outputs:.

{ type: 'exchange',
   currency: 'usd',
   amount: '13.97576373',
   available: '13.97576373' }

Doesn't seem to be transform issue, as this lib receives [ 'exchange', 'USD', 13.97576373, 0, null ] from the API.

Actual question: Which API should be used? Is v2 finished or still in development?

@ddeath
Copy link

ddeath commented May 3, 2018

@askmike the null is valid value. In the api v2 you have to use different call which will calculate available balance:

https://bitfinex.readme.io/v2/reference#rest-auth-calc-bal-available

@askmike
Copy link
Contributor Author

askmike commented May 3, 2018

@ddeath thanks for clarifying. I guess the easiest for now is to simply query the v1 endpoint instead of fetching the new endpoint per currency you need whenever you see a null.

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