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

            if (a == null)
            {
                return(symbol);
            }
            try
            {
                CandlePeriod other = Parse(a);
                if (other.Equals(DEFAULT))
                {
                    MarketEventSymbols.RemoveAttributeStringByKey(symbol, ATTRIBUTE_KEY);
                }
                if (!a.Equals(other.ToString()))
                {
                    return(MarketEventSymbols.ChangeAttributeStringByKey(symbol, ATTRIBUTE_KEY, other.ToString()));
                }
                return(symbol);
            }
            catch (ArgumentNullException)
            {
                return(symbol);
            }
        }
예제 #2
0
 /// <summary>
 /// Checks this candle symbol have all default attributes.
 /// </summary>
 /// <returns>"true" if all attributes is default, otherwise returns false.</returns>
 public bool IsDefault()
 {
     return(exchange.Equals(CandleExchange.DEFAULT) &&
            period.Equals(CandlePeriod.DEFAULT) &&
            alignment.Equals(CandleAlignment.DEFAULT) &&
            price.Equals(CandlePrice.DEFAULT) &&
            session.Equals(CandleSession.DEFAULT) &&
            priceLevel.Equals(CandlePriceLevel.DEFAULT));
 }