public async Task OpenItemAsync(string item, Refinitiv.DataPlatform.Core.ISession RdpSession, Type modelType, bool streamRequest = false) { var fieldNameList = modelType.GetProperties() .SelectMany(p => p.GetCustomAttributes(typeof(JsonPropertyAttribute)) .Cast <JsonPropertyAttribute>()) .Select(prop => prop.PropertyName) .ToArray(); await OpenItemAsync(item, RdpSession, fieldNameList, streamRequest); }
public async Task OpenItemAsync(string item, Refinitiv.DataPlatform.Core.ISession RdpSession, Type modelType) { var fieldnameList = modelType.GetProperties() .SelectMany(p => p.GetCustomAttributes(typeof(JsonPropertyAttribute)) .Cast <JsonPropertyAttribute>()) .Select(prop => prop.PropertyName) .ToArray(); if (RdpSession != null) { await Task.Run(() => { ItemStream.Params itemParams; if (!fieldnameList.Any()) { // First, prepare our item stream details including the fields of interest and where to capture events... itemParams = new ItemStream.Params().Session(RdpSession) .OnRefresh(processOnRefresh) .OnUpdate(processOnUpdate) .OnStatus(processOnStatus); } else { // First, prepare our item stream details including the fields of interest and where to capture events... itemParams = new ItemStream.Params().Session(RdpSession) .WithFields(fieldnameList) .OnRefresh(processOnRefresh) .OnUpdate(processOnUpdate) .OnStatus(processOnStatus); } var stream = DeliveryFactory.CreateStream(itemParams.Name(item)); if (_streamCache.TryAdd(item, stream)) { stream.OpenAsync(); } else { var msg = $"Unable to open new stream for item {item}."; RaiseOnError(msg); } }); } else { throw new ArgumentNullException("RDP Session is null."); } }
public async Task <CompanyName> GetCompanyNameAsync(Refinitiv.DataPlatform.Core.ISession session, string ricname) { var companyName = new CompanyName(); var endpoint = new StringBuilder(); endpoint.Append(baseEndpoint); endpoint.Append($"corp/company-name/{ricname}"); var response = await Endpoint.SendRequestAsync(session, endpoint.ToString()).ConfigureAwait(true); if (response.IsSuccess) { companyName = response.Data?.Raw?["data"]["companyName"].ToObject <CompanyName>(); } return(companyName); }
public async Task <List <string> > GetFiledList(string item, Refinitiv.DataPlatform.Core.ISession RdpSession) { var fields = new List <string>(); bool isComplete = false; if (RdpSession != null) { await Task.Run(() => { using (var stream = Pricing.CreateStreamingPrices(new StreamingPrices.Params().WithStreaming(false).Universe(item) .OnStatus((o, item, status) => { isComplete = true; }))) { if (stream.Open() == Stream.State.Opened) { // Retrieve a snapshot of the whole cache. The interface also supports the ability to pull out specific items and fields. var snapshot = stream.GetSnapshotData().FirstOrDefault(); if (snapshot.Key == item) { var fieldList = ((IPriceData)snapshot.Value).Fields(); foreach (var key in fieldList) { fields.Add((string)key); } } isComplete = true; } } }).ConfigureAwait(false); } else { throw new ArgumentNullException("RDP Session is null."); } while (!isComplete) { ; } return(fields); }
public async Task OpenItemAsync(string item, Refinitiv.DataPlatform.Core.ISession RdpSession, IEnumerable <string> fieldNameList = null, bool streamRequest = false) { if (RdpSession != null) { await Task.Run(() => { var itemParams = new ItemStream.Params().Session(RdpSession) .WithStreaming(streamRequest) .OnRefresh(processOnRefresh) .OnUpdate(processOnUpdate) .OnStatus(processOnStatus); var nameList = (fieldNameList ?? Array.Empty <string>()).ToList(); if (nameList.Any()) { // First, prepare our item stream details including the fields of interest and where to capture events... itemParams.WithFields(nameList); } var stream = DeliveryFactory.CreateStream(itemParams.Name(item)); if (_streamCache.TryAdd(item, stream)) { stream.OpenAsync(); } else { var msg = $"Unable to open new stream for item {item}."; RaiseOnError(msg); } }).ConfigureAwait(false); } else { throw new ArgumentNullException("RDP Session is null."); } }
public async Task OpenItemAsync(string item, Refinitiv.DataPlatform.Core.ISession RdpSession, bool streamRequest = false) { await OpenItemAsync(item, RdpSession, new List <string>(), streamRequest); }