org.knowm.xchange.dto.marketdata.OrderBook.getAsks()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.knowm.xchange.dto.marketdata.OrderBook.getAsks()方法的一些代码示例,展示了OrderBook.getAsks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OrderBook.getAsks()方法的具体详情如下:
包路径:org.knowm.xchange.dto.marketdata.OrderBook
类名称:OrderBook
方法名:getAsks

OrderBook.getAsks介绍

暂无

代码示例

代码示例来源:origin: knowm/XChange

private static void generic(Exchange exchange) throws IOException {
 // Interested in the public market data feed (no authentication).
 MarketDataService marketDataService = exchange.getMarketDataService();
 // Get the order book data for BTC/CNY.
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_CNY);
 System.out.println(orderBook);
 System.out.println("asks: " + orderBook.getAsks());
 System.out.println("bids: " + orderBook.getBids());
 System.out.println("size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

public static void generic(MarketDataService marketDataService) throws IOException {
 /* get OrderBook data */
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.ETH_EUR);
 //    System.out.println(orderBook.toString());
 System.out.println(
   "Current Order Book size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 //    System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for ETH/BTC
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.ETH_BTC);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for CurrencyPair.BTC_USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD, 10000, 10000);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(Exchange exchange) throws IOException {
 MarketDataService marketDataService = exchange.getMarketDataService();
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.LTC_USD, "LIVE");
 System.out.println(orderBook.toString());
 System.out.println("size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
 orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD, "DEMO");
 System.out.println(orderBook.toString());
 System.out.println("size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
 orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
 System.out.println(orderBook.toString());
 System.out.println("size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_EUR);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 //    System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD, 3);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/CAD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD, 3);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/BRL
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_BRL);
 System.out.println(
   "Current Order Book size for BTC / BRL: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for ETH/USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.ETH_USD);
 System.out.println(
   "Current Order Book size for ETH / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for BTC/USD
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
 System.out.println(
   "Current Order Book size for BTC / USD: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(MarketDataService marketDataService) throws IOException {
 // Get the latest order book data for LTC/BRL
 OrderBook orderBook =
   marketDataService.getOrderBook(new CurrencyPair(Currency.LTC, Currency.BRL));
 System.out.println(
   "Current Order Book size for LTC / BRL: "
     + (orderBook.getAsks().size() + orderBook.getBids().size()));
 System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
 System.out.println(
   "Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
 System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
 System.out.println(
   "Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
 System.out.println(orderBook.toString());
}

代码示例来源:origin: knowm/XChange

private static void generic(Exchange lakebtcExchange) throws IOException {
 MarketDataService marketDataService = lakebtcExchange.getMarketDataService();
 // Get the latest full order book data for NMC/XRP
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
 // Get the latest partial size order book data for NMC/XRP
 orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_CNY);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

private static void generic(Exchange krakenExchange) throws IOException {
 // Interested in the public market data feed (no authentication)
 MarketDataService krakenMarketDataService = krakenExchange.getMarketDataService();
 // Get the latest full order book data for NMC/XRP
 OrderBook orderBook = krakenMarketDataService.getOrderBook(CurrencyPair.BTC_EUR);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
 // Get the latest partial size order book data for NMC/XRP
 orderBook = krakenMarketDataService.getOrderBook(CurrencyPair.BTC_EUR, 3L);
 System.out.println(orderBook.toString());
 System.out.println(
   "partial orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

private static void generic(Exchange quoineExchange) throws IOException {
 // Interested in the public market data feed (no authentication)
 MarketDataService quoineMarketDataService = quoineExchange.getMarketDataService();
 // Get the latest full order book data for NMC/XRP
 OrderBook orderBook = quoineMarketDataService.getOrderBook(CurrencyPair.BTC_USD);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

private static void generic(Exchange okcoinExchange) throws IOException {
 // Interested in the public market data feed (no authentication)
 MarketDataService marketDataService = okcoinExchange.getMarketDataService();
 // Get the latest full order book data for NMC/XRP
 OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_CNY);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

private static void generic(final Exchange liquiExchange) throws IOException {
 final MarketDataService marketDataService = liquiExchange.getMarketDataService();
 final OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.LTC_BTC);
 System.out.println(orderBook.toString());
 System.out.println(
   "full orderbook size: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
}

代码示例来源:origin: knowm/XChange

public static void main(String[] args) throws IOException {
  Exchange coingi = CoingiDemoUtils.createExchange();

  MarketDataService marketDataService = coingi.getMarketDataService();
  OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_EUR);

  // The following example limits max asks to 10, max bids to 10, and market depth to 32
  // OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_EUR, 10, 10, 32);

  List<LimitOrder> asks = orderBook.getAsks();
  List<LimitOrder> bids = orderBook.getBids();

  asks.forEach(System.out::println);
  bids.forEach(System.out::println);

  System.out.printf(
    "Received an order book with the latest %d asks and %d bids.\n", asks.size(), bids.size());
 }
}

代码示例来源:origin: knowm/XChange

public static void main(String[] args) throws IOException {

  // Use the factory to get the version 2 MtGox exchange API using default settings
  Exchange anx = ANXExamplesUtils.createExchange();

  // Interested in the public market data feed (no authentication)
  MarketDataService marketDataService = anx.getMarketDataService();

  // Get the current orderbook
  OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);

  System.out.println(
    "Current Order Book size for BTC / USD: "
      + (orderBook.getAsks().size() + orderBook.getBids().size()));

  System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());

  System.out.println("First Bid: " + orderBook.getBids().get(0).toString());

  System.out.println(orderBook.toString());
 }
}

相关文章