Esempio n. 1
0
        public async Task <List <TModel> > GetPastHoursData(DataSourceIdentification dataSourceIdentification, int hour, string cryptoTicker)
        {
            FluxQueryBuilder queryBulder = this.GetHourDataQuery(dataSourceIdentification, hour).AddFilter("ticker", cryptoTicker);
            List <FluxTable> data        = await this.context.Client.GetQueryApi().QueryAsync(queryBulder.CreateQuery(), dataSourceIdentification.Organization);

            return(this.ParseData(data));
        }
Esempio n. 2
0
        private static IFluxQueryBuilder BuildFluxQueryBuilder(IOptions <InfluxDbOptions> options)
        {
            var influxDBClientProvider = new InfluxDBClientProvider(options);
            var envSensorsStore        = new FluxQueryBuilder(options, influxDBClientProvider.Get());

            return(envSensorsStore);
        }
Esempio n. 3
0
        private FluxQueryBuilder GetHourDataQuery(DataSourceIdentification dataSourceIdentification, int hour)
        {
            if (dataSourceIdentification is null)
            {
                throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification));
            }

            FluxQueryBuilder queryBuilder = new FluxQueryBuilder();

            return(queryBuilder.From(dataSourceIdentification.Bucket)
                   .RangePastDays(hour)
                   .AddMeasurementFilter(this.measurementName));
        }
Esempio n. 4
0
        public async Task <List <TModel> > GetPastDaysData(DataSourceIdentification dataSourceIdentification, int days)
        {
            if (dataSourceIdentification is null)
            {
                throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification));
            }

            FluxQueryBuilder queryBuilder = new FluxQueryBuilder();
            string           query        = queryBuilder.From(dataSourceIdentification.Bucket)
                                            .RangePastDays(days)
                                            .AddMeasurementFilter(this.measurementName)
                                            .CreateQuery();

            List <FluxTable> data = await this.context.Client.GetQueryApi().QueryAsync(query, dataSourceIdentification.Organization);

            return(this.ParseData(data));
        }