stockshark-util
Advanced tools
Comparing version 1.0.402 to 1.0.403
{ | ||
"name": "stockshark-util", | ||
"version": "1.0.402", | ||
"version": "1.0.403", | ||
"description": "util", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -0,41 +1,66 @@ | ||
const util = require("./util") | ||
function getIndicatorKey({ live, instrument, indicatorName, interval, scaling }) { | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `Indicators/${prefixLive}/${instrument}/${indicatorName}-${interval}-${scaling}` | ||
return cacheKey | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `Indicators/${prefixLive}/${instrument}/${indicatorName}-${interval}-${scaling}` | ||
return cacheKey | ||
} | ||
function parseIndicatorKey(key) { | ||
key = key.substring("Indicators/".length) | ||
key = key.substring("Indicators/".length) | ||
const parts1 = key.split("/") | ||
const parts2 = parts1[2].split("-") | ||
const parts1 = key.split("/") | ||
const parts2 = parts1[2].split("-") | ||
const live = parts1[0] === "live" | ||
const instrument = parts1[1] | ||
const live = parts1[0] === "live" | ||
const instrument = parts1[1] | ||
const indicatorName = parts2[0] | ||
const interval = parts2[1] | ||
const scaling = parts2[2] | ||
return { live, instrument, indicatorName, interval, scaling } | ||
const indicatorName = parts2[0] | ||
const interval = parts2[1] | ||
const scaling = parts2[2] | ||
return { live, instrument, indicatorName, interval, scaling } | ||
} | ||
function getPredictorKey({ live, instrument, indicatorName, interval, scaling, modelId, num_of_loops }) { | ||
modelId = util.replaceAll(modelId, "-", "") | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `Predictors/${prefixLive}/${instrument}/${indicatorName}-${interval}-${scaling}-${modelId}-${num_of_loops}` | ||
return cacheKey | ||
} | ||
function parsePredictorKey(key) { | ||
key = key.substring("Predictors/".length) | ||
const parts1 = key.split("/") | ||
const parts2 = parts1[2].split("-") | ||
const live = parts1[0] === "live" | ||
const instrument = parts1[1] | ||
const indicatorName = parts2[0] | ||
const interval = parts2[1] | ||
const scaling = parts2[2] | ||
const modelId = parts2[3] | ||
const num_of_loops = parts2[4] | ||
return { live, instrument, indicatorName, interval, scaling, modelId, num_of_loops } | ||
} | ||
function getSourceKey({ live, instrument, interval }) { | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `Sources/${prefixLive}/${instrument}/${interval}` | ||
return cacheKey | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `Sources/${prefixLive}/${instrument}/${interval}` | ||
return cacheKey | ||
} | ||
function getRegularizedSourceKey({ live, instrument, interval }) { | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `RegularizedSources/${prefixLive}/${instrument}/${interval}` | ||
return cacheKey | ||
const prefixLive = live ? "live" : "train" | ||
const cacheKey = `RegularizedSources/${prefixLive}/${instrument}/${interval}` | ||
return cacheKey | ||
} | ||
module.exports = { | ||
getIndicatorKey, | ||
parseIndicatorKey, | ||
getSourceKey, | ||
getRegularizedSourceKey | ||
getIndicatorKey, | ||
parseIndicatorKey, | ||
getPredictorKey, | ||
getSourceKey, | ||
getRegularizedSourceKey, | ||
} |
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
110130
3136