Package com.xeiam.xchange.dto.marketdata

Examples of com.xeiam.xchange.dto.marketdata.Ticker


    ObjectMapper mapper = new ObjectMapper();
    BTERTickers tickers = mapper.readValue(is, BTERTickers.class);

    Map<CurrencyPair, BTERTicker> tickerMap = tickers.getTickerMap();

    Ticker ticker = BTERAdapters.adaptTicker(CurrencyPair.BTC_CNY, tickerMap.get(CurrencyPair.BTC_CNY));
    assertThat(ticker.getLast()).isEqualTo("3400.01");
    assertThat(ticker.getHigh()).isEqualTo("3497.41");
    assertThat(ticker.getLow()).isEqualTo("3400.01");
    assertThat(ticker.getAsk()).isEqualTo("3400.17");
    assertThat(ticker.getBid()).isEqualTo("3400.01");
    assertThat(ticker.getVolume()).isEqualTo("347.2045");
  }
View Full Code Here


  @Test
  public void testAdapter() {

    final List<JustcoinTicker> tickers = new ArrayList<JustcoinTicker>();
    tickers.add(justcoinTicker);
    final Ticker ticker = JustcoinAdapters.adaptTicker(tickers, currencyPair);

    assertThat(ticker.getLast()).isEqualTo(last);
    assertThat(ticker.getHigh()).isEqualTo(high);
    assertThat(ticker.getLow()).isEqualTo(low);
    assertThat(ticker.getBid()).isEqualTo(bid);
    assertThat(ticker.getAsk()).isEqualTo(ask);
    assertThat(ticker.getVolume()).isEqualTo(volume);
    assertThat(ticker.getTimestamp()).isNull();
    assertThat(ticker.getCurrencyPair()).isEqualTo(currencyPair);
  }
View Full Code Here

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

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

    System.out.println("Ticker: " + ticker.toString());
    System.out.println("Currency: " + Currencies.EUR);
    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());
  }
View Full Code Here

    BigDecimal last = rawRetObj.getLast();
    BigDecimal bid = rawRetObj.getBid();
    BigDecimal ask = rawRetObj.getAsk();
    BigDecimal low = rawRetObj.getLow();
    BigDecimal high = rawRetObj.getHigh();
    Ticker genericTicker =
        new Ticker.Builder().volume(rawRetObj.getVolume()).ask(ask).currencyPair(new CurrencyPair("BTC", "GBP")).bid(bid).high(high).low(low).last(last).build();

    synchronized (cachedDataSynchronizationObject) {
      cachedTicker = genericTicker;
    }
View Full Code Here

    try {
      rawRetObj = streamObjectMapper.readValue(data, CoinfloorTicker.class);
    } catch (IOException e) {
      throw new ExchangeException("JSON parse error", e);
    }
    Ticker genericTicker;

    synchronized (cachedDataSynchronizationObject) {
      // base & counter currencies hard coded in; no way to make it dynamic with return data - may change over time.
      BigDecimal last = (rawRetObj.getLast().doubleValue() == 0 ? cachedTicker.getLast() : rawRetObj.getLast());
      BigDecimal bid = (rawRetObj.getBid().doubleValue() == 0 ? cachedTicker.getBid() : rawRetObj.getBid());
View Full Code Here

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

    // Get the latest ticker data showing BTC to USD
    Ticker ticker = marketDataService.getTicker(new CurrencyPair(Currencies.GHs, Currencies.BTC));

    System.out.println("Pair: " + Currencies.GHs + "/" + Currencies.BTC);
    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());
    System.out.println("Bid: " + ticker.getBid().toString());
    System.out.println("Ask: " + ticker.getAsk().toString());
    System.out.println("Timestamp: " + ticker.getTimestamp().toString());
  }
View Full Code Here

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

    Ticker ticker = BTCEAdapters.adaptTicker(BTCETicker, CurrencyPair.BTC_USD);

    assertThat(ticker.getLast().toString()).isEqualTo("13.07");
    assertThat(ticker.getLow().toString()).isEqualTo("13");
    assertThat(ticker.getHigh().toString()).isEqualTo("13.23");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("3078.62284"));
    assertThat(ticker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);

  }
View Full Code Here

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

    Ticker ticker = BitstampAdapters.adaptTicker(bitstampTicker, CurrencyPair.BTC_USD);

    assertThat(ticker.getLast().toString()).isEqualTo("134.89");
    assertThat(ticker.getBid().toString()).isEqualTo("134.89");
    assertThat(ticker.getAsk().toString()).isEqualTo("134.92");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("21982.44926674"));
    SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    f.setTimeZone(TimeZone.getTimeZone("UTC"));
    String dateString = f.format(ticker.getTimestamp());
    assertThat(dateString).isEqualTo("2013-10-14 21:45:33");
  }
View Full Code Here

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

    // Get the latest ticker data showing BTC to EUR
    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_EUR);
    double value = ticker.getLast().doubleValue();

    System.out.println("Last: " + ticker.getCurrencyPair().counterSymbol + "-" + value);
    System.out.println("Last: " + ticker.getLast().toString());
    System.out.println("Volume: " + ticker.getVolume().toString());
  }
View Full Code Here

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

    // Get the latest ticker data showing BTC to CNY.
    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_CNY);
    System.out.println(ticker);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.marketdata.Ticker

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.