public void TestForHistory() { List <BloombergDataInstrument> bbdis = new List <BloombergDataInstrument>(); BloombergDataInstrument bbdi = new BloombergDataInstrument(); bbdi.RequestType = BloombergDataInstrument.eRequestType.Historic; bbdi.ID = 0; bbdi.Ticker = "VOD LN Equity"; bbdi.SecurityType = "Equity"; bbdi.Type = BloombergDataInstrumentType.Security; bbdi.BBFields = new Dictionary <string, BloombergDataInstrumentField>(); bbdi.BBFields.Add("PX_LAST", new BloombergDataInstrumentField("PX_LAST")); bbdi.DateFrom = DateTime.Today.AddDays(-12); bbdi.DateTo = DateTime.Today.AddDays(-5); bbdis.Add(bbdi); BloombergData bbd = new BloombergData(new StringCollection(), "*****@*****.**", "testing Bloomberg v3 api", ";"); bbd.InstrumentCompleteChanged += bbd_InstrumentCompleteChanged; bbd.PercentCompleteChanged += bbd_PercentCompleteChanged; bbd.ProcessCompleted += bbd_ProcessCompleted; bbd.StatusChanged += bbd_StatusChanged; bbd.GetBloombergData(bbdis); }
public void TestForReference() { List <BloombergDataInstrument> bbdis = new List <BloombergDataInstrument>(); BloombergDataInstrument bbdi = new BloombergDataInstrument(); bbdi.RequestType = BloombergDataInstrument.eRequestType.Reference; bbdi.ID = 0; bbdi.Ticker = "VOD LN Equity"; //bbdi.Ticker = "BBG002626686 BUID"; //bbdi.SecurityType = "Equity"; bbdi.Type = BloombergDataInstrumentType.Security; bbdi.BBFields = new Dictionary <string, BloombergDataInstrumentField>(); bbdi.BBFields.Add("PX_LAST", new BloombergDataInstrumentField("PX_LAST")); bbdis.Add(bbdi); /* * bbdi.ID = 0; * bbdi.Ticker = "US0200021014 EQUITY"; * bbdi.SecurityType = "EQUITY"; * bbdi.Type = BloombergDataInstrumentType.Security; * bbdi.BBFields = new Dictionary<string, object>(); * bbdi.BBFields.Add("ID_ISIN", null); * bbdi.BBFields.Add("BID", null); * bbdi.BBFields.Add("ASK", null); * bbdi.BBFields.Add("PX_CLOSE_DT", null); * bbdis.Add(bbdi); * * bbdi = new BloombergDataInstrument(); * bbdi.ID = 1; * bbdi.Ticker = "RBS LN EQUITY"; * bbdi.SecurityType = "EQUITY"; * bbdi.Type = BloombergDataInstrumentType.Security; * bbdi.BBFields = new Dictionary<string, object>(); * bbdi.BBFields.Add("ID_GAVIN", null); * bbdi.BBFields.Add("PX_LAST", null); * bbdis.Add(bbdi); */ // BloombergData bbd = new BloombergData(new System.Collections.Specialized.StringCollection(), "*****@*****.**", "testing Bloomberg v3 api", ";"); // OR BloombergData bbd = new BloombergData(); bbd.InstrumentCompleteChanged += bbd_InstrumentCompleteChanged; bbd.PercentCompleteChanged += bbd_PercentCompleteChanged; bbd.ProcessCompleted += bbd_ProcessCompleted; bbd.StatusChanged += bbd_StatusChanged; bbd.GetBloombergData(bbdis); }
/// <summary> /// Indicates when the retrieval process has completed. /// </summary> virtual public void GetBbgData(List <BloombergDataInstrument> bbdis) { BloombergData bbd = new BloombergData(); RaiseMessageEvent("Retrieving data"); bbd.PercentCompleteChanged += bbd_PercentCompleteChanged; bbd.ProcessCompleted += bbd_ProcessCompleted; bbd.StatusChanged += bbd_StatusChanged; //wait here ! look for completed to be set bbd.GetBloombergData(bbdis); Completed.Reset(); Completed.WaitOne(); NLogger.Instance.Info("Completed"); }
public void GetBBGData(List <BloombergDataInstrument> bbdis) { Maple.Logger.Log("Started GetBBGData"); BloombergData bbd = new BloombergData(); //bbd.InstrumentCompleteChanged += new BloombergData.InstrumentComplete(bbd_InstrumentCompleteChanged); bbd.PercentCompleteChanged += new BloombergData.PercentComplete(bbd_PercentCompleteChanged); bbd.ProcessCompleted += new BloombergData.ProcessStatus(bbd_ProcessCompleted); bbd.StatusChanged += new BloombergData.StatusUpdate(bbd_StatusChanged); bbd.GetBloombergData(bbdis); while (!completed) { Thread.Sleep(100); // wait } Console.WriteLine("Completed"); Maple.Logger.Log("Completed GetBBGData"); }