Search in sources :

Example 11 with RawOrderbookConfiguration

use of com.github.jnidzwetzki.bitfinex.v2.entity.RawOrderbookConfiguration in project bitfinex-v2-wss-api-java by jnidzwetzki.

the class RawOrderbookHandler method handleEntry.

/**
 * Handle a new orderbook entry
 * @param bitfinexApiBroker
 * @param configuration
 * @param jsonArray
 */
private void handleEntry(final BitfinexApiBroker bitfinexApiBroker, final RawOrderbookConfiguration configuration, final JSONArray jsonArray) {
    final long orderId = jsonArray.getNumber(0).longValue();
    final BigDecimal price = jsonArray.getBigDecimal(1);
    final BigDecimal amount = jsonArray.getBigDecimal(2);
    final RawOrderbookEntry orderbookEntry = new RawOrderbookEntry(orderId, price, amount);
    bitfinexApiBroker.getRawOrderbookManager().handleNewOrderbookEntry(configuration, orderbookEntry);
}
Also used : RawOrderbookEntry(com.github.jnidzwetzki.bitfinex.v2.entity.RawOrderbookEntry) BigDecimal(java.math.BigDecimal)

Aggregations

RawOrderbookConfiguration (com.github.jnidzwetzki.bitfinex.v2.entity.RawOrderbookConfiguration)8 OrderbookConfiguration (com.github.jnidzwetzki.bitfinex.v2.entity.OrderbookConfiguration)5 BitfinexCandlestickSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexCandlestickSymbol)4 BitfinexExecutedTradeSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexExecutedTradeSymbol)4 BitfinexTickerSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexTickerSymbol)4 Test (org.junit.Test)4 SubscribeRawOrderbookCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeRawOrderbookCommand)3 BitfinexApiBroker (com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker)2 SubscribeCandlesCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeCandlesCommand)2 SubscribeOrderbookCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeOrderbookCommand)2 SubscribeTickerCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeTickerCommand)2 SubscribeTradesCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeTradesCommand)2 UnsubscribeChannelCommand (com.github.jnidzwetzki.bitfinex.v2.commands.UnsubscribeChannelCommand)2 APIException (com.github.jnidzwetzki.bitfinex.v2.entity.APIException)2 RawOrderbookEntry (com.github.jnidzwetzki.bitfinex.v2.entity.RawOrderbookEntry)2 JSONArray (org.json.JSONArray)2 CandlestickHandler (com.github.jnidzwetzki.bitfinex.v2.callback.channel.CandlestickHandler)1 ChannelCallbackHandler (com.github.jnidzwetzki.bitfinex.v2.callback.channel.ChannelCallbackHandler)1 ExecutedTradeHandler (com.github.jnidzwetzki.bitfinex.v2.callback.channel.ExecutedTradeHandler)1 OrderbookHandler (com.github.jnidzwetzki.bitfinex.v2.callback.channel.OrderbookHandler)1