Package quickfix.banzai

Examples of quickfix.banzai.Order


        ExecID execID = (ExecID)message.getField(new ExecID());
        if(alreadyProcessed(execID, sessionID))
            return;

        String id = message.getField(new ClOrdID()).getValue();
        Order order = orderTableModel.getOrder(id);
        if(order == null)
            return;

        LastShares lastShares = new LastShares(0);

        try {
            OrderQty orderQty = (OrderQty)message.getField(new OrderQty());
            int diff = order.getQuantity() - (int)orderQty.getValue();
            order.setQuantity((int)orderQty.getValue());
            order.setOpen(order.getOpen() - diff);
        } catch(FieldNotFound e) {}
        try {
            Price price = (Price)message.getField(new Price());
            order.setLimit(new Double(price.getValue()));
        } catch(FieldNotFound e) {}
        try {
            message.getField(lastShares);
        } catch(FieldNotFound e) {}

        if(lastShares.getValue() > 0) {
            order.setExecuted((int)message.getField(new CumQty()).getValue());
            order.setAvgPx(message.getField(new AvgPx()).getValue());
        }
        OrdStatus ordStatus = (OrdStatus)message.getField(new OrdStatus());

        try {
            order.setOpen((int)message.getField(new LeavesQty()).getValue());
        } catch(FieldNotFound e) {
            // FIX40 doesn't have LeavesQty
            if(ordStatus.valueEquals(OrdStatus.REJECTED) ||
                    ordStatus.valueEquals(OrdStatus.CANCELED))
                order.setOpen(0);
            else if(ordStatus.valueEquals(OrdStatus.NEW)) {
                if(order.isNew()) {
                    order.setOpen(order.getQuantity());
                    order.setNew(false);
                }
            }
            order.setOpen(order.getOpen() - (int)lastShares.getValue());
        }

        if(ordStatus.valueEquals(OrdStatus.REJECTED))
            order.setRejected(true);
        else if(ordStatus.valueEquals(OrdStatus.CANCELED) ||
                ordStatus.valueEquals(OrdStatus.DONE_FOR_DAY))
            order.setCanceled(true);

        try {
            order.setMessage(message.getField(new Text()).getValue());
        } catch(FieldNotFound e) {
            order.setMessage(null);
        }

        orderTableModel.updateOrder(order, id);
        observableOrder.update(order);
View Full Code Here


    private void cancelReject(Message message, SessionID sessionID)
    throws FieldNotFound {

        String id = message.getField(new ClOrdID()).getValue();
        Order order = orderTableModel.getOrder(id);
        if(order == null)
            return;
        if(order.getOriginalID() != null)
            order = orderTableModel.getOrder(order.getOriginalID());

        try {
            order.setMessage(message.getField(new Text()).getValue());
        } catch(FieldNotFound e) {}
        orderTableModel.updateOrder(order, order.getID());
    }
View Full Code Here

            }

            if(numSelected > 1)
                orderEntryPanel.clearMessage();
            else {
                Order order = (Order)orderTableModel.getOrder(selectedRow);
                if(order != null) {
                    orderEntryPanel.setMessage(order.getMessage());
                    cancelReplacePanel.setOrder(order);
                }
            }
        }
