use of com.github.jnidzwetzki.bitfinex.v2.callback.channel.OrderbookHandler in project bitfinex-v2-wss-api-java by jnidzwetzki.
the class BitfinexApiBroker method handleChannelDataArray.
/**
* Handle the channel data with has an array at first position
* @param jsonArray
* @param channelSymbol
* @throws APIException
*/
private void handleChannelDataArray(final JSONArray jsonArray, final BitfinexStreamSymbol channelSymbol) throws APIException {
final JSONArray subarray = jsonArray.getJSONArray(1);
if (channelSymbol instanceof BitfinexCandlestickSymbol) {
final ChannelCallbackHandler handler = new CandlestickHandler();
handler.handleChannelData(this, channelSymbol, subarray);
} else if (channelSymbol instanceof RawOrderbookConfiguration) {
final RawOrderbookHandler handler = new RawOrderbookHandler();
handler.handleChannelData(this, channelSymbol, subarray);
} else if (channelSymbol instanceof OrderbookConfiguration) {
final OrderbookHandler handler = new OrderbookHandler();
handler.handleChannelData(this, channelSymbol, subarray);
} else if (channelSymbol instanceof BitfinexTickerSymbol) {
final ChannelCallbackHandler handler = new TickHandler();
handler.handleChannelData(this, channelSymbol, subarray);
} else if (channelSymbol instanceof BitfinexExecutedTradeSymbol) {
final ChannelCallbackHandler handler = new ExecutedTradeHandler();
handler.handleChannelData(this, channelSymbol, subarray);
} else {
logger.error("Unknown stream type: {}", channelSymbol);
}
}
Aggregations