use of org.knowm.xchange.kraken.dto.marketdata.KrakenPublicTrades in project XChange by knowm.
the class KrakenTradesDemo method raw.
private static void raw(Exchange krakenExchange) throws IOException {
// Interested in the public market data feed (no authentication)
KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
// Get the latest trade data for BTC_USD
KrakenPublicTrades krakenPublicTrades = krakenMarketDataService.getKrakenTrades(CurrencyPair.BTC_USD);
long last = krakenPublicTrades.getLast();
System.out.println(krakenPublicTrades.getTrades());
System.out.println("Trades size: " + krakenPublicTrades.getTrades().size());
System.out.println("Trades(0): " + krakenPublicTrades.getTrades().get(0).toString());
System.out.println("Last: " + last);
// Poll for any new trades since last id
krakenPublicTrades = krakenMarketDataService.getKrakenTrades(CurrencyPair.LTC_USD, last);
System.out.println(krakenPublicTrades.getTrades());
System.out.println("Trades size: " + krakenPublicTrades.getTrades().size());
}
use of org.knowm.xchange.kraken.dto.marketdata.KrakenPublicTrades in project XChange by knowm.
the class KrakenMarketDataService method getTrades.
@Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
Long since = null;
if (args != null && args.length > 0) {
Object arg0 = args[0];
if (arg0 instanceof Long) {
since = (Long) arg0;
} else {
throw new ExchangeException("args[0] must be of type Long!");
}
}
KrakenPublicTrades krakenTrades = getKrakenTrades(currencyPair, since);
return KrakenAdapters.adaptTrades(krakenTrades.getTrades(), currencyPair, krakenTrades.getLast());
}
Aggregations