pricehistory
Version:
Series data with technical indicators.
19 lines (18 loc) • 742 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function setCandlePriceLimit(option, candle) {
if (option.limit !== true)
return;
candle.priceLimit = function makePriceLimit(limit, threshold = 0) {
if (typeof candle.priceOpen !== "number")
return;
const priceLimit = Math.ceil((candle.priceOpen + candle.priceOpen * (limit / 100)) * 100) /
100;
const isHit = typeof candle.priceHigh === "number" &&
typeof candle.priceLow === "number" &&
priceLimit + threshold <= candle.priceHigh &&
priceLimit - threshold >= candle.priceLow;
return { priceLimit, isHit };
};
}
exports.default = setCandlePriceLimit;