Exemplo n.º 1
0
        private static void tickOptionComputationOperations(EClientSocket client)
        {
            /*** Requesting real time market data ***/
            client.reqMarketDataType(4);

            //! [reqmktdata]
            client.reqMktData(2001, ContractSamples.OptionWithLocalSymbol(), string.Empty, false, false, null);
            //! [reqmktdata]

            Thread.Sleep(10000);

            /*** Canceling the market data subscription ***/
            //! [cancelmktdata]
            client.cancelMktData(2001);
            //! [cancelmktdata]
        }
Exemplo n.º 2
0
        private static void tickDataOperations(EClientSocket client)
        {
            /*** Requesting real time market data ***/
            //Thread.Sleep(1000);
            //! [reqmktdata]
            client.reqMktData(1001, ContractSamples.StockComboContract(), string.Empty, false, null);
            //! [reqmktdata]
            //! [reqmktdata_snapshot]
            client.reqMktData(1003, ContractSamples.FutureComboContract(), string.Empty, true, null);
            //! [reqmktdata_snapshot]

            //! [reqmktdata_genticks]
            //Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
            client.reqMktData(1004, ContractSamples.USStock(), "233,236,258", false, null);
            //! [reqmktdata_genticks]

            //! [reqmktdata_contractnews]
            client.reqMktData(1005, ContractSamples.USStock(), "mdoff,292:BZ", false, null);
            client.reqMktData(1006, ContractSamples.USStock(), "mdoff,292:BT", false, null);
            client.reqMktData(1007, ContractSamples.USStock(), "mdoff,292:FLY", false, null);
            client.reqMktData(1008, ContractSamples.USStock(), "mdoff,292:MT", false, null);
            //! [reqmktdata_contractnews]
            //! [reqmktdata_broadtapenews]
            client.reqMktData(1009, ContractSamples.BTbroadtapeNewsFeed(), "mdoff,292", false, null);
            client.reqMktData(1010, ContractSamples.BZbroadtapeNewsFeed(), "mdoff,292", false, null);
            client.reqMktData(1011, ContractSamples.FLYbroadtapeNewsFeed(), "mdoff,292", false, null);
            client.reqMktData(1012, ContractSamples.MTbroadtapeNewsFeed(), "mdoff,292", false, null);
            //! [reqmktdata_broadtapenews]

            //! [reqoptiondatagenticks]
            //Requesting data for an option contract will return the greek values
            client.reqMktData(1002, ContractSamples.OptionWithLocalSymbol(), string.Empty, false, null);
            //! [reqoptiondatagenticks]

            Thread.Sleep(10000);
            /*** Canceling the market data subscription ***/
            //! [cancelmktdata]
            client.cancelMktData(1001);
            client.cancelMktData(1002);
            client.cancelMktData(1003);
            //! [cancelmktdata]
        }
Exemplo n.º 3
0
        private static void optionsOperations(EClientSocket client)
        {
            //! [reqsecdefoptparams]
            client.reqSecDefOptParams(0, "IBM", "", "STK", 8314);
            //! [reqsecdefoptparams]

            /*** Calculating implied volatility ***/
            //! [calculateimpliedvolatility]
            client.calculateImpliedVolatility(5001, ContractSamples.OptionWithLocalSymbol(), 0.5, 55, null);
            //! [calculateimpliedvolatility]
            /*** Canceling implied volatility ***/
            client.cancelCalculateImpliedVolatility(5001);
            /*** Calculating option's price ***/
            //! [calculateoptionprice]
            client.calculateOptionPrice(5002, ContractSamples.OptionWithLocalSymbol(), 0.6, 55, null);
            //! [calculateoptionprice]
            /*** Canceling option's price calculation ***/
            client.cancelCalculateOptionPrice(5002);
            /*** Exercising options ***/
            //! [exercise_options]
            client.exerciseOptions(5003, ContractSamples.OptionWithTradingClass(), 1, 1, null, 1);
            //! [exercise_options]
        }
Exemplo n.º 4
0
        private static void tickDataOperations(EClientSocket client)
        {
            /*** Requesting real time market data ***/
            //Thread.Sleep(1000);
            //! [reqmktdata]
            client.reqMktData(1001, ContractSamples.StockComboContract(), string.Empty, false, false, null);
            //! [reqmktdata]
            //! [reqmktdata_snapshot]
            client.reqMktData(1003, ContractSamples.FutureComboContract(), string.Empty, true, false, null);
            //! [reqmktdata_snapshot]

            /*
             * //! [regulatorysnapshot]
             * // Each regulatory snapshot incurs a 0.01 USD fee
             * client.reqMktData(1005, ContractSamples.USStock(), "", false, true, null);
             * //! [regulatorysnapshot]
             */

            //! [reqmktdata_genticks]
            //Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
            client.reqMktData(1004, ContractSamples.USStockAtSmart(), "233,236,258", false, false, null);
            //! [reqmktdata_genticks]

            //! [reqmktdata_contractnews]
            // Without the API news subscription this will generate an "invalid tick type" error
            client.reqMktData(1005, ContractSamples.USStock(), "mdoff,292:BZ", false, false, null);
            client.reqMktData(1006, ContractSamples.USStock(), "mdoff,292:BT", false, false, null);
            client.reqMktData(1007, ContractSamples.USStock(), "mdoff,292:FLY", false, false, null);
            client.reqMktData(1008, ContractSamples.USStock(), "mdoff,292:MT", false, false, null);
            //! [reqmktdata_contractnews]
            //! [reqmktdata_broadtapenews]
            client.reqMktData(1009, ContractSamples.BTbroadtapeNewsFeed(), "mdoff,292", false, false, null);
            client.reqMktData(1010, ContractSamples.BZbroadtapeNewsFeed(), "mdoff,292", false, false, null);
            client.reqMktData(1011, ContractSamples.FLYbroadtapeNewsFeed(), "mdoff,292", false, false, null);
            client.reqMktData(1012, ContractSamples.MTbroadtapeNewsFeed(), "mdoff,292", false, false, null);
            //! [reqmktdata_broadtapenews]

            //! [reqoptiondatagenticks]
            //Requesting data for an option contract will return the greek values
            client.reqMktData(1002, ContractSamples.OptionWithLocalSymbol(), string.Empty, false, false, null);
            //! [reqoptiondatagenticks]

            //! [reqfuturesopeninterest]
            //Requesting data for a futures contract will return the futures open interest
            client.reqMktData(1014, ContractSamples.SimpleFuture(), "mdoff,588", false, false, null);
            //! [reqfuturesopeninterest]

            //! [reqmktdatapreopenbidask]
            //Requesting data for a futures contract will return the pre-open bid/ask flag
            client.reqMktData(1015, ContractSamples.SimpleFuture(), "", false, false, null);
            //! [reqmktDatapreopenbidask]

            //! [reqavgoptvolume]
            //Requesting data for a stock will return the average option volume
            client.reqMktData(1016, ContractSamples.USStockAtSmart(), "mdoff,105", false, false, null);
            //! [reqavgoptvolume]

            Thread.Sleep(10000);
            /*** Canceling the market data subscription ***/
            //! [cancelmktdata]
            client.cancelMktData(1001);
            client.cancelMktData(1002);
            client.cancelMktData(1003);
            client.cancelMktData(1014);
            client.cancelMktData(1015);
            client.cancelMktData(1016);
            //! [cancelmktdata]
        }