internal MarketElementSubscriptionCancelReason()
 {
     this._source      = new MarketElementString("source", "Session");
     this._errorCode   = new MarketElementInt("errorCode", 0);
     this._category    = new MarketElementString("category", "CANCELED");
     this._description = new MarketElementString("description", "Subscription canceled");
     this._subCategory = new MarketElementString("subcategory", "");
 }
Пример #2
0
        internal MarketMessageSubscriptionData(Subscription sub, Dictionary <string, object> fields) : base(new Name("MarketDataEvents"), sub.CorrelationID, null)
        {
            this._fields = new Dictionary <string, Element>();
            foreach (var item in fields)
            {
                Element elm = null;
                if (item.Value is double)
                {
                    elm = new MarketElementDouble(item.Key, (double)item.Value);
                }

                else if (item.Value is Datetime)
                {
                    Datetime temp = (Datetime)item.Value;

                    bool isDate     = temp.HasParts(Datetime.DATE);
                    bool isTime     = temp.HasParts(Datetime.TIME);
                    bool isDatetime = isDate && isTime;

                    if (isDatetime)
                    {
                        elm = new MarketElementDatetime(item.Key, temp.ToSystemDateTime());
                    }
                    else if (isDate)
                    {
                        elm = new MarketElementDate(item.Key, temp.ToSystemDateTime());
                    }
                    else if (isTime)
                    {
                        elm = new MarketElementTime(item.Key, temp.ToSystemDateTime());
                    }
                }

                else if (item.Value is int)
                {
                    elm = new MarketElementInt(item.Key, (int)item.Value);
                }
                else if (item.Value is string)
                {
                    elm = new MarketElementString(item.Key, (string)item.Value);
                }
                else if (item.Value is bool)
                {
                    elm = new MarketElementBool(item.Key, (bool)item.Value);
                }

                if (elm != null)
                {
                    this._fields.Add(item.Key, elm);
                }
            }
            this._security = sub.Security;
        }
Пример #3
0
 public MarketElementReason(ReasonTypeEnum reasonType)
 {
     if (reasonType == ReasonTypeEnum.badSecurity)
     {
         this._source      = new MarketElementString("source", string.Format("{0}{1}@{2}", Types.RandomDataGenerator.RandomString(5).ToLower(), Types.RandomDataGenerator.RandomInt(9), Types.RandomDataGenerator.RandomInt(99)));
         this._errorCode   = new MarketElementInt("errorCode", Types.RandomDataGenerator.RandomInt(99));
         this._category    = new MarketElementString("category", "BAD_SEC");
         this._description = new MarketElementString("description", "Invalid security, rcode = -1");
     }
     else if (reasonType == ReasonTypeEnum.badField)
     {
         this._source      = new MarketElementString("source", string.Format("{0}@{1}", Types.RandomDataGenerator.RandomString(7).ToLower(), Types.RandomDataGenerator.RandomInt(999)));
         this._errorCode   = new MarketElementInt("errorCode", Types.RandomDataGenerator.RandomInt(99));
         this._category    = new MarketElementString("category", "BAD_FLD");
         this._description = new MarketElementString("description", "Unknown Field");
     }
 }
 internal MarketMessageServiceStatus(CorrelationID corr) : base(new Name("ServiceOpened"), corr, null)
 {
     this._serviceName = new MarketElementString("serviceName", "//blp/mktdata");
 }
Пример #5
0
 public MarketElementExceptions(string badField)
 {
     this._fieldId = new MarketElementString("fieldId", badField);
     this._reason  = new MarketElementReason(MarketElementReason.ReasonTypeEnum.badField);
 }
Пример #6
0
 internal MarketElementServiceStatus(MarketMessageServiceStatus arg)
 {
     this._serviceName = (MarketElementString)arg.Elements.First();
 }