private void validateTicksize(Instrument instrument, double price) { TickType ts = instrument.getTickscale(); if (ts.canVerifyPrice()) { if (!ts.isValid(price)) { delim().append(INVALID_PRICE); ts.writeError(price, _err); } } else { ReusableString msg = TLC.instance().pop(); msg.append(MISSING_TICK).append(instrument.getRIC()); _log.warn(msg); TLC.instance().pushback(msg); } }
private void commonValidation(Exchange ex, OrderRequest req, Order order, long now) { if (req.getClOrdId().length() == 0) addError(MISSING_CLORDID); validateHandlingInstruction(req.getHandlInst()); validateAge(req.getTransactTime(), now); Instrument inst = req.getInstrument(); final ViewString exDest = req.getExDest(); final ViewString secEx = req.getSecurityExchange(); final double price = order.getPendingVersion().getMarketPrice(); if (exDest.length() > 0 && !ex.getRecCode().equals(exDest)) { delim() .append(EXDEST_MISMATCH) .append(exDest) .append(Strings.EXPECTED) .append(ex.getRecCode()); } if (secEx.length() > 0 && !ex.getRecCode().equals(secEx)) { delim().append(SECEX_MISMATCH).append(secEx).append(Strings.EXPECTED).append(ex.getRecCode()); } validateTicksize(inst, price); if (inst.isRestricted() && !canTradeRestricted(req.getClient(), req.getBookingType(), req.getOrderCapacity())) { delim() .append(RESTRICTED) .append(req.getBookingType()) .append(Strings.ORDCAP) .append(req.getOrderCapacity()); } if (!inst.isEnabled()) { delim().append(INSTRUMENT_DISABLED).append(inst.getRIC()); } TradingRange band = inst.getValidTradingRange(); band.valid(price, req.getSide().getIsBuySide(), _err); }