Search in sources :

Example 1 with ExecTransType

use of quickfix.field.ExecTransType 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 2 with ExecTransType

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

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix42.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix42.ExecutionReport accept = new quickfix.fix42.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order.getSymbol(), order.getSide(), new LeavesQty(0), new CumQty(0), new AvgPx(0));
        accept.set(order.getClOrdID());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix42.ExecutionReport executionReport = new quickfix.fix42.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), order.getSymbol(), order.getSide(), new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
            executionReport.set(order.getClOrdID());
            executionReport.set(orderQty);
            executionReport.set(new LastShares(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) 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 3 with ExecTransType

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

the class TradeExecutor method onMessage.

private void onMessage(quickfix.fix40.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
    try {
        validateOrder(order);
        OrderQty orderQty = order.getOrderQty();
        Price price = getPrice(order);
        quickfix.fix40.ExecutionReport accept = new quickfix.fix40.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new OrdStatus(OrdStatus.NEW), order.getSymbol(), order.getSide(), orderQty, new LastShares(0), new LastPx(0), new CumQty(0), new AvgPx(0));
        accept.set(order.getClOrdID());
        sendMessage(sessionID, accept);
        if (isOrderExecutable(order, price)) {
            quickfix.fix40.ExecutionReport fill = new quickfix.fix40.ExecutionReport(genOrderID(), genExecID(), new ExecTransType(ExecTransType.NEW), new OrdStatus(OrdStatus.FILLED), order.getSymbol(), order.getSide(), orderQty, new LastShares(orderQty.getValue()), new LastPx(price.getValue()), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
            fill.set(order.getClOrdID());
            sendMessage(sessionID, fill);
        }
    } 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)

Aggregations

AvgPx (quickfix.field.AvgPx)3 CumQty (quickfix.field.CumQty)3 ExecTransType (quickfix.field.ExecTransType)3 LastPx (quickfix.field.LastPx)3 LastShares (quickfix.field.LastShares)3 OrdStatus (quickfix.field.OrdStatus)3 OrderQty (quickfix.field.OrderQty)3 Price (quickfix.field.Price)3 ExecType (quickfix.field.ExecType)2 LeavesQty (quickfix.field.LeavesQty)2