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)); }
public async Task DeleteAll(DataSourceIdentification dataSourceIdentification) { if (dataSourceIdentification is null) { throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification)); } await this.Delete(dataSourceIdentification, new DateTimeRange()); }
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 Delete(DataSourceIdentification dataSourceIdentification, DeletePredicateRequest deletePredicate) { if (dataSourceIdentification is null) { throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification)); } if (deletePredicate is null) { throw new ArgumentException(ParameterErrorMessage, nameof(deletePredicate)); } await this.context.Client.GetDeleteApi().Delete(deletePredicate, dataSourceIdentification.Bucket, dataSourceIdentification.Organization).ConfigureAwait(false); }
public async Task Delete(DataSourceIdentification dataSourceIdentification, DateTimeRange dateTimeRange) { if (dateTimeRange is null) { throw new ArgumentException(ParameterErrorMessage, nameof(dateTimeRange)); } if (dataSourceIdentification is null) { throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification)); } await this.context.Client.GetDeleteApi().Delete(dateTimeRange.From, dateTimeRange.To, null, dataSourceIdentification.Bucket, dataSourceIdentification.Organization); }
public async Task WriteAll(IEnumerable <TModel> model, DataSourceIdentification dataSourceIdentification) { if (model is null) { throw new ArgumentException(ParameterErrorMessage, nameof(model)); } if (dataSourceIdentification is null) { throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification)); } WriteApiAsync writeContext = this.context.Client.GetWriteApiAsync(); await writeContext.WriteMeasurementsAsync(dataSourceIdentification.Bucket, dataSourceIdentification.Organization, WritePrecision.Ns, model).ConfigureAwait(false); }
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)); }