internal ElementReferenceFieldData(Dictionary <string, object> values)
        {
            this._fields = new List <Element>();

            foreach (var item in values)
            {
                if (item.Value is double)
                {
                    Element elmDouble = new ElementReferenceDouble(item.Key.ToUpper(), (double)item.Value);
                    this._fields.Add(elmDouble);
                }
                else if (item.Value is int)
                {
                    Element elmInt = new ElementReferenceInt(item.Key.ToUpper(), (int)item.Value);
                    this._fields.Add(elmInt);
                }
                else if (item.Value is DateTime)
                {
                    Element elmDateTime = new ElementReferenceDateTime(item.Key.ToUpper(), (DateTime)item.Value);
                    this._fields.Add(elmDateTime);
                }
                else if (item.Value is string)
                {
                    Element elmString = new ElementReferenceString(item.Key.ToUpper(), (string)item.Value);
                    this._fields.Add(elmString);
                }
                else if (item.Value is ElementReferenceArrayChainTickers)
                {
                    this._fields.Add((ElementReferenceArrayChainTickers)item.Value);
                }
            }
        }
        internal ElementReferenceErrorInfo()
        {
            string sourceGibberish = Types.RandomDataGenerator.RandomString(5).ToLower();

            this._source = new ElementReferenceString("source", string.Format("{0}::{1}{2}", Types.RandomDataGenerator.RandomInt(99), sourceGibberish, Types.RandomDataGenerator.RandomInt(99)));
            this._code = new ElementReferenceInt("code", Types.RandomDataGenerator.RandomInt(99));
            this._category = new ElementReferenceString("category", "BAD_FLD");
            this._message = new ElementReferenceString("message", "Field not valid");
            this._subCategory = new ElementReferenceString("subcategory", "INVALID_FIELD");
        }
        internal ElementReferenceSecurityError(string security)
        {
            int code = Types.RandomDataGenerator.RandomInt(99);
            string sourceGibberish = Types.RandomDataGenerator.RandomString(5).ToLower();

            this._source = new ElementReferenceString("source", string.Format("{0}::{1}{2}", code, sourceGibberish, Types.RandomDataGenerator.RandomInt(99)));
            this._code = new ElementReferenceInt("code", code);
            this._category = new ElementReferenceString("category", "BAD_SEC");
            this._message = new ElementReferenceString("message", string.Format("Unknown/Invalid security [nid:{0}]", code));
            this._subCategory = new ElementReferenceString("subcategory", "INVALID_SECURITY");
        }
        public override void SetElement(string name, object value)
        {
            var toUse = name.ToUpper();

            switch (toUse)
            {
            case "FIELDID":
                this._fieldId = new ElementReferenceString(toUse, value.ToString());
                break;

            case "VALUE":
                this._value = new ElementReferenceObject(toUse, value);
                break;

            default:
                throw new ArgumentException();
            }
        }
        internal ElementReferenceSecurityData(string securityName, Dictionary<string, object> fieldData, int sequenceNumber)
        {
            this._isSecurityError = Types.Rules.IsSecurityError(securityName);

            { //find bad field names
                List<string> badFields = new List<string>();
                foreach (var item in fieldData)
                {
                    if (Types.Rules.IsBadField(item.Key))
                        badFields.Add(item.Key);
                }

                //remove bad field names from the dictionary
                foreach (var item in badFields)
                {
                    fieldData.Remove(item);
                }

                if (badFields.Count == 0)
                    this._elmFieldExceptions = null;
                else
                    this._elmFieldExceptions = new ElementReferenceFieldExceptionsArray(badFields);
            }

            this._elmSecurityName = new ElementReferenceString("security", securityName);
            if (this._isSecurityError)
            {
                this._elmSequenceNumber = new ElementReferenceInt("sequenceNumber", sequenceNumber);
                this._elmSecError = new ElementReferenceSecurityError(securityName);
                this._elmFieldData = new ElementReferenceFieldData(new Dictionary<string, object>());
            }
            else
            {
                this._elmSequenceNumber = new ElementReferenceInt("sequenceNumber", sequenceNumber);
                this._elmSecError = null;
                this._elmFieldData = new ElementReferenceFieldData(fieldData);
            }
        }
        internal ElementReferenceArrayChainTickersItem(string ticker, DateTime dtExp, ElementReferenceArrayChainTickers.OptionalityEnum optionality, int strike)
        {
            string optionTicker = string.Format("{0} US {1:MM/dd/yy} {2}{3}", ticker, dtExp, (char)optionality, strike);

            this._element = new ElementReferenceString("TICKER", optionTicker);
        }
 internal ElementReferenceArrayChainTickersItem(string ticker, DateTime dtExp, ElementReferenceArrayChainTickers.OptionalityEnum optionality, int strike)
 {
     string optionTicker = string.Format("{0} US {1:MM/dd/yy} {2}{3}", ticker, dtExp, (char)optionality, strike);
     this._element = new ElementReferenceString("TICKER", optionTicker);
 }
 public override void SetElement(string name, object value)
 {
     var toUse = name.ToUpper();
     switch (toUse)
     {
         case "FIELDID":
             this._fieldId = new ElementReferenceString(toUse, value.ToString());
             break;
         case "VALUE":
             this._value = new ElementReferenceObject(toUse, value);
             break;
         default:
             throw new ArgumentException();
     }
 }
 internal RequestReferenceElementOverride()
 {
     this._fieldId = new ElementReferenceString("fieldId", "");
     this._value = new ElementReferenceObject("value", "");
 }
 public ElementReferenceFieldExceptions(string badField)
 {
     this._fieldId = new ElementReferenceString("fieldId", badField);
     this._errorInfo = new ElementReferenceErrorInfo();
 }
 internal RequestReferenceElementOverride()
 {
     this._fieldId = new ElementReferenceString("fieldId", "");
     this._value   = new ElementReferenceObject("value", "");
 }
Ejemplo n.º 12
0
 internal ElementReferenceSecurityData(string securityName, Dictionary <string, object> fieldData, int sequenceNumber)
 {
     this._elmSecurityName   = new ElementReferenceString("security", securityName);
     this._elmSequenceNumber = new ElementReferenceInt("sequenceNumber", sequenceNumber);
     this._elmFieldData      = new ElementReferenceFieldData(fieldData);
 }