/** * Gets the <code>OrderStatus</code> for the given <code>OrderID</code>. * * <p>The given <code>OrderID</code> may be any part of the order chain. For example, if an order is replaced, * either the original <code>OrderID</code> or the current <code>OrderID</code> will return the same value, * although only the current <code>OrderID</code> is open. * * @param inOrderID an <code>OrderID</code> value or <code>null</code> if the given order cannot be found * @return an <code>OrderStatus</code> value */ protected final OrderStatus getOrderStatus(OrderID inOrderID) { ReportBase latestReport = orderHistoryManager.getLatestReportFor(inOrderID); if(latestReport == null) { return null; } return latestReport.getOrderStatus(); } /**
@Override protected boolean isLater(ReportHolder inHolder1, ReportHolder inHolder2) { boolean hasOrderID1 = inHolder1.getReport().getBrokerOrderID() != null; boolean hasOrderID2 = inHolder2.getReport().getBrokerOrderID() != null; if ((hasOrderID1 && hasOrderID2) || (!hasOrderID1 && !hasOrderID2)){ return super.isLater(inHolder1, inHolder2); } else { return hasOrderID1; } } }
private void updateOrderIDMappings(ReportBase inReport) { if (inReport.getOrderID() != null && inReport.getOriginalOrderID() != null) { OrderID origOrderID = inReport.getOriginalOrderID(); OrderID orderID = inReport.getOrderID(); OrderID groupID; // first check to see if the orig is in the map, and if so, use // whatever it maps to as the groupID if (mOrderIDToGroupMap.containsKey(origOrderID)){ groupID = getGroupID(origOrderID); } else { // otherwise, do a mapping from clOrdId -> origOrderID groupID = origOrderID; } mOrderIDToGroupMap.put(orderID, groupID); } }
@Override public int compare(ReportBase inLHS, ReportBase inRHS) { return new CompareToBuilder().append(inLHS.getSendingTime(),inRHS.getSendingTime()).append(inLHS.getReportID(),inRHS.getReportID()).toComparison(); } }
try { ReportID uniqueID = inReport.getReportID(); if(uniqueID == null) { SLF4JLoggerProxy.debug(this, "Recieved report without report id: {}", inReport); //$NON-NLS-1$ if(SLF4JLoggerProxy.isDebugEnabled(this) && inReport.getSendingTime() != null) { long sendingTime =0; sendingTime = inReport.getSendingTime().getTime(); long systemTime = System.currentTimeMillis(); double diff = (sendingTime-systemTime)/1000.0; && inReport.getOrderID() != null) { OrderID id = inReport.getOrderID(); OrderStatus status = inReport.getOrderStatus(); if (Originator.Server == ((ExecutionReport) inReport) .getOriginator()
ReportBase report = order.getLatestReport(); if(report != null && !handledOrders.contains(report.getOrderID())) { latestReportTable.addCell(order.getLatestReport().getOrderID().getValue()); latestReportTable.addCell(order.getLatestReport().getOrderStatus().name()); latestReportTable.addCell(DateUtils.dateToString(order.getLatestReport().getSendingTime())); latestReportTable.addCell(order.getOrderIdChain().toString()); latestReportTable.addCell(report instanceof ExecutionReport ? ((ExecutionReport)report).getSide().name() : none); latestReportTable.addCell(report instanceof ExecutionReport ? String.valueOf(((ExecutionReport)report).getOrderType()) : none); latestReportTable.addCell(report instanceof ExecutionReport ? String.valueOf(((ExecutionReport)report).getPrice()) : none); latestReportTable.addCell(order.getLatestReport().getText()); handledOrders.add(report.getOrderID()); 1); for(ReportBase report : openOrders.values()) { latestReportTable.addCell(report.getOrderID().getValue()); latestReportTable.addCell(report.getOrderStatus().name()); latestReportTable.addCell(DateUtils.dateToString(report.getSendingTime())); latestReportTable.addCell(report instanceof ExecutionReport ? ((ExecutionReport)report).getSide().name() : none); latestReportTable.addCell(report instanceof ExecutionReport ? String.valueOf(((ExecutionReport)report).getOrderQuantity()) : none); latestReportTable.addCell(report instanceof ExecutionReport ? String.valueOf(((ExecutionReport)report).getOrderType()) : none); latestReportTable.addCell(report instanceof ExecutionReport ? String.valueOf(((ExecutionReport)report).getPrice()) : none); latestReportTable.addCell(report.getText());
if(inReport.getOrderStatus() == null || inReport.getOrderID() == null) { Messages.SKIPPNG_MALFORMED_REPORT.warn(this, inReport); inReport); synchronized(orders) { OrderID actualOrderID = inReport.getOrderID(); OrderID originalOrderID = inReport.getOriginalOrderID(); if(inReport.getOrderStatus().isCancellable()) { inReport.getOrderID(), inReport.getOrderStatus(), history); openOrders.put(inReport.getOrderID(), (ExecutionReport)inReport); SLF4JLoggerProxy.debug(this, "{} represents a closed order ({}) updating live order list for {}", //$NON-NLS-1$ inReport.getOrderID(), inReport.getOrderStatus(), history); openOrders.remove(inReport.getOrderID()); if(inReport.getOriginalOrderID() != null) { SLF4JLoggerProxy.debug(this, "{} replaces {}, updating live order list", //$NON-NLS-1$ inReport.getOrderID(),
@Override public boolean matches(ReportBase item) { Originator originator = item.getOriginator(); Hierarchy hierarchy = item.getHierarchy(); if(item instanceof ExecutionReport) { ExecutionReport er = (ExecutionReport)item; ExecutionType executionType = er.getExecutionType(); return originator.forPositions() && hierarchy.forPositions() && executionType != null && executionType.isFill() && isValid(er); } else { return false; } }
/** * Adds the given <code>ReportBase</code> to the order history. * * @param inReport a <code>ReportBase</code> value */ private void add(ReportBase inReport) { orderHistory.addFirst(inReport); orderIdChain.add(inReport.getOrderID()); latestReport = inReport; } /**
@Override public int compare(ReportHolder o1, ReportHolder o2) { ReportBase r1 = o1.getReport(); ReportBase r2 = o2.getReport(); // sort by descending report id (sequence number) return new CompareToBuilder().append(r2.getReportID().longValue(), r1.getReportID().longValue()).toComparison(); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OrderHistory [").append(latestReport == null ? "none" : latestReport.getOrderID()).append("]"); return builder.toString(); } /**
if(execType == null) { OrderStatus orderStatus = report.getOrderStatus();
private OrderID getGroupID(ReportBase inReport) { return getGroupID(inReport.getOrderID()); }
/** * Gets the root order ID for the given order ID. * * @param inOrderID an <code>OrderID</code> value * @return an <code>OrderID</code> value or <code>null</code> */ public OrderID getRootOrderIdFor(OrderID inOrderID) { Deque<ReportBase> orders = getReportHistoryFor(inOrderID); if(orders == null || orders.isEmpty()) { return null; } return orders.getLast().getOrderID(); } /**
ReportHolder reportHolder = reversedHolders[i]; ReportBase report = reportHolder.getReport(); OrderID orderId = report.getOrderID(); if(eReport.getOriginator().forOrders() && eReport.getHierarchy().forOrders() && out.getReport().getOrderID().equals(orderId)) { return reportHolder;