Search in sources :

Example 1 with HeartbeatHandler

use of com.github.jnidzwetzki.bitfinex.v2.callback.api.HeartbeatHandler in project bitfinex-v2-wss-api-java by jnidzwetzki.

the class HeartbeatManagerTest method testHeartbeatHandler.

/**
 * Test the heartbeart handler
 * @throws APIException
 */
@Test
public void testHeartbeatHandler() throws APIException {
    final BitfinexApiBroker bitfinexApiBroker = Mockito.mock(BitfinexApiBroker.class);
    final HeartbeatHandler handler = new HeartbeatHandler();
    handler.handleChannelData(bitfinexApiBroker, null);
    Mockito.verify(bitfinexApiBroker, Mockito.times(1)).updateConnectionHeartbeat();
}
Also used : BitfinexApiBroker(com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker) HeartbeatHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.HeartbeatHandler) Test(org.junit.Test)

Example 2 with HeartbeatHandler

use of com.github.jnidzwetzki.bitfinex.v2.callback.api.HeartbeatHandler 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());
}
Also used : HeartbeatHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.HeartbeatHandler) PositionHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.PositionHandler) NotificationHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.NotificationHandler) DoNothingHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.DoNothingHandler) WalletHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.WalletHandler) TradeHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.TradeHandler) ExecutedTradeHandler(com.github.jnidzwetzki.bitfinex.v2.callback.channel.ExecutedTradeHandler) OrderHandler(com.github.jnidzwetzki.bitfinex.v2.callback.api.OrderHandler)

Aggregations

HeartbeatHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.HeartbeatHandler)2 BitfinexApiBroker (com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker)1 DoNothingHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.DoNothingHandler)1 NotificationHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.NotificationHandler)1 OrderHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.OrderHandler)1 PositionHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.PositionHandler)1 TradeHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.TradeHandler)1 WalletHandler (com.github.jnidzwetzki.bitfinex.v2.callback.api.WalletHandler)1 ExecutedTradeHandler (com.github.jnidzwetzki.bitfinex.v2.callback.channel.ExecutedTradeHandler)1 Test (org.junit.Test)1