Search in sources :

Example 6 with UnsubscribeChannelCommand

use of com.github.jnidzwetzki.bitfinex.v2.commands.UnsubscribeChannelCommand in project bitfinex-v2-wss-api-java by jnidzwetzki.

the class RawOrderbookManager method unsubscribeOrderbook.

/**
 * Unsubscribe a orderbook
 * @param currencyPair
 * @param orderBookPrecision
 * @param orderBookFrequency
 * @param pricePoints
 */
public void unsubscribeOrderbook(final RawOrderbookConfiguration orderbookConfiguration) {
    final int channel = bitfinexApiBroker.getChannelForSymbol(orderbookConfiguration);
    if (channel == -1) {
        throw new IllegalArgumentException("Unknown symbol: " + orderbookConfiguration);
    }
    final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(channel);
    bitfinexApiBroker.sendCommand(command);
    bitfinexApiBroker.removeChannelForSymbol(orderbookConfiguration);
}
Also used : UnsubscribeChannelCommand(com.github.jnidzwetzki.bitfinex.v2.commands.UnsubscribeChannelCommand)

Aggregations

UnsubscribeChannelCommand (com.github.jnidzwetzki.bitfinex.v2.commands.UnsubscribeChannelCommand)6 BitfinexApiBroker (com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker)1 AbstractAPICommand (com.github.jnidzwetzki.bitfinex.v2.commands.AbstractAPICommand)1 AuthCommand (com.github.jnidzwetzki.bitfinex.v2.commands.AuthCommand)1 CancelOrderCommand (com.github.jnidzwetzki.bitfinex.v2.commands.CancelOrderCommand)1 CancelOrderGroupCommand (com.github.jnidzwetzki.bitfinex.v2.commands.CancelOrderGroupCommand)1 OrderCommand (com.github.jnidzwetzki.bitfinex.v2.commands.OrderCommand)1 PingCommand (com.github.jnidzwetzki.bitfinex.v2.commands.PingCommand)1 SubscribeCandlesCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeCandlesCommand)1 SubscribeOrderbookCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeOrderbookCommand)1 SubscribeRawOrderbookCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeRawOrderbookCommand)1 SubscribeTickerCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeTickerCommand)1 SubscribeTradesCommand (com.github.jnidzwetzki.bitfinex.v2.commands.SubscribeTradesCommand)1 BitfinexOrder (com.github.jnidzwetzki.bitfinex.v2.entity.BitfinexOrder)1 OrderbookConfiguration (com.github.jnidzwetzki.bitfinex.v2.entity.OrderbookConfiguration)1 RawOrderbookConfiguration (com.github.jnidzwetzki.bitfinex.v2.entity.RawOrderbookConfiguration)1 BitfinexCandlestickSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexCandlestickSymbol)1 BitfinexExecutedTradeSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexExecutedTradeSymbol)1 BitfinexTickerSymbol (com.github.jnidzwetzki.bitfinex.v2.entity.symbol.BitfinexTickerSymbol)1 Test (org.junit.Test)1