Package com.xeiam.xchange.dto.marketdata

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


    ObjectMapper mapper = new ObjectMapper();

    LakeBTCTickers tickers = mapper.readValue(is, LakeBTCTickers.class);

    LakeBTCTicker cnyTicker = tickers.getCny();
    Ticker adaptedTicker = LakeBTCAdapters.adaptTicker(cnyTicker, CurrencyPair.BTC_CNY);

    assertThat(adaptedTicker.getAsk()).isEqualTo("3524.07");
    assertThat(adaptedTicker.getBid()).isEqualTo("3517.13");
    assertThat(adaptedTicker.getLow()).isEqualTo("3480.07");
    assertThat(adaptedTicker.getHigh()).isEqualTo("3584.97");
    assertThat(adaptedTicker.getLast()).isEqualTo("3524.07");
    assertThat(adaptedTicker.getVolume()).isEqualTo("5964.7677");
    assertThat(adaptedTicker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_CNY);
  }
View Full Code Here


    super.addListener(new CoinsetterExchangeAdapter() {

      @Override
      public void onTicker(CoinsetterTicker coinsetterTicker) {

        Ticker ticker = CoinsetterAdapters.adaptTicker(coinsetterTicker);
        putEvent(new DefaultExchangeEvent(ExchangeEventType.TICKER, null, ticker));
      }

      @Override
      public void onDepth(CoinsetterPair[] depth) {
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosTicker.class);
    VosResponse<VosTicker> VaultOfSatoshiTicker = mapper.readValue(is, type);

    Ticker ticker = VaultOfSatoshiAdapters.adaptTicker(VaultOfSatoshiTicker.getData(), CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("684.00000000");
    assertThat(ticker.getLow().toString()).isEqualTo("601.00000000");
    assertThat(ticker.getHigh().toString()).isEqualTo("686.50000000");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("29.32450256"));
    assertThat(ticker.getCurrencyPair().baseSymbol).isEqualTo("BTC");

  }
View Full Code Here

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

    PoloniexTicker poloniexTicker = getPoloniexTicker(currencyPair);
    Ticker ticker = PoloniexAdapters.adaptPoloniexTicker(poloniexTicker, currencyPair);
    return ticker;
  }
View Full Code Here

  @Test
  public void testAdaptTicker() throws JsonParseException, JsonMappingException, IOException {

    CoinsetterTicker coinsetterTicker = ObjectMapperHelper.readValue(getClass().getResource("dto/marketdata/ticker.json"), CoinsetterTicker.class);
    Ticker ticker = CoinsetterAdapters.adaptTicker(coinsetterTicker);
    assertEquals(CurrencyPair.BTC_USD, ticker.getCurrencyPair());
    assertEquals(1392947181242L, ticker.getTimestamp().getTime());
    assertEquals(new BigDecimal("10.0"), ticker.getBid());
    assertEquals(new BigDecimal("12.0"), ticker.getAsk());
    assertEquals(new BigDecimal("10.0"), ticker.getLast());
    assertEquals(new BigDecimal("35.5"), ticker.getVolume());
  }
View Full Code Here

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

    Ticker ticker = VirtExAdapters.adaptTicker(VirtExTicker.getTicker(), CurrencyPair.BTC_CAD);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("545.060000000");
    assertThat(ticker.getLow().toString()).isEqualTo("538.000000000");
    assertThat(ticker.getHigh().toString()).isEqualTo("574.000000000");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("284.231600000"));

    assertThat(ticker.getCurrencyPair().baseSymbol).isEqualTo("BTC");

  }
View Full Code Here

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

    Ticker ticker = VirtExAdapters.adaptTicker(VirtExTicker, CurrencyPair.BTC_CAD);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("12.32900");
    assertThat(ticker.getLow().toString()).isEqualTo("11.64001");
    assertThat(ticker.getHigh().toString()).isEqualTo("12.37989");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("1866.56"));
    assertThat(ticker.getCurrencyPair().baseSymbol).isEqualTo("BTC");

  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    KrakenTickerResult krakenTicker = mapper.readValue(is, KrakenTickerResult.class);
    CurrencyPair currencyPair = CurrencyPair.BTC_EUR;
    String krakenCurencyPair = "XXBTZEUR";
    Ticker ticker = KrakenAdapters.adaptTicker(krakenTicker.getResult().get(krakenCurencyPair), currencyPair);

    // Verify that the example data was unmarshalled correctly
    assertThat(ticker.getAsk()).isEqualTo(new BigDecimal("562.26651"));
    assertThat(ticker.getBid()).isEqualTo(new BigDecimal("560.46600"));
    assertThat(ticker.getLow()).isEqualTo(new BigDecimal("560.00000"));
    assertThat(ticker.getHigh()).isEqualTo(new BigDecimal("591.11000"));
    assertThat(ticker.getLast()).isEqualTo(new BigDecimal("560.87711"));
    assertThat(ticker.getVolume()).isEqualByComparingTo("600.91850325");
    assertThat(ticker.getCurrencyPair().baseSymbol).isEqualTo(currencyPair.baseSymbol);
  }
View Full Code Here

    for (int i = 1; i <= noMDEntries; i++) {
      Group group = message.getGroup(i, NoMDEntries.FIELD);
      adapt(tickerBuilder, group);
    }

    Ticker ticker = tickerBuilder.build();
    return ticker;
  }
View Full Code Here

  @Test
  public void testAdaptTicker() throws JSONException, IOException {

    JSONObject jsonObject = new JSONObject(IOUtils.toString(getClass().getResource("ticker.json"), Charsets.UTF_8));
    Ticker ticker = BTCChinaJSONObjectAdapters.adaptTicker(jsonObject);
    assertEquals(new BigDecimal("90604.96"), ticker.getVolume());
    assertEquals(new BigDecimal("25.96"), ticker.getLast());
    assertEquals(new BigDecimal("26.1"), ticker.getAsk());
    assertEquals(new BigDecimal("25.94"), ticker.getBid());
    assertEquals(new BigDecimal("27.41"), ticker.getHigh());
    assertEquals(1411924391000L, ticker.getTimestamp().getTime());
    assertEquals(new BigDecimal("25.8"), ticker.getLow());
    assertEquals(CurrencyPair.LTC_CNY, ticker.getCurrencyPair());
  }
View Full Code Here

TOP

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

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.