private List <Message> GenerateMessages() { List <Message> result = new List <Message>(); var ireq = (IntradayTickRequest)base._request; string security = ireq.Security; bool isResponseError = Types.Rules.IsSecurityError(security); if (isResponseError) { IntradayTickMessage msg = new IntradayTickMessage(base._request.correlationId, ireq.Service); result.Add(msg); } else { var tickData = new SortedDictionary <DateTime, Types.Tuple3 <string, double, int> >(); if (ireq.DtStart.HasValue) { foreach (var dtCurrent in ireq.GetDates()) { if ((dtCurrent.DayOfWeek != DayOfWeek.Sunday) && (dtCurrent.DayOfWeek != DayOfWeek.Saturday)) { var value = new Types.Tuple3 <string, double, int>("TRADE", Types.RandomDataGenerator.RandomDouble(), Types.RandomDataGenerator.IntradayTickTradeSize()); tickData.Add(dtCurrent, value); } } } IntradayTickMessage msg = new IntradayTickMessage(base._request.correlationId, ireq.Service, tickData, ireq.IncludeConditionCodes); result.Add(msg); } return(result); }
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); } }