Beispiel #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;
                }
            }
        }
Beispiel #2
0
 public void tickOptionComputation(int tickerId, int field, double impliedVolatility, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
 {
     TwsRtdServerData.OptionComputationData value = new TwsRtdServerData.OptionComputationData(impliedVolatility,
                                                                                               delta, optPrice, pvDividend, gamma, vega, theta, undPrice);
     SetOptionComputationTopicsValues(tickerId, field, value);
 }
Beispiel #3
0
        public void SetValue(string tickType, object value)
        {
            // save latest values
            switch (tickType)
            {
            case TwsRtdServerData.LAST:
                m_lastPrice = (double)value;
                break;

            case TwsRtdServerData.ASK:
                m_askPrice = (double)value;
                break;

            case TwsRtdServerData.BID:
                m_bidPrice = (double)value;
                break;

            case TwsRtdServerData.LASTSIZE:
                m_lastSize = (int)value;
                break;

            case TwsRtdServerData.ASKSIZE:
                m_askSize = (int)value;
                break;

            case TwsRtdServerData.BIDSIZE:
                m_bidSize = (int)value;
                break;

            case TwsRtdServerData.HIGH:
                m_high = (double)value;
                break;

            case TwsRtdServerData.LOW:
                m_low = (double)value;
                break;

            case TwsRtdServerData.OPEN:
                m_open = (double)value;
                break;

            case TwsRtdServerData.CLOSE:
                m_close = (double)value;
                break;

            case TwsRtdServerData.HALTED:
                m_halted = (double)value;
                break;

            case TwsRtdServerData.VOLUME:
                m_volume = (int)value;
                break;

            case TwsRtdServerData.BIDEXCH:
                m_bidExch = (string)value;
                break;

            case TwsRtdServerData.ASKEXCH:
                m_askExch = (string)value;
                break;

            case TwsRtdServerData.LASTEXCH:
                m_lastExch = (string)value;
                break;

            case TwsRtdServerData.LASTTIME:
                m_lastTime = (string)value;
                break;

            case TwsRtdServerData.BID_OPTION_COMPUTATION:
                m_bidOptionComputation = (TwsRtdServerData.OptionComputationData)value;
                break;

            case TwsRtdServerData.ASK_OPTION_COMPUTATION:
                m_askOptionComputation = (TwsRtdServerData.OptionComputationData)value;
                break;

            case TwsRtdServerData.LAST_OPTION_COMPUTATION:
                m_lastOptionComputation = (TwsRtdServerData.OptionComputationData)value;
                break;

            case TwsRtdServerData.MODEL_OPTION_COMPUTATION:
                m_modelOptionComputation = (TwsRtdServerData.OptionComputationData)value;
                break;

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

            case TwsRtdServerData.GEN_TICK_AUCTION_IMBALANCE:
                m_genTickAuctionImbalance = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_AUCTION_PRICE:
                m_genTickAuctionPrice = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_REGULATORY_IMBALANCE:
                m_genTickRegulatoryImbalance = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_PL_PRICE:
                m_genTickPlPrice = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_CREDITMAN_MARK_PRICE:
                m_genTickCreditmanMarkPrice = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_CREDITMAN_SLOW_MARK_PRICE:
                m_genTickCreditmanSlowMarkPrice = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_CALL_OPTION_VOLUME:
                m_genTickCallOptionVolume = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_PUT_OPTION_VOLUME:
                m_genTickPutOptionVolume = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_CALL_OPTION_OPEN_INTEREST:
                m_genTickCallOptionOpenInterest = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_PUT_OPTION_OPEN_INTEREST:
                m_genTickPutOptionOpenInterest = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_OPTION_HISTORICAL_VOL:
                m_genTickOptionHistoricalVol = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_RT_HISTORICAL_VOL:
                m_genTickRTHistoricalVol = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_INDEX_FUTURE_PREMIUM:
                m_genTickIndexFuturePremium = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_SHORTABLE:
                m_genTickShortable = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_FUNDAMENTALS:
                m_genTickFundamentals = (string)value;
                break;

            case TwsRtdServerData.GEN_TICK_TRADE_COUNT:
                m_genTickTradeCount = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_TRADE_RATE:
                m_genTickTradeRate = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_VOLUME_RATE:
                m_genTickVolumeRate = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_LAST_RTH_TRADE:
                m_genTickLastRTHTrade = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_IB_DIVIDENDS:
                m_genTickIBDividends = (string)value;
                break;

            case TwsRtdServerData.GEN_TICK_BOND_MULTIPLIER:
                m_genTickBondMultiplier = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_AVERAGE_VOLUME:
                m_genTickAverageVolume = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_13_HI:
                m_genTickWeek13Hi = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_13_LO:
                m_genTickWeek13Lo = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_26_HI:
                m_genTickWeek26Hi = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_26_LO:
                m_genTickWeek26Lo = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_52_HI:
                m_genTickWeek52Hi = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_WEEK_52_LO:
                m_genTickWeek52Lo = (double)value;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_3_MIN:
                m_genTickShortTermVolume3Min = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_5_MIN:
                m_genTickShortTermVolume5Min = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_SHORT_TERM_VOLUME_10_MIN:
                m_genTickShortTermVolume10Min = (int)value;
                break;

            case TwsRtdServerData.FUTURES_OPEN_INTEREST:
                m_futuresOpenInterest = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_AVG_OPT_VOLUME:
                m_genTickAvgOptVolume = (int)value;
                break;

            case TwsRtdServerData.GEN_TICK_SHORTABLE_SHARES:
                m_genTickShortableShares = (int)value;
                break;

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

            case TwsRtdServerData.DELAYED_BID:
                m_delayed_bidPrice = (double)value;
                break;

            case TwsRtdServerData.DELAYED_ASK:
                m_delayed_askPrice = (double)value;
                break;

            case TwsRtdServerData.DELAYED_LAST_SIZE:
                m_delayed_lastSize = (int)value;
                break;

            case TwsRtdServerData.DELAYED_BID_SIZE:
                m_delayed_bidSize = (int)value;
                break;

            case TwsRtdServerData.DELAYED_ASK_SIZE:
                m_delayed_askSize = (int)value;
                break;

            case TwsRtdServerData.DELAYED_HIGH:
                m_delayed_high = (double)value;
                break;

            case TwsRtdServerData.DELAYED_LOW:
                m_delayed_low = (double)value;
                break;

            case TwsRtdServerData.DELAYED_VOLUME:
                m_delayed_volume = (int)value;
                break;

            case TwsRtdServerData.DELAYED_CLOSE:
                m_delayed_close = (double)value;
                break;

            case TwsRtdServerData.DELAYED_OPEN:
                m_delayed_open = (double)value;
                break;

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