final TimeValue time = message.getTime();
/** Update SETTLE State */
{
final PriceValue priceSettle = message.getPriceSettle();
if (isClear(priceSettle)) {
// ",-, " : means remove old value
//log.debug("Set State IS_SETTLED false inside visit
//MarketSnapshot because priceSettle is clear");
market.setState(MarketStateEntry.IS_SETTLED, false);
} else if (isEmpty(priceSettle)) {
// ",," : means leave alone
// no change of current value
} else {
// ",12345," : means replace with new value
//log.debug("Set State IS_SETTLED true inside visit
//MarketSnapshot because priceSettle is not empty");
market.setState(MarketStateEntry.IS_SETTLED, true);
}
}
/** Update top of book */
{
/* Update changed comonents */
market.setChange(Component.BOOK_COMBINED);
final PriceValue priceBid = message.getPriceBid();
final PriceValue priceAsk = message.getPriceAsk();
/** XXX note: {@link MarketBook#ENTRY_TOP} */
final MarketDoBookEntry entryBid = new DefBookEntry(
MODIFY, Book.Side.BID,
Book.Type.DEFAULT, ENTRY_TOP, priceBid, ValueConst.NULL_SIZE);
final MarketDoBookEntry entryAsk = new DefBookEntry(
MODIFY, Book.Side.ASK,
Book.Type.DEFAULT, ENTRY_TOP, priceAsk, ValueConst.NULL_SIZE);
applyTop(entryBid, time, market);
applyTop(entryAsk, time, market);
}
/** Update CURRENT bar */
{
/* Update changed comonents */
market.setChange(Component.DEFAULT_CURRENT);
final MarketBarType type = CURRENT;
final MarketDoBar bar = market.loadBar(type.field);
final DDF_TradeDay tradeDay = message.getTradeDay();
bar.set(MarketBarField.TRADE_DATE, tradeDay.tradeDate());
final PriceValue priceOpen = message.getPriceOpen();
final PriceValue priceHigh = message.getPriceHigh();
final PriceValue priceLow = message.getPriceLow();
final PriceValue priceClose = message.getPriceLast(); // XXX
final PriceValue priceSettle = message.getPriceSettle();
final SizeValue sizeVolume = message.getSizeVolume();
applyBar(bar, MarketBarField.OPEN, priceOpen);
applyBar(bar, MarketBarField.HIGH, priceHigh);
applyBar(bar, MarketBarField.LOW, priceLow);
applyBar(bar, MarketBarField.CLOSE, priceClose);
applyBar(bar, MarketBarField.SETTLE, priceSettle);
applyBar(bar, MarketBarField.VOLUME, sizeVolume);
bar.set(MarketBarField.BAR_TIME, time);
market.setBar(type, bar);
}
/** Update PREVIOUS bar */
{
/* Update changed comonents */
market.setChange(Component.DEFAULT_PREVIOUS);
final MarketBarType type = PREVIOUS;
final MarketDoBar bar = market.loadBar(type.field);
final PriceValue priceOpen = message.getPriceOpen();
final PriceValue priceHigh = message.getPriceHigh();
final PriceValue priceLow = message.getPriceLow();
final PriceValue priceClose = message.getPriceLastPrevious();
final PriceValue priceSettle = message.getPriceSettle();
final SizeValue sizeVolume = message.getSizeVolumePrevious();
final SizeValue sizeInterest = message.getSizeInterest(); // XXX
applyBar(bar, MarketBarField.OPEN, priceOpen);
applyBar(bar, MarketBarField.HIGH, priceHigh);