当前位置: 首页>>代码示例>>Java>>正文


Java OrdStatus.NEW属性代码示例

本文整理汇总了Java中quickfix.field.OrdStatus.NEW属性的典型用法代码示例。如果您正苦于以下问题:Java OrdStatus.NEW属性的具体用法?Java OrdStatus.NEW怎么用?Java OrdStatus.NEW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在quickfix.field.OrdStatus的用法示例。


在下文中一共展示了OrdStatus.NEW属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStatus

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());
		}
	}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:20,代码来源:FixUtil.java

示例2: 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);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:29,代码来源:TradeExecutor.java


注:本文中的quickfix.field.OrdStatus.NEW属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。