stockshark-data-access
Advanced tools
Comparing version 1.0.51 to 1.0.52
{ | ||
"name": "stockshark-data-access", | ||
"version": "1.0.51", | ||
"version": "1.0.52", | ||
"main": "./src/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -1,2 +0,2 @@ | ||
const { InfluxDB, Point } = require("@influxdata/influxdb-client"); | ||
const { InfluxDB, Point, } = require("@influxdata/influxdb-client"); | ||
const apis = require("@influxdata/influxdb-client-apis"); | ||
@@ -55,7 +55,18 @@ | ||
async readSequence(id) { | ||
let fluxQuery = `from(bucket: "${config.INFLUXDB_BUCKET}") | ||
|> range(start: 0) | ||
|> filter(fn: (r) => r._measurement == "${id}")`; | ||
async readSequence(id, start, end) { | ||
const _start = start ? start / 1000 : undefined // Convert to seconds | ||
const _end = end ? end / 1000 : undefined // Convert to seconds | ||
let fluxQuery = `from(bucket: "${config.INFLUXDB_BUCKET}")`; | ||
if (_start && _end) { | ||
fluxQuery += ` |> range(start: ${_start}, stop: ${_end})`; | ||
} else if (_start) { | ||
fluxQuery += ` |> range(start: ${_start})`; | ||
} else if (_end) { | ||
fluxQuery += ` |> range(stop: ${_end})`; | ||
} | ||
fluxQuery += ` |> filter(fn: (r) => r._measurement == "${id}")` | ||
const result = []; | ||
@@ -62,0 +73,0 @@ for await (const { values, tableMeta } of this.queryApi.iterateRows(fluxQuery)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22179
428