/** * Get the message id used for the event at the given level of the ask book. * * @param inOrderbook an <code>OrderBook</code> value * @param inLevel an <code>int</code> value * @return a <code>long</code> value */ private long getAskIdFor(OrderBook inOrderbook, int inLevel) { return inOrderbook.getAskBook().get(inLevel-1).getMessageId(); } /**
/** * Create a new TopOfBook instance. * * @param inBidEvent a <code>BidEvent</code> value or <code>null</code> * @param inAskEvent an <code>AskEvent</code> value or <code>null</code> * @throws IllegalArgumentException if both the <code>BidEvent</code> and <code>AskEvent</code> * are specified but are not events for the same <code>Instrument</code> */ TopOfBook(BidEvent inBidEvent, AskEvent inAskEvent) { super(inBidEvent, inAskEvent); if(inBidEvent != null && inAskEvent != null) { if(!inBidEvent.getInstrument().equals(inAskEvent.getInstrument())) { throw new IllegalArgumentException(); } } } /**
AskEvent ask = askIterator.next(); StringBuilder entry = new StringBuilder(); entry.append(ask.getPrice()).append(" ").append(ask.getSize()); //$NON-NLS-1$ if(inShowExchange) { entry.append(" ").append(ask.getExchange()); //$NON-NLS-1$
"Examining {}", //$NON-NLS-1$ ask); BigDecimal askPrice = ask.getPrice(); BigDecimal askSize = ask.getSize(); bidCorrection.setEventType(EventType.UPDATE_FINAL); askCorrection = QuoteEventBuilder.delete(ask); askCorrection.setEventType(EventType.UPDATE_FINAL); } else { new Date(tradeTime), askSize.subtract(tradeSize)); askCorrection.setEventType(EventType.UPDATE_FINAL);
throw new IllegalArgumentException("Insufficient liquidity to peg-to-midpoint for " + newOrReplaceOrder.getInstrument().getFullSymbol()); BigDecimal totalPrice = bid.getPrice().add(ask.getPrice()); BigDecimal newPrice = totalPrice.divide(new BigDecimal(2)).setScale(6,RoundingMode.HALF_UP); newOrReplaceOrder.setPrice(newPrice);
getLatestUnderlyingBid().getPrice(), getLatestUnderlyingBid().getExchange())).append(nl); builder.append(ASK).append(getLatestUnderlyingAsk() == null ? none : String.format("%s %s %s", //$NON-NLS-1$ //$NON-NLS-2$ getLatestUnderlyingAsk().getSize(), getLatestUnderlyingAsk().getPrice(), getLatestUnderlyingAsk().getExchange())).append(nl); put.getLatestAsk() != null) { AskEvent ask = put.getLatestAsk(); table.addCell(ask.getSize().toPlainString()); table.addCell(String.format("%s %s", //$NON-NLS-1$ ask.getPrice().toPlainString(), ask.getExchange())); } else { table.addCell(none); call.getLatestAsk() != null) { AskEvent ask = call.getLatestAsk(); table.addCell(ask.getSize().toPlainString()); table.addCell(String.format("%s %s", //$NON-NLS-1$ ask.getPrice().toPlainString(), ask.getExchange())); } else { table.addCell(none);
/** * Get the message id used for the event at the given level of the ask book. * * @param inOrderbook an <code>OrderBook</code> value * @param inLevel an <code>int</code> value * @return a <code>long</code> value */ private long getAskIdFor(OrderBook inOrderbook, int inLevel) { return inOrderbook.getAskBook().get(inLevel-1).getMessageId(); } /**