Exemple #1
0
        void SetOptionComputationTopicsValues(int tickerId, int field, TwsRtdServerData.OptionComputationData value)
        {
            TwsRtdServerMktDataRequest mktDataRequest = m_connection.GetMktDataRequest(tickerId);
            string tickTypeStr = TwsRtdServerData.GetTickTypeStrByTickId(field);

            if (mktDataRequest != null && tickTypeStr != null)
            {
                switch (tickTypeStr)
                {
                // assigning implied vol, delta, opt price, pv dividend, gamma, vega, theta and und price
                case TwsRtdServerData.BID_OPTION_COMPUTATION:
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_TICK_ATTRIB, mktDataRequest, value.getTickAttrib());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_IMPLIED_VOL, mktDataRequest, value.getImpliedVolatility());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_DELTA, mktDataRequest, value.getDelta());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_OPT_PRICE, mktDataRequest, value.getOptPrice());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_PV_DIVIDEND, mktDataRequest, value.getPvDividend());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_GAMMA, mktDataRequest, value.getGamma());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_VEGA, mktDataRequest, value.getVega());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_THETA, mktDataRequest, value.getTheta());
                    GetTopicAndAddUpdate(TwsRtdServerData.BID_UND_PRICE, mktDataRequest, value.getUndPrice());
                    break;

                case TwsRtdServerData.ASK_OPTION_COMPUTATION:
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_TICK_ATTRIB, mktDataRequest, value.getTickAttrib());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_IMPLIED_VOL, mktDataRequest, value.getImpliedVolatility());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_DELTA, mktDataRequest, value.getDelta());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_OPT_PRICE, mktDataRequest, value.getOptPrice());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_PV_DIVIDEND, mktDataRequest, value.getPvDividend());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_GAMMA, mktDataRequest, value.getGamma());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_VEGA, mktDataRequest, value.getVega());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_THETA, mktDataRequest, value.getTheta());
                    GetTopicAndAddUpdate(TwsRtdServerData.ASK_UND_PRICE, mktDataRequest, value.getUndPrice());
                    break;

                case TwsRtdServerData.LAST_OPTION_COMPUTATION:
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_TICK_ATTRIB, mktDataRequest, value.getTickAttrib());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_IMPLIED_VOL, mktDataRequest, value.getImpliedVolatility());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_DELTA, mktDataRequest, value.getDelta());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_OPT_PRICE, mktDataRequest, value.getOptPrice());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_PV_DIVIDEND, mktDataRequest, value.getPvDividend());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_GAMMA, mktDataRequest, value.getGamma());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_VEGA, mktDataRequest, value.getVega());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_THETA, mktDataRequest, value.getTheta());
                    GetTopicAndAddUpdate(TwsRtdServerData.LAST_UND_PRICE, mktDataRequest, value.getUndPrice());
                    break;

                case TwsRtdServerData.MODEL_OPTION_COMPUTATION:
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_TICK_ATTRIB, mktDataRequest, value.getTickAttrib());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_IMPLIED_VOL, mktDataRequest, value.getImpliedVolatility());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_DELTA, mktDataRequest, value.getDelta());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_OPT_PRICE, mktDataRequest, value.getOptPrice());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_PV_DIVIDEND, mktDataRequest, value.getPvDividend());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_GAMMA, mktDataRequest, value.getGamma());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_VEGA, mktDataRequest, value.getVega());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_THETA, mktDataRequest, value.getTheta());
                    GetTopicAndAddUpdate(TwsRtdServerData.MODEL_UND_PRICE, mktDataRequest, value.getUndPrice());
                    break;
                }
            }
        }
Exemple #2
0
        public Object GetValue(string topicStr)
        {
            Object value = null;

            switch (topicStr)
            {
            case TwsRtdServerData.LAST:
                value = m_lastPrice;
                break;

            case TwsRtdServerData.BID:
                value = m_bidPrice;
                break;

            case TwsRtdServerData.ASK:
                value = m_askPrice;
                break;

            case TwsRtdServerData.LASTSIZE:
                value = m_lastSize;
                break;

            case TwsRtdServerData.ASKSIZE:
                value = m_askSize;
                break;

            case TwsRtdServerData.BIDSIZE:
                value = m_bidSize;
                break;

            case TwsRtdServerData.HIGH:
                value = m_high;
                break;

            case TwsRtdServerData.LOW:
                value = m_low;
                break;

            case TwsRtdServerData.OPEN:
                value = m_open;
                break;

            case TwsRtdServerData.CLOSE:
                value = m_close;
                break;

            case TwsRtdServerData.HALTED:
                value = m_halted;
                break;

            case TwsRtdServerData.VOLUME:
                value = m_volume;
                break;

            case TwsRtdServerData.BIDEXCH:
                value = m_bidExch;
                break;

            case TwsRtdServerData.ASKEXCH:
                value = m_askExch;
                break;

            case TwsRtdServerData.LASTEXCH:
                value = m_lastExch;
                break;

            case TwsRtdServerData.LASTTIME:
                value = m_lastTime;
                break;

            case TwsRtdServerData.BID_IMPLIED_VOL:
                value = m_bidOptionComputation.getImpliedVolatility();
                break;

            case TwsRtdServerData.BID_DELTA:
                value = m_bidOptionComputation.getDelta();
                break;

            case TwsRtdServerData.BID_OPT_PRICE:
                value = m_bidOptionComputation.getOptPrice();
                break;

            case TwsRtdServerData.BID_PV_DIVIDEND:
                value = m_bidOptionComputation.getPvDividend();
                break;

            case TwsRtdServerData.BID_GAMMA:
                value = m_bidOptionComputation.getGamma();
                break;

            case TwsRtdServerData.BID_VEGA:
                value = m_bidOptionComputation.getVega();
                break;

            case TwsRtdServerData.BID_THETA:
                value = m_bidOptionComputation.getTheta();
                break;

            case TwsRtdServerData.BID_UND_PRICE:
                value = m_bidOptionComputation.getUndPrice();
                break;

            case TwsRtdServerData.ASK_IMPLIED_VOL:
                value = m_askOptionComputation.getImpliedVolatility();
                break;

            case TwsRtdServerData.ASK_DELTA:
                value = m_askOptionComputation.getDelta();
                break;

            case TwsRtdServerData.ASK_OPT_PRICE:
                value = m_askOptionComputation.getOptPrice();
                break;

            case TwsRtdServerData.ASK_PV_DIVIDEND:
                value = m_askOptionComputation.getPvDividend();
                break;

            case TwsRtdServerData.ASK_GAMMA:
                value = m_askOptionComputation.getGamma();
                break;

            case TwsRtdServerData.ASK_VEGA:
                value = m_askOptionComputation.getVega();
                break;

            case TwsRtdServerData.ASK_THETA:
                value = m_askOptionComputation.getTheta();
                break;

            case TwsRtdServerData.ASK_UND_PRICE:
                value = m_askOptionComputation.getUndPrice();
                break;

            case TwsRtdServerData.LAST_IMPLIED_VOL:
                value = m_lastOptionComputation.getImpliedVolatility();
                break;

            case TwsRtdServerData.LAST_DELTA:
                value = m_lastOptionComputation.getDelta();
                break;

            case TwsRtdServerData.LAST_OPT_PRICE:
                value = m_lastOptionComputation.getOptPrice();
                break;

            case TwsRtdServerData.LAST_PV_DIVIDEND:
                value = m_lastOptionComputation.getPvDividend();
                break;

            case TwsRtdServerData.LAST_GAMMA:
                value = m_lastOptionComputation.getGamma();
                break;

            case TwsRtdServerData.LAST_VEGA:
                value = m_lastOptionComputation.getVega();
                break;

            case TwsRtdServerData.LAST_THETA:
                value = m_lastOptionComputation.getTheta();
                break;

            case TwsRtdServerData.LAST_UND_PRICE:
                value = m_lastOptionComputation.getUndPrice();
                break;

            case TwsRtdServerData.MODEL_IMPLIED_VOL:
                value = m_modelOptionComputation.getImpliedVolatility();
                break;

            case TwsRtdServerData.MODEL_DELTA:
                value = m_modelOptionComputation.getDelta();
                break;

            case TwsRtdServerData.MODEL_OPT_PRICE:
                value = m_modelOptionComputation.getOptPrice();
                break;

            case TwsRtdServerData.MODEL_PV_DIVIDEND:
                value = m_modelOptionComputation.getPvDividend();
                break;

            case TwsRtdServerData.MODEL_GAMMA:
                value = m_modelOptionComputation.getGamma();
                break;

            case TwsRtdServerData.MODEL_VEGA:
                value = m_modelOptionComputation.getVega();
                break;

            case TwsRtdServerData.MODEL_THETA:
                value = m_modelOptionComputation.getTheta();
                break;

            case TwsRtdServerData.MODEL_UND_PRICE:
                value = m_modelOptionComputation.getUndPrice();
                break;

            // generic ticks
            case TwsRtdServerData.GEN_TICK_AUCTION_VOLUME:
                value = m_genTickAuctionVolume;
                break;

            case TwsRtdServerData.GEN_TICK_AUCTION_IMBALANCE:
                value = m_genTickAuctionImbalance;
                break;

            case TwsRtdServerData.GEN_TICK_AUCTION_PRICE:
                value = m_genTickAuctionPrice;
                break;

            case TwsRtdServerData.GEN_TICK_REGULATORY_IMBALANCE:
                value = m_genTickRegulatoryImbalance;
                break;

            case TwsRtdServerData.GEN_TICK_PL_PRICE:
                value = m_genTickPlPrice;
                break;

            case TwsRtdServerData.GEN_TICK_CREDITMAN_MARK_PRICE:
                value = m_genTickCreditmanMarkPrice;
                break;

            case TwsRtdServerData.GEN_TICK_CREDITMAN_SLOW_MARK_PRICE:
                value = m_genTickCreditmanSlowMarkPrice;
                break;

            case TwsRtdServerData.GEN_TICK_CALL_OPTION_VOLUME:
                value = m_genTickCallOptionVolume;
                break;

            case TwsRtdServerData.GEN_TICK_PUT_OPTION_VOLUME:
                value = m_genTickPutOptionVolume;
                break;

            case TwsRtdServerData.GEN_TICK_CALL_OPTION_OPEN_INTEREST:
                value = m_genTickCallOptionOpenInterest;
                break;

            case TwsRtdServerData.GEN_TICK_PUT_OPTION_OPEN_INTEREST:
                value = m_genTickPutOptionOpenInterest;
                break;

            case TwsRtdServerData.GEN_TICK_OPTION_HISTORICAL_VOL:
                value = m_genTickOptionHistoricalVol;
                break;

            case TwsRtdServerData.GEN_TICK_RT_HISTORICAL_VOL:
                value = m_genTickRTHistoricalVol;
                break;

            case TwsRtdServerData.GEN_TICK_INDEX_FUTURE_PREMIUM:
                value = m_genTickIndexFuturePremium;
                break;

            case TwsRtdServerData.GEN_TICK_SHORTABLE:
                value = m_genTickShortable;
                break;

            case TwsRtdServerData.GEN_TICK_FUNDAMENTALS:
                value = m_genTickFundamentals;
                break;

            case TwsRtdServerData.GEN_TICK_TRADE_COUNT:
                value = m_genTickTradeCount;
                break;

            case TwsRtdServerData.GEN_TICK_TRADE_RATE:
                value = m_genTickTradeRate;
                break;

            case TwsRtdServerData.GEN_TICK_VOLUME_RATE:
                value = m_genTickVolumeRate;
                break;

            case TwsRtdServerData.GEN_TICK_LAST_RTH_TRADE:
                value = m_genTickLastRTHTrade;
                break;

            case TwsRtdServerData.GEN_TICK_IB_DIVIDENDS:
                value = m_genTickIBDividends;
                break;

            case TwsRtdServerData.GEN_TICK_BOND_MULTIPLIER:
                value = m_genTickBondMultiplier;
                break;

            case TwsRtdServerData.GEN_TICK_AVERAGE_VOLUME:
                value = m_genTickAverageVolume;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_13_HI:
                value = m_genTickWeek13Hi;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_13_LO:
                value = m_genTickWeek13Lo;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_26_HI:
                value = m_genTickWeek26Hi;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_26_LO:
                value = m_genTickWeek26Lo;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_52_HI:
                value = m_genTickWeek52Hi;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_52_LO:
                value = m_genTickWeek52Lo;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_3_MIN:
                value = m_genTickShortTermVolume3Min;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_5_MIN:
                value = m_genTickShortTermVolume5Min;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_10_MIN:
                value = m_genTickShortTermVolume10Min;
                break;

            case TwsRtdServerData.FUTURES_OPEN_INTEREST:
                value = m_futuresOpenInterest;
                break;

            case TwsRtdServerData.GEN_TICK_AVG_OPT_VOLUME:
                value = m_genTickAvgOptVolume;
                break;

            case TwsRtdServerData.GEN_TICK_SHORTABLE_SHARES:
                value = m_genTickShortableShares;
                break;

            // delayed ticks
            case TwsRtdServerData.DELAYED_LAST:
                value = m_delayed_lastPrice;
                break;

            case TwsRtdServerData.DELAYED_BID:
                value = m_delayed_bidPrice;
                break;

            case TwsRtdServerData.DELAYED_ASK:
                value = m_delayed_askPrice;
                break;

            case TwsRtdServerData.DELAYED_LAST_SIZE:
                value = m_delayed_lastSize;
                break;

            case TwsRtdServerData.DELAYED_BID_SIZE:
                value = m_delayed_bidSize;
                break;

            case TwsRtdServerData.DELAYED_ASK_SIZE:
                value = m_delayed_askSize;
                break;

            case TwsRtdServerData.DELAYED_HIGH:
                value = m_delayed_high;
                break;

            case TwsRtdServerData.DELAYED_LOW:
                value = m_delayed_low;
                break;

            case TwsRtdServerData.DELAYED_VOLUME:
                value = m_delayed_volume;
                break;

            case TwsRtdServerData.DELAYED_CLOSE:
                value = m_delayed_close;
                break;

            case TwsRtdServerData.DELAYED_OPEN:
                value = m_delayed_open;
                break;

            case TwsRtdServerData.DELAYED_LAST_TIMESTAMP:
                value = m_delayed_lastTimestamp;
                break;
            }
            return(value);
        }