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

com.xeiam.xchange.examples.bitfinex.marketdata.SymbolsDemo 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.bitfinex.marketdata;

import java.io.IOException;
import java.util.Collection;

import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.bitfinex.v1.BitfinexExchange;
import com.xeiam.xchange.bitfinex.v1.service.polling.BitfinexMarketDataServiceRaw;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.service.polling.marketdata.PollingMarketDataService;

public class SymbolsDemo {

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

    // Use the factory to get Bitfinex exchange API using default settings
    Exchange bitfinex = ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName());

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

    generic(marketDataService);
    raw((BitfinexMarketDataServiceRaw) marketDataService);
  }

  private static void generic(PollingMarketDataService marketDataService) throws IOException {

    Collection currencyPairs = marketDataService.getExchangeSymbols();

    System.out.println(currencyPairs);
  }

  private static void raw(BitfinexMarketDataServiceRaw marketDataService) throws IOException {

    Collection symbols = marketDataService.getBitfinexSymbols();
    System.out.println(symbols);

    Collection currencyPairs = marketDataService.getExchangeSymbols();
    System.out.println(currencyPairs);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy