Search in sources :

Example 1 with OrderQty

use of quickfix.field.OrderQty in project camel by apache.

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix44.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix44.ExecutionReport accept = new quickfix.fix44.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order.getSide(), new LeavesQty(order.getOrderQty().getValue()), new CumQty(0), new AvgPx(0));
        accept.set(order.getClOrdID());
        accept.set(order.getSymbol());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix44.ExecutionReport executionReport = new quickfix.fix44.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), order.getSide(), new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
            executionReport.set(order.getClOrdID());
            executionReport.set(order.getSymbol());
            executionReport.set(orderQty);
            executionReport.set(new LastQty(orderQty.getValue()));
            executionReport.set(new LastPx(price.getValue()));
            sendMessage(sessionID, executionReport);
        }
    } catch (RuntimeException e) {
        LogUtil.logThrowable(sessionID, e.getMessage(), e);
    }
}
Also used : CumQty(quickfix.field.CumQty) LastPx(quickfix.field.LastPx) OrderQty(quickfix.field.OrderQty) LastQty(quickfix.field.LastQty) AvgPx(quickfix.field.AvgPx) Price(quickfix.field.Price) OrdStatus(quickfix.field.OrdStatus) ExecType(quickfix.field.ExecType) LeavesQty(quickfix.field.LeavesQty)

Example 2 with OrderQty

use of quickfix.field.OrderQty in project camel by apache.

the class TradeExecutorExample method createNewOrderMessage.

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;
}
Also used : NewOrderSingle(quickfix.fix42.NewOrderSingle) Side(quickfix.field.Side) OrderQty(quickfix.field.OrderQty) Price(quickfix.field.Price) Symbol(quickfix.field.Symbol) OrdType(quickfix.field.OrdType) ClOrdID(quickfix.field.ClOrdID) HandlInst(quickfix.field.HandlInst) TransactTime(quickfix.field.TransactTime) Date(java.util.Date)

Example 3 with OrderQty

use of quickfix.field.OrderQty in project camel by apache.

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix43.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix43.ExecutionReport accept = new quickfix.fix43.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order.getSide(), new LeavesQty(order.getOrderQty().getValue()), new CumQty(0), new AvgPx(0));
        accept.set(order.getClOrdID());
        accept.set(order.getSymbol());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix43.ExecutionReport executionReport = new quickfix.fix43.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), order.getSide(), new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
            executionReport.set(order.getClOrdID());
            executionReport.set(order.getSymbol());
            executionReport.set(orderQty);
            executionReport.set(new LastQty(orderQty.getValue()));
            executionReport.set(new LastPx(price.getValue()));
            sendMessage(sessionID, executionReport);
        }
    } catch (RuntimeException e) {
        LogUtil.logThrowable(sessionID, e.getMessage(), e);
    }
}
Also used : CumQty(quickfix.field.CumQty) LastPx(quickfix.field.LastPx) OrderQty(quickfix.field.OrderQty) LastQty(quickfix.field.LastQty) AvgPx(quickfix.field.AvgPx) Price(quickfix.field.Price) OrdStatus(quickfix.field.OrdStatus) ExecType(quickfix.field.ExecType) LeavesQty(quickfix.field.LeavesQty)

Example 4 with OrderQty

use of quickfix.field.OrderQty in project camel by apache.

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix41.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix41.ExecutionReport accept = new quickfix.fix41.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order.getSymbol(), order.getSide(), orderQty, new LastShares(0), new LastPx(0), new LeavesQty(0), new CumQty(0), new AvgPx(0));
        accept.set(order.getClOrdID());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix41.ExecutionReport executionReport = new quickfix.fix41.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), order.getSymbol(), order.getSide(), orderQty, new LastShares(orderQty.getValue()), new LastPx(price.getValue()), new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
            executionReport.set(order.getClOrdID());
            sendMessage(sessionID, executionReport);
        }
    } catch (RuntimeException e) {
        LogUtil.logThrowable(sessionID, e.getMessage(), e);
    }
}
Also used : LastPx(quickfix.field.LastPx) CumQty(quickfix.field.CumQty) OrderQty(quickfix.field.OrderQty) ExecTransType(quickfix.field.ExecTransType) AvgPx(quickfix.field.AvgPx) Price(quickfix.field.Price) OrdStatus(quickfix.field.OrdStatus) LastShares(quickfix.field.LastShares) ExecType(quickfix.field.ExecType) LeavesQty(quickfix.field.LeavesQty)

Example 5 with OrderQty

use of quickfix.field.OrderQty in project camel by apache.

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix50.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix50.ExecutionReport accept = new quickfix.fix50.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order.getSide(), new LeavesQty(order.getOrderQty().getValue()), new CumQty(0));
        accept.set(order.getClOrdID());
        accept.set(order.getSymbol());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix50.ExecutionReport executionReport = new quickfix.fix50.ExecutionReport(genOrderID(), genExecID(), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), order.getSide(), new LeavesQty(0), new CumQty(orderQty.getValue()));
            executionReport.set(order.getClOrdID());
            executionReport.set(order.getSymbol());
            executionReport.set(orderQty);
            executionReport.set(new LastQty(orderQty.getValue()));
            executionReport.set(new LastPx(price.getValue()));
            executionReport.set(new AvgPx(price.getValue()));
            sendMessage(sessionID, executionReport);
        }
    } catch (RuntimeException e) {
        LogUtil.logThrowable(sessionID, e.getMessage(), e);
    }
}
Also used : CumQty(quickfix.field.CumQty) LastPx(quickfix.field.LastPx) OrderQty(quickfix.field.OrderQty) LastQty(quickfix.field.LastQty) AvgPx(quickfix.field.AvgPx) Price(quickfix.field.Price) OrdStatus(quickfix.field.OrdStatus) ExecType(quickfix.field.ExecType) LeavesQty(quickfix.field.LeavesQty)

Aggregations

OrderQty (quickfix.field.OrderQty)7 Price (quickfix.field.Price)7 AvgPx (quickfix.field.AvgPx)6 CumQty (quickfix.field.CumQty)6 LastPx (quickfix.field.LastPx)6 OrdStatus (quickfix.field.OrdStatus)6 ExecType (quickfix.field.ExecType)5 LeavesQty (quickfix.field.LeavesQty)5 ExecTransType (quickfix.field.ExecTransType)3 LastQty (quickfix.field.LastQty)3 LastShares (quickfix.field.LastShares)3 Date (java.util.Date)1 ClOrdID (quickfix.field.ClOrdID)1 HandlInst (quickfix.field.HandlInst)1 OrdType (quickfix.field.OrdType)1 Side (quickfix.field.Side)1 Symbol (quickfix.field.Symbol)1 TransactTime (quickfix.field.TransactTime)1 NewOrderSingle (quickfix.fix42.NewOrderSingle)1