com.xeiam.xchange.examples.cexio.marketdata.TradesDemo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-examples Show documentation
Show all versions of xchange-examples Show documentation
Provides a set of examples that demonstrate how to use XChange in client applications
The newest version!
package com.xeiam.xchange.examples.cexio.marketdata;
import java.io.IOException;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.cexio.CexIOExchange;
import com.xeiam.xchange.currency.Currencies;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.marketdata.Trades;
import com.xeiam.xchange.service.polling.marketdata.PollingMarketDataService;
/**
* Author: brox Since: 2/6/14
*/
public class TradesDemo {
public static void main(String[] args) throws IOException {
// Use the factory to get Cex.IO exchange API using default settings
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CexIOExchange.class.getName());
// Interested in the public polling market data feed (no authentication)
PollingMarketDataService marketDataService = exchange.getPollingMarketDataService();
// Get the latest trade data for GHs/BTC since tid=5635556
Trades trades = marketDataService.getTrades(new CurrencyPair(Currencies.GHs, Currencies.BTC), 5909107);
System.out.println("Trades Size= " + trades.getTrades().size());
System.out.println(trades.toString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy