public void Request(string securityId, string[] fields, Action <Dictionary <string, object> > parseResultTableAction, List <Override> overrideList) { if (string.IsNullOrWhiteSpace(securityId) || fields == null || !fields.Any()) { return; } var response = _marketDataProvider.GetData( new StaticDataRequest(SecurityIdentifier.CreateBatchFromBloombergTickers(securityId), Field.CreateBatch(fields), overrideList, allowFallbackToDelayedData: true)); if (response == null || response.Result == null || !response.Result.Rows.Any()) { throw new InvalidDataException( string.Format("Failed to get data from Bloomberg for '{0}'. The result is empty.", securityId)); } if (response.Status == ResponseStatus.Failed) { throw new BPipeException("Response failed.", response.Exception); } var dataRow = response.Result.Rows.FirstOrDefault(); parseResultTableAction(GetResult(dataRow, fields.ToList())); }
public void RequestHist(string[] securityIds, string[] fields, DateTime requestStartDate, DateTime requestEndDate, Action <IReadOnlyList <Dictionary <string, object> > > parseResultTableAction) { var response = _marketDataProvider.GetData( new HistoryStaticDataRequest(SecurityIdentifier.CreateBatchFromBloombergTickers(securityIds), Field.CreateBatch(fields), allowFallbackToDelayedData: true, optionalParameters: new[] { BloombergOptionalParameters.PeriodicitySelectionParameter(PeriodicitySelection.Daily), BloombergOptionalParameters.PeriodicityAdjustmentParameter(PeriodicityAdjustment.Actual), BloombergOptionalParameters.StartDateParameter(requestStartDate), BloombergOptionalParameters.EndDateParameter(requestEndDate) } )); if (response == null || response.Result == null || !response.Result.Rows.Any()) { throw new InvalidDataException( string.Format("Failed to get data from Bloomberg for '{0}'. The result dataset is empty.", string.Join(",", securityIds))); } if (response.Status == ResponseStatus.Failed) { throw new BPipeException("Response failed.", response.Exception); } var dataList = GetResultList(response.Result.Rows, fields.ToList()); parseResultTableAction(dataList); }
public void Request(string[] securityIds, string[] fields, Action <IReadOnlyList <Dictionary <string, object> > > parseResultTableAction) { var response = _marketDataProvider.GetData( new StaticDataRequest(SecurityIdentifier.CreateBatchFromBloombergTickers(securityIds), Field.CreateBatch(fields), allowFallbackToDelayedData: true)); if (response == null || response.Result == null || !response.Result.Rows.Any()) { throw new InvalidDataException( string.Format("Failed to get data from Bloomberg for '{0}'. The result dataset is empty.", string.Join(",", securityIds))); } if (response.Status == ResponseStatus.Failed) { throw new BPipeException("Response failed.", response.Exception); } parseResultTableAction(GetResultList(response.Result.Rows, fields.ToList())); }