// Roll session if needed
final MarketBarType type = market.ensureBar(date);
final MarketBookTop top = market.get(MarketField.BOOK_TOP);
final MarketDoBar bar = market.loadBar(type.field);
switch (param) {
case TRADE_ASK_PRICE:
market.setTrade(ddfSession.type, ddfSession.session,
ddfSession.sequencing, price, size, time, date);
return null;
case TRADE_BID_PRICE:
market.setTrade(ddfSession.type, ddfSession.session,
ddfSession.sequencing, price, size, time, date);
return null;
case TRADE_LAST_PRICE:
market.setTrade(ddfSession.type, ddfSession.session,
ddfSession.sequencing, price, size, time, date);
return null;
case ASK_LAST:
case ASK_LAST_PRICE:
final DefBookEntry topAskPrice = new DefBookEntry(
MODIFY, Book.Side.ASK,
Book.Type.DEFAULT, ENTRY_TOP, price, top.side(Book.Side.ASK).sizeValue());
applyTop(topAskPrice, time, market);
return null;
case ASK_LAST_SIZE:
final DefBookEntry topAskSize = new DefBookEntry(
MODIFY, Book.Side.ASK,
Book.Type.DEFAULT, ENTRY_TOP, top.side(Book.Side.ASK).priceValue(), size);
applyTop(topAskSize, time, market);
return null;
case BID_LAST:
case BID_LAST_PRICE:
final DefBookEntry topBidPrice = new DefBookEntry(
MODIFY, Book.Side.BID,
Book.Type.DEFAULT, ENTRY_TOP, price, top.side(Book.Side.BID).sizeValue());
applyTop(topBidPrice, time, market);
return null;
case BID_LAST_SIZE:
final DefBookEntry topBidSize = new DefBookEntry(
MODIFY, Book.Side.BID,
Book.Type.DEFAULT, ENTRY_TOP, top.side(Book.Side.BID).priceValue(), size);
applyTop(topBidSize, time, market);
return null;
case CLOSE_LAST:
case CLOSE_2_LAST:
case CLOSE_ASK_PRICE:
case CLOSE_BID_PRICE:
case CLOSE_2_ASK_PRICE:
case CLOSE_2_BID_PRICE:
bar.set(MarketBarField.CLOSE, price);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
return null;
case HIGH_LAST_PRICE:
case HIGH_BID_PRICE:
case YEAR_HIGH_PRICE:
bar.set(MarketBarField.HIGH, price);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
return null;
case LOW_LAST_PRICE:
case LOW_ASK_PRICE:
case YEAR_LOW_PRICE:
bar.set(MarketBarField.LOW, price);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
return null;
case VOLUME_PAST_SIZE:
if (type == CURRENT) {
final MarketDoBar barPrevious = market.loadBar(PREVIOUS.field);
barPrevious.set(MarketBarField.VOLUME, size);
barPrevious.set(MarketBarField.BAR_TIME, time);
market.setBar(PREVIOUS, barPrevious);
}
return null;
case VOLUME_THIS_SIZE:
bar.set(MarketBarField.VOLUME, size);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
return null;
case OPEN_LAST_PRICE:
case OPEN_ASK_PRICE:
case OPEN_BID_PRICE:
case OPEN_2_LAST_PRICE:
case OPEN_2_ASK_PRICE:
case OPEN_2_BID_PRICE:
bar.set(MarketBarField.OPEN, price);
bar.set(MarketBarField.HIGH, price);
bar.set(MarketBarField.LOW, price);
bar.set(MarketBarField.CLOSE, price);
bar.set(MarketBarField.INTEREST, size);
bar.set(MarketBarField.VOLUME, size);
bar.set(MarketBarField.BAR_TIME, time);
bar.set(MarketBarField.SETTLE, ValueConst.NULL_PRICE);
bar.set(MarketBarField.IS_SETTLED, ValueConst.FALSE_BOOLEAN);
market.setBar(type, bar);
return null;
case INTEREST_LAST_SIZE:
bar.set(MarketBarField.INTEREST, size);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
return null;
case INTEREST_PAST_SIZE:
if (type == CURRENT) {
final MarketDoBar barPrevious = market.loadBar(PREVIOUS.field);
barPrevious.set(MarketBarField.INTEREST, size);
barPrevious.set(MarketBarField.BAR_TIME, time);
market.setBar(PREVIOUS, barPrevious);
}
return null;
case PREVIOUS_LAST_PRICE:
if (type == CURRENT) {
final MarketDoBar barPrevious = market.loadBar(PREVIOUS.field);
barPrevious.set(MarketBarField.CLOSE, price);
barPrevious.set(MarketBarField.BAR_TIME, time);
market.setBar(PREVIOUS, barPrevious);
}
return null;