use of org.knowm.xchange.livecoin.LivecoinExchange in project XChange by knowm.
the class OrderBookDemo method main.
public static void main(String[] args) throws IOException {
Exchange livecoinExchange = ExchangeFactory.INSTANCE.createExchange(LivecoinExchange.class);
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = livecoinExchange.getMarketDataService();
System.out.println("fetching data...");
// Get the current orderbook
OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
System.out.println("received data.");
for (LimitOrder limitOrder : orderBook.getBids()) {
System.out.println(limitOrder.getType() + " " + limitOrder.getCurrencyPair() + " Limit price: " + limitOrder.getLimitPrice() + " Amount: " + limitOrder.getOriginalAmount());
}
for (LimitOrder limitOrder : orderBook.getAsks()) {
System.out.println(limitOrder.getType() + " " + limitOrder.getCurrencyPair() + " Limit price: " + limitOrder.getLimitPrice() + " Amount: " + limitOrder.getOriginalAmount());
}
}
use of org.knowm.xchange.livecoin.LivecoinExchange in project XChange by knowm.
the class TradeDemo method main.
public static void main(String[] args) throws IOException {
Exchange livecoinExchange = ExchangeFactory.INSTANCE.createExchange(LivecoinExchange.class);
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = livecoinExchange.getMarketDataService();
System.out.println("fetching data...");
Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD);
System.out.println("received data.");
for (Trade trade : trades.getTrades()) {
System.out.println(trade.getType() + " " + trade.getCurrencyPair() + " Price: " + trade.getPrice() + " Amount: " + trade.getOriginalAmount());
}
}
Aggregations