How to call websocket api and make a data set based on time?

ashish fugat 11 Reputation points
2020-10-11T07:36:44.293+00:00

I want to call websocket api from data anlytics or data factory which gives continous data from api.

i want to read that data and based on time after every 5 minutes want to take out open high low and close values from that set.

i can able to do it using my c# webjob code but for robust solution looking solution using analytics service.

// here i will get data continously which i will store into below list
var inputList = new SortedSet<MyObject>(new MyObjectComparer());

inputList.Add(new MyObject() { Time = DateTime.Now, Value = 9 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 11 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 13 });
Thread.Sleep(50000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 14 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 16 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 11 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 13 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 12 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 11 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 15 });
Thread.Sleep(10000);
inputList.Add(new MyObject() { Time = DateTime.Now, Value = 16 });

var resultSet = inputList.GroupBy(i => i.GetStartOfPeriodByMins(1)).Select(gr =>
                new
                {
                    StartOfPeriod = gr.Key,
                    Min = gr.Min(item => item.Value),
                    Max = gr.Max(item => item.Value),
                    Open = gr.OrderBy(item => item.Time).First().Value,
                    Close = gr.OrderBy(item => item.Time).Last().Value
                });

var my = resultSet.ToList();
Azure Analysis Services
Azure Analysis Services
An Azure service that provides an enterprise-grade analytics engine.
459 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,222 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,866 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.