本文整理汇总了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);
}
}