com.xeiam.xchange.vircurex.service.polling.VircurexMarketDataService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-vircurex Show documentation
Show all versions of xchange-vircurex Show documentation
XChange implementation for the Vircurex Exchange
The newest version!
package com.xeiam.xchange.vircurex.service.polling;
import java.io.IOException;
import java.util.List;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.marketdata.OrderBook;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.dto.marketdata.Trades;
import com.xeiam.xchange.dto.trade.LimitOrder;
import com.xeiam.xchange.exceptions.NotAvailableFromExchangeException;
import com.xeiam.xchange.service.polling.marketdata.PollingMarketDataService;
import com.xeiam.xchange.vircurex.VircurexAdapters;
import com.xeiam.xchange.vircurex.dto.marketdata.VircurexDepth;
import com.xeiam.xchange.vircurex.dto.marketdata.VircurexLastTrade;
/**
*
* Implementation of the market data service for Vircurex
*
*
* - Provides access to various market data values
*
*/
public class VircurexMarketDataService extends VircurexMarketDataServiceRaw implements PollingMarketDataService {
/**
* Constructor
*
* @param exchange
*/
public VircurexMarketDataService(Exchange exchange) {
super(exchange);
}
@Override
public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {
VircurexLastTrade vircurexLastTrade = getVircurexTicker(currencyPair);
return new Ticker.Builder().currencyPair(currencyPair).last(vircurexLastTrade.getValue()).build();
}
@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
VircurexDepth vircurexDepth = getVircurexOrderBook(currencyPair);
// Adapt to XChange DTOs
List asks = VircurexAdapters.adaptOrders(vircurexDepth.getAsks(), currencyPair, "ask", "");
List bids = VircurexAdapters.adaptOrders(vircurexDepth.getBids(), currencyPair, "bid", "");
return new OrderBook(null, asks, bids);
}
@Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
throw new NotAvailableFromExchangeException();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy