예제 #1
0
        public IntradayTickElementData(DateTime datetime, Types.Tuple3 <string, double, int> values, bool includeConditionCodes)
        {
            this._fields = new Dictionary <string, Element>();

            Element elmTime = new IntradayTickElementDateTime(datetime);

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

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

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

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

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

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

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

            if (includeConditionCodes)
            {
                Element elmConditionCodes = new IntradayTickElementString("conditionCodes", "R6,IS");
                this._fields.Add(elmConditionCodes.Name.ToString(), elmConditionCodes);
            }
        }
        internal IntradayTickElementResponseError()
        {
            int    code            = Types.RandomDataGenerator.RandomInt(99);
            string sourceGibberish = Types.RandomDataGenerator.RandomString(5).ToLower();

            this._source      = new IntradayTickElementString("source", string.Format("{0}::{1}{2}", code, sourceGibberish, Types.RandomDataGenerator.RandomInt(99)));
            this._code        = new IntradayTickElementInt("code", code);
            this._category    = new IntradayTickElementString("category", "BAD_SEC");
            this._message     = new IntradayTickElementString("message", string.Format("Unknown/Invalid security [nid:{0}]", code));
            this._subCategory = new IntradayTickElementString("subcategory", "INVALID_SECURITY");
        }