/// <summary> /// Create the BB connection and populate field data /// </summary> /// <param name="Instruments"></param> private void GetBBData(List <BloombergDataInstrument> Instruments, DateTime valuationDate) { // Update instruments depending on what date we need the data for BloombergDataInstrument.eRequestType requestType = BloombergDataInstrument.eRequestType.Historical; if (valuationdate == DateTime.Today.Date || useHistoricalRequests == false) { requestType = BloombergDataInstrument.eRequestType.Reference; } foreach (BloombergDataInstrument ins in Instruments) { ins.RequestType = requestType; if (requestType == BloombergDataInstrument.eRequestType.Historical) { ins.DateFrom = valuationdate; } } int reference = BERG_from_C_sharp.RequestBBdataVertically(Instruments, "OptionValueManager"); SaveTickerDataAndNotifyComplete(Instruments, reference); }
public List <BloombergDataInstrument> ComposeBBobjects(List <RequestItem> requestItems) { List <BloombergDataInstrument> tickerList = new List <BloombergDataInstrument>(); int lastId = 0; string lastTicker = ""; BloombergDataInstrument.eRequestType lastRequestType = BloombergDataInstrument.eRequestType.NotSet; BloombergDataInstrument bdi = null; foreach (RequestItem ri in requestItems) { if (ri.SendToBloomberg) { bool newBdi = false; // For reference types, we can place the fields into the same bdi for speed if (lastRequestType == ri.RequestType && ri.RequestType == BloombergDataInstrument.eRequestType.Reference) { if (string.Compare(lastTicker, ri.BBTicker, true) != 0) { newBdi = true; } } else { if (lastId != ri.ID) { newBdi = true; } } lastRequestType = ri.RequestType; lastTicker = ri.BBTicker; lastId = ri.ID; if (newBdi) { // Next instrument class bdi = new BloombergDataInstrument(); bdi.ResponseError = ""; bdi.RequestType = ri.RequestType; bdi.ID = ri.ID; bdi.EventType = ri.EventType == null ? null : ri.EventType.ToUpper(); bdi.Ticker = ri.BBTicker; if (ri.DateFrom > DateTime.MinValue) { bdi.DateFrom = ri.DateFrom; } if (ri.DateTo > DateTime.MinValue) { bdi.DateTo = ri.DateTo; } else { // Just one day bdi.DateTo = bdi.DateFrom; } bdi.Periodicity = ri.Periodicity; } foreach (RequestItemField field in ri.riFields.Values) { AddBBfield(bdi, field, ri.ID); } if (newBdi) { tickerList.Add(bdi); } } } return(tickerList); }