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

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


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

    verifyPriceWindow(orderbookwindow);

    // Request data
    BitcoiniumOrderbook bitcoiniumDepth = bitcoinium.getDepth(pair, orderbookwindow, exchangeSpecification.getApiKey());

    return bitcoiniumDepth;
  }
View Full Code Here


    else {
      throw new ExchangeException("Exactly 1 String arguments is necessary: the priceWindow!");
    }

    // Request data
    BitcoiniumOrderbook bitcoiniumOrderbook = getBitcoiniumOrderbook(currencyPair.baseSymbol, currencyPair.counterSymbol, priceWindow);

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

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

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

    OrderBook orderBook = BitcoiniumAdapters.adaptOrderbook(bitcoiniumDepth, CurrencyPair.BTC_USD);

    // Verify all fields filled
    assertThat(orderBook.getAsks().get(0).getLimitPrice()).isEqualTo(new BigDecimal("522.9"));
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    // mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    BitcoiniumOrderbook bitcoiniumOrderbook = mapper.readValue(is, BitcoiniumOrderbook.class);

    // Verify that the example data was unmarshalled correctly
    assertThat(bitcoiniumOrderbook.getBitcoiniumTicker().getVolume()).isEqualTo(new BigDecimal("5787"));
    assertThat(bitcoiniumOrderbook.getBids()[0].getVolume()).isEqualTo(new BigDecimal("1.55"));
  }
View Full Code Here

  private void updateData() throws IOException {

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

    System.out.println(bitcoiniumOrderbook.toString());

    // build ticker history chart series data
    // Bids Series

    List<Float> bidsPriceData = getPriceData(bitcoiniumOrderbook.getBids());
    Collections.reverse(bidsPriceData);
    List<Float> bidsVolumeData = getVolumeData(bitcoiniumOrderbook.getBids());
    Collections.reverse(bidsVolumeData);

    xAxisBidData = bidsPriceData;
    yAxisBidData = bidsVolumeData;

    // Asks Series
    xAxisAskData = getPriceData(bitcoiniumOrderbook.getAsks());
    yAxisAskData = getVolumeData(bitcoiniumOrderbook.getAsks());

    // /////////////////////////////////
  }
View Full Code Here

    BitcoiniumMarketDataServiceRaw bitcoiniumMarketDataService = (BitcoiniumMarketDataServiceRaw) bitcoiniumExchange.getPollingMarketDataService();

    System.out.println("fetching data...");

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

    System.out.println("Order book: " + bitcoiniumOrderbook);
    System.out.println("received data.");

    System.out.println("plotting...");

    // Create Chart
    Chart chart = new Chart(800, 500);

    // Customize Chart
    chart.setChartTitle("Bitcoinium Order Book - BITSTAMP_BTC_USD");
    chart.setYAxisTitle("BTC");
    chart.setXAxisTitle("USD");
    chart.getStyleManager().setChartType(ChartType.Area);

    // BIDS

    // Collections.reverse(bitcoiniumOrderbook.getBidPriceList());
    // Collections.reverse(bitcoiniumOrderbook.getBidVolumeList());

    // Bids Series
    List<Float> bidsPriceData = getPriceData(bitcoiniumOrderbook.getBids());
    Collections.reverse(bidsPriceData);
    List<Float> bidsVolumeData = getVolumeData(bitcoiniumOrderbook.getBids());
    Collections.reverse(bidsVolumeData);

    Series series = chart.addSeries("bids", bidsPriceData, bidsVolumeData);
    series.setMarker(SeriesMarker.NONE);

    // ASKS

    // Asks Series
    series = chart.addSeries("asks", getPriceData(bitcoiniumOrderbook.getAsks()), getVolumeData(bitcoiniumOrderbook.getAsks()));
    series.setMarker(SeriesMarker.NONE);

    new SwingWrapper(chart).displayChart();
  }
View Full Code Here

    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.BitcoiniumOrderbook

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.