jnidzwetzki / bitfinex-v2-wss-api-java

This project provides a Java client library for the Bitfinex WebSocket API (v2). Public and private channels (candles, ticks, executed trades, (raw) orderbooks, orders, and wallets) are implemented.
Apache License 2.0
91 stars 55 forks source link

Wallet getBalanceAvailable is returning null value #123

Closed guilllet closed 5 years ago

guilllet commented 5 years ago

hello, I used the following piece of code for getting the available amount for a currency

for (final BitfinexWallet wallet : bitfinexWebsocketClient.getWalletManager().getWallets()) {
            if (wallet.getCurrency().equals(currency.getCurrency2())) {
                logger.info(wallet.toString());
                return wallet.getBalanceAvailable();
            }
        }

but the return value is null while getBalance() is returning 2327.6672216

[walletType=EXCHANGE, currency=USD, balance=2327.6672216, unsettledInterest=0, balanceAvailable=null]

thank you in advance

mironbalcerzak commented 5 years ago

I think balanceAvailable is used for margin trading - as actual balance, and tradable balance differs (due to ledger).

-mb

guilllet commented 5 years ago

Ok but how do i get the available free amount in my wallet ?

jnidzwetzki commented 5 years ago

Bitfinex usually let some of the balance related fields empty in data updates. To get these values, you have to request the data. See https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/master/EXAMPLES.md#request-wallet-balance for an example.