Package com.ib.client

Examples of com.ib.client.Contract


  @Override
  public void historicalData(int requestId, String formattedDate, double openPrice, double highPrice,
      double lowPrice, double closePrice, int volume, int tradeCount, double weightedAverage,
      boolean hasGaps) {
    Contract c = null;
   
    synchronized (requestIdContractMap) {
      c = requestIdContractMap.get(requestId);
    }
   
View Full Code Here


 
  public static Contract createContract(String symbol,
      SecurityType securityType, Exchange exchange, Currency currency,
      String expiry, CallPut callPut, double strike)
          throws InvalidContractException {
    Contract contract = new Contract();
   
    if (symbol != null)
      contract.m_symbol = symbol;
    else
      throw new InvalidContractException("No symbol specified");
View Full Code Here

        }
      }
    }

  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;
View Full Code Here

                       " referencePriceType=" + order.m_referencePriceType);
    }

    public void contractDetails(ContractDetails contractDetails)
    {
        Contract contract = contractDetails.m_summary;

        m_TWS.add( " ---- Contract Details begin ----");
        m_TWS.add( "symbol = " + contract.m_symbol);
        m_TWS.add( "secType = " + contract.m_secType);
        m_TWS.add( "expiry = " + contract.m_expiry);
View Full Code Here

    }

    public void scannerData(int reqId, int rank,
                            ContractDetails contractDetails, String distance,
                            String benchmark, String projection) {
        Contract contract = contractDetails.m_summary;

        m_tickers.add("id = " + reqId +
                   " rank=" + rank +
                   " symbol=" + contract.m_symbol +
                   " secType=" + contract.m_secType +
View Full Code Here

                   " projection=" + projection);
    }

    public void bondContractDetails(ContractDetails contractDetails)
    {
        Contract contract = contractDetails.m_summary;

        m_TWS.add(" ---- Bond Contract Details begin ----");
        m_TWS.add("symbol = " + contract.m_symbol);
        m_TWS.add("secType = " + contract.m_secType);
        m_TWS.add("cusip = " + contract.m_cusip);
View Full Code Here

            m_contract = new ComboContract("Z", "GBP", "LIFFE");
            m_contract.m_comboLegs = new Vector(2);
            m_contract.m_comboLegs.setSize(2);

            {
               Contract l1 = new OptContract(
                     "Z", "LIFFE", "200809", 54.75, "CALL");
               l1.m_currency = "GBP";
               submitSecDef(1, l1);
            }

            {
               Contract l2 = new OptContract(
                     "Z", "LIFFE", "200810", 55.00, "CALL");
               l2.m_currency = "GBP";
               submitSecDef(2, l2);
            }

            m_status = Status.SecDef;
            break;
         }
      case 5:
         {
            m_contract = new ComboContract("IBM");
            m_contract.m_comboLegs = new Vector(1);
            m_contract.m_comboLegs.setSize(1);

            m_contract.m_underComp = new UnderComp();
            //m_contract.m_underComp.m_delta = 0.8;
            //m_contract.m_underComp.m_price = 120;

            {
               Contract l1 = new OptContract("IBM", "200809", 120, "CALL");
               submitSecDef(1, l1);
            }

            m_status = Status.SecDef;
            break;
         }
      case 6:
         {
            m_contract = new ComboContract("RUT");
            m_contract.m_comboLegs = new Vector(1);
            m_contract.m_comboLegs.setSize(1);

            m_contract.m_underComp = new UnderComp();
            m_needFrontMonthFuture = true;

            {
               Contract l1 = new OptContract("RUT", "200809", 740, "CALL");
               submitSecDef(1, l1);
            }

            m_status = Status.SecDef;
            break;
         }
      case 7:
         {
            m_contract = new ComboContract("Z", "GBP", "LIFFE");
            m_contract.m_comboLegs = new Vector(1);
            m_contract.m_comboLegs.setSize(1);

            m_contract.m_underComp = new UnderComp();

            m_needFrontMonthFuture = true;

            {
               Contract l1 = new OptContract(
                     "Z", "LIFFE", "200808", 55.00, "CALL");
               l1.m_currency = "GBP";
               submitSecDef(1, l1);
            }
View Full Code Here

                   */

                  if (m_needFrontMonthFuture) {
                     m_status = Status.SecDefFMF;

                     Contract futContract = new FutContract(
                           contractDetails.m_summary.m_symbol,
                           /* all expirations */ "",
                           contractDetails.m_summary.m_currency);

                     submitSecDef(0, futContract);
                     return;
                  }

                  consoleMsg("using " + m_underConId + " for hedging");
                  m_contract.m_underComp.m_conId = m_underConId;
               }

               /*
                * And finally submit RFQ
                */
               submitRfq();
            }
            else if (m_status == Status.SecDefFMF) {

               /*
                * Ignore unknown reqId's
                */

               if (reqId != 0) {
                  return;
               }

               /*
                * Ignore secDefs with different underConId
                */
               if (contractDetails.m_underConId != m_underConId) {
                  return;
               }

               Contract contract = contractDetails.m_summary;

               /*
                * Check if we have a better match
                */

 
View Full Code Here

      m_contract = new OptContract("IBM", "20121019", 200, "CALL");
      m_contract.m_currency = "USD";
      m_contract.m_multiplier = "100";

      Contract underlying = new StkContract("IBM");
      submitSecDef(1, underlying);

      m_status = Status.SecDef;
   }
View Full Code Here

  }
 
  private void placeOrder(final EClientSocket client, int count) {
    System.out.print(".");
   
    Contract contract = new Contract();
    contract.m_conId = 8314;
        contract.m_symbol = "IBM";
        contract.m_secType = "STK";
        contract.m_expiry = "";
         contract.m_strike = 0.0;
View Full Code Here

TOP

Related Classes of com.ib.client.Contract

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.