Examples of Ticker


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

  }

  @Test
  public void testAdaptUpdate() throws IOException, InvalidMessage, FieldNotFound {

    Ticker oldTicker = getTicker();

    String messageData = getMessageData("X.txt");

    MarketDataIncrementalRefresh message = new MarketDataIncrementalRefresh();
    message.fromString(messageData, dataDictionary, true);

    log.debug(message.toXML(dataDictionary));

    Ticker ticker = BTCChinaFIXAdapters.adaptUpdate(oldTicker, message);

    assertEquals(CurrencyPair.BTC_CNY, ticker.getCurrencyPair());
    assertEquals(1413482716000L, ticker.getTimestamp().getTime());
    assertEquals(new BigDecimal("2328.08"), ticker.getBid());
    assertEquals(new BigDecimal("2325.53"), ticker.getAsk());
    assertEquals(new BigDecimal("2328.09"), ticker.getLast());
    assertEquals(new BigDecimal("2447.87"), ticker.getHigh());
    assertEquals(new BigDecimal("2316"), ticker.getLow());
    assertEquals(new BigDecimal("53826.1999"), ticker.getVolume());

  }
View Full Code Here

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

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

    Ticker ticker = BTCChinaAdapters.adaptTicker(BTCChinaTicker, CurrencyPair.BTC_CNY);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("546.00");
    assertThat(ticker.getLow().toString()).isEqualTo("545.00");
    assertThat(ticker.getHigh().toString()).isEqualTo("547.77");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("2593.89900000"));

  }
View Full Code Here

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

    Map<CurrencyPair, Ticker> tickers = BTCChinaAdapters.adaptTickers(btcChinaTicker);
    assertEquals(3, tickers.size());

    assertEquals(new HashSet<CurrencyPair>(Arrays.asList(CurrencyPair.BTC_CNY, CurrencyPair.LTC_CNY, CurrencyPair.LTC_BTC)), tickers.keySet());

    Ticker btccny = tickers.get(CurrencyPair.BTC_CNY);
    assertEquals(new BigDecimal("2894.97"), btccny.getHigh());
    assertEquals(new BigDecimal("2850.08"), btccny.getLow());
    assertEquals(new BigDecimal("2880.00"), btccny.getBid());
    assertEquals(new BigDecimal("2883.86"), btccny.getAsk());
    assertEquals(new BigDecimal("2880.00"), btccny.getLast());
    assertEquals(new BigDecimal("4164.41040000"), btccny.getVolume());
    assertEquals(1396412841000L, btccny.getTimestamp().getTime());
  }
View Full Code Here

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

    MarketDataSnapshotFullRefresh message = new MarketDataSnapshotFullRefresh();
    message.fromString(messageData, dataDictionary, true);

    log.debug(message.toXML(dataDictionary));

    Ticker ticker = BTCChinaFIXAdapters.adaptTicker(message);
    return ticker;
  }
View Full Code Here

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

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXTicker anxTicker = mapper.readValue(is, ANXTicker.class);

    Ticker ticker = ANXAdapters.adaptTicker(anxTicker);

    Assert.assertEquals(new BigDecimal("725.38123"), ticker.getLast());
    Assert.assertEquals(new BigDecimal("725.38123"), ticker.getHigh());
    Assert.assertEquals(new BigDecimal("380.00000"), ticker.getLow());
    Assert.assertEquals(new BigDecimal("7.00000000"), ticker.getVolume());
    Assert.assertEquals(new BigDecimal("725.38123"), ticker.getLast());
    Assert.assertEquals(new BigDecimal("38.85148"), ticker.getBid());
    Assert.assertEquals(new BigDecimal("897.25596"), ticker.getAsk());

    Assert.assertEquals(new Date(1393388594814L), ticker.getTimestamp());
  }
View Full Code Here

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

    ObjectMapper mapper = new ObjectMapper();
    BTCETickerWrapper bTCETickerWrapper = mapper.readValue(is, BTCETickerWrapper.class);

    // Verify that the example data was unmarshalled correctly
    assertThat(bTCETickerWrapper.getTicker(BTCEUtils.getPair(CurrencyPair.BTC_USD)).getLast()).isEqualTo(new BigDecimal("757"));
    Ticker ticker = BTCEAdapters.adaptTicker(bTCETickerWrapper.getTicker(BTCEUtils.getPair(CurrencyPair.BTC_USD)), CurrencyPair.BTC_USD);

    assertThat(ticker.getLast().toString()).isEqualTo("757");
    assertThat(ticker.getLow().toString()).isEqualTo("655");
    assertThat(ticker.getHigh().toString()).isEqualTo("770");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("24620.6561"));
    assertThat(DateUtils.toUTCString(ticker.getTimestamp())).isEqualTo("2013-11-23 11:13:39 GMT");

  }
View Full Code Here

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

  }

  private static void generic(PollingMarketDataService marketDataService) throws IOException {

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

    System.out.println("Currency: " + Currencies.CAD);
    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

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

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

  @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

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

    // 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
TOP
Copyright © 2018 www.massapi.com. 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.