本文整理匯總了Java中quickfix.field.CumQty類的典型用法代碼示例。如果您正苦於以下問題:Java CumQty類的具體用法?Java CumQty怎麽用?Java CumQty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CumQty類屬於quickfix.field包,在下文中一共展示了CumQty類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStatus
import quickfix.field.CumQty; //導入依賴的package包/類
public static Status getStatus(OrdStatus ordStatus, CumQty cumQty) {
if (ordStatus.getValue() == OrdStatus.NEW || ordStatus.getValue() == OrdStatus.PENDING_NEW) {
return Status.SUBMITTED;
} else if (ordStatus.getValue() == OrdStatus.PARTIALLY_FILLED) {
return Status.PARTIALLY_EXECUTED;
} else if (ordStatus.getValue() == OrdStatus.FILLED) {
return Status.EXECUTED;
} else if (ordStatus.getValue() == OrdStatus.CANCELED || ordStatus.getValue() == OrdStatus.PENDING_CANCEL || ordStatus.getValue() == OrdStatus.REJECTED) {
return Status.CANCELED;
} else if (ordStatus.getValue() == OrdStatus.REPLACED || ordStatus.getValue() == OrdStatus.PENDING_REPLACE) {
if (cumQty.getValue() == 0) {
return Status.SUBMITTED;
} else {
return Status.PARTIALLY_EXECUTED;
}
} else {
throw new IllegalArgumentException("unknown orderStatus " + ordStatus.getValue());
}
}
示例2: createExecutionReport
import quickfix.field.CumQty; //導入依賴的package包/類
private quickfix.fix44.ExecutionReport createExecutionReport(
quickfix.fix44.NewOrderSingle order) throws FieldNotFound {
quickfix.fix44.ExecutionReport execReport = new ExecutionReport(new OrderID("ORD_" + currentOrdId++),
new ExecID("EXEC_" + currentExecId++),
new ExecType(ExecType.NEW),
new OrdStatus(OrdStatus.PENDING_NEW),
new Side(order.getSide().getValue()),
new LeavesQty(0.0),
new CumQty(0.0),
new AvgPx(order.getPrice().getValue()));
execReport.set(order.getClOrdID());
execReport.set(order.getAccount());
execReport.set(order.getOrderQty());
execReport.set(order.getPrice());
execReport.set(order.getOrdType());
execReport.set(order.getSymbol());
return execReport;
}
示例3: getOrderStatus
import quickfix.field.CumQty; //導入依賴的package包/類
public ExecutionReport getOrderStatus(OrderStatusRequest request) throws FieldNotFound {
LOG.info("Received order status request for orderId=" + request.getOrderID().getValue());
return new ExecutionReport(request.getOrderID(),
new ExecID(UUID.randomUUID().toString()),
new ExecTransType(ExecTransType.STATUS),
new ExecType(ExecType.REJECTED),
new OrdStatus(OrdStatus.REJECTED),
new Symbol("GOOG"),
new Side(Side.BUY),
new LeavesQty(100),
new CumQty(0),
new AvgPx(0));
}
示例4: onMessage
import quickfix.field.CumQty; //導入依賴的package包/類
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);
}
}