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

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

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

OrderBook.<init>介绍

[英]Constructor
[中]建造师

代码示例

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

public static OrderBook adaptOrderBook(
  CoinbeneOrderBook.Container response, CurrencyPair currencyPair) {
 CoinbeneOrderBook orders = response.getOrderBook();
 List<LimitOrder> asks = new LinkedList<>();
 orders.getAsks().forEach(order -> asks.add(adaptOrder(currencyPair, OrderType.ASK, order)));
 List<LimitOrder> bids = new LinkedList<>();
 orders.getBids().forEach(order -> bids.add(adaptOrder(currencyPair, OrderType.BID, order)));
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptBitcointoyouOrderBook(
  BitcointoyouOrderBook depth, CurrencyPair currencyPair) {
 List<LimitOrder> asks =
   adaptBitcointoyouPublicOrders(depth.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids =
   adaptBitcointoyouPublicOrders(depth.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(new Date(), asks, bids);
}

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

public static OrderBook adaptOrderBook(
  BTCMarketsOrderBook btcmarketsOrderBook, CurrencyPair currencyPair) {
 List<LimitOrder> asks =
   createOrders(Order.OrderType.ASK, btcmarketsOrderBook.getAsks(), currencyPair);
 List<LimitOrder> bids =
   createOrders(Order.OrderType.BID, btcmarketsOrderBook.getBids(), currencyPair);
 Collections.sort(bids, BID_COMPARATOR);
 Collections.sort(asks, ASK_COMPARATOR);
 return new OrderBook(btcmarketsOrderBook.getTimestamp(), asks, bids);
}

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

public static OrderBook adaptOrderBook(BTCTradeDepth btcTradeDepth, CurrencyPair currencyPair) {
 List<LimitOrder> asks = adaptLimitOrders(btcTradeDepth.getAsks(), currencyPair, OrderType.ASK);
 Collections.reverse(asks);
 List<LimitOrder> bids = adaptLimitOrders(btcTradeDepth.getBids(), currencyPair, OrderType.BID);
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(
  QuadrigaCxOrderBook quadrigacxOrderBook, CurrencyPair currencyPair, int timeScale) {
 List<LimitOrder> asks =
   createOrders(currencyPair, Order.OrderType.ASK, quadrigacxOrderBook.getAsks());
 List<LimitOrder> bids =
   createOrders(currencyPair, Order.OrderType.BID, quadrigacxOrderBook.getBids());
 Date date =
   new Date(
     quadrigacxOrderBook.getTimestamp()
       * timeScale); // polled order books provide a timestamp in seconds, stream in ms
 return new OrderBook(date, asks, bids);
}

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

public static OrderBook adaptOrderBook(GeminiDepth btceDepth, CurrencyPair currencyPair) {
 OrdersContainer asksOrdersContainer =
   adaptOrders(btceDepth.getAsks(), currencyPair, OrderType.ASK);
 OrdersContainer bidsOrdersContainer =
   adaptOrders(btceDepth.getBids(), currencyPair, OrderType.BID);
 return new OrderBook(
   new Date(Math.max(asksOrdersContainer.getTimestamp(), bidsOrdersContainer.getTimestamp())),
   asksOrdersContainer.getLimitOrders(),
   bidsOrdersContainer.getLimitOrders());
}

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

public static OrderBook adaptOrderBook(BitfinexDepth btceDepth, CurrencyPair currencyPair) {
 OrdersContainer asksOrdersContainer =
   adaptOrders(btceDepth.getAsks(), currencyPair, OrderType.ASK);
 OrdersContainer bidsOrdersContainer =
   adaptOrders(btceDepth.getBids(), currencyPair, OrderType.BID);
 return new OrderBook(
   new Date(Math.max(asksOrdersContainer.getTimestamp(), bidsOrdersContainer.getTimestamp())),
   asksOrdersContainer.getLimitOrders(),
   bidsOrdersContainer.getLimitOrders());
}

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

public static OrderBook adaptOrderBook(
  CoinbaseProProductBook book, CurrencyPair currencyPair, Date date) {
 List<LimitOrder> asks = toLimitOrderList(book.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids = toLimitOrderList(book.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(date, asks, bids);
}

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

public static OrderBook adaptOrderBook(FCoinDepth depth, CurrencyPair currencyPair) {
 Stream<LimitOrder> asks =
   adaptLimitOrders(Order.OrderType.ASK, depth.getAsks(), depth.getTs(), currencyPair)
     .sorted();
 Stream<LimitOrder> bids =
   adaptLimitOrders(Order.OrderType.BID, depth.getBids(), depth.getTs(), currencyPair)
     .sorted();
 return new OrderBook(depth.getTs(), asks, bids);
}

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

public static OrderBook adaptOrderBook(LivecoinOrderBook book, CurrencyPair currencyPair) {
 List<LimitOrder> asks = toLimitOrderList(book.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids = toLimitOrderList(book.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(OkCoinDepth depth, CurrencyPair currencyPair) {
 Stream<LimitOrder> asks =
   adaptLimitOrders(OrderType.ASK, depth.getAsks(), depth.getTimestamp(), currencyPair)
     .sorted();
 Stream<LimitOrder> bids =
   adaptLimitOrders(OrderType.BID, depth.getBids(), depth.getTimestamp(), currencyPair)
     .sorted();
 return new OrderBook(depth.getTimestamp(), asks, bids);
}

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

public static OrderBook adaptPoloniexDepth(PoloniexDepth depth, CurrencyPair currencyPair) {
 List<LimitOrder> asks = adaptPoloniexPublicOrders(depth.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids = adaptPoloniexPublicOrders(depth.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(
  LakeBTCOrderBook lakeBTCOrderBook, CurrencyPair currencyPair) {
 return new OrderBook(
   null,
   transformArrayToLimitOrders(lakeBTCOrderBook.getAsks(), OrderType.ASK, currencyPair),
   transformArrayToLimitOrders(lakeBTCOrderBook.getBids(), OrderType.BID, currencyPair));
}

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

public static OrderBook adaptOrderBook(BankeraOrderBook orderbook, CurrencyPair currencyPair) {
 List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, orderbook.getBids());
 List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, orderbook.getAsks());
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(YoBitOrderBook book, CurrencyPair currencyPair) {
 List<LimitOrder> asks = toLimitOrderList(book.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids = toLimitOrderList(book.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(ZaifFullBook book, CurrencyPair currencyPair) {
 List<LimitOrder> asks = toLimitOrderList(book.getAsks(), Order.OrderType.ASK, currencyPair);
 List<LimitOrder> bids = toLimitOrderList(book.getBids(), Order.OrderType.BID, currencyPair);
 return new OrderBook(null, asks, bids);
}

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

@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
 VircurexDepth vircurexDepth = getVircurexOrderBook(currencyPair);
 // Adapt to XChange DTOs
 List<LimitOrder> asks =
   VircurexAdapters.adaptOrders(vircurexDepth.getAsks(), currencyPair, "ask", "");
 List<LimitOrder> bids =
   VircurexAdapters.adaptOrders(vircurexDepth.getBids(), currencyPair, "bid", "");
 return new OrderBook(null, asks, bids);
}

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

@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
 ItBitDepth depth = getItBitDepth(currencyPair, args);
 List<LimitOrder> asks = ItBitAdapters.adaptOrders(depth.getAsks(), currencyPair, OrderType.ASK);
 List<LimitOrder> bids = ItBitAdapters.adaptOrders(depth.getBids(), currencyPair, OrderType.BID);
 return new OrderBook(null, asks, bids);
}

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

public static OrderBook adaptOrderBook(
  CoinoneOrderBook coinoneOrderBook, CurrencyPair currencyPair) {
 if (!"0".equals(coinoneOrderBook.getErrorCode())) {
  throw new CoinoneException(coinoneOrderBook.getResult());
 }
 List<LimitOrder> asks =
   adaptMarketOrderToLimitOrder(coinoneOrderBook.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids =
   adaptMarketOrderToLimitOrder(coinoneOrderBook.getBids(), OrderType.BID, currencyPair);
 return new OrderBook(
   DateUtils.fromMillisUtc(Long.valueOf(coinoneOrderBook.getTimestamp()) * 1000), asks, bids);
}

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

@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
 LunoOrderBook ob = lunoAPI.orderbook(LunoUtil.toLunoPair(currencyPair));
 return new OrderBook(
   ob.getTimestamp(),
   convert(ob.getAsks(), currencyPair, OrderType.ASK),
   convert(ob.getBids(), currencyPair, OrderType.BID));
}

相关文章