UNPKG

turingtrader.js

Version:
86 lines (76 loc) 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IndicatorsOHLCV = void 0; var _ = require("."); //============================================================================== // Name: indicators/ohlcv // Description: Indicators on OHLCV bars. // History: FUB, 2021v07, created //============================================================================== var IndicatorsOHLCV = function IndicatorsOHLCV(sim, id0, promise0) { return { get open() { var id = "".concat(id0, ".open"); return sim.cache(id, function () { return (0, _.IndicatorsNum)(sim, id, promise0.then(function (data) { return { t: data.t, x: data.o }; })); }); }, //---------------------------------------- get high() { var id = "".concat(id0, ".high"); return sim.cache(id, function () { return (0, _.IndicatorsNum)(sim, id, promise0.then(function (data) { return { t: data.t, x: data.h }; })); }); }, //---------------------------------------- get low() { var id = "".concat(id0, ".low"); return sim.cache(id, function () { return (0, _.IndicatorsNum)(sim, id, promise0.then(function (data) { return { t: data.t, x: data.l }; })); }); }, //---------------------------------------- get close() { var id = "".concat(id0, ".close"); return sim.cache(id, function () { return (0, _.IndicatorsNum)(sim, id, promise0.then(function (data) { return { t: data.t, x: data.c }; })); }); }, //---------------------------------------- get volume() { var id = "".concat(id0, ".volume"); return sim.cache(id, function () { return (0, _.IndicatorsNum)(sim, id, promise0.then(function (data) { return { t: data.t, x: data.v }; })); }); } }; }; //============================================================================== // end of file exports.IndicatorsOHLCV = IndicatorsOHLCV;