View Full Code Here

        addMouseListener(this);
    }

    public Component prepareRenderer(TableCellRenderer renderer,
                                     int row, int column) {
        Order order = (Order)((OrderTableModel)dataModel).getOrder(row);

        int open = order.getOpen();
        int executed = order.getExecuted();
        boolean rejected = order.getRejected();
        boolean canceled = order.getCanceled();

        DefaultTableCellRenderer r = (DefaultTableCellRenderer)renderer;
        r.setForeground(Color.black);

        if(rejected)
View Full Code Here

    public void mouseClicked(MouseEvent e) {
        if(e.getClickCount() != 2)
            return;
        int row = rowAtPoint(e.getPoint());
        Order order = (Order)((OrderTableModel)dataModel).getOrder(row);
        application.cancel(order);
    }
View Full Code Here

        ExecID execID = (ExecID)message.getField(new ExecID());
        if(alreadyProcessed(execID, sessionID))
            return;

        String id = message.getField(new ClOrdID()).getValue();
        Order order = orderTableModel.getOrder(id);
        if(order == null)
            return;

        LastShares lastShares = new LastShares(0);

        try {
            OrderQty orderQty = (OrderQty)message.getField(new OrderQty());
            int diff = order.getQuantity() - (int)orderQty.getValue();
            order.setQuantity((int)orderQty.getValue());
            order.setOpen(order.getOpen() - diff);
        } catch(FieldNotFound e) {}
        try {
            Price price = (Price)message.getField(new Price());
            order.setLimit(new Double(price.getValue()));
        } catch(FieldNotFound e) {}
        try {
            message.getField(lastShares);
        } catch(FieldNotFound e) {}

        if(lastShares.getValue() > 0) {
            order.setExecuted((int)message.getField(new CumQty()).getValue());
            order.setAvgPx(message.getField(new AvgPx()).getValue());
        }
        OrdStatus ordStatus = (OrdStatus)message.getField(new OrdStatus());

        try {
            order.setOpen((int)message.getField(new LeavesQty()).getValue());
        } catch(FieldNotFound e) {
            // FIX40 doesn't have LeavesQty
            if(ordStatus.valueEquals(OrdStatus.REJECTED) ||
                    ordStatus.valueEquals(OrdStatus.CANCELED))
                order.setOpen(0);
            else if(ordStatus.valueEquals(OrdStatus.NEW)) {
                if(order.isNew()) {
                    order.setOpen(order.getQuantity());
                    order.setNew(false);
                }
            }
            order.setOpen(order.getOpen() - (int)lastShares.getValue());
        }

        if(ordStatus.valueEquals(OrdStatus.REJECTED))
            order.setRejected(true);
        else if(ordStatus.valueEquals(OrdStatus.CANCELED) ||
                ordStatus.valueEquals(OrdStatus.DONE_FOR_DAY))
            order.setCanceled(true);

        try {
            order.setMessage(message.getField(new Text()).getValue());
        } catch(FieldNotFound e) {
            order.setMessage(null);
        }

        orderTableModel.updateOrder(order, id);
        observableOrder.update(order);
View Full Code Here

    private void cancelReject(Message message, SessionID sessionID)
    throws FieldNotFound {

        String id = message.getField(new ClOrdID()).getValue();
        Order order = orderTableModel.getOrder(id);
        if(order == null)
            return;
        if(order.getOriginalID() != null)
            order = orderTableModel.getOrder(order.getOriginalID());

        try {
            order.setMessage(message.getField(new Text()).getValue());
        } catch(FieldNotFound e) {}
        orderTableModel.updateOrder(order, order.getID());
    }
View Full Code Here

            }

            if(numSelected > 1)
                orderEntryPanel.clearMessage();
            else {
                Order order = (Order)orderTableModel.getOrder(selectedRow);
                if(order != null) {
                    orderEntryPanel.setMessage(order.getMessage());
                    cancelReplacePanel.setOrder(order);
                }
            }
        }
View Full Code Here

        addMouseListener(this);
    }

    public Component prepareRenderer(TableCellRenderer renderer,
                                     int row, int column) {
        Order order = (Order)((OrderTableModel)dataModel).getOrder(row);

        int open = order.getOpen();
        int executed = order.getExecuted();
        boolean rejected = order.getRejected();
        boolean canceled = order.getCanceled();

        DefaultTableCellRenderer r = (DefaultTableCellRenderer)renderer;
        r.setForeground(Color.black);

        if(rejected)
View Full Code Here

    public void mouseClicked(MouseEvent e) {
        if(e.getClickCount() != 2)
            return;
        int row = rowAtPoint(e.getPoint());
        Order order = (Order)((OrderTableModel)dataModel).getOrder(row);
        application.cancel(order);
    }
View Full Code Here

TOP

Related Classes of quickfix.banzai.Order

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.