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

com.xeiam.xchange.examples.vaultofsatoshi.marketdata.VoSTickerDemo Maven / Gradle / Ivy

package com.xeiam.xchange.examples.vaultofsatoshi.marketdata;

import java.io.IOException;

import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeException;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.NotAvailableFromExchangeException;
import com.xeiam.xchange.NotYetImplementedForExchangeException;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.service.polling.PollingMarketDataService;
import com.xeiam.xchange.vaultofsatoshi.VaultOfSatoshiExchange;

/**
 * Demonstrate requesting Ticker at Vault of Satoshi
 *
 * @author timmolter
 */
public class VoSTickerDemo {

  static Exchange vos = ExchangeFactory.INSTANCE.createExchange(VaultOfSatoshiExchange.class.getName());

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

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

    generic();
    raw();
  }

  public static void generic() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    // Get the latest ticker data showing BTC to CNY
    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_CAD);

    System.out.println("Date: " + ticker.getTimestamp());

    System.out.println("Last: " + ticker.getLast().toString());
    System.out.println("Volume: " + ticker.getVolume().toString());
    System.out.println("High: " + ticker.getHigh().toString());
    System.out.println("Low: " + ticker.getLow().toString());

  }

  public static void raw() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy