当前位置: 首页>>代码示例>>C#>>正文


C# OptionType.ToString方法代码示例

本文整理汇总了C#中OptionType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OptionType.ToString方法的具体用法?C# OptionType.ToString怎么用?C# OptionType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OptionType的用法示例。


在下文中一共展示了OptionType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AbstractOption

        public AbstractOption(OptionType key)
        {
            this.ID = Guid.NewGuid();
            this.Key = key;

            Name = MultiLanguageTextProxy.GetText("OptionType_" + key.ToString() + "_Name", key.ToString());
            Description = MultiLanguageTextProxy.GetText("OptionType_" + key.ToString() + "_Description", key.ToString());                
        }
开发者ID:vetesii,项目名称:7k,代码行数:8,代码来源:Options.cs

示例2: UnparseOptionType

		/// <summary>
		/// Translates the given <see cref="OptionType"/> into the string representation
		/// used in the XML.
		/// </summary>
		/// <param name="p_otpType">The <see cref="OptionType"/> to unparse.</param>
		/// <returns>The string representation used in the XML for the given <see cref="OptionType"/>.</returns>
		protected string UnparseOptionType(OptionType p_otpType)
		{
			return p_otpType.ToString();
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:10,代码来源:Unparser.cs

示例3: GetOptionSearchCriteria

        /// <summary>
        /// Private method which exposes all possible parameters, with default values for the optional ones.
        /// </summary>
        /// <param name="category">Category=StockOption, IndexOption, FutureOption or CurrencyOption</param>
        /// <param name="symbolRoot">Symbol root. Required Field, the symbol the option is a derivative of, this search will not return options based on a partial root.</param>
        /// <param name="strikeCount">Number of strikes prices above and below the underlying price. Defaults to 3. Ignored if strike price high and low are passed.</param>
        /// <param name="strikePriceLow">Strike price low</param>
        /// <param name="strikePriceHigh">Strike price high</param>
        /// <param name="dateCount">Number of expiration dates. Default value 3. Ignored if expiration dates high and low are passed.</param>
        /// <param name="expirationDateLow">Expiration date low</param>
        /// <param name="expirationDateHigh">Expiration date high</param>
        /// <param name="optionType">Option type (Both, Call, Put) Default: Both</param>
        /// <param name="futureType">Future type (Electronic, Pit) Default: Electronic</param>
        /// <param name="symbolType">SymbolType (Both, Composite, Regional) Default: Composite</param>
        /// <param name="country">Country code (US, DE, CA) Default: US</param>
        /// <returns></returns>
        public static string GetOptionSearchCriteria(SearchCategory category, string symbolRoot,
			uint strikeCount = 3, decimal strikePriceLow = 0, decimal strikePriceHigh = decimal.MaxValue, 
			uint dateCount = 3, DateTime? expirationDateLow = null, DateTime? expirationDateHigh = null,
			OptionType optionType = OptionType.Both, 
			FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US)
        {
            if (string.IsNullOrEmpty(symbolRoot)) throw new ArgumentException("symbolRoot is required.", "symbolRoot");
            if (GetAssetType(category) != AssetClass.Option) throw new ArgumentException("SearchCategory must be StockOption, IndexOption, FutureOption or CurrencyOption", "category");
            if (strikePriceLow < 0) throw new ArgumentOutOfRangeException("strikePriceLow", "Argument cannot be less than 0.");
            if (strikePriceHigh < 0) throw new ArgumentOutOfRangeException("strikePriceHigh", "Argument cannot be less than 0.");
            if ((expirationDateLow.HasValue && !expirationDateHigh.HasValue) || (expirationDateHigh.HasValue && !expirationDateLow.HasValue)) throw new ArgumentException("If either expiration date parameter is passed, both must be passed.");
            if (expirationDateHigh.HasValue && expirationDateLow.HasValue && expirationDateHigh < expirationDateLow) throw new ArgumentOutOfRangeException("expirationDateHigh", "expirationDateHigh cannot be before expirationDateLow.");

            StringBuilder criteria = new StringBuilder(255);
            Append(criteria, "c=" + category.ToString());
            Append(criteria, "R=" + symbolRoot);
            // strike price range takes precidence over strike count
            if (strikePriceLow > 0 && strikePriceHigh < decimal.MaxValue)
            {
                Append(criteria, "Spl=" + strikePriceLow);
                Append(criteria, "Sph=" + strikePriceHigh);
            }
            else if (strikeCount != 3)
                Append(criteria, "Stk=" + strikeCount);

            // daterange takes precidence over datacount
            if (expirationDateLow.HasValue)
            {
                Append(criteria, "Edl=" + ((DateTime)expirationDateLow).ToString("MM-dd-yyyy"));
                Append(criteria, "Edh=" + ((DateTime)expirationDateHigh).ToString("MM-dd-yyyy"));
            }
            else if (dateCount != 3)
                Append(criteria, "Exd=" + dateCount);

            if (optionType != OptionType.Both) Append(criteria, "OT=" + optionType.ToString());
            if (futureType != FutureType.Electronic) Append(criteria, "FT=" + futureType.ToString());
            if (symbolType != SymbolType.Composite) Append(criteria, "ST=" + symbolType.ToString());
            if (country != CountryCode.US) Append(criteria, "Cnt=" + country.ToString());

            return criteria.ToString();
        }
开发者ID:bcbowen,项目名称:WebAPIObjects,代码行数:57,代码来源:SymbolSearch.cs


注:本文中的OptionType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。