Package com.quantcomponents.algo

Examples of com.quantcomponents.algo.OrderBean


  }

  @Override
  public synchronized String sendOrder(IOrder order) {
    int internalId = nextInternalId();
    OrderBean orderBean = OrderBean.copyOf(order);
    orderBean.setId(Integer.toString(internalId));
    processOrder(new OrderInfo(orderBean, internalId, null, null));
    removeDeletedOrders();
    return Integer.toString(internalId);
  }
View Full Code Here


  public synchronized String[] sendBracketOrders(IOrder parent, IOrder[] children) {
    String[] ids = new String[children.length + 1];
    int parentInternalId = nextInternalId();
    ids[0] = Integer.toString(parentInternalId);
    int ocaGroupId = nextOcaGroupId();
    OrderBean parentOrderBean = OrderBean.copyOf(parent);
    parentOrderBean.setId(Integer.toString(parentInternalId));
    currentOrders.add(new OrderInfo(parentOrderBean, parentInternalId, null, null));
    for (int i = 0; i < children.length; i++) {
      IOrder child = children[i];
      OrderBean childOrderBean = OrderBean.copyOf(child);
      int childId = nextInternalId();
      childOrderBean.setId(Integer.toString(childId));
      ids[i + 1] = Integer.toString(childId);
      currentOrders.add(new OrderInfo(childOrderBean, childId, ocaGroupId, parentInternalId));
    }
    processOrders();
    return ids;
View Full Code Here

    } else if (shortAverageResult > longAverageResult) {
      deltaPosition = positionSize - position;
    }
    if (deltaPosition != 0) {
      try {
        OrderBean order = new OrderBean(stockTimeSeries.getContract(), deltaPosition > 0 ? OrderSide.BUY : OrderSide.SELL, OrderType.MARKET, Math.abs(deltaPosition), 0.0, 0.0);
          String orderId = orderReceiver.sendOrder(order);
          order.setId(orderId);
          position += deltaPosition;
        } catch (Exception e) {
          logger.log(Level.SEVERE, "Error while adding delta position: " + deltaPosition, e);
        }
      }
View Full Code Here

TOP

Related Classes of com.quantcomponents.algo.OrderBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.