public static object ReferenceDataFromFieldName(string fieldName, string security, bool isOption, ReferenceDataRequest.RequestReference rreq)
        {
            string upper = fieldName.ToUpper();
            object result;

            if (upper == "CHAIN_TICKERS")
            {
                if (isOption)
                {
                    result = null;
                }
                else
                {
                    uint numPoints = 1;
                    string dtExp = null;
                    var optionality = ReferenceDataRequest.ElementReferenceArrayChainTickers.OptionalityEnum.call;

                    if (rreq.HasElement("overrides"))
                    {
                        var overrides = rreq["overrides"];
                        for (int i = 0; i < overrides.NumValues; i++)
                        {
                            var element = overrides.GetValueAsElement(i);

                            var fieldId = element["fieldId"].GetValueAsString();
                            var value = element["value"].GetValueAsString();

                            switch (fieldId.ToUpper())
                            {
                                case "CHAIN_POINTS_OVRD":
                                    numPoints = uint.Parse(value);
                                    break;
                                case "CHAIN_EXP_DT_OVRD":
                                    dtExp = value;
                                    break;
                                case "CHAIN_PUT_CALL_TYPE_OVRD":
                                    if (value.ToUpper() == "P")
                                        optionality = ReferenceDataRequest.ElementReferenceArrayChainTickers.OptionalityEnum.put;
                                    break;
                            }
                        }
                    }

                    ReferenceDataRequest.ElementReferenceArrayChainTickers chain = new ReferenceDataRequest.ElementReferenceArrayChainTickers(security, numPoints, dtExp, optionality);
                    result = chain;
                }
            }
            else if (upper.Contains("TICKER"))
            {
                result = security.Substring(0, security.IndexOf(' '));
            }
            else if (upper.Contains("OPT_EXPIRE_DT"))
            {
                if (security.EndsWith("COMDTY") || security.EndsWith("INDEX"))
                {
                    result = DateTime.Today.AddMonths(3);
                }
                else if (isOption)
                {
                    string strDate = security.Substring(security.LastIndexOf(' ') - 15, 6);
                    result = DateTime.ParseExact(strDate, "yyMMdd", null);
                }
                else
                    result = null;
            }
            else if (upper.Contains("TRADEABLE_DT"))
            {
                result = DateTime.Today.AddMonths(3);
            }
            else
            {
                result = RandomDataGenerator.RandomDouble();
            }

            return result;
        }
        public static object ReferenceDataFromFieldName(string fieldName, string security, bool isOption, ReferenceDataRequest.RequestReference rreq)
        {
            string upper = fieldName.ToUpper();
            object result;

            if (upper == "CHAIN_TICKERS")
            {
                if (isOption)
                {
                    result = null;
                }
                else
                {
                    uint   numPoints   = 1;
                    string dtExp       = null;
                    var    optionality = ReferenceDataRequest.ElementReferenceArrayChainTickers.OptionalityEnum.call;

                    if (rreq.HasElement("overrides"))
                    {
                        var overrides = rreq["overrides"];
                        for (int i = 0; i < overrides.NumValues; i++)
                        {
                            var element = overrides.GetValueAsElement(i);

                            var fieldId = element["fieldId"].GetValueAsString();
                            var value   = element["value"].GetValueAsString();

                            switch (fieldId.ToUpper())
                            {
                            case "CHAIN_POINTS_OVRD":
                                numPoints = uint.Parse(value);
                                break;

                            case "CHAIN_EXP_DT_OVRD":
                                dtExp = value;
                                break;

                            case "CHAIN_PUT_CALL_TYPE_OVRD":
                                if (value.ToUpper() == "P")
                                {
                                    optionality = ReferenceDataRequest.ElementReferenceArrayChainTickers.OptionalityEnum.put;
                                }
                                break;
                            }
                        }
                    }

                    ReferenceDataRequest.ElementReferenceArrayChainTickers chain = new ReferenceDataRequest.ElementReferenceArrayChainTickers(security, numPoints, dtExp, optionality);
                    result = chain;
                }
            }
            else if (upper.Contains("TICKER"))
            {
                result = security.Substring(0, security.IndexOf(' '));
            }
            else if (upper.Contains("OPT_EXPIRE_DT"))
            {
                if (security.EndsWith("COMDTY") || security.EndsWith("INDEX"))
                {
                    result = DateTime.Today.AddMonths(3);
                }
                else if (isOption)
                {
                    string strDate = security.Substring(security.LastIndexOf(' ') - 15, 6);
                    result = DateTime.ParseExact(strDate, "yyMMdd", null);
                }
                else
                {
                    result = null;
                }
            }
            else if (upper.Contains("TRADEABLE_DT"))
            {
                result = DateTime.Today.AddMonths(3);
            }
            else
            {
                result = RandomDataGenerator.RandomDouble();
            }

            return(result);
        }