Package quickfix.fix44.component

Examples of quickfix.fix44.component.OrderQtyData


            exchange.getIn().setHeader(QuickfixjEndpoint.SESSION_ID_KEY, sessionID);
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
    }
View Full Code Here


            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, new DataDictionary("FIX44.xml"));
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
    }
View Full Code Here

            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, "FIX44.xml");
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
    }
View Full Code Here

    @Override
    public String generateNewOrderSingleMessage(Order order) {

        logger.debug("Generating NewOrderSingle: {}", order);

        NewOrderSingle fixMessage = new NewOrderSingle(
                ClOrdIDConverter.toFix(getBrokerId(), order.getId()),
                OrderSideConverter.toFix(order.getSide()),
                new TransactTime(order.getCreationTime().toDate()),
                OrderTypeConverter.toFix(order.getType()));

        fixMessage.set(InstrumentConverter.toFix(order.getSymbol()));
        fixMessage.set(OrderQuantityConverter.toFix(order.getQuantity()));
        if (order.getLimitPrice() != null) {
            fixMessage.set(MoneyConverter.toFixPrice(order.getLimitPrice()));
            fixMessage.set(MoneyConverter.toFixCurrency(order.getLimitPrice()));
        }
        fixMessage.set(OrderTermConverter.toFix(order.getTerm()));
        if (order.isAllOrNone()) {
            fixMessage.set(new ExecInst(Character.toString(ExecInst.ALL_OR_NONE)));
        }
       
        logger.debug("Sending message:\n{}", FixFormatter.format(fixMessage));
        return fixMessage.toString();
    }
View Full Code Here

    }

    @Override
    public String generateOrderCancelRequest(Order order) {

        OrderCancelRequest fixMessage = new OrderCancelRequest(
                OrigClOrdIDConverter.toFix(getBrokerId(), order.getId()),
                ClOrdIDConverter.toFix(getBrokerId(), order.getId()),
                OrderSideConverter.toFix(order.getSide()),
                new TransactTime(new Date()));

        fixMessage.set(InstrumentConverter.toFix(order.getSymbol()));
        fixMessage.set(OrderQuantityConverter.toFix(order.getQuantity()));
       
        logger.debug("Sending message:\n{}", FixFormatter.format(fixMessage));
        return fixMessage.toString();
    }
View Full Code Here

                Symbol.FIELD, SecurityID.FIELD, SecurityIDSource.FIELD, Product.FIELD,
                QuoteType.FIELD, OrderQty.FIELD, SettlDate.FIELD, QuotePriceType.FIELD,
                ValidUntilTime.FIELD, ExpireTime.FIELD
        };

        Message message = new QuoteRequest(new QuoteReqID("20101110-2"));
        Group group = new Group(NoRelatedSym.FIELD, Symbol.FIELD, order);
        group.setField(new Symbol("TestSymbol"));
        group.setField(new SecurityID("SecurityID"));
        group.setField(new SecurityIDSource("SecurityIDSource"));
        group.setField(new Product(11));
        group.setField(new QuoteType(1));
        group.setField(new OrderQty(500));
        group.setField(new SettlDate("20151116"));
        group.setField(new QuotePriceType(1));
        group.setField(new ValidUntilTime(new Date()));
        group.setField(new ExpireTime(new Date()));
        message.addGroup(group);
        System.out.println("Original Message: " + message);

        MessageContext msgCtx = new MessageContext();
        FIXUtils.getInstance().setSOAPEnvelope(message, 1, "TestSession", msgCtx);
        OMElement msgElt = msgCtx.getEnvelope().getBody().getFirstElement();
        OMElement groupsElt = msgElt.getFirstChildWithName(new QName(FIXConstants.FIX_BODY)).
                getFirstChildWithName(new QName(FIXConstants.FIX_GROUPS));

        int groupId = Integer.parseInt(groupsElt.getAttributeValue(
                new QName(FIXConstants.FIX_FIELD_ID)));
        assertEquals(groupId, group.getFieldTag());

        // Test whether the fileds in the SOAP infoset are in the correct order
        Iterator fields = groupsElt.getFirstElement().getChildrenWithName(
                new QName(FIXConstants.FIX_FIELD));
        List<Integer> fieldList = new ArrayList<Integer>();
        while (fields.hasNext()) {
            OMElement fieldElt = (OMElement) fields.next();
            fieldList.add(Integer.parseInt(fieldElt.getAttributeValue(
                    new QName(FIXConstants.FIX_FIELD_ID))));
        }
        assertEquals(order.length, fieldList.size());
        for (int i = 0; i < order.length; i++) {
            assertEquals(order[i], (int) fieldList.get(i));
        }

        // Test whether the reconstructed message preserves the group field order
        Message copy = FIXUtils.getInstance().createFIXMessage(msgCtx);
        System.out.println("Reconstructed Message: " + copy);
        List<Group> groups = copy.getGroups(NoRelatedSym.FIELD);
        assertEquals(1, groups.size());
        int[] copyOrder = groups.get(0).getFieldOrder();
        assertEquals(order.length, copyOrder.length);
        for (int i = 0; i < order.length; i++) {
            assertEquals(order[i], copyOrder[i]);
        }

        assertEquals(message.toString(), copy.toString());       
    }
View Full Code Here

*/
public class OrderQuantityConverter {

    public static OrderQtyData toFix(DecimalQuantity quantity) {

        OrderQtyData orderQtyData = new OrderQtyData();
        orderQtyData.set(new OrderQty(quantity.doubleValue()));
        return orderQtyData;
    }
View Full Code Here

*/
public class OrderQuantityConverter {

    public static OrderQtyData toFix(DecimalQuantity quantity) {

        OrderQtyData orderQtyData = new OrderQtyData();
        orderQtyData.set(new OrderQty(quantity.doubleValue()));
        return orderQtyData;
    }
View Full Code Here

TOP

Related Classes of quickfix.fix44.component.OrderQtyData

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.