use of com.github.jnidzwetzki.bitfinex.v2.entity.Wallet in project bitfinex-v2-wss-api-java by jnidzwetzki.
the class WalletManager method calculateWalletFundingBalance.
/**
* Calculate the wallet funding balance for the given currency (e.g., BTC)
*
* @param symbol
* @throws APIException
*/
public void calculateWalletFundingBalance(final String symbol) throws APIException {
throwExceptionIfUnauthenticated();
bitfinexApiBroker.sendCommand(new CalculateCommand("wallet_funding_" + symbol));
}
use of com.github.jnidzwetzki.bitfinex.v2.entity.Wallet in project bitfinex-v2-wss-api-java by jnidzwetzki.
the class WalletHandler method handleWalletcallback.
/**
* Handle the callback for a single wallet
* @param bitfinexApiBroker
* @param walletArray
* @throws APIException
*/
private void handleWalletcallback(final BitfinexApiBroker bitfinexApiBroker, final JSONArray walletArray) throws APIException {
final String walletType = walletArray.getString(0);
final String currency = walletArray.getString(1);
final BigDecimal balance = walletArray.getBigDecimal(2);
final BigDecimal unsettledInterest = walletArray.getBigDecimal(3);
final BigDecimal balanceAvailable = walletArray.optBigDecimal(4, BigDecimal.valueOf(-1));
final Wallet wallet = new Wallet(walletType, currency, balance, unsettledInterest, balanceAvailable);
final WalletManager walletManager = bitfinexApiBroker.getWalletManager();
final Table<String, String, Wallet> walletTable = walletManager.getWalletTable();
synchronized (walletTable) {
walletTable.put(walletType, currency, wallet);
walletTable.notifyAll();
}
}
use of com.github.jnidzwetzki.bitfinex.v2.entity.Wallet in project bitfinex-v2-wss-api-java by jnidzwetzki.
the class BitfinexApiBroker method setupChannelHandler.
/**
* Setup the channel handler
*/
private void setupChannelHandler() {
// Heartbeat
channelHandler.put("hb", new HeartbeatHandler());
// Position snapshot
channelHandler.put("ps", new PositionHandler());
// Position new
channelHandler.put("pn", new PositionHandler());
// Position updated
channelHandler.put("pu", new PositionHandler());
// Position caneled
channelHandler.put("pc", new PositionHandler());
// Founding offers
channelHandler.put("fos", new DoNothingHandler());
// Founding credits
channelHandler.put("fcs", new DoNothingHandler());
// Founding loans
channelHandler.put("fls", new DoNothingHandler());
// Ats - Unkown
channelHandler.put("ats", new DoNothingHandler());
// Wallet snapshot
channelHandler.put("ws", new WalletHandler());
// Wallet update
channelHandler.put("wu", new WalletHandler());
// Order snapshot
channelHandler.put("os", new OrderHandler());
// Order notification
channelHandler.put("on", new OrderHandler());
// Order update
channelHandler.put("ou", new OrderHandler());
// Order cancelation
channelHandler.put("oc", new OrderHandler());
// Trade executed
channelHandler.put("te", new TradeHandler());
// Trade update
channelHandler.put("tu", new TradeHandler());
// General notification
channelHandler.put("n", new NotificationHandler());
}
Aggregations