Пример #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 session attribute of the given candle symbol string.
        /// The result is {@link #DEFAULT} if the symbol does not have candle session attribute.
        /// </summary>
        /// <param name="symbol">candle symbol string.</param>
        /// <returns>candle session attribute of the given candle symbol string.</returns>
        public static CandleSession GetAttributeForSymbol(string symbol)
        {
            string a = MarketEventSymbols.GetAttributeStringByKey(symbol, ATTRIBUTE_KEY);

            return(a != null && bool.Parse(a) ? REGULAR : DEFAULT);
        }
Пример #4
0
        /// <summary>
        /// Returns candle price level attribute of the given candle symbol string.
        /// The result is {@link #DEFAULT} if the symbol does not have candle session attribute.
        /// </summary>
        /// <param name="symbol">The candle symbol string.</param>
        /// <returns>The candle price level attribute of the given candle symbol string.</returns>
        public static CandlePriceLevel GetAttributeForSymbol(string symbol)
        {
            var s = MarketEventSymbols.GetAttributeStringByKey(symbol, ATTRIBUTE_KEY);

            return(s == null ? DEFAULT : Parse(s));
        }