@Override protected final void applyAsk(final MDEntry entry) { final int lvl = entry.getMdPriceLevel() - 1; switch (entry.getMdUpdateAction()) { case New: { _tmpEntry.set(entry.getMdEntrySize(), entry.getMdEntryPx()); _book.insertAsk(lvl, _tmpEntry); } break; case Change: { final double px = entry.getMdEntryPx(); if (px != Constants.UNSET_DOUBLE) { _tmpEntry.set(entry.getMdEntrySize(), px); _book.setAsk(lvl, _tmpEntry); } else { _book.setAskQty(lvl, entry.getMdEntrySize()); } } break; case Delete: { _book.deleteAsk(lvl); } break; case DeleteThru: _book.deleteThruAsk(lvl); break; case DeleteFrom: _book.deleteFromAsk(lvl); break; case Overlay: { final int qty = entry.getMdEntrySize(); if (qty != Constants.UNSET_INT) { _tmpEntry.set(qty, entry.getMdEntryPx()); _book.setAsk(lvl, _tmpEntry); } else { _book.setAskPrice(lvl, entry.getMdEntryPx()); } } break; case Unknown: break; } }
@Override protected final void applyBid(final MDEntry entry) { final int lvl = entry.getMdPriceLevel() - 1; switch (entry.getMdUpdateAction()) { case New: { _tmpEntry.set(entry.getMdEntrySize(), entry.getMdEntryPx()); _book.insertBid(lvl, _tmpEntry); } break; case Change: { // should be used ONLY for qty change, but CME use for price setting as well final double px = entry.getMdEntryPx(); if (px != Constants.UNSET_DOUBLE) { _tmpEntry.set(entry.getMdEntrySize(), px); _book.setBid(lvl, _tmpEntry); } else { _book.setBidQty(lvl, entry.getMdEntrySize()); } } break; case Delete: { _book.deleteBid(lvl); } break; case DeleteThru: _book.deleteThruBid(lvl); break; case DeleteFrom: _book.deleteFromBid(lvl); break; case Overlay: { final int qty = entry.getMdEntrySize(); if (qty != Constants.UNSET_INT) { _tmpEntry.set(qty, entry.getMdEntryPx()); _book.setBid(lvl, _tmpEntry); } else { _book.setBidPrice(lvl, entry.getMdEntryPx()); } } break; case Unknown: break; } }