Example #1
0
        private readonly Dictionary <string, Element> _fields; //make a dict

        public ElementIntradayTickData(DateTime datetime, Tuple <string, double, int> values, bool includeConditionCodes)
        {
            this._fields = new Dictionary <string, Element>();

            Element elmTime = new ElementIntradayTickDateTime(datetime);

            this._fields.Add(elmTime.Name.ToString().ToUpper(), elmTime);

            //TODO: This should actually be an enumeration, not a string
            Element elmType = new ElementIntradayTickString("type", values.Item1);

            this._fields.Add(elmType.Name.ToString().ToUpper(), elmType);

            Element elmValue = new ElementIntradayTickDouble("value", values.Item2);

            this._fields.Add(elmValue.Name.ToString().ToUpper(), elmValue);

            Element elmSize = new ElementIntradayTickInt("size", values.Item3);

            this._fields.Add(elmSize.Name.ToString().ToUpper(), elmSize);

            if (includeConditionCodes)
            {
                Element elmConditionCodes = new ElementIntradayTickString("conditionCodes", "R6,IS");
                this._fields.Add(elmConditionCodes.Name.ToString().ToUpper(), elmConditionCodes);
            }
        }
        private readonly Dictionary<string, Element> _fields; //make a dict

        #endregion Fields

        #region Constructors

        public ElementIntradayTickData(DateTime datetime, Tuple<string, double, int> values, bool includeConditionCodes)
        {
            this._fields = new Dictionary<string, Element>();

            Element elmTime = new ElementIntradayTickDateTime(datetime);
            this._fields.Add(elmTime.Name.ToString().ToUpper(), elmTime);

            //TODO: This should actually be an enumeration, not a string
            Element elmType = new ElementIntradayTickString("type", values.Item1);
            this._fields.Add(elmType.Name.ToString().ToUpper(), elmType);

            Element elmValue = new ElementIntradayTickDouble("value", values.Item2);
            this._fields.Add(elmValue.Name.ToString().ToUpper(), elmValue);

            Element elmSize = new ElementIntradayTickInt("size", values.Item3);
            this._fields.Add(elmSize.Name.ToString().ToUpper(), elmSize);

            if (includeConditionCodes)
            {
                Element elmConditionCodes = new ElementIntradayTickString("conditionCodes", "R6,IS");
                this._fields.Add(elmConditionCodes.Name.ToString().ToUpper(), elmConditionCodes);
            }
        }