All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xeiam.xchange.examples.therock.TheRockMarketDataDemo Maven / Gradle / Ivy

Go to download

Provides a set of examples that demonstrate how to use XChange in client applications

The newest version!
package com.xeiam.xchange.examples.therock;

import java.io.IOException;

import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.service.polling.marketdata.PollingMarketDataService;
import com.xeiam.xchange.therock.TheRockExchange;

public class TheRockMarketDataDemo {

  public static void main(String[] args) throws IOException {

    // Use the factory to get TheRock exchange API using default settings
    Exchange theRockExchange = ExchangeFactory.INSTANCE.createExchange(TheRockExchange.class.getName());

    generic(theRockExchange);
  }

  private static void generic(Exchange loyalbitExchange) throws IOException {

    // Interested in the public polling market data feed (no authentication)
    PollingMarketDataService loyalbitMarketDataService = loyalbitExchange.getPollingMarketDataService();

    // Get the ticker
    System.out.println("Ticker: " + loyalbitMarketDataService.getTicker(CurrencyPair.BTC_USD));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy