Package quickfix.fix41

Examples of quickfix.fix41.NewOrderSingle


    private static final String CHECKSUM        = "67890";
    private static final String TX_DATE         = new Date().toString();
    private static final String SESSION_ID      = "FIX.4.1:BANZAI->SYNAPSE";

    public void testSimpleFIXMessage() throws Exception {
        Message message = new NewOrderSingle();
        message.getHeader().setField(new BeginString(BEGIN_STRING));
        message.getHeader().setField(new SenderCompID(SENDER_ID));
        message.getHeader().setField(new TargetCompID(TARGET_ID));
        message.getHeader().setField(new MsgSeqNum(SEQ_NUM));

        message.setField(new Symbol(SYMBOL));
        message.setField(new ClOrdID(CLORD_ID));
        message.setField(new TradeOriginationDate(TX_DATE));

        message.getTrailer().setField(new CheckSum(CHECKSUM));

        MessageContext msgCtx = new MessageContext();
        FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx);
        String result = msgCtx.getEnvelope().getBody().getFirstElement().toString();
        String expected =
View Full Code Here


        assertXMLEqual(expected, AXIOMUtil.stringToOM(result).toString());       
    }

    public void testAdvancedFIXMessage() throws Exception {
        Message message = new NewOrderSingle();
        message.getHeader().setField(new BeginString(BEGIN_STRING));
        message.getHeader().setField(new SenderCompID(SENDER_ID));
        message.getHeader().setField(new TargetCompID(TARGET_ID));
        message.getHeader().setField(new MsgSeqNum(SEQ_NUM));

        message.setField(new Symbol(SYMBOL));
        message.setField(new ClOrdID(CLORD_ID));
        message.setField(new TradeOriginationDate(TX_DATE));

        Group g1 = new Group(NoAllocs.FIELD, AllocAccount.FIELD);
        g1.setField(new AllocAccount("ABC"));
        g1.setField(new IndividualAllocID("PQR"));
        message.addGroup(g1);
        Group g2 = new Group(NoAllocs.FIELD, AllocAccount.FIELD);
        g2.setField(new AllocAccount("MNO"));
        g2.setField(new IndividualAllocID("XYZ"));
        message.addGroup(g2);

        message.getTrailer().setField(new CheckSum(CHECKSUM));

        MessageContext msgCtx = new MessageContext();
        FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx);
        String result = msgCtx.getEnvelope().getBody().getFirstElement().toString();
        String expected =
View Full Code Here

        Endpoint gatewayEndpoint = context.getEndpoint(gatewayUri);
        Producer producer = gatewayEndpoint.createProducer();
       
        LOG.info("Sending order");
       
        NewOrderSingle order = createNewOrderMessage();
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(order);
        producer.process(exchange);           

        if (!executionReportLatch.await(5, TimeUnit.SECONDS)) {
View Full Code Here

       
        LOG.info("Order execution example complete");
    }

    private NewOrderSingle createNewOrderMessage() {
        NewOrderSingle order = new NewOrderSingle(
            new ClOrdID("CLIENT_ORDER_ID"),
            new HandlInst('1'),
            new Symbol("GOOG"),
            new Side(Side.BUY),
            new TransactTime(new Date()),
            new OrdType(OrdType.LIMIT));
       
        order.set(new OrderQty(10));
        order.set(new Price(300.00));
       
        return order;
    }
View Full Code Here

        Endpoint gatewayEndpoint = context.getEndpoint(gatewayUri);
        Producer producer = gatewayEndpoint.createProducer();
       
        LOG.info("Sending order");
       
        NewOrderSingle order = createNewOrderMessage();
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(order);
        producer.process(exchange);           

        if (!executionReportLatch.await(5, TimeUnit.SECONDS)) {
View Full Code Here

       
        LOG.info("Order execution example complete");
    }

    private NewOrderSingle createNewOrderMessage() {
        NewOrderSingle order = new NewOrderSingle(
            new ClOrdID("CLIENT_ORDER_ID"),
            new HandlInst('1'),
            new Symbol("GOOG"),
            new Side(Side.BUY),
            new TransactTime(new Date()),
            new OrdType(OrdType.LIMIT));
       
        order.set(new OrderQty(10));
        order.set(new Price(300.00));
       
        return order;
    }
View Full Code Here

        Endpoint gatewayEndpoint = context.getEndpoint(gatewayUri);
        Producer producer = gatewayEndpoint.createProducer();
       
        LOG.info("Sending order");
       
        NewOrderSingle order = createNewOrderMessage();
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(order);
        producer.process(exchange);           

        if (!executionReportLatch.await(5, TimeUnit.SECONDS)) {
View Full Code Here

       
        LOG.info("Order execution example complete");
    }

    private NewOrderSingle createNewOrderMessage() {
        NewOrderSingle order = new NewOrderSingle(
            new ClOrdID("CLIENT_ORDER_ID"),
            new HandlInst('1'),
            new Symbol("GOOG"),
            new Side(Side.BUY),
            new TransactTime(new Date()),
            new OrdType(OrdType.LIMIT));
       
        order.set(new OrderQty(10));
        order.set(new Price(300.00));
       
        return order;
    }
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

TOP

Related Classes of quickfix.fix41.NewOrderSingle

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.