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)); }
private static IFluxQueryBuilder BuildFluxQueryBuilder(IOptions <InfluxDbOptions> options) { var influxDBClientProvider = new InfluxDBClientProvider(options); var envSensorsStore = new FluxQueryBuilder(options, influxDBClientProvider.Get()); return(envSensorsStore); }
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)); }
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)); }