示例#1
0
        /// <summary>
        /// Returns candle symbol string with the normalized representation of the candle session attribute.
        /// </summary>
        /// <param name="symbol">candle symbol string.</param>
        /// <returns>candle symbol string with the normalized representation of the the candle session attribute.</returns>
        public static string NormalizeAttributeForSymbol(string symbol)
        {
            string a = MarketEventSymbols.GetAttributeStringByKey(symbol, ATTRIBUTE_KEY);

            if (a == null)
            {
                return(symbol);
            }
            try
            {
                bool b = bool.Parse(a);
                if (!b)
                {
                    MarketEventSymbols.RemoveAttributeStringByKey(symbol, ATTRIBUTE_KEY);
                }
                if (b && !a.Equals(REGULAR.ToString()))
                {
                    return(MarketEventSymbols.ChangeAttributeStringByKey(symbol, ATTRIBUTE_KEY, REGULAR.ToString()));
                }
                return(symbol);
            }
            catch (ArgumentNullException)
            {
                return(symbol);
            }
        }
示例#2
0
        /// <summary>
        /// Returns candle symbol string with the normalized representation of the candle price level attribute.
        /// </summary>
        /// <param name="symbol">The candle symbol string.</param>
        /// <returns>The candle symbol string with the normalized representation of the the candle price level attribute.</returns>
        public static string NormalizeAttributeForSymbol(string symbol)
        {
            var a = MarketEventSymbols.GetAttributeStringByKey(symbol, ATTRIBUTE_KEY);

            if (a == null)
            {
                return(symbol);
            }
            try
            {
                var other = Parse(a);

                if (other.Equals(DEFAULT))
                {
                    MarketEventSymbols.RemoveAttributeStringByKey(symbol, ATTRIBUTE_KEY);
                }

                return(!a.Equals(other.ToString())
                    ? MarketEventSymbols.ChangeAttributeStringByKey(symbol, ATTRIBUTE_KEY, other.ToString())
                    : symbol);
            } catch (ArgumentNullException)
            {
                return(symbol);
            }
        }
示例#3
0
 /// <summary>
 /// Returns candle event symbol string with this session attribute set.
 /// </summary>
 /// <param name="symbol">original candle event symbol.</param>
 /// <returns>candle event symbol string with this session attribute set.</returns>
 public string ChangeAttributeForSymbol(string symbol)
 {
     return(this == DEFAULT?
            MarketEventSymbols.RemoveAttributeStringByKey(symbol, ATTRIBUTE_KEY) :
                MarketEventSymbols.ChangeAttributeStringByKey(symbol, ATTRIBUTE_KEY, ToString()));
 }
示例#4
0
 public string ChangeAttributeForSymbol(string symbol)
 {
     return(Equals(this, DEFAULT)
         ? MarketEventSymbols.RemoveAttributeStringByKey(symbol, ATTRIBUTE_KEY)
         : MarketEventSymbols.ChangeAttributeStringByKey(symbol, ATTRIBUTE_KEY, stringBuf));
 }