Ejemplo n.º 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);
            }
        }
        internal ElementIntradayTickResponseError()
        {
            int code = Types.RandomDataGenerator.RandomInt(99);
            string sourceGibberish = Types.RandomDataGenerator.RandomString(5).ToLower();

            this._source = new ElementIntradayTickString("source", string.Format("{0}::{1}{2}", code, sourceGibberish, Types.RandomDataGenerator.RandomInt(99)));
            this._code = new ElementIntradayTickInt("code", code);
            this._category = new ElementIntradayTickString("category", "BAD_SEC");
            this._message = new ElementIntradayTickString("message", string.Format("Unknown/Invalid security [nid:{0}]", code));
            this._subCategory = new ElementIntradayTickString("subcategory", "INVALID_SECURITY");
        }
Ejemplo n.º 3
0
        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);
            }
        }