internal ElementMarketSubscriptionCancelReason() { this._source = new ElementMarketString("source", "Session"); this._errorCode = new ElementMarketInt("errorCode", 0); this._category = new ElementMarketString("category", "CANCELED"); this._description = new ElementMarketString("description", "Subscription canceled"); this._subCategory = new ElementMarketString("subcategory", ""); }
internal MessageMarketSubscriptionData(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 ElementMarketDouble(item.Key, (double)item.Value); } else if (item.Value is Datetime) { Datetime temp = (Datetime)item.Value; switch (temp.DateTimeType) { case Datetime.DateTimeTypeEnum.date: elm = new ElementMarketDate(item.Key, temp.ToSystemDateTime()); break; case Datetime.DateTimeTypeEnum.time: elm = new ElementMarketTime(item.Key, temp.ToSystemDateTime()); break; case Datetime.DateTimeTypeEnum.both: elm = new ElementMarketDatetime(item.Key, temp.ToSystemDateTime()); break; } } else if (item.Value is int) { elm = new ElementMarketInt(item.Key, (int)item.Value); } else if (item.Value is string) { elm = new ElementMarketString(item.Key, (string)item.Value); } else if (item.Value is bool) { elm = new ElementMarketBool(item.Key, (bool)item.Value); } if (elm != null) { this._fields.Add(item.Key.ToUpper(), elm); } } this._security = sub.Security; }
public ElementMarketReason(ReasonTypeEnum reasonType) { if (reasonType == ReasonTypeEnum.badSecurity) { this._source = new ElementMarketString("source", string.Format("{0}{1}@{2}", Types.RandomDataGenerator.RandomString(5).ToLower(), Types.RandomDataGenerator.RandomInt(9), Types.RandomDataGenerator.RandomInt(99))); this._errorCode = new ElementMarketInt("code", Types.RandomDataGenerator.RandomInt(99)); this._category = new ElementMarketString("category", "BAD_SEC"); this._description = new ElementMarketString("description", "Invalid security, rcode = -1"); } else if (reasonType == ReasonTypeEnum.badField) { this._source = new ElementMarketString("source", string.Format("{0}@{1}", Types.RandomDataGenerator.RandomString(7).ToLower(), Types.RandomDataGenerator.RandomInt(999))); this._errorCode = new ElementMarketInt("errorCode", Types.RandomDataGenerator.RandomInt(99)); this._category = new ElementMarketString("category", "BAD_FLD"); this._description = new ElementMarketString("description", "Unknown Field"); } }
internal MessageMarketSubscriptionData(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 ElementMarketDouble(item.Key, (double)item.Value); else if (item.Value is Datetime) { Datetime temp = (Datetime)item.Value; switch (temp.DateTimeType) { case Datetime.DateTimeTypeEnum.date: elm = new ElementMarketDate(item.Key, temp.ToSystemDateTime()); break; case Datetime.DateTimeTypeEnum.time: elm = new ElementMarketTime(item.Key, temp.ToSystemDateTime()); break; case Datetime.DateTimeTypeEnum.both: elm = new ElementMarketDatetime(item.Key, temp.ToSystemDateTime()); break; } } else if (item.Value is int) elm = new ElementMarketInt(item.Key, (int)item.Value); else if (item.Value is string) elm = new ElementMarketString(item.Key, (string)item.Value); else if (item.Value is bool) elm = new ElementMarketBool(item.Key, (bool)item.Value); if (elm != null) this._fields.Add(item.Key.ToUpper(), elm); } this._security = sub.Security; }