Beispiel #1
0
  public Contract getContract() {
    Contract c = new Contract();
    c.m_conId = m_conid;
    c.m_symbol = m_symbol;
    c.m_secType = m_secType.toString();
    c.m_expiry = m_expiry;
    c.m_strike = m_strike;
    c.m_right = m_right.getApiString();
    c.m_multiplier = m_multiplier;
    c.m_exchange = m_exchange;
    c.m_currency = m_currency;
    c.m_localSymbol = m_localSymbol;
    c.m_tradingClass = m_tradingClass;
    c.m_primaryExch = m_primaryExch;
    c.m_secIdType = m_secIdType.getApiString();
    c.m_secId = m_secId;

    if (m_underComp != null) {
      c.m_underComp = new UnderComp();
      c.m_underComp.m_conId = m_underComp.conid();
      c.m_underComp.m_delta = m_underComp.delta();
      c.m_underComp.m_price = m_underComp.price();
    }

    c.m_comboLegs = new Vector<ComboLeg>();
    for (NewComboLeg leg : m_comboLegs) {
      c.m_comboLegs.add(leg.getComboLeg());
    }

    return c;
  }
Beispiel #2
0
  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_currency = c.m_currency;
    m_localSymbol = c.m_localSymbol;
    m_tradingClass = c.m_tradingClass;
    m_primaryExch = c.m_primaryExch;
    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));
      }
    }
  }