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

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

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

OrderBook.<init>介绍

暂无

代码示例

代码示例来源:origin: com.xeiam.xchange/xchange-loyalbit

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

代码示例来源:origin: com.xeiam.xchange/xchange-btccentral

/**
 * @param marketDepth
 * @param currencyPair
 * @return new order book
 */
public static OrderBook adaptMarketDepth(BTCCentralMarketDepth marketDepth, CurrencyPair currencyPair) {
 List<LimitOrder> asks = adaptMarketOrderToLimitOrder(marketDepth.getAsks(), OrderType.ASK, currencyPair);
 List<LimitOrder> bids = adaptMarketOrderToLimitOrder(marketDepth.getBids(), OrderType.BID, currencyPair);
 Collections.reverse(bids);
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-huobi

public static OrderBook adaptOrderBook(BitVcFuturesDepth depth, CurrencyPair currencyPair) {
 List<LimitOrder> asks = adaptOrderBook(depth.getAsks(), ASK, currencyPair);
 List<LimitOrder> bids = adaptOrderBook(depth.getBids(), BID, currencyPair);
 // ask side is flipped
 Collections.sort(asks);
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitstamp

private OrderBook parseOrderBook(String rawJson) throws IOException {
 BitstampStreamingOrderBook bitstampOrderBook = streamObjectMapper.readValue(rawJson, BitstampStreamingOrderBook.class);
 List<LimitOrder> asks = BitstampAdapters.createOrders(CurrencyPair.BTC_USD, Order.OrderType.ASK, bitstampOrderBook.getAsks());
 List<LimitOrder> bids = BitstampAdapters.createOrders(CurrencyPair.BTC_USD, Order.OrderType.BID, bitstampOrderBook.getBids());
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-cryptsy

public static List<OrderBook> adaptPublicOrderBooks(Map<Integer, CryptsyPublicOrderbook> cryptsyOrderBooks) {
 List<OrderBook> orderBooks = new ArrayList<OrderBook>();
 for (CryptsyPublicOrderbook cryptsyOrderBook : cryptsyOrderBooks.values()) {
  CurrencyPair currencyPair = adaptCurrencyPair(cryptsyOrderBook.getLabel());
  List<LimitOrder> asks = adaptPublicOrders(cryptsyOrderBook.getSellOrders(), OrderType.ASK, currencyPair);
  List<LimitOrder> bids = adaptPublicOrders(cryptsyOrderBook.getBuyOrders(), OrderType.BID, currencyPair);
  orderBooks.add(new OrderBook(null, asks, bids));
 }
 return orderBooks;
}

代码示例来源:origin: com.xeiam.xchange/xchange-cavirtex

@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
 // Request data
 VirtExDepth virtExDepth = getVirtExOrderBook(currencyPair);
 // Adapt to XChange DTOs
 List<LimitOrder> asks = VirtExAdapters.adaptOrders(virtExDepth.getAsks(), currencyPair, "ask", "");
 Collections.reverse(asks);
 List<LimitOrder> bids = VirtExAdapters.adaptOrders(virtExDepth.getBids(), currencyPair, "bid", "");
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitso

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

代码示例来源:origin: com.xeiam.xchange/xchange-bitfinex

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: com.xeiam.xchange/xchange-kraken

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

代码示例来源:origin: com.xeiam.xchange/xchange-hitbtc

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

代码示例来源:origin: com.xeiam.xchange/xchange-mercadobitcoin

/**
 * Adapts a com.xeiam.xchange.mercadobitcoin.dto.marketdata.OrderBook to a OrderBook Object
 *
 * @param currencyPair (e.g. BTC/BRL or LTC/BRL)
 * @param timestamp When the book was retrieved from server.
 * @return The XChange OrderBook
 */
public static OrderBook adaptOrderBook(MercadoBitcoinOrderBook mercadoBitcoinOrderBook, CurrencyPair currencyPair) {
 List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, mercadoBitcoinOrderBook.getAsks());
 List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, mercadoBitcoinOrderBook.getBids());
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-huobi

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

代码示例来源:origin: com.xeiam.xchange/xchange-coinbaseex

public static OrderBook adaptOrderBook(CoinbaseExProductBook 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: com.xeiam.xchange/xchange-bitcointoyou

/**
 * Adapts a com.xeiam.xchange.bitcointoyou.dto.marketdata.OrderBook to a OrderBook Object
 *
 * @param currencyPair (e.g. BTC/BRL or LTC/BRL)
 * @param timestamp When the book was retrieved from server.
 * @return The XChange OrderBook
 */
public static OrderBook adaptOrderBook(BitcoinToYouOrderBook bitcoinToYouOrderBook, CurrencyPair currencyPair) {
 List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, bitcoinToYouOrderBook.getAsks());
 List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, bitcoinToYouOrderBook.getBids());
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitkonan

public static OrderBook adaptOrderBook(BitKonanOrderBook bitKonanOrderBook, CurrencyPair pair) {
 // only BTCUSD available at BitKonan
 List<LimitOrder> asks = adaptMarketOrderToLimitOrder(bitKonanOrderBook.getAsks(), OrderType.ASK, pair);
 List<LimitOrder> bids = adaptMarketOrderToLimitOrder(bitKonanOrderBook.getBids(), OrderType.BID, pair);
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitfloor

/**
 * Adapts a com.xeiam.xchange.bitfloor.api.model.OrderBook to a OrderBook Object
 */
public static OrderBook adaptOrders(BitfloorOrderBook bitfloorOrderBook, String currency, String tradableIdentifier) {
 List<LimitOrder> asks = createOrders(tradableIdentifier, currency, Order.OrderType.ASK, bitfloorOrderBook.getAsks());
 List<LimitOrder> bids = createOrders(tradableIdentifier, currency, Order.OrderType.BID, bitfloorOrderBook.getBids());
 return new OrderBook(asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-mexbt

public static OrderBook adaptOrderBook(CurrencyPair currencyPair, MeXBTOrderBook meXBTOrderBook) {
 final List<LimitOrder> asks = new ArrayList<LimitOrder>(meXBTOrderBook.getAsks().length);
 final List<LimitOrder> bids = new ArrayList<LimitOrder>(meXBTOrderBook.getBids().length);
 for (final BigDecimal[] order : meXBTOrderBook.getAsks()) {
  asks.add(new LimitOrder.Builder(OrderType.ASK, currencyPair).limitPrice(order[0]).tradableAmount(order[1]).build());
 }
 for (final BigDecimal[] order : meXBTOrderBook.getBids()) {
  bids.add(new LimitOrder.Builder(OrderType.BID, currencyPair).limitPrice(order[0]).tradableAmount(order[1]).build());
 }
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitcurex

@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
 // get data
 BitcurexDepth bitcurexDepth = getBitcurexOrderBook(currencyPair.counterSymbol);
 // Adapt to XChange DTOs
 List<LimitOrder> asks = BitcurexAdapters.adaptOrders(bitcurexDepth.getAsks(), currencyPair, OrderType.ASK, "");
 List<LimitOrder> bids = BitcurexAdapters.adaptOrders(bitcurexDepth.getBids(), currencyPair, OrderType.BID, "");
 return new OrderBook(null, asks, bids);
}

代码示例来源:origin: com.xeiam.xchange/xchange-taurus

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

代码示例来源:origin: com.xeiam.xchange/xchange-mtgox

@Override
public OrderBook getFullOrderBook(String tradableIdentifier, String currency) {
 verify(tradableIdentifier, currency);
 MtGoxDepth mtgoxFullDepth = mtGoxV1.getFullDepth(tradableIdentifier, currency);
 // Adapt to XChange DTOs
 List<LimitOrder> asks = MtGoxAdapters.adaptOrders(mtgoxFullDepth.getAsks(), currency, "ask", "");
 List<LimitOrder> bids = MtGoxAdapters.adaptOrders(mtgoxFullDepth.getBids(), currency, "bid", "");
 return new OrderBook(null, asks, bids);
}

相关文章