Package com.xeiam.xchange.bitcoinium.dto.marketdata

Examples of com.xeiam.xchange.bitcoinium.dto.marketdata.BitcoiniumTicker


    // Read in the JSON from the example resources
    InputStream is = BitcoiniumTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BitcoiniumTicker bitcoiniumTicker = mapper.readValue(is, BitcoiniumTicker.class);

    // Verify that the example data was unmarshalled correctly
    assertThat(bitcoiniumTicker.getLast()).isEqualTo(new BigDecimal("516.8"));
    assertThat(bitcoiniumTicker.getHigh()).isEqualTo(new BigDecimal("523.09"));
    assertThat(bitcoiniumTicker.getLow()).isEqualTo(new BigDecimal("508.28"));
    assertThat(bitcoiniumTicker.getVolume()).isEqualTo(new BigDecimal("3522"));
  }
View Full Code Here


  public BitcoiniumTicker getBitcoiniumTicker(String tradableIdentifier, String currency) throws IOException {

    String pair = BitcoiniumUtils.createCurrencyPairString(tradableIdentifier, currency);

    // Request data
    BitcoiniumTicker bitcoiniumTicker = bitcoinium.getTicker(pair, exchangeSpecification.getApiKey());

    // Adapt to XChange DTOs
    return bitcoiniumTicker;
  }
View Full Code Here

  @Override
  public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {

    // Request data
    BitcoiniumTicker bitcoiniumTicker = getBitcoiniumTicker(currencyPair.baseSymbol, currencyPair.counterSymbol);

    // Adapt to XChange DTOs
    return BitcoiniumAdapters.adaptTicker(bitcoiniumTicker, currencyPair);
  }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = BitcoiniumTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BitcoiniumTicker BitcoiniumTicker = mapper.readValue(is, BitcoiniumTicker.class);

    Ticker ticker = BitcoiniumAdapters.adaptTicker(BitcoiniumTicker, CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast()).isEqualTo(new BigDecimal("516.8"));
View Full Code Here

    List<Date> xAxisData = new ArrayList<Date>();
    List<Float> yAxisData = new ArrayList<Float>();
    for (int i = 0; i < bitcoiniumTickerHistory.getCondensedTickers().length; i++) {

      BitcoiniumTicker bitcoiniumTicker = bitcoiniumTickerHistory.getCondensedTickers()[i];

      Date timestamp = new Date(bitcoiniumTicker.getTimestamp());
      float price = bitcoiniumTicker.getLast().floatValue();
      System.out.println(timestamp + ": " + price);
      xAxisData.add(timestamp);
      yAxisData.add(price);
    }
View Full Code Here

      @Override
      public void run() {

        try {
          BitcoiniumTicker bitcoiniumTicker = bitcoiniumMarketDataService.getBitcoiniumTicker(Currencies.BTC, "BITSTAMP_USD");
          System.out.println(bitcoiniumTicker.toString());
          Date timestamp = new Date(bitcoiniumTicker.getTimestamp());
          float price = bitcoiniumTicker.getLast().floatValue();
          if (xAxisData.get(xAxisData.size() - 1).getTime() != timestamp.getTime()) {
            xAxisData.add(timestamp);
            yAxisData.add(price);
            Series series = chartPanel.updateSeries(SERIES_NAME, xAxisData, yAxisData);
            System.out.println(series.getXData());
View Full Code Here

    // build ticker history chart series data
    xAxisData = new ArrayList<Date>();
    yAxisData = new ArrayList<Float>();
    for (int i = 0; i < bitcoiniumTickerHistory.getCondensedTickers().length; i++) {

      BitcoiniumTicker bitcoiniumTicker = bitcoiniumTickerHistory.getCondensedTickers()[i];

      Date timestamp = new Date(bitcoiniumTicker.getTimestamp());
      float price = bitcoiniumTicker.getLast().floatValue();
      System.out.println(timestamp + ": " + price);
      xAxisData.add(timestamp);
      yAxisData.add(price);
    }
View Full Code Here

    // Interested in the public polling market data feed (no authentication)
    BitcoiniumMarketDataServiceRaw bitcoiniumSpecificMarketDataService = (BitcoiniumMarketDataServiceRaw) exchange.getPollingMarketDataService();

    // Get the latest ticker data showing BTC to USD
    BitcoiniumTicker bitcoiniumTicker = bitcoiniumSpecificMarketDataService.getBitcoiniumTicker(Currencies.BTC, "BITSTAMP_USD");

    System.out.println("Last: " + bitcoiniumTicker.getLast());
    System.out.println("Bid: " + bitcoiniumTicker.getBid());
    System.out.println("Ask: " + bitcoiniumTicker.getAsk());
    System.out.println("Volume: " + bitcoiniumTicker.getVolume());

    // Get the latest order book data for BTC/USD - MtGox
    BitcoiniumOrderbook bitcoiniumOrderbook = bitcoiniumSpecificMarketDataService.getBitcoiniumOrderbook(Currencies.BTC, "BITSTAMP_USD", "TEN_PERCENT");

    System.out.println("Order book: " + bitcoiniumOrderbook);
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.bitcoinium.dto.marketdata.BitcoiniumTicker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.