21bbd521b3
- Rust core: super_trend.rs (SuperTrend — ATR-banded trailing stop with
flip logic; SuperTrendOutput { value, direction }), chandelier_exit.rs
(Chandelier Exit — ATR stop hung off the window's highest high / lowest
low; ChandelierExitOutput { long_stop, short_stop }),
chande_kroll_stop.rs (Chande Kroll Stop — a two-stage ATR stop;
ChandeKrollStopOutput { stop_long, stop_short }), atr_trailing_stop.rs
(ATR Trailing Stop — a single ratcheting close-based stop). Each with a
full Indicator impl, runnable doctest and reference / property / warmup
/ reset / batch==streaming tests.
- Python: PySuperTrend / PyChandelierExit / PyChandeKrollStop /
PyAtrTrailingStop PyO3 classes (struct outputs as tuples and (n, 2)
arrays) + module registration + .pyi stubs.
- Node: explicit SuperTrendNode / ChandelierExitNode / ChandeKrollStopNode
/ AtrTrailingStopNode with SuperTrendValue / ChandelierExitValue /
ChandeKrollStopValue objects; index.d.ts and index.js updated.
- WASM: WasmSuperTrend / WasmChandelierExit / WasmChandeKrollStop /
WasmAtrTrailingStop.
- Wiki: Indicator-SuperTrend/ChandelierExit/ChandeKrollStop/
AtrTrailingStop.md plus rows in the "Trailing stop" table of
Indicators-Overview.md and entries in Home.md.
- Add clippy.toml with doc-valid-idents for the proper noun "LeBeau".
cargo fmt + clippy (core/wickra/data/wasm/node) clean; 427 core tests,
25 data tests and 61 doctests green.
374 lines
11 KiB
JavaScript
374 lines
11 KiB
JavaScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/* prettier-ignore */
|
|
|
|
/* auto-generated by NAPI-RS */
|
|
|
|
const { existsSync, readFileSync } = require('fs')
|
|
const { join } = require('path')
|
|
|
|
const { platform, arch } = process
|
|
|
|
let nativeBinding = null
|
|
let localFileExisted = false
|
|
let loadError = null
|
|
|
|
function isMusl() {
|
|
// For Node 10
|
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
try {
|
|
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
} catch (e) {
|
|
return true
|
|
}
|
|
} else {
|
|
const { glibcVersionRuntime } = process.report.getReport().header
|
|
return !glibcVersionRuntime
|
|
}
|
|
}
|
|
|
|
switch (platform) {
|
|
case 'android':
|
|
switch (arch) {
|
|
case 'arm64':
|
|
localFileExisted = existsSync(join(__dirname, 'wickra.android-arm64.node'))
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.android-arm64.node')
|
|
} else {
|
|
nativeBinding = require('wickra-android-arm64')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
case 'arm':
|
|
localFileExisted = existsSync(join(__dirname, 'wickra.android-arm-eabi.node'))
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.android-arm-eabi.node')
|
|
} else {
|
|
nativeBinding = require('wickra-android-arm-eabi')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
default:
|
|
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
}
|
|
break
|
|
case 'win32':
|
|
switch (arch) {
|
|
case 'x64':
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.win32-x64-msvc.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.win32-x64-msvc.node')
|
|
} else {
|
|
nativeBinding = require('wickra-win32-x64-msvc')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
case 'ia32':
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.win32-ia32-msvc.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.win32-ia32-msvc.node')
|
|
} else {
|
|
nativeBinding = require('wickra-win32-ia32-msvc')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
case 'arm64':
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.win32-arm64-msvc.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.win32-arm64-msvc.node')
|
|
} else {
|
|
nativeBinding = require('wickra-win32-arm64-msvc')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
default:
|
|
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
}
|
|
break
|
|
case 'darwin':
|
|
localFileExisted = existsSync(join(__dirname, 'wickra.darwin-universal.node'))
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.darwin-universal.node')
|
|
} else {
|
|
nativeBinding = require('wickra-darwin-universal')
|
|
}
|
|
break
|
|
} catch {}
|
|
switch (arch) {
|
|
case 'x64':
|
|
localFileExisted = existsSync(join(__dirname, 'wickra.darwin-x64.node'))
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.darwin-x64.node')
|
|
} else {
|
|
nativeBinding = require('wickra-darwin-x64')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
case 'arm64':
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.darwin-arm64.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.darwin-arm64.node')
|
|
} else {
|
|
nativeBinding = require('wickra-darwin-arm64')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
default:
|
|
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
}
|
|
break
|
|
case 'freebsd':
|
|
if (arch !== 'x64') {
|
|
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
}
|
|
localFileExisted = existsSync(join(__dirname, 'wickra.freebsd-x64.node'))
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.freebsd-x64.node')
|
|
} else {
|
|
nativeBinding = require('wickra-freebsd-x64')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
case 'linux':
|
|
switch (arch) {
|
|
case 'x64':
|
|
if (isMusl()) {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-x64-musl.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-x64-musl.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-x64-musl')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
} else {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-x64-gnu.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-x64-gnu.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-x64-gnu')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
}
|
|
break
|
|
case 'arm64':
|
|
if (isMusl()) {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-arm64-musl.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-arm64-musl.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-arm64-musl')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
} else {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-arm64-gnu.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-arm64-gnu.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-arm64-gnu')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
}
|
|
break
|
|
case 'arm':
|
|
if (isMusl()) {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-arm-musleabihf.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-arm-musleabihf.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-arm-musleabihf')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
} else {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-arm-gnueabihf.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-arm-gnueabihf.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-arm-gnueabihf')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
}
|
|
break
|
|
case 'riscv64':
|
|
if (isMusl()) {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-riscv64-musl.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-riscv64-musl.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-riscv64-musl')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
} else {
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-riscv64-gnu.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-riscv64-gnu.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-riscv64-gnu')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
}
|
|
break
|
|
case 's390x':
|
|
localFileExisted = existsSync(
|
|
join(__dirname, 'wickra.linux-s390x-gnu.node')
|
|
)
|
|
try {
|
|
if (localFileExisted) {
|
|
nativeBinding = require('./wickra.linux-s390x-gnu.node')
|
|
} else {
|
|
nativeBinding = require('wickra-linux-s390x-gnu')
|
|
}
|
|
} catch (e) {
|
|
loadError = e
|
|
}
|
|
break
|
|
default:
|
|
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
}
|
|
break
|
|
default:
|
|
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
}
|
|
|
|
if (!nativeBinding) {
|
|
if (loadError) {
|
|
throw loadError
|
|
}
|
|
throw new Error(`Failed to load native binding`)
|
|
}
|
|
|
|
const { version, SMA, EMA, WMA, RSI, DEMA, TEMA, HMA, ROC, TRIX, SMMA, TRIMA, ZLEMA, T3, VWMA, MOM, CMO, TSI, PMO, StochRSI, UltimateOscillator, PPO, DPO, Coppock, AroonOscillator, Vortex, MassIndex, NATR, StdDev, UlcerIndex, HistoricalVolatility, BollingerBandwidth, PercentB, ADL, VolumePriceTrend, ChaikinMoneyFlow, ChaikinOscillator, ForceIndex, EaseOfMovement, SuperTrend, ChandelierExit, ChandeKrollStop, AtrTrailingStop, MACD, BollingerBands, ATR, Stochastic, OBV, ADX, CCI, WilliamsR, MFI, PSAR, Keltner, Donchian, VWAP, AwesomeOscillator, Aroon, KAMA } = nativeBinding
|
|
|
|
module.exports.version = version
|
|
module.exports.SMA = SMA
|
|
module.exports.EMA = EMA
|
|
module.exports.WMA = WMA
|
|
module.exports.RSI = RSI
|
|
module.exports.DEMA = DEMA
|
|
module.exports.TEMA = TEMA
|
|
module.exports.HMA = HMA
|
|
module.exports.ROC = ROC
|
|
module.exports.TRIX = TRIX
|
|
module.exports.SMMA = SMMA
|
|
module.exports.TRIMA = TRIMA
|
|
module.exports.ZLEMA = ZLEMA
|
|
module.exports.T3 = T3
|
|
module.exports.VWMA = VWMA
|
|
module.exports.MOM = MOM
|
|
module.exports.CMO = CMO
|
|
module.exports.TSI = TSI
|
|
module.exports.PMO = PMO
|
|
module.exports.StochRSI = StochRSI
|
|
module.exports.UltimateOscillator = UltimateOscillator
|
|
module.exports.PPO = PPO
|
|
module.exports.DPO = DPO
|
|
module.exports.Coppock = Coppock
|
|
module.exports.AroonOscillator = AroonOscillator
|
|
module.exports.Vortex = Vortex
|
|
module.exports.MassIndex = MassIndex
|
|
module.exports.NATR = NATR
|
|
module.exports.StdDev = StdDev
|
|
module.exports.UlcerIndex = UlcerIndex
|
|
module.exports.HistoricalVolatility = HistoricalVolatility
|
|
module.exports.BollingerBandwidth = BollingerBandwidth
|
|
module.exports.PercentB = PercentB
|
|
module.exports.ADL = ADL
|
|
module.exports.VolumePriceTrend = VolumePriceTrend
|
|
module.exports.ChaikinMoneyFlow = ChaikinMoneyFlow
|
|
module.exports.ChaikinOscillator = ChaikinOscillator
|
|
module.exports.ForceIndex = ForceIndex
|
|
module.exports.EaseOfMovement = EaseOfMovement
|
|
module.exports.SuperTrend = SuperTrend
|
|
module.exports.ChandelierExit = ChandelierExit
|
|
module.exports.ChandeKrollStop = ChandeKrollStop
|
|
module.exports.AtrTrailingStop = AtrTrailingStop
|
|
module.exports.MACD = MACD
|
|
module.exports.BollingerBands = BollingerBands
|
|
module.exports.ATR = ATR
|
|
module.exports.Stochastic = Stochastic
|
|
module.exports.OBV = OBV
|
|
module.exports.ADX = ADX
|
|
module.exports.CCI = CCI
|
|
module.exports.WilliamsR = WilliamsR
|
|
module.exports.MFI = MFI
|
|
module.exports.PSAR = PSAR
|
|
module.exports.Keltner = Keltner
|
|
module.exports.Donchian = Donchian
|
|
module.exports.VWAP = VWAP
|
|
module.exports.AwesomeOscillator = AwesomeOscillator
|
|
module.exports.Aroon = Aroon
|
|
module.exports.KAMA = KAMA
|