UNPKG

pricehistory

Version:

Transforms raw OHLCV series data into enriched candles with technical indicators, pattern recognition, and trend analysis.

19 lines 763 B
import * as utilN from "@nameer/utils"; function setCandlePriceLimit(opt, candle) { if (opt.limit !== true) return; candle.priceLimit = function makePriceLimit(limit, threshold = 0) { if (candle.priceOpen === undefined) return; const priceLimit = utilN.math.num(candle.priceOpen + candle.priceOpen * (limit / 100)); if (priceLimit === undefined) return; const isHit = candle.priceHigh !== undefined && candle.priceLow !== undefined && priceLimit + threshold <= candle.priceHigh && priceLimit - threshold >= candle.priceLow; return { priceLimit, isHit }; }; } export default setCandlePriceLimit; //# sourceMappingURL=candle.setPriceLimit.js.map