private void InitTransientFields() { baseSymbol = MarketEventSymbols.GetBaseSymbol(symbol); if (exchange == null) { exchange = CandleExchange.GetAttributeForSymbol(symbol); } if (price == null) { price = CandlePrice.GetAttributeForSymbol(symbol); } if (session == null) { session = CandleSession.GetAttributeForSymbol(symbol); } if (period == null) { period = CandlePeriod.GetAttributeForSymbol(symbol); } if (alignment == null) { alignment = CandleAlignment.GetAttributeForSymbol(symbol); } if (priceLevel == null) { priceLevel = CandlePriceLevel.GetAttributeForSymbol(symbol); } }
/// <summary> /// Returns candle symbol string with the normalized representation of the candle alignment attribute. /// </summary> /// <param name="symbol">candle symbol string.</param> /// <returns>candle symbol string with the normalized representation of the the candle alignment attribute.</returns> public static string NormalizeAttributeForSymbol(string symbol) { string a = MarketEventSymbols.GetAttributeStringByKey(symbol, ATTRIBUTE_KEY); if (a == null) { return(symbol); } try { CandleAlignment other = Parse(a); if (other == 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); } }
private static string Normalize(string symbol) { symbol = CandlePrice.NormalizeAttributeForSymbol(symbol); symbol = CandleSession.NormalizeAttributeForSymbol(symbol); symbol = CandlePeriod.NormalizeAttributeForSymbol(symbol); symbol = CandleAlignment.NormalizeAttributeForSymbol(symbol); symbol = CandlePriceLevel.NormalizeAttributeForSymbol(symbol); return(symbol); }