public static SObjectDTO GetIntradayHistData(string moniker_) { SObjectDTO ret = new SObjectDTO() { Moniker = moniker_ }; try { var moniker = GetHistDataMoniker.FromMoniker(moniker_); if(!moniker.IsComplete()) { ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("given moniker was not complete"); return ret; } var staticF = StaticFutureHelpers.GetStaticFuturesForBbgStart(moniker.BbgTicker); if (staticF == null || staticF.Count()==0) { ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage(string.Format("cannot locate static info for bbg ticker = {0}. Consider using symFindFutures to ensure we have future first", moniker.BbgTicker)); return ret; } var tz = (IntradayData.TZ)Enum.Parse(typeof(IntradayData.TZ), moniker.Timezone.ToUpper()); var dfT = (IntradayData.DataFrequencyType)Enum.Parse(typeof(IntradayData.DataFrequencyType),moniker.FrequencyPeriodType.ToUpper()); ret.Xml = IntradayDataHelpers.GetDataAsXml(staticF.First(), moniker.StartDateTime.Value, moniker.EndDateTime.Value, tz, moniker.FrequencyNumPeriods.Value, dfT); if (ret.Xml == null) ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("No data found"); } catch (Exception ex_) { SLog.log.Error(string.Format("Error getting intraday hist data for moniker: {0}", moniker_), ex_); ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("Internal server error"); } return ret; }
public static SObjectDTO GetEventDates(string moniker_) { var ret = new SObjectDTO() { Moniker = moniker_ }; try { var moniker = GetEventDatesMoniker.FromMoniker(moniker_); if (!moniker.IsComplete()) { ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("given moniker was not complete"); return ret; } var eventGroup = EventGroupHelpers.GetEventGroupWithCode(moniker.EventCode); if (eventGroup == null) { ret.Xml = EventGroupHelpers.GetAllEventGroupsAsXml(); return ret; } TZ tz = (TZ)Enum.Parse(typeof(TZ), moniker.TimeZone); ret.Xml = IntradayDataHelpers.GetEventDatesAsXml(eventGroup, tz, moniker.StartDate.Value, moniker.EndDate.Value); if (ret.Xml == null) ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("No data found"); } catch(Exception ex_) { SLog.log.Error(string.Format("Error getting event dates for moniker: {0}", moniker_), ex_); ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("Internal server error"); } return ret; }
public static SObjectDTO FindFutures(string moniker_) { SObjectDTO ret = new SObjectDTO() { Moniker=moniker_ }; try { var m = FindFuturesMoniker.FromMoniker(moniker_); var list = IntradayData.StaticFutureHelpers.GetStaticFuturesForBbgStart(bbgStart_: m.BbgCodeStartWith.ToUpper(), liveDate_: m.LiveDate); if (list != null) ret.Xml = list.Select(x => new { SymmetryCode = x.BbgTicker, FirstTrade = x.FirstTrade, LastTrade = x.LastTrade, Description = x.Description }) .ToGenericTableXml(); else ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage(string.Format("'{0}' @ '{1}' -> No matching futures found.", m.BbgCodeStartWith, m.LiveDate.ToString("dd-MMM-yyyy"))); } catch (Exception ex_) { SLog.log.Error("Error Finding Futures", ex_); ret.Xml = IntradayDataHelpers.XmlStringForGenericTableErrorMessage("Internal server error"); } return ret; }