Example #1
0
  /** Construct using an old Contract */
  public NewContract(Contract c) {
    m_conid = c.m_conId;
    m_symbol = c.m_symbol;
    m_secType = c.m_secType == null ? SecType.None : SecType.valueOf(c.m_secType);
    m_expiry = c.m_expiry == null || c.m_expiry.equals("0") ? "" : c.m_expiry;
    m_strike = c.m_strike;
    m_right = Right.get(c.m_right);
    m_multiplier = c.m_multiplier;
    m_exchange = c.m_exchange;
    m_primaryExch = c.m_primaryExch;
    m_currency = c.m_currency;
    m_localSymbol = c.m_localSymbol;
    m_tradingClass = c.m_tradingClass;
    m_secIdType = SecIdType.get(c.m_secIdType);
    m_secId = c.m_secId;
    m_underComp =
        c.m_underComp != null
            ? new DeltaNeutralContract(
                c.m_underComp.m_conId, c.m_underComp.m_delta, c.m_underComp.m_price)
            : null;

    m_comboLegs.clear();
    if (c.m_comboLegs != null) {
      for (ComboLeg leg : c.m_comboLegs) {
        m_comboLegs.add(new NewComboLeg(leg));
      }
    }
  }