ohlcv-indicators 3.1.9 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,3901 @@
1
- var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){l=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(l)throw a}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{default:()=>or});var o=function(t){return"string"==typeof t&&/^\d{4}-\d{2}-\d{2}/.test(t)},i=function(t){if(0!==t.lastComputedIndex)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.')},a=1e6,u="[big.js] ",l=u+"Invalid ",c=l+"decimal places",s=l+"rounding mode",f=u+"Division by zero",h={},y=void 0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(t,e,r,n){var o=t.c;if(r===y&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(s);if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==y))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==y||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e,n)for(;++o[--e]>9;)if(o[e]=0,0===e){++t.e,o.unshift(1);break}for(e=o.length;!o[--e];)o.pop()}return t}function d(t,e,r){var n=t.e,o=t.c.join(""),i=o.length;if(e)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function b(t){var e="function"==typeof Map?new Map:void 0;return b=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(g())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&w(o,r.prototype),o}(t,arguments,S(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),w(r,t)},b(t)}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(g=function(){return!!t})()}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},w(t,e)}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}h.abs=function(){var t=new this.constructor(this);return t.s=1,t},h.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,i=r.s,a=t.s,u=r.e,l=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(e=i<0,u!=l)return u>l^e?1:-1;for(a=(u=n.length)<(l=o.length)?u:l,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^e?1:-1;return u==l?0:u>l^e?1:-1},h.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,i=e.s==t.s?1:-1,u=r.DP;if(u!==~~u||u<0||u>a)throw Error(c);if(!o[0])throw Error(f);if(!n[0])return t.s=i,t.c=[t.e=0],t;var l,s,h,p,d,m=o.slice(),b=l=o.length,g=n.length,w=n.slice(0,l),S=w.length,O=t,j=O.c=[],_=0,P=u+(O.e=e.e-t.e)+1;for(O.s=i,i=P<0?0:P,m.unshift(0);S++<l;)w.push(0);do{for(h=0;h<10;h++){if(l!=(S=w.length))p=l>S?1:-1;else for(d=-1,p=0;++d<l;)if(o[d]!=w[d]){p=o[d]>w[d]?1:-1;break}if(!(p<0))break;for(s=S==l?o:m;S;){if(w[--S]<s[S]){for(d=S;d&&!w[--d];)w[d]=9;--w[d],w[S]+=10}w[S]-=s[S]}for(;!w[0];)w.shift()}j[_++]=p?h:++h,w[0]&&p?w[S]=n[b]||0:w=[n[b]]}while((b++<g||w[0]!==y)&&i--);return j[0]||1==_||(j.shift(),O.e--,P--),_>P&&v(O,P,r.RM,w[0]!==y),O},h.eq=function(t){return 0===this.cmp(t)},h.gt=function(t){return this.cmp(t)>0},h.gte=function(t){return this.cmp(t)>-1},h.lt=function(t){return this.cmp(t)<0},h.lte=function(t){return this.cmp(t)<1},h.minus=h.sub=function(t){var e,r,n,o,i=this,a=i.constructor,u=i.s,l=(t=new a(t)).s;if(u!=l)return t.s=-l,i.plus(t);var c=i.c.slice(),s=i.e,f=t.c,h=t.e;if(!c[0]||!f[0])return f[0]?t.s=-l:c[0]?t=new a(i):t.s=1,t;if(u=s-h){for((o=u<0)?(u=-u,n=c):(h=s,n=f),n.reverse(),l=u;l--;)n.push(0);n.reverse()}else for(r=((o=c.length<f.length)?c:f).length,u=l=0;l<r;l++)if(c[l]!=f[l]){o=c[l]<f[l];break}if(o&&(n=c,c=f,f=n,t.s=-t.s),(l=(r=f.length)-(e=c.length))>0)for(;l--;)c[e++]=0;for(l=e;r>u;){if(c[--r]<f[r]){for(e=r;e&&!c[--e];)c[e]=9;--c[e],c[r]+=10}c[r]-=f[r]}for(;0===c[--l];)c.pop();for(;0===c[0];)c.shift(),--h;return c[0]||(t.s=1,c=[h=0]),t.c=c,t.e=h,t},h.mod=function(t){var e,r=this,n=r.constructor,o=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(f);return r.s=t.s=1,e=1==t.cmp(r),r.s=o,t.s=i,e?new n(r):(o=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=i,this.minus(r.times(t)))},h.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},h.plus=h.add=function(t){var e,r,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,u=o.c,l=t.e,c=t.c;if(!u[0]||!c[0])return c[0]||(u[0]?t=new i(o):t.s=o.s),t;if(u=u.slice(),e=a-l){for(e>0?(l=a,n=c):(e=-e,n=u),n.reverse();e--;)n.push(0);n.reverse()}for(u.length-c.length<0&&(n=c,c=u,u=n),e=c.length,r=0;e;u[e]%=10)r=(u[--e]=u[e]+c[e]+r)/10|0;for(r&&(u.unshift(r),++l),e=u.length;0===u[--e];)u.pop();return t.c=u,t.e=l,t},h.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(l+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},h.prec=function(t,e){if(t!==~~t||t<1||t>a)throw Error(l+"precision");return v(new this.constructor(this),t,e)},h.round=function(t,e){if(t===y)t=0;else if(t!==~~t||t<-a||t>a)throw Error(c);return v(new this.constructor(this),t+this.e+1,e)},h.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,l=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(u+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((e=n.c.join("")).length+a&1||(e+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(e))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{r=t,t=l.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return v(t,(o.DP-=4)+t.e+1,o.RM)},h.times=h.mul=function(t){var e,r=this,n=r.constructor,o=r.c,i=(t=new n(t)).c,a=o.length,u=i.length,l=r.e,c=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=l+c,a<u&&(e=o,o=i,i=e,c=a,a=u,u=c),e=new Array(c=a+u);c--;)e[c]=0;for(l=u;l--;){for(u=0,c=a+l;c>l;)u=e[c]+i[l]*o[c-l-1]+u,e[c--]=u%10,u=u/10|0;e[c]=u}for(u?++t.e:e.shift(),l=e.length;!e[--l];)e.pop();return t.c=e,t},h.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==y){if(t!==~~t||t<0||t>a)throw Error(c);for(r=v(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return d(r,!0,!!n)},h.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==y){if(t!==~~t||t<0||t>a)throw Error(c);for(t=t+(r=v(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return d(r,!1,!!n)},h[Symbol.for("nodejs.util.inspect.custom")]=h.toJSON=h.toString=function(){var t=this,e=t.constructor;return d(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},h.toNumber=function(){var t=Number(d(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(u+"Imprecise conversion");return t},h.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==y){if(t!==~~t||t<1||t>a)throw Error(l+"precision");for(r=v(new n(r),t,e);r.c.length<t;)r.c.push(0)}return d(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},h.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(u+"valueOf disallowed");return d(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===y?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(l+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!p.test(e))throw Error(l+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=h,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=!1,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var O=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,r){return e=S(e),function(t,e){if(e&&("object"==m(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,g()?Reflect.construct(e,r||[],S(t).constructor):e.apply(t,r))}(this,e,[r]),Object.setPrototypeOf(t,(this instanceof e?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(b(Error));function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,A(n.key),n)}}function P(t,e,r){return(e=A(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function A(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:e+""}var E=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),P(this,"previousHighest",void 0),P(this,"highest",void 0),P(this,"previousLowest",void 0),P(this,"lowest",void 0),P(this,"previousResult",void 0),P(this,"result",void 0)},(e=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new O;return this.result}},{key:"setResult",value:function(t,e){return e&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function x(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function T(t,e,r){return e=M(e),function(t,e){if(e&&("object"==k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,I()?Reflect.construct(e,r||[],M(t).constructor):e.apply(t,r))}function I(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(I=function(){return!!t})()}function M(t){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},M(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}function C(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}var D=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=r=T(this,e),i=void 0,(o=C(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.interval=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R(t,e)}(e,t),r=e,(n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&x(r.prototype,n),o&&x(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function V(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,z(n.key),n)}}function L(t,e,r){return e=H(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,N()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}function N(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(N=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},U(t,e)}function z(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var q=function(t){function e(){var t,r,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=t=L(this,e,[].concat(a)),o=[],(n=z(n="prices"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&U(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var r=this.prices.reduce((function(t,e){return t+e}),0);return this.setResult(r/this.prices.length,e)}}}],n&&V(r.prototype,n),o&&V(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Q(n.key),n)}}function G(t,e,r){return e=J(e),function(t,e){if(e&&("object"==$(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,K()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function K(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(K=function(){return!!t})()}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}function Y(t,e,r){return(e=Q(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Q(t){var e=function(t,e){if("object"!=$(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$(e)?e:e+""}var X=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Y(r=G(this,e),"interval",void 0),Y(r,"indicator",void 0),Y(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new q(t),r.smoothingFactor=1/r.interval,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),r=e,n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.indicator.update(t);if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}if(void 0===this.result&&void 0!==r)return this.setResult(r,e)}}],n&&F(r.prototype,n),o&&F(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function Z(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nt(n.key),n)}}function rt(t,e,r){return(e=nt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tt(e)?e:e+""}var ot=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),rt(this,"interval",void 0),rt(this,"deviationMultiplier",void 0),rt(this,"prices",[]),rt(this,"result",void 0),this.interval=e,this.deviationMultiplier=r},(e=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var e=Z(this.prices),r=function(t,e){var r=e||Z(t),n=Z(t.map((function(t){return t-r})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,e);return this.result={lower:e-r*this.deviationMultiplier,middle:e,upper:e+r*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new O;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&et(t.prototype,e),r&&et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ht(n.key),n)}}function ut(t,e,r){return e=ct(e),function(t,e){if(e&&("object"==it(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lt()?Reflect.construct(e,r||[],ct(t).constructor):e.apply(t,r))}function lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lt=function(){return!!t})()}function ct(t){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ct(t)}function st(t,e){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},st(t,e)}function ft(t,e,r){return(e=ht(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}var yt=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ft(r=ut(this,e,[t]),"interval",void 0),ft(r,"pricesCounter",0),ft(r,"weightFactor",void 0),r.interval=t,r.weightFactor=2/(r.interval+1),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&st(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?e&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,e&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),e):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),e)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new O;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&at(r.prototype,n),o&&at(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mt(n.key),n)}}function dt(t,e,r){return(e=mt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mt(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pt(e)?e:e+""}var bt=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),dt(this,"short",void 0),dt(this,"long",void 0),dt(this,"signal",void 0),dt(this,"prices",[]),dt(this,"result",void 0),this.short=e,this.long=r,this.signal=n},e=[{key:"getResult",value:function(){if(void 0===this.result)throw new O;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t);var r=this.short.update(t,e),n=this.long.update(t,e);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}],e&&vt(t.prototype,e),r&&vt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function St(t,e,r){return e=jt(e),function(t,e){if(e&&("object"==gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ot()?Reflect.construct(e,r||[],jt(t).constructor):e.apply(t,r))}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ot=function(){return!!t})()}function jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}function Pt(t,e,r){return(e=At(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function At(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:e+""}var Et=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Pt(r=St(this,e),"interval",void 0),Pt(r,"previousPrices",[]),Pt(r,"avgGain",void 0),Pt(r,"avgLoss",void 0),Pt(r,"maxValue",100),r.interval=t,r.avgGain=new n(r.interval),r.avgLoss=new n(r.interval),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_t(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&e?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var r=t,n=this.previousPrices[this.previousPrices.length-2];if(r>n?(this.avgLoss.update(0,e),this.avgGain.update(t-n,e)):(this.avgLoss.update(n-r,e),this.avgGain.update(0,e)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,e);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),e)}}}}],n&&wt(r.prototype,n),o&&wt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function kt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return xt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Tt=function(t){var e=1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1);return Math.round(t*e)/e},It=function(t){return t.replace(/(?!^-)[^0-9.]/g,"")};function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function Rt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ct(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ct(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Dt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Bt=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.05;if(null==t||null==e)return null;var n=t>=0,o=Math.abs(t),i=e.upper,a=e.middle,u=e.lower;if(o<u)return 0;if(o>i)return n?1:-1;var l=Number.EPSILON*Math.max(o,Math.abs(a));if(Math.abs(o-a)<l)return n?.5:-.5;if(i===u)return null;var c=Tt((o-u)/(i-u),r);return n?Math.min(c,1):Math.max(-c,-1)};function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}function Lt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ht(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Nt(t){return function(t){if(Array.isArray(t))return Ut(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ht(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ht(t,e){if(t){if("string"==typeof t)return Ut(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ut(t,e):void 0}}function Ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var zt={ema:yt,sma:q},qt=function(t,e,r,n){if(!r||"object"!==Vt(r))throw new Error('"options" must be an object in '.concat(t,". eg: {target, height, range}"));var o=r.target,i=void 0===o?"close":o,a=r.diff,u=void 0===a?null:a;if("string"!=typeof i)throw new Error('"target" must be a valid keyName '.concat(t,"."));if("number"!=typeof e||e<=0)throw new Error('"size" must be a positive number in '.concat(t,"."));var l={target:i,diff:null};if(null!==u&&("object"===Vt(u)||"boolean"==typeof u&&!0===u)){var c=u=!0===u?{}:u,s=c.stdDev,f=void 0===s?2:s,h=c.scale,y=void 0===h?.05:h,p=c.targets,v=void 0===p?["close"]:p,d=c.size,m=void 0===d?e:d,b=c.lag,g=void 0===b?0:b;if("number"!=typeof f||f<=0)throw new Error('"diff.stdDev" must be a number greater than 0 in '.concat(t,"."));if("number"!=typeof y||!n.includes(y))throw new Error('"diff.scale" must be a number between 0.01 and 1 in '.concat(t,"."));if("number"!=typeof m||!Number.isInteger(m)||m<=0)throw new Error('"diff.size" must be an integer greater than or equal to size in '.concat(t,"."));if(!Array.isArray(v))throw new Error('"diff.targest" must be an array of keyNames with at least 1 item in '.concat(t,"."));if("number"!=typeof g||!Number.isInteger(g)||g<0)throw new Error('"diff.lag" must be an integer greater than 0 in '.concat(t,"."));l.diff={stdDev:f,scale:y,size:m,targets:v,lag:g}}return l};function $t(t){return $t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$t(t)}function Ft(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=$t(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$t(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gt(t){return function(t){if(Array.isArray(t))return Kt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Kt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Kt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Jt="close";function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Yt(t){return Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yt(t)}function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Xt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Yt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Yt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=te(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function te(t,e){if(t){if("string"==typeof t)return ee(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ee(t,e):void 0}}function ee(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function re(t){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(t)}function ne(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function oe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=re(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==re(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ie(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ae(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ae(t,e){if(t){if("string"==typeof t)return ue(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(t,e):void 0}}function ue(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ce(t){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(t)}function se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function fe(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?se(Object(r),!0).forEach((function(e){he(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function he(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=ce(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ce(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ye(t){return function(t){if(Array.isArray(t))return me(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||de(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||de(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ve(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=de(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function de(t,e){if(t){if("string"==typeof t)return me(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?me(t,e):void 0}}function me(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var be=function(t,e){return(t-e)/e};function ge(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Se(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function we(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Se(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Se(t,e){if(t){if("string"==typeof t)return Oe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oe(t,e):void 0}}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function je(t){return je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(t)}var _e=function(t,e){var r=t.instances,n=t.verticalOhlcv,o=t.nullArray;if(0===e){var i=t.inputParams,a=t.priceBased,u=i.filter((function(t){return"lag"===t.key}));if("object"!==je(u))return;var l,c=u.map((function(t){return t.params})),s=we(c);try{for(s.s();!(l=s.n()).done;){var f,h=ge(l.value,2),y=h[0],p=h[1],v=we(y);try{for(v.s();!(f=v.n()).done;){var d=f.value;if(a.includes(d))for(var m=1;m<=p;m++)a.push("".concat(d,"_lag_").concat(m))}}catch(t){v.e(t)}finally{v.f()}}}catch(t){s.e(t)}finally{s.f()}r.lag={lagParams:c}}var b,g,w=we(r.lag.lagParams);try{for(w.s();!(b=w.n()).done;){var S,O=ge(b.value,2),j=O[0],_=O[1],P=we(j);try{for(P.s();!(S=P.n()).done;){var A=S.value,E=n[A];if(0===e)for(var k=1;k<=_;k++)n["".concat(A,"_lag_").concat(k)]=function(t){if(Array.isArray(t))return Oe(t)}(g=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(g)||Se(g)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();for(var x=1;x<=_;x++){var T="".concat(A,"_lag_").concat(x),I=e-x,M=I<=0||void 0===E[I]?null:E[I];t.pushToMain({index:e,key:T,value:M})}}}catch(t){P.e(t)}finally{P.f()}}}catch(t){w.e(t)}finally{w.f()}return!0};function Pe(t,e){if(t){if("string"==typeof t)return Ae(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ae(t,e):void 0}}function Ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function ke(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:e+""}var Te=function(t,e){return t>e},Ie=function(t,e){return t<e},Me=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:null,prevSlow:null,prevHigh:null,prevLow:null,areHighAndLowUndefined:!1,index:0,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t){var e=t.fast,r=t.high,n=t.slow,o=t.low,i=this.prevState;this.areHighAndLowUndefined||void 0!==r&&void 0!==o||(this.areHighAndLowUndefined=!0),null===e||null===n||function(t,e){return t===e}(e,n)?i=.5:Te(e,n)?i=this.areHighAndLowUndefined?1:[o,n,this.prevLow,this.prevSlow].every((function(t){return null!==t}))&&Ie(o,n)&&Te(this.prevLow,this.prevSlow)?0:1:Ie(e,n)&&(i=this.areHighAndLowUndefined?0:[r,n,this.prevHigh,this.prevSlow].every((function(t){return null!==t}))&&Te(r,n)&&Ie(this.prevHigh,this.prevSlow)?1:0),.5===i?this.interval=0:1===i?this.prevState<=.5?this.interval=1:this.interval++:0===i&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(this.index),-1===this.interval&&this.crossIndexes.down.push(this.index),Object.assign(this,{index:this.index+1,prevState:i,prevFast:e,prevSlow:n,prevHigh:r,prevLow:o})}},{key:"getResult",value:function(){return this.interval}}])&&ke(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),Re=function(t,e){var r=t.nullArray,n=t.verticalOhlcv,o=t.instances,i=t.len;if(0===e){var a=t.inputParams.filter((function(t){return"crossPairs"===t.key}));if("object"!==Ee(a))return;o.crossPairs={crossPairsList:a.flatMap((function(t){return t.params.flat()}))}}var u,l,c=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pe(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(o.crossPairs.crossPairsList);try{for(c.s();!(u=c.n()).done;){var s=u.value,f=s.fast,h=s.slow;if(null!=f&&null!=h){var y="".concat(f,"_x_").concat(h);if(0===e){if("number"==typeof h&&(n[h]=new Array(i).fill(h)),"price"!==f&&!n.hasOwnProperty(f))throw Error('fast "'.concat(f,' not found in crossPairs"'));if(!n.hasOwnProperty(h))throw Error('slow "'.concat(h,' not found in crossPairs"'));o[y]=new Me,n[y]=function(t){if(Array.isArray(t))return Ae(t)}(l=r)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(l)||Pe(l)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=void 0,v=void 0,d=void 0,m=void 0,b=void 0;"price"===f?(v=n.close[e],d=n.high[e],m=n.low[e],b=n[h][e],o[y].update({fast:v,slow:b,high:d,low:m})):(p=n[f][e],b=n[h][e],o[y].update({fast:p,slow:b})),t.pushToMain({index:e,key:y,value:o[y].getResult()})}}}catch(t){c.e(t)}finally{c.f()}};function Ce(t){return function(t){if(Array.isArray(t))return De(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return De(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?De(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function De(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Be(t){return function(t){if(Array.isArray(t))return Ve(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ve(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ve(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Le=["open","high","low","close"];function Ne(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ze(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function He(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Ue(t){return function(t){if(Array.isArray(t))return qe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ze(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ze(t,e){if(t){if("string"==typeof t)return qe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(t,e):void 0}}function qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var $e={dateTime:function(t,e){var r=t.instances,n=t.verticalOhlcv;if(0===e){var o=t.nullArray;if(!t.isValidDate)throw Error('dateTime method found and invalid "date" in input ohlcv');var i=n.date[0].slice(0,10);Object.assign(r,{dateTime:{prevDateStr:i,sessionDailyIndexCount:0,sessionIntradayIndexCount:0,cachedDayInfo:i}}),Object.assign(n,{day_of_the_week:Ce(o),day_of_the_month:Ce(o),week_of_the_month:Ce(o),hour:Ce(o),month:Ce(o),year:Ce(o),session_daily_index:Ce(o),session_intraday_index:Ce(o)})}var a=n.date[e],u=function(t){var e=new Date(t),r=e.getMonth(),n=e.getFullYear(),o=e.getHours(),i=e.getMinutes(),a=e.getDay(),u=e.getDate(),l=new Date(e.getFullYear(),e.getMonth(),1).getDay();return{month:r,year:n,hour:o,minute:i,day_of_the_week:a,day_of_the_month:u,week_of_the_month:Math.ceil((u+l)/7)}}(a),l=u.day_of_the_week,c=u.day_of_the_month,s=u.week_of_the_month,f=u.month,h=u.year,y=u.hour,p=a.slice(0,10);p!==r.dateTime.prevDateStr&&(r.dateTime.prevDateStr=p,r.dateTime.sessionDailyIndexCount++,r.dateTime.sessionIntradayIndexCount=0),t.pushToMain({index:e,key:"session_daily_index",value:r.dateTime.sessionDailyIndexCount}),t.pushToMain({index:e,key:"session_intraday_index",value:r.dateTime.sessionIntradayIndexCount}),t.pushToMain({index:e,key:"day_of_the_week",value:l}),t.pushToMain({index:e,key:"day_of_the_month",value:c}),t.pushToMain({index:e,key:"week_of_the_month",value:s}),t.pushToMain({index:e,key:"month",value:f}),t.pushToMain({index:e,key:"year",value:h}),t.pushToMain({index:e,key:"hour",value:y}),r.dateTime.sessionIntradayIndexCount++},priceVariations:function(t,e){0===e&&(t.priceBased=Be(new Set([].concat(Be(t.priceBased),["mid_price_open_close","mid_price_high_low"]))),Object.assign(t.verticalOhlcv,{mid_price_open_close:Be(t.nullArray),mid_price_high_low:Be(t.nullArray)}));var r=t.verticalOhlcv.open[e],n=t.verticalOhlcv.high[e],o=t.verticalOhlcv.low[e],i=t.verticalOhlcv.close[e];t.pushToMain({index:e,key:"mid_price_open_close",value:(r+i)/2}),t.pushToMain({index:e,key:"mid_price_high_low",value:(n+o)/2})},rsi:function(t,e,r,n){var o=n.scale,i=n.target,a=n.lag,u=t.verticalOhlcv,l=t.instances,c=t.lastIndexReplace,s="close"===i?"":"_".concat(i),f="rsi_".concat(r).concat(s),h="rsi_sma_".concat(r).concat(s);if(0===e){var y=t.crossPairsList,p=t.nullArray;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for rsi."));y.push({fast:f,slow:h,isDefault:!0}),Object.assign(l,Dt(Dt({},f,new Et(r)),h,new q(r))),Object.assign(u,Dt(Dt({},f,Rt(p)),h,Rt(p))),a>0&&t.lag([f,h],a)}var v=u[i][e],d=null,m=null;l[f].update(v,c);try{d=l[f].getResult()}catch(t){d=null}null!==d&&"number"==typeof d&&o&&(d=Tt(d,o)),t.pushToMain({index:e,key:f,value:d}),null!==d&&"number"==typeof d&&l[h].update(d,c);try{m=l[h].getResult()}catch(t){m=null}null!==m&&"number"==typeof m&&o&&(m=Tt(m,o)),t.pushToMain({index:e,key:h,value:m})},movingAverages:function(t,e,r,n,o){var i=o.target,a=o.diff,u=t.verticalOhlcv,l=t.instances,c=t.priceBased,s=t.lastIndexReplace,f="string"==typeof i&&u.hasOwnProperty(i)&&"close"!==i?"_".concat(i):"",h="".concat(r,"_").concat(n).concat(f),y="".concat(r,"_").concat(n,"_diff").concat(f);if(0===e){var p=t.nullArray;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));if(l[h]={maInstance:new zt[r](n)},u[h]=Nt(p),null!==a){l[h].diffInstance=new ot(a.size,a.stdDev);var v,d=[],m=Lt(a.targets);try{for(m.s();!(v=m.n()).done;){var b=v.value;u["".concat(y,"_").concat(b)]=Nt(p),a.lag>0&&d.push("".concat(y,"_").concat(b))}}catch(t){m.e(t)}finally{m.f()}a.lag>0&&t.lag(d,a.lag)}c.push(h)}var g=u[i][e],w=l[h],S=w.maInstance,O=w.diffInstance;S.update(g,s);var j=null;try{j=S.getResult()}catch(t){j=null}if(t.pushToMain({index:e,key:h,value:j}),null!==a){var _,P=Lt(a.targets);try{for(P.s();!(_=P.n()).done;){var A=_.value,E=null;null!==j&&"number"==typeof j&&(E=u[A][e]-j),null!==E&&"number"==typeof E&&O.update(Math.abs(E),s);var k=null;try{k=O.getResult()}catch(t){k=null}var x=Bt(E,k,a.scale);t.pushToMain({index:e,key:"".concat(y,"_").concat(A),value:x})}}catch(t){P.e(t)}finally{P.f()}}return!0},macd:function(t,e,r,n,o,i){var a=i.target,u=t.verticalOhlcv,l=t.instances,c=t.lastIndexReplace,s="".concat(r,"_").concat(n,"_").concat(o).concat(a===Jt?"":"_".concat(a));if(0===e){var f=t.inputParams,h=t.crossPairsList,y=t.nullArray,p=t.priceBased;if(!u.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var v=f.filter((function(t){return"macd"===t.key})).length,d=v>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",m=a===Jt?"".concat(d,"_diff"):"".concat(d,"_diff_").concat(a),b=a===Jt?"".concat(d,"_dea"):"".concat(d,"_dea_").concat(a),g=a===Jt?"".concat(d,"_histogram"):"".concat(d,"_histogram_").concat(a);h.push({fast:m,slow:b,isDefault:!0}),l.hasOwnProperty("macd")||(l.macd={numberOfIndicators:v,settings:{}}),l.macd.settings[s]=new bt(new yt(r),new yt(n),new yt(o)),Object.assign(u,Ft(Ft(Ft({},m,Gt(y)),b,Gt(y)),g,Gt(y))),p.push(m,b,g)}var w=l.macd,S=w.numberOfIndicators,O=w.settings,j=S>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",_=a===Jt?"".concat(j,"_diff"):"".concat(j,"_diff_").concat(a),P=a===Jt?"".concat(j,"_dea"):"".concat(j,"_dea_").concat(a),A=a===Jt?"".concat(j,"_histogram"):"".concat(j,"_histogram_").concat(a),E=O[s],k=u[a][e];E.update(k,c);var x=null;try{x=E.getResult()}catch(t){x=null}return t.pushToMain({index:e,key:_,value:x?x.macd:null}),t.pushToMain({index:e,key:P,value:x?x.signal:null}),t.pushToMain({index:e,key:A,value:x?x.histogram:null}),!0},relativeVolume:function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=(arguments.length>3?arguments[3]:void 0).scale,i="relative_volume_".concat(n),a=t.instances,u=t.verticalOhlcv,l=t.lastIndexReplace;if(0===e){var c=t.nullArray;a[i]={instance:new q(n),prevRelativeVolumeSma:null},u[i]=function(t){if(Array.isArray(t))return Wt(t)}(r=c)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return Wt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wt(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var s=u.volume[e],f=a[i].instance;f.update(s,l);var h=null;try{h=f.getResult()}catch(t){h=null}var y=a[i].prevRelativeVolumeSma,p=null;return"number"==typeof h&&"number"==typeof y&&0!==y&&(p=s/y,o&&(p=Tt(p,o))),t.pushToMain({index:e,key:i,value:p}),a[i].prevRelativeVolumeSma=h,!0},donchianChannels:function(t,e,r,n,o){var i=o.height,a=o.range,u=o.scale,l=o.lag,c="".concat(r,"_").concat(n),s=t.verticalOhlcv,f=t.instances,h=t.len;if(0===e){var y=t.inputParams,p=t.priceBased,v=t.nullArray,d=y.filter((function(t){return"donchianChannels"===t.key})).length,m=d>1?"donchian_channel_".concat(c):"donchian_channel",b=["".concat(m,"_upper"),"".concat(m,"_basis"),"".concat(m,"_lower")];i&&b.push("".concat(m,"_height")),f.hasOwnProperty("donchian_channel")||(f.donchian_channel={numberOfIndicators:d,settings:{}});var g,w=Zt(a);try{for(w.s();!(g=w.n()).done;){var S=g.value;if(!(S in s)||!p.includes(S))throw new Error('Invalid range item value "'.concat(S,'" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(p)));b.push("".concat(m,"_range_").concat(S))}}catch(t){w.e(t)}finally{w.f()}var O=Object.fromEntries(b.map((function(t){return[t,(e=v,function(t){if(Array.isArray(t))return ee(t)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||te(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())];var e})));Object.assign(s,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Qt(Object(r),!0).forEach((function(e){Xt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},O)),l>0&&t.lag(b,l),p.push("".concat(m,"_upper"),"".concat(m,"_basis"),"".concat(m,"_lower")),f.donchian_channel.settings[c]={maxDeque:[],minDeque:[]}}var j=f.donchian_channel.numberOfIndicators>1?"donchian_channel_".concat(c):"donchian_channel",_=f.donchian_channel.settings[c],P=_.maxDeque,A=_.minDeque,E=e-n,k=E+1,x=k-r;if(x<0||k>h){t.pushToMain({index:e,key:"".concat(j,"_upper"),value:null}),t.pushToMain({index:e,key:"".concat(j,"_basis"),value:null}),t.pushToMain({index:e,key:"".concat(j,"_lower"),value:null}),i&&t.pushToMain({index:e,key:"".concat(j,"_height"),value:null});var T,I=Zt(a);try{for(I.s();!(T=I.n()).done;){var M=T.value;t.pushToMain({index:e,key:"".concat(j,"_range_").concat(M),value:null})}}catch(t){I.e(t)}finally{I.f()}return!0}for(var R=s.high,C=s.low;P.length&&P[0]<x;)P.shift();for(;P.length&&R[P[P.length-1]]<=R[E];)P.pop();for(P.push(E);A.length&&A[0]<x;)A.shift();for(;A.length&&C[A[A.length-1]]>=C[E];)A.pop();A.push(E);var D=P.length?R[P[0]]:null,B=A.length?C[A[0]]:null,V="number"==typeof D&&"number"==typeof B?(D+B)/2:null;if(t.pushToMain({index:e,key:"".concat(j,"_upper"),value:D}),t.pushToMain({index:e,key:"".concat(j,"_basis"),value:V}),t.pushToMain({index:e,key:"".concat(j,"_lower"),value:B}),i){var L=null;"number"==typeof D&&"number"==typeof B&&0!==B&&(L=Tt((D-B)/B,.001)),t.pushToMain({index:e,key:"".concat(j,"_height"),value:L})}var N,H=Zt(a);try{for(H.s();!(N=H.n()).done;){var U=N.value,z=null,q=s[U][e];"number"==typeof q&&"number"==typeof D&&"number"==typeof B&&D-B!=0&&(z=Math.max(Math.min((q-B)/(D-B),1),0),u&&(z=Tt(z,u))),t.pushToMain({index:e,key:"".concat(j,"_range_").concat(U),value:z})}}catch(t){H.e(t)}finally{H.f()}return!0},bollingerBands:function(t,e,r,n,o){var i,a,u,l,c,s,f,h=o.height,y=o.range,p=void 0===y?[]:y,v=o.target,d=o.scale,m=o.lag,b=t.verticalOhlcv,g=t.instances,w=t.lastIndexReplace,S="close"===v?"":"_".concat(v),O="".concat(r,"_").concat(n).concat(S);if(0===e){var j=t.priceBased,_=t.inputParams,P=t.nullArray,A=t.verticalOhlcv;if(!(v in A))throw new Error('bollingerBands could not find target "'.concat(v,'"'));var E=_.filter((function(t){return"bollingerBands"===t.key})).length;f=E>1?"bollinger_bands_".concat(O):"bollinger_bands".concat(S),g.bollinger_bands||(g.bollinger_bands={numberOfIndicators:E,settings:{}}),g.bollinger_bands.settings[O]=new ot(r,n);var k=["".concat(f,"_upper"),"".concat(f,"_middle"),"".concat(f,"_lower")];h&&k.push("".concat(f,"_height"));var x,T=ie(p);try{for(T.s();!(x=T.n()).done;){var I=x.value;if(!(I in A)||!j.includes(I))throw new Error('Invalid range item value "'.concat(I,'" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(j)));k.push("".concat(f,"_range_").concat(I))}}catch(t){T.e(t)}finally{T.f()}var M=Object.fromEntries(k.map((function(t){return[t,(e=P,function(t){if(Array.isArray(t))return ue(t)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||ae(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())];var e})));Object.assign(A,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ne(Object(r),!0).forEach((function(e){oe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},M)),m>0&&t.lag(k,m),j.push("".concat(f,"_upper"),"".concat(f,"_middle"),"".concat(f,"_lower"))}f||(f=g.bollinger_bands.numberOfIndicators>1?"bollinger_bands_".concat(O):"bollinger_bands".concat(S));var R=f,C=g.bollinger_bands.settings[O],D=b[v][e];C.update(D,w);var B=null;try{B=C.getResult()}catch(t){}var V=null!==(i=null===(a=B)||void 0===a?void 0:a.upper)&&void 0!==i?i:null,L=null!==(u=null===(l=B)||void 0===l?void 0:l.middle)&&void 0!==u?u:null,N=null!==(c=null===(s=B)||void 0===s?void 0:s.lower)&&void 0!==c?c:null;if(t.pushToMain({index:e,key:"".concat(R,"_upper"),value:V}),t.pushToMain({index:e,key:"".concat(R,"_middle"),value:L}),t.pushToMain({index:e,key:"".concat(R,"_lower"),value:N}),h){var H=null;"number"==typeof V&&"number"==typeof N&&0!==N&&(H=Tt((V-N)/N,.001)),t.pushToMain({index:e,key:"".concat(R,"_height"),value:H})}var U,z=ie(p);try{for(z.s();!(U=z.n()).done;){var q=U.value,$=null,F=b[q][e];"number"==typeof F&&"number"==typeof N&&"number"==typeof V&&V-N!=0&&($=Math.max(Math.min((F-N)/(V-N),1),0),d&&($=Tt($,d))),t.pushToMain({index:e,key:"".concat(R,"_range_").concat(q),value:$})}}catch(t){z.e(t)}finally{z.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a=o.scale,u=t.verticalOhlcv,l=t.instances,c=t.lastIndexReplace,s=u.volume[e],f="volume_oscillator";if(0===e){var h=t.crossPairsList,y=t.nullArray;Object.assign(l,{volume_oscillator:{fastEMA:new yt(r),slowEMA:new yt(n)}}),u[f]=function(t){if(Array.isArray(t))return le(t)}(i=y)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return le(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?le(t,e):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),h.push({fast:f,slow:0,isDefault:!0})}var p=l[f],v=p.fastEMA,d=p.slowEMA;v.update(s,c),d.update(s,c);var m=null,b=null;try{m=v.getResult()}catch(t){m=null}try{b=d.getResult()}catch(t){b=null}var g=null;return"number"==typeof m&&"number"==typeof b&&0!==b&&(g=100*(m-b)/b,a&&(g=Tt(g,a))),t.pushToMain({index:e,key:f,value:g}),!0},candleStudies:function(t,e,r,n){var o=n.stdDev,i=n.patternSize,a=n.lag,u=n.scale,l=t.verticalOhlcv,c=t.instances,s=t.lastIndexReplace,f=function(t,e){return Bt(t,e,u)};if(0===e){for(var h=t.nullArray,y=[["close","open"],["close","high"],["close","low"],["open","high"],["open","low"],["high","low"]],p=[["open","open"],["high","high"],["low","low"],["close","close"]].concat(y),v=[],d={},m=0;m<i;m++){var b,g=ve(p);try{for(g.s();!(b=g.n()).done;){var w=pe(b.value,2),S=w[0],O=w[1];v.push("candle_change_".concat(m+1,"_").concat(S,"_").concat(O)),d["candle_change_".concat(m+1,"_").concat(S,"_").concat(O)]=ye(h)}}catch(t){g.e(t)}finally{g.f()}}for(var j=[],_={},P=0,A=y;P<A.length;P++){var E=pe(A[P],2),k=E[0],x=E[1];j.push("candle_body_".concat(k,"_").concat(x)),_["candle_body_".concat(k,"_").concat(x)]=ye(h)}var T=[].concat(j,v);Object.assign(l,fe(fe({},_),d)),Object.assign(c,{candleStudies:{bodyVectors:y,lookBackVectors:p,keyNames:T,bodyInstance:new ot(r,o)}}),a>0&&t.lag(T,a)}if(0===e)return!0;var I=c.candleStudies,M=I.bodyVectors,R=I.lookBackVectors,C=I.bodyInstance,D=null,B=l.open[e],V=l.close[e],L=be(V,B);C.update(L,s);try{D=C.getResult()}catch(t){}for(var N=0;N<M.length;N++){var H=pe(M[N],2),U=H[0],z=H[1],q=l[U][e],$=l[z][e];t.pushToMain({index:e,key:"candle_body_".concat(U,"_").concat(z),value:f(be(q,$),D)})}for(var F=0;F<i;F++){var G,K=ve(R);try{for(K.s();!(G=K.n()).done;){var J=pe(G.value,2),W=J[0],Y=J[1],Q=l[W][e],X=l[Y][e-(F+1)];t.pushToMain({index:e,key:"candle_change_".concat(F+1,"_").concat(W,"_").concat(Y),value:void 0===X?null:f(be(Q,X),D)})}}catch(t){K.e(t)}finally{K.f()}}return!0}},Fe=function(t,e,r){var n=function(t){return r>1?t*r:t};if("number"===e)return n(t);if("string"===e){var o=It(t);return n(Number(o))}return 0},Ge=function(t,e){return"number"===e?t:"string"===e?Number(It(t)):0},Ke=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e.len,i=e.inputParams,a=e.hasVolume;e.nullArray=new Array(o).fill(null);var u=["open","high","low","close"];a&&u.push("volume");var l=new Set(u);if(0===n){!function(t){var e,n=t.inputParams,o=t.len,i=r(n);try{for(i.s();!(e=i.n()).done;){var a,u=r(e.value.params);try{for(u.s();!(a=u.n()).done;){var l=a.value;if("number"==typeof l&&l>o)throw console.log(l,o),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){u.e(t)}finally{u.f()}}}catch(t){i.e(t)}finally{i.f()}}(e),u.forEach((function(t){e.verticalOhlcv[t]=Ue(e.nullArray)}));var c=Object.keys(t[0]).filter((function(t){return!l.has(t)}));c.forEach((function(t){e.verticalOhlcv[t]=Ue(e.nullArray)})),e.otherKeys=c,function(t,e){for(var r=0,n=Object.keys(e.inputTypes);r<n.length;r++){var o=n[r];if(!(o in t))throw new Error('Property "'.concat(o,'" not found in ohlcv array. ').concat(e.ticker));var i=t[o];if("number"==typeof i&&i>0)e.inputTypes[o]="number";else{if("string"!=typeof i||!/^(\d+(\.\d*)?|\.\d+)$/.test(i))throw new Error('Invalid property "'.concat(o,'" in ohlcv array. ').concat(e.ticker));e.inputTypes[o]="string",i=It(i)}if(0===e.precisionMultiplier&&!0===e.precision){var a=(c=String(i).split("."),s=2,function(t){if(Array.isArray(t))return t}(c)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(c,s)||ze(c,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],u=void 0===a?"":a,l=Math.max(4,u.length);e.precisionMultiplier=l>1?Math.pow(10,l-1):1}}var c,s}(t[0],e)}else if(!e.otherKeys)throw new Error("otherKeys not found in main. Ensure you run with startIndex=0 first to initialize.");for(var s=function(t){return Array.isArray(t)?t.map((function(t){var e=t.key,r=t.params;return{key:e,fn:$e[e],args:r}})):[]}(i),f=n;f<o;f++){var h=t[f],y=h.open,p=h.high,v=h.low,d=h.close,m=He(h,Le),b=e.precisionMultiplier,g=Fe(y,e.inputTypes.open,b),w=Fe(p,e.inputTypes.high,b),S=Fe(v,e.inputTypes.low,b),O=Fe(d,e.inputTypes.close,b);if(e.pushToMain({index:f,key:"open",value:g}),e.pushToMain({index:f,key:"high",value:w}),e.pushToMain({index:f,key:"low",value:S}),e.pushToMain({index:f,key:"close",value:O}),a){var j=h.volume,_=Ge(j,e.inputTypes.volume);e.pushToMain({index:f,key:"volume",value:_})}else delete m.volume;var P,A=Ne(e.otherKeys);try{for(A.s();!(P=A.n()).done;){var E=P.value;e.pushToMain({index:f,key:E,value:m[E]})}}catch(t){A.e(t)}finally{A.f()}var k,x=Ne(s);try{for(x.s();!(k=x.n()).done;){var T=k.value,I=T.key,M=T.fn,R=T.args;["crossPairs","lag"].includes(I)||M.apply(void 0,[e,f].concat(Ue(R)))}}catch(t){x.e(t)}finally{x.f()}_e(e,f),Re(e,f),e.lastComputedIndex++}},Je=function(t,e){for(var r=t.length,n=new q(e),o=new Array(r),i=0,a=0,u=0,l=0;l<r;l++)if(n.update(t[l]),n.isStable){var c=n.getResult();o[l]=c,i+=c,a+=c*c,u++}else o[l]=null;var s=i/u,f=a/u-s*s,h=Math.sqrt(f);return o.map((function(t){return null!==t?(t-s)/h:null}))},We=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(t.length!==e.length)throw new Error("Both arrays must have the same length");for(var n=Je(t,r),o=Je(e,r),i=t.length,a=[],u=0,l=0,c=0,s=0,f=0,h=0,y=-1,p=0;p<i;p++){if(null!==n[p]&&null!==o[p]){y=p;break}a.push(0)}if(-1===y)return new Array(i).fill(0);for(var v=y;v<i;v++){var d=n[v],m=o[v];if(null!==d&&null!==m)if(u+=d,l+=m,c+=d*m,s+=d*d,f+=m*m,++h<2)a.push(0);else{var b=h*c-u*l,g=Math.sqrt((h*s-u*u)*(h*f-l*l)),w=0===g?0:b/g;a.push(w)}else u=l=c=s=f=h=0,a.push(0)}return a};function Ye(t){return function(t){if(Array.isArray(t))return tr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ze(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(t){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qe(t)}function Xe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Ze(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ze(t,e){if(t){if("string"==typeof t)return tr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tr(t,e):void 0}}function tr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function er(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rr(n.key),n)}}function rr(t){var e=function(t,e){if("object"!=Qe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qe(e)?e:e+""}var nr=[.001,.002,.0025,.005,.01,.02,.025,.05,.1,.2,.25,.5,1,2,2.5,5,10],or=function(){return t=function t(e){var r=e.input,n=e.ticker,o=void 0===n?null:n,i=e.precision,a=void 0===i||i,u=e.inputParams,l=void 0===u?null:u;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!Array.isArray(r))throw Error("input OHLCV must be an array: "+o);if(0===r.length)throw Error("input OHLCV must not be empty: "+o);if(!r[0].hasOwnProperty("close"))throw Error("input OHLCV array objects require at least close property: "+o);return this.hasVolume=!!("number"==typeof r[0].volume&&r[0].volume>0||"string"==typeof r[0].volume&&r[0].volume),this.isComputed=!1,this.lastComputedIndex=0,this.input=r,this.inputTypes=this.hasVolume?{open:"",high:"",low:"",close:"",volume:""}:{open:"",high:"",low:"",close:""},this.priceBased=["open","high","low","close"],this.len=r.length,this.lastIndexReplace=!1,this.instances={},this.crossPairsList=[],this.verticalOhlcv={},this.studies={},this.utilities={correlation:We},this.invalidValueIndex=-1,this.precision=a,this.precisionMultiplier=!0===this.precision?0:1,this.minMaxRanges={},Array.isArray(l)&&(this.inputParams=l,this.compute()),this.inputParams=[],this},e=[{key:"pushToMain",value:function(t){var e=t.index,r=t.key,n=t.value;if(null==n)for(var o in this.invalidValueIndex=e,this.minMaxRanges)this.minMaxRanges[o]={min:1/0,max:-1/0};if(this.verticalOhlcv[r][e]=n,"number"==typeof n)if(r.includes("_diff_"))this.minMaxRanges.hasOwnProperty(r)&&this.minMaxRanges[r].min!==1/0&&this.minMaxRanges[r].max!==-1/0||(this.minMaxRanges[r]={min:-1,max:1});else if(r.startsWith("candle_"))this.minMaxRanges[r]={min:-1,max:1};else if(r.includes("_range_")&&(r.startsWith("bollinger_bands_")||r.startsWith("donchian_channel_")))this.minMaxRanges[r]={min:0,max:1};else if(!r.includes("_x_")){var i=this.precision&&this.priceBased.includes(r)?n/this.precisionMultiplier:n;this.minMaxRanges.hasOwnProperty(r)||(this.minMaxRanges[r]={min:1/0,max:-1/0}),i<this.minMaxRanges[r].min&&(this.minMaxRanges[r].min=i),i>this.minMaxRanges[r].max&&(this.minMaxRanges[r].max=i)}}},{key:"getDataAsCols",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.compute();for(var e=this.precisionMultiplier,r=this.precision,n=this.invalidValueIndex,o=this.len,i=this.verticalOhlcv,a=this.priceBased,u={},l=n>=0&&t,c=o-(n+1),s=0,f=Object.entries(i);s<f.length;s++){var h=Xe(f[s],2),y=h[0],p=h[1],v=l?p.slice(-c):p;r&&a.includes(y)&&(v=v.map((function(t){return null==t?null:t/e}))),u[y]=v}return u}},{key:"getData",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.compute();var e=this.precisionMultiplier,r=this.priceBased,n=this.precision;return function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=Object.keys(t);if(0===a.length)return[];for(var u=e&&i>=0?i+1:0,l=t[a[0]].length,c=new Array(l-u),s=u;s<l;s++){for(var f={},h=0;h<a.length;h++){var y=a[h],p=t[y][s];f[y]=r&&o.includes(y)?p/n:p}c[s-u]=f}return c}(this.verticalOhlcv,t,n,e,r,this.invalidValueIndex)}},{key:"getLastValues",value:function(){this.compute();for(var t=this.precisionMultiplier,e=this.priceBased,r=this.precision,n=this.verticalOhlcv,o=this.len,i={},a=0,u=Object.keys(n);a<u.length;a++){var l=u[a];i[l]=n[l][o-1]}return r?function(t){for(var e=t.row,r=t.precisionMultiplier,n=t.priceBased,o={},i=0,a=Object.entries(e);i<a.length;i++){var u=kt(a[i],2),l=u[0],c=u[1];n.includes(l)&&(c/=r),o[l]=c}return o}({row:i,precisionMultiplier:t,priceBased:e}):i}},{key:"compute",value:function(t){if(!0===this.isComputed&&!t)return this;if(this.isComputed=!1,this.isValidDate=this.input[0].hasOwnProperty("date")&&o(this.input[0].date),this.len>this.lastComputedIndex&&!t&&Ke(this.input,this,0),t&&"object"===Qe(t)){var e;if(!["open","high","low","close","volume","date"].every((function(e){return Object.keys(t).includes(e)})))throw Error('Invalid OHLCV object sent in "compute". Correct usage: .compute({open: 108.25, high: 108.410004, low: 108.25, close: 99999999, volume: 875903, date: "2024-12-16 15:45:00" || "2024-12-16"})');if(!this.isValidDate)throw Error('All the OHLCV rows require a valid date property to access the compute change method. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');if(!o(t.date))throw Error('The date in the new OHLCV row is invalid. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');var r=t.date,n=this.len-1,i=null===(e=this.input[n])||void 0===e?void 0:e.date;0===this.lastComputedIndex&&this.compute(),i!==r?(this.len++,this.input.push(t),Ke(this.input,this,this.len)):(this.input[n]=t,Ke(this.input,this,n))}return this}},{key:"crossPairs",value:function(t){return i(this),this.crossPairsList=[].concat(Ye(this.crossPairsList),Ye(t)),this.inputParams.push({key:"crossPairs",params:[this.crossPairsList]}),this}},{key:"lag",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(i(this),!Array.isArray(e))throw new Error('Param "colKeys" must be a valid array of keyNames in lag.');if("number"!=typeof r||!Number.isInteger(r)||r<0)throw new Error('Param "lags" must be a integer greater or equal to 0: '.concat(JSON.stringify(e)));this.inputParams.push({key:"lag",params:[e,r]});for(var n=function(){var r=e[o];t.priceBased.find((function(t){return r===t}))&&t.priceBased.push(r)},o=0;o<e.length;o++)n();return this}},{key:"relativeVolume",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!1===this.hasVolume)throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');i(this);var r=e.scale,n=void 0===r?null:r;if("number"==typeof n&&!nr.includes(n))throw new Error('"scale" value in relativeVolume must be any of the following numbers: '.concat(nr.join(", ")));return this.inputParams.push({key:"relativeVolume",params:[t,{scale:n}]}),this}},{key:"ema",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this);var r=qt("ema",t,e,nr);return this.inputParams.push({key:"movingAverages",params:["ema",t,r]}),this}},{key:"sma",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this);var r=qt("sma",t,e,nr);return this.inputParams.push({key:"movingAverages",params:["sma",t,r]}),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"fast" must be a positive number in macd.');if("number"!=typeof e||e<=t)throw new Error('"slow" must be a positive number greater than "fast" in macd.');if("number"!=typeof r||r<=0)throw new Error('"signal" must be a positive number in macd.');if("object"!==Qe(n))throw new Error('"options" must be an object in macd. eg: {target}');var o=n.target,a=void 0===o?"close":o;return this.inputParams.push({key:"macd",params:[t,e,r,{target:a}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),!r||"object"!==Qe(r))throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');var n=r.target,o=void 0===n?"close":n,a=r.height,u=void 0!==a&&a,l=r.range,c=void 0===l?[]:l,s=r.scale,f=void 0===s?null:s,h=r.lag,y=void 0===h?0:h;if("number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in bollingerBands.');if("number"!=typeof e||e<=0)throw new Error('"stdDev" must be a positive number in bollingerBands.');if(!Array.isArray(c))throw new Error('If set, "range" must be a array of column names in bollingerBands.');if("number"!=typeof y)throw new Error('"lag" value in rsi must be a number in bollingerBands.');if("boolean"!=typeof u)throw new Error('"height" must be a boolean in bollingerBands.');if("number"==typeof f&&!nr.includes(f))throw new Error('"scale" value in bollingerBands must be any of the following numbers: '.concat(nr.join(", ")));return this.inputParams.push({key:"bollingerBands",params:[t,e,{target:o,height:u,scale:f,range:c,lag:y}]}),this}},{key:"rsi",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in rsi.');var r=e.scale,n=void 0===r?null:r,o=e.target,a=void 0===o?"close":o,u=e.lag,l=void 0===u?0:u;if("number"==typeof n&&!nr.includes(n))throw new Error('"scale" value in rsi must be any of the following numbers: '.concat(nr.join(", ")));if("number"!=typeof l)throw new Error('"lag" value in rsi must be a number in rsi.');return this.inputParams.push({key:"rsi",params:[t,{scale:n,target:a,lag:l}]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number greater than 0 in donchianChannels.');if("number"!=typeof e||e<0)throw new Error('"offset" must be a number greater than or equal to 0 in donchianChannels.');var n=r.height,o=void 0!==n&&n,a=r.range,u=void 0===a?[]:a,l=r.scale,c=void 0===l?null:l,s=r.lag,f=void 0===s?0:s;if(!Array.isArray(u))throw new Error('If set, "range" must be an array of column names in donchianChannels.');if("number"!=typeof f)throw new Error('"lag" value in rsi must be a number in donchianChannels.');if("boolean"!=typeof o)throw new Error('"height" must be a boolean in donchianChannels.');if("number"==typeof c&&!nr.includes(c))throw new Error('"scale" value in donchianChannels must be any of the following numbers: '.concat(nr.join(", ")));return this.inputParams.push({key:"donchianChannels",params:[t,e,{height:o,range:u,scale:c,lag:f}]}),this}},{key:"candleStudies",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number greater than 0 in candleStudies.');var r=e.stdDev,n=void 0===r?.5:r,o=e.lag,a=void 0===o?0:o,u=e.scale,l=void 0===u?.05:u,c=e.patternSize,s=void 0===c?1:c;if("number"!=typeof n||n<=0)throw new Error('"stdDev" must be a positive number greater than 0 in candleStudies.');if("number"==typeof l&&!nr.includes(l))throw new Error('"scale" value in candleStudies must be any of the following numbers: '.concat(nr.join(", ")));if("number"!=typeof s||!Number.isInteger(s)||s<1)throw new Error('"patternSize" value in candleStudies must be an integer greater than 0.}');return this.inputParams.push({key:"candleStudies",params:[t,{stdDev:n,patternSize:s,lag:a,scale:l}]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1===this.hasVolume)throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');if(i(this),"number"!=typeof t||t<=1)throw new Error('fastSize" must be a positive number greater than 1 in volumeOscillator.');if("number"!=typeof e||e<=t)throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');var n=r.scale,o=void 0===n?null:n;if("number"==typeof o&&!nr.includes(o))throw new Error('"scale" value in volumeOscillator must be any of the following numbers: '.concat(nr.join(", ")));return this.inputParams.push({key:"volumeOscillator",params:[t,e,{scale:o}]}),this}},{key:"dateTime",value:function(){return i(this),this.inputParams.push({key:"dateTime",params:[]}),this}},{key:"priceVariations",value:function(){return i(this),this.inputParams.push({key:"priceVariations",params:[]}),this}}],e&&er(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
1
+ var OHLCV_INDICATORS;
2
+
3
+ /******/ (() => {
4
+ // webpackBootstrap
5
+ /******/ "use strict";
6
+ /******/ // The require scope
7
+ /******/ var t = {
8
+ /******/ // define getter functions for harmony exports
9
+ /******/ d: (e, r) => {
10
+ /******/ for (var n in r)
11
+ /******/ t.o(r, n) && !t.o(e, n) &&
12
+ /******/ Object.defineProperty(e, n, {
13
+ enumerable: !0,
14
+ get: r[n]
15
+ })
16
+ /******/;
17
+ /******/ },
18
+ /******/ o: (t, e) => Object.prototype.hasOwnProperty.call(t, e)
19
+ /******/ ,
20
+ /******/ // define __esModule on exports
21
+ /******/ r: t => {
22
+ /******/ "undefined" != typeof Symbol && Symbol.toStringTag &&
23
+ /******/ Object.defineProperty(t, Symbol.toStringTag, {
24
+ value: "Module"
25
+ })
26
+ /******/ , Object.defineProperty(t, "__esModule", {
27
+ value: !0
28
+ });
29
+ }
30
+ /******/ }, e = {};
31
+ /******/
32
+ /************************************************************************/
33
+ /******/ /* webpack/runtime/define property getters */
34
+ /******/
35
+ // This entry need to be wrapped in an IIFE because it declares 'OHLCV_INDICATORS' on top-level, which conflicts with the current library output.
36
+ (() => {
37
+ // ./src/utilities/validators.js
38
+ function r(t, e) {
39
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
40
+ if (!r) {
41
+ if (Array.isArray(t) || (r = function(t, e) {
42
+ if (t) {
43
+ if ("string" == typeof t) return n(t, e);
44
+ var r = {}.toString.call(t).slice(8, -1);
45
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(t, e) : void 0;
46
+ }
47
+ }(t)) || e && t && "number" == typeof t.length) {
48
+ r && (t = r);
49
+ var o = 0, i = function() {};
50
+ return {
51
+ s: i,
52
+ n: function() {
53
+ return o >= t.length ? {
54
+ done: !0
55
+ } : {
56
+ done: !1,
57
+ value: t[o++]
58
+ };
59
+ },
60
+ e: function(t) {
61
+ throw t;
62
+ },
63
+ f: i
64
+ };
65
+ }
66
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
67
+ }
68
+ var a, u = !0, l = !1;
69
+ return {
70
+ s: function() {
71
+ r = r.call(t);
72
+ },
73
+ n: function() {
74
+ var t = r.next();
75
+ return u = t.done, t;
76
+ },
77
+ e: function(t) {
78
+ l = !0, a = t;
79
+ },
80
+ f: function() {
81
+ try {
82
+ u || null == r.return || r.return();
83
+ } finally {
84
+ if (l) throw a;
85
+ }
86
+ }
87
+ };
88
+ }
89
+ function n(t, e) {
90
+ (null == e || e > t.length) && (e = t.length);
91
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
92
+ return n;
93
+ }
94
+ // ESM COMPAT FLAG
95
+ t.r(e),
96
+ // EXPORTS
97
+ t.d(e, {
98
+ default: () => /* binding */ Lr
99
+ });
100
+ var o = function(t) {
101
+ return "string" == typeof t && /^\d{4}-\d{2}-\d{2}/.test(t);
102
+ }, i = function(t) {
103
+ if (0 !== t.lastComputedIndex) throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.');
104
+ }, // 0, 1, 2 or 3
105
+ // The maximum value of DP and Big.DP.
106
+ a = 1e6, // 0 to 1000000
107
+ // The maximum magnitude of the exponent argument to the pow method.
108
+ u = 1e6, // true or false
109
+ /**************************************************************************************************/
110
+ // Error messages.
111
+ l = "[big.js] ", c = l + "Invalid ", s = c + "decimal places", f = c + "rounding mode", h = l + "Division by zero",
112
+ // The shared prototype object.
113
+ y = {}, p = void 0, v = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
114
+ /*
115
+ * Round Big x to a maximum of sd significant digits using rounding mode rm.
116
+ *
117
+ * x {Big} The Big to round.
118
+ * sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
119
+ * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
120
+ * [more] {boolean} Whether the result of division was truncated.
121
+ */
122
+ function d(t, e, r, n) {
123
+ var o = t.c;
124
+ if (r === p && (r = t.constructor.RM), 0 !== r && 1 !== r && 2 !== r && 3 !== r) throw Error(f);
125
+ if (e < 1) n = 3 === r && (n || !!o[0]) || 0 === e && (1 === r && o[0] >= 5 || 2 === r && (o[0] > 5 || 5 === o[0] && (n || o[1] !== p))),
126
+ o.length = 1, n ? (
127
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
128
+ t.e = t.e - e + 1, o[0] = 1) :
129
+ // Zero.
130
+ o[0] = t.e = 0; else if (e < o.length) {
131
+ // Round up?
132
+ if (
133
+ // xc[sd] is the digit after the digit that may be rounded up.
134
+ n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !== p || 1 & o[e - 1])) || 3 === r && (n || !!o[0]),
135
+ // Remove any digits after the required precision.
136
+ o.length = e, n)
137
+ // Rounding up may mean the previous digit has to be rounded up.
138
+ for (;++o[--e] > 9; ) if (o[e] = 0, 0 === e) {
139
+ ++t.e, o.unshift(1);
140
+ break;
141
+ }
142
+ // Remove trailing zeros.
143
+ for (e = o.length; !o[--e]; ) o.pop();
144
+ }
145
+ return t;
146
+ }
147
+ /*
148
+ * Return a string representing the value of Big x in normal or exponential notation.
149
+ * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
150
+ */ function b(t, e, r) {
151
+ var n = t.e, o = t.c.join(""), i = o.length;
152
+ // Exponential notation?
153
+ if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
154
+ // Normal notation.
155
+ else if (n < 0) {
156
+ for (;++n; ) o = "0" + o;
157
+ o = "0." + o;
158
+ } else if (n > 0) if (++n > i) for (n -= i; n--; ) o += "0"; else n < i && (o = o.slice(0, n) + "." + o.slice(n)); else i > 1 && (o = o.charAt(0) + "." + o.slice(1));
159
+ return t.s < 0 && r ? "-" + o : o;
160
+ }
161
+ // Prototype/instance methods
162
+ /*
163
+ * Return a new Big whose value is the absolute value of this Big.
164
+ */ y.abs = function() {
165
+ var t = new this.constructor(this);
166
+ return t.s = 1, t;
167
+ },
168
+ /*
169
+ * Return 1 if the value of this Big is greater than the value of Big y,
170
+ * -1 if the value of this Big is less than the value of Big y, or
171
+ * 0 if they have the same value.
172
+ */
173
+ y.cmp = function(t) {
174
+ var e, r = this, n = r.c, o = (t = new r.constructor(t)).c, i = r.s, a = t.s, u = r.e, l = t.e;
175
+ // Either zero?
176
+ if (!n[0] || !o[0]) return n[0] ? i : o[0] ? -a : 0;
177
+ // Signs differ?
178
+ if (i != a) return i;
179
+ // Compare exponents.
180
+ if (e = i < 0, u != l) return u > l ^ e ? 1 : -1;
181
+ // Compare digit by digit.
182
+ for (a = (u = n.length) < (l = o.length) ? u : l, i = -1; ++i < a; ) if (n[i] != o[i]) return n[i] > o[i] ^ e ? 1 : -1;
183
+ // Compare lengths.
184
+ return u == l ? 0 : u > l ^ e ? 1 : -1;
185
+ },
186
+ /*
187
+ * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
188
+ * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
189
+ */
190
+ y.div = function(t) {
191
+ var e = this, r = e.constructor, n = e.c, // dividend
192
+ o = (t = new r(t)).c, // divisor
193
+ i = e.s == t.s ? 1 : -1, u = r.DP;
194
+ if (u !== ~~u || u < 0 || u > a) throw Error(s);
195
+ // Divisor is zero?
196
+ if (!o[0]) throw Error(h);
197
+ // Dividend is 0? Return +-0.
198
+ if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
199
+ var l, c, f, y, v, b = o.slice(), m = l = o.length, g = n.length, w = n.slice(0, l), // remainder
200
+ O = w.length, S = t, // quotient
201
+ _ = S.c = [], j = 0, P = u + (S.e = e.e - t.e) + 1;
202
+ // precision of the result
203
+ // Add zeros to make remainder as long as divisor.
204
+ for (S.s = i, i = P < 0 ? 0 : P,
205
+ // Create version of divisor with leading zero.
206
+ b.unshift(0); O++ < l; ) w.push(0);
207
+ do {
208
+ // n is how many times the divisor goes into current remainder.
209
+ for (f = 0; f < 10; f++) {
210
+ // Compare divisor and remainder.
211
+ if (l != (O = w.length)) y = l > O ? 1 : -1; else for (v = -1, y = 0; ++v < l; ) if (o[v] != w[v]) {
212
+ y = o[v] > w[v] ? 1 : -1;
213
+ break;
214
+ }
215
+ // If divisor < remainder, subtract divisor from remainder.
216
+ if (!(y < 0)) break;
217
+ // Remainder can't be more than 1 digit longer than divisor.
218
+ // Equalise lengths using divisor with extra leading zero?
219
+ for (c = O == l ? o : b; O; ) {
220
+ if (w[--O] < c[O]) {
221
+ for (v = O; v && !w[--v]; ) w[v] = 9;
222
+ --w[v], w[O] += 10;
223
+ }
224
+ w[O] -= c[O];
225
+ }
226
+ for (;!w[0]; ) w.shift();
227
+ }
228
+ // Add the digit n to the result array.
229
+ _[j++] = y ? f : ++f,
230
+ // Update the remainder.
231
+ w[0] && y ? w[O] = n[m] || 0 : w = [ n[m] ];
232
+ } while ((m++ < g || w[0] !== p) && i--);
233
+ // Leading zero? Do not remove if result is simply zero (qi == 1).
234
+ return _[0] || 1 == j || (
235
+ // There can't be more than one zero.
236
+ _.shift(), S.e--, P--),
237
+ // Round?
238
+ j > P && d(S, P, r.RM, w[0] !== p), S;
239
+ },
240
+ /*
241
+ * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
242
+ */
243
+ y.eq = function(t) {
244
+ return 0 === this.cmp(t);
245
+ },
246
+ /*
247
+ * Return true if the value of this Big is greater than the value of Big y, otherwise return
248
+ * false.
249
+ */
250
+ y.gt = function(t) {
251
+ return this.cmp(t) > 0;
252
+ },
253
+ /*
254
+ * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
255
+ * return false.
256
+ */
257
+ y.gte = function(t) {
258
+ return this.cmp(t) > -1;
259
+ },
260
+ /*
261
+ * Return true if the value of this Big is less than the value of Big y, otherwise return false.
262
+ */
263
+ y.lt = function(t) {
264
+ return this.cmp(t) < 0;
265
+ },
266
+ /*
267
+ * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
268
+ * return false.
269
+ */
270
+ y.lte = function(t) {
271
+ return this.cmp(t) < 1;
272
+ },
273
+ /*
274
+ * Return a new Big whose value is the value of this Big minus the value of Big y.
275
+ */
276
+ y.minus = y.sub = function(t) {
277
+ var e, r, n, o, i = this, a = i.constructor, u = i.s, l = (t = new a(t)).s;
278
+ // Signs differ?
279
+ if (u != l) return t.s = -l, i.plus(t);
280
+ var c = i.c.slice(), s = i.e, f = t.c, h = t.e;
281
+ // Either zero?
282
+ if (!c[0] || !f[0]) return f[0] ? t.s = -l : c[0] ? t = new a(i) : t.s = 1,
283
+ t;
284
+ // Determine which is the bigger number. Prepend zeros to equalise exponents.
285
+ if (u = s - h) {
286
+ for ((o = u < 0) ? (u = -u, n = c) : (h = s, n = f), n.reverse(), l = u; l--; ) n.push(0);
287
+ n.reverse();
288
+ } else for (
289
+ // Exponents equal. Check digit by digit.
290
+ r = ((o = c.length < f.length) ? c : f).length, u = l = 0; l < r; l++) if (c[l] != f[l]) {
291
+ o = c[l] < f[l];
292
+ break;
293
+ }
294
+ // x < y? Point xc to the array of the bigger number.
295
+ /*
296
+ * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
297
+ * needs to start at yc.length.
298
+ */
299
+ if (o && (n = c, c = f, f = n, t.s = -t.s), (l = (r = f.length) - (e = c.length)) > 0) for (;l--; ) c[e++] = 0;
300
+ // Subtract yc from xc.
301
+ for (l = e; r > u; ) {
302
+ if (c[--r] < f[r]) {
303
+ for (e = r; e && !c[--e]; ) c[e] = 9;
304
+ --c[e], c[r] += 10;
305
+ }
306
+ c[r] -= f[r];
307
+ }
308
+ // Remove trailing zeros.
309
+ for (;0 === c[--l]; ) c.pop();
310
+ // Remove leading zeros and adjust exponent accordingly.
311
+ for (;0 === c[0]; ) c.shift(), --h;
312
+ return c[0] || (
313
+ // n - n = +0
314
+ t.s = 1,
315
+ // Result must be zero.
316
+ c = [ h = 0 ]), t.c = c, t.e = h, t;
317
+ },
318
+ /*
319
+ * Return a new Big whose value is the value of this Big modulo the value of Big y.
320
+ */
321
+ y.mod = function(t) {
322
+ var e, r = this, n = r.constructor, o = r.s, i = (t = new n(t)).s;
323
+ if (!t.c[0]) throw Error(h);
324
+ return r.s = t.s = 1, e = 1 == t.cmp(r), r.s = o, t.s = i, e ? new n(r) : (o = n.DP,
325
+ i = n.RM, n.DP = n.RM = 0, r = r.div(t), n.DP = o, n.RM = i, this.minus(r.times(t)));
326
+ },
327
+ /*
328
+ * Return a new Big whose value is the value of this Big negated.
329
+ */
330
+ y.neg = function() {
331
+ var t = new this.constructor(this);
332
+ return t.s = -t.s, t;
333
+ },
334
+ /*
335
+ * Return a new Big whose value is the value of this Big plus the value of Big y.
336
+ */
337
+ y.plus = y.add = function(t) {
338
+ var e, r, n, o = this, i = o.constructor;
339
+ // Signs differ?
340
+ if (t = new i(t), o.s != t.s) return t.s = -t.s, o.minus(t);
341
+ var a = o.e, u = o.c, l = t.e, c = t.c;
342
+ // Either zero?
343
+ if (!u[0] || !c[0]) return c[0] || (u[0] ? t = new i(o) : t.s = o.s),
344
+ t;
345
+ // Prepend zeros to equalise exponents.
346
+ // Note: reverse faster than unshifts.
347
+ if (u = u.slice(), e = a - l) {
348
+ for (e > 0 ? (l = a, n = c) : (e = -e, n = u), n.reverse(); e--; ) n.push(0);
349
+ n.reverse();
350
+ }
351
+ // Point xc to the longer array.
352
+ // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
353
+ for (u.length - c.length < 0 && (n = c, c = u, u = n), e = c.length, r = 0; e; u[e] %= 10) r = (u[--e] = u[e] + c[e] + r) / 10 | 0;
354
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
355
+ // Remove trailing zeros.
356
+ for (r && (u.unshift(r), ++l), e = u.length; 0 === u[--e]; ) u.pop();
357
+ return t.c = u, t.e = l, t;
358
+ },
359
+ /*
360
+ * Return a Big whose value is the value of this Big raised to the power n.
361
+ * If n is negative, round to a maximum of Big.DP decimal places using rounding
362
+ * mode Big.RM.
363
+ *
364
+ * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
365
+ */
366
+ y.pow = function(t) {
367
+ var e = this, r = new e.constructor("1"), n = r, o = t < 0;
368
+ if (t !== ~~t || t < -1e6 || t > u) throw Error(c + "exponent");
369
+ for (o && (t = -t); 1 & t && (n = n.times(e)), t >>= 1; ) e = e.times(e);
370
+ return o ? r.div(n) : n;
371
+ },
372
+ /*
373
+ * Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
374
+ * significant digits using rounding mode rm, or Big.RM if rm is not specified.
375
+ *
376
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
377
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
378
+ */
379
+ y.prec = function(t, e) {
380
+ if (t !== ~~t || t < 1 || t > a) throw Error(c + "precision");
381
+ return d(new this.constructor(this), t, e);
382
+ },
383
+ /*
384
+ * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
385
+ * using rounding mode rm, or Big.RM if rm is not specified.
386
+ * If dp is negative, round to an integer which is a multiple of 10**-dp.
387
+ * If dp is not specified, round to 0 decimal places.
388
+ *
389
+ * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
390
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
391
+ */
392
+ y.round = function(t, e) {
393
+ if (t === p) t = 0; else if (t !== ~~t || t < -a || t > a) throw Error(s);
394
+ return d(new this.constructor(this), t + this.e + 1, e);
395
+ },
396
+ /*
397
+ * Return a new Big whose value is the square root of the value of this Big, rounded, if
398
+ * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
399
+ */
400
+ y.sqrt = function() {
401
+ var t, e, r, n = this, o = n.constructor, i = n.s, a = n.e, u = new o("0.5");
402
+ // Zero?
403
+ if (!n.c[0]) return new o(n);
404
+ // Negative?
405
+ if (i < 0) throw Error(l + "No square root");
406
+ // Estimate.
407
+ // Math.sqrt underflow/overflow?
408
+ // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
409
+ 0 === (i = Math.sqrt(n + "")) || i === 1 / 0 ? ((e = n.c.join("")).length + a & 1 || (e += "0"),
410
+ a = ((a + 1) / 2 | 0) - (a < 0 || 1 & a), t = new o(((i = Math.sqrt(e)) == 1 / 0 ? "5e" : (i = i.toExponential()).slice(0, i.indexOf("e") + 1)) + a)) : t = new o(i + ""),
411
+ a = t.e + (o.DP += 4);
412
+ // Newton-Raphson iteration.
413
+ do {
414
+ r = t, t = u.times(r.plus(n.div(r)));
415
+ } while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
416
+ return d(t, (o.DP -= 4) + t.e + 1, o.RM);
417
+ },
418
+ /*
419
+ * Return a new Big whose value is the value of this Big times the value of Big y.
420
+ */
421
+ y.times = y.mul = function(t) {
422
+ var e, r = this, n = r.constructor, o = r.c, i = (t = new n(t)).c, a = o.length, u = i.length, l = r.e, c = t.e;
423
+ // Determine sign of result.
424
+ // Return signed 0 if either 0.
425
+ if (t.s = r.s == t.s ? 1 : -1, !o[0] || !i[0]) return t.c = [ t.e = 0 ], t;
426
+ // Initialise exponent of result as x.e + y.e.
427
+ // Initialise coefficient array of result with zeros.
428
+ for (t.e = l + c,
429
+ // If array xc has fewer digits than yc, swap xc and yc, and lengths.
430
+ a < u && (e = o, o = i, i = e, c = a, a = u, u = c), e = new Array(c = a + u); c--; ) e[c] = 0;
431
+ // Multiply.
432
+ // i is initially xc.length.
433
+ for (l = u; l--; ) {
434
+ // a is yc.length.
435
+ for (u = 0, c = a + l; c > l; )
436
+ // Current sum of products at this digit position, plus carry.
437
+ u = e[c] + i[l] * o[c - l - 1] + u, e[c--] = u % 10,
438
+ // carry
439
+ u = u / 10 | 0;
440
+ e[c] = u;
441
+ }
442
+ // Increment result exponent if there is a final carry, otherwise remove leading zero.
443
+ // Remove trailing zeros.
444
+ for (u ? ++t.e : e.shift(), l = e.length; !e[--l]; ) e.pop();
445
+ return t.c = e, t;
446
+ },
447
+ /*
448
+ * Return a string representing the value of this Big in exponential notation rounded to dp fixed
449
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
450
+ *
451
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
452
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
453
+ */
454
+ y.toExponential = function(t, e) {
455
+ var r = this, n = r.c[0];
456
+ if (t !== p) {
457
+ if (t !== ~~t || t < 0 || t > a) throw Error(s);
458
+ for (r = d(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
459
+ }
460
+ return b(r, !0, !!n);
461
+ },
462
+ /*
463
+ * Return a string representing the value of this Big in normal notation rounded to dp fixed
464
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
465
+ *
466
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
467
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
468
+ *
469
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
470
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
471
+ */
472
+ y.toFixed = function(t, e) {
473
+ var r = this, n = r.c[0];
474
+ if (t !== p) {
475
+ if (t !== ~~t || t < 0 || t > a) throw Error(s);
476
+ // x.e may have changed if the value is rounded up.
477
+ for (t = t + (r = d(new r.constructor(r), t + r.e + 1, e)).e + 1; r.c.length < t; ) r.c.push(0);
478
+ }
479
+ return b(r, !1, !!n);
480
+ },
481
+ /*
482
+ * Return a string representing the value of this Big.
483
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
484
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
485
+ * Omit the sign for negative zero.
486
+ */
487
+ y[Symbol.for("nodejs.util.inspect.custom")] = y.toJSON = y.toString = function() {
488
+ var t = this, e = t.constructor;
489
+ return b(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
490
+ },
491
+ /*
492
+ * Return the value of this Big as a primitve number.
493
+ */
494
+ y.toNumber = function() {
495
+ var t = Number(b(this, !0, !0));
496
+ if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(l + "Imprecise conversion");
497
+ return t;
498
+ },
499
+ /*
500
+ * Return a string representing the value of this Big rounded to sd significant digits using
501
+ * rounding mode rm, or Big.RM if rm is not specified.
502
+ * Use exponential notation if sd is less than the number of digits necessary to represent
503
+ * the integer part of the value in normal notation.
504
+ *
505
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
506
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
507
+ */
508
+ y.toPrecision = function(t, e) {
509
+ var r = this, n = r.constructor, o = r.c[0];
510
+ if (t !== p) {
511
+ if (t !== ~~t || t < 1 || t > a) throw Error(c + "precision");
512
+ for (r = d(new n(r), t, e); r.c.length < t; ) r.c.push(0);
513
+ }
514
+ return b(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
515
+ },
516
+ /*
517
+ * Return a string representing the value of this Big.
518
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
519
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
520
+ * Include the sign for negative zero.
521
+ */
522
+ y.valueOf = function() {
523
+ var t = this, e = t.constructor;
524
+ if (!0 === e.strict) throw Error(l + "valueOf disallowed");
525
+ return b(t, t.e <= e.NE || t.e >= e.PE, !0);
526
+ };
527
+ // Export
528
+ (
529
+ /*
530
+ * Create and return a Big constructor.
531
+ */
532
+ function t() {
533
+ /*
534
+ * The Big constructor and exported function.
535
+ * Create and return a new instance of a Big number object.
536
+ *
537
+ * n {number|string|Big} A numeric value.
538
+ */
539
+ function e(r) {
540
+ var n = this;
541
+ // Enable constructor usage without new.
542
+ if (!(n instanceof e)) return r === p ? t() : new e(r);
543
+ // Duplicate.
544
+ if (r instanceof e) n.s = r.s, n.e = r.e, n.c = r.c.slice(); else {
545
+ if ("string" != typeof r) {
546
+ if (!0 === e.strict && "bigint" != typeof r) throw TypeError(c + "value");
547
+ // Minus zero?
548
+ r = 0 === r && 1 / r < 0 ? "-0" : String(r);
549
+ }
550
+ !
551
+ /*
552
+ * Parse the number or string value passed to a Big constructor.
553
+ *
554
+ * x {Big} A Big number instance.
555
+ * n {number|string} A numeric value.
556
+ */
557
+ function(t, e) {
558
+ var r, n, o;
559
+ if (!v.test(e)) throw Error(c + "number");
560
+ // Determine sign.
561
+ // Decimal point?
562
+ t.s = "-" == e.charAt(0) ? (e = e.slice(1), -1) : 1, (r = e.indexOf(".")) > -1 && (e = e.replace(".", ""));
563
+ // Exponential form?
564
+ (n = e.search(/e/i)) > 0 ? (
565
+ // Determine exponent.
566
+ r < 0 && (r = n), r += +e.slice(n + 1), e = e.substring(0, n)) : r < 0 && (
567
+ // Integer.
568
+ r = e.length);
569
+ // Determine leading zeros.
570
+ for (o = e.length, n = 0; n < o && "0" == e.charAt(n); ) ++n;
571
+ if (n == o)
572
+ // Zero.
573
+ t.c = [ t.e = 0 ]; else {
574
+ // Determine trailing zeros.
575
+ for (;o > 0 && "0" == e.charAt(--o); ) ;
576
+ // Convert string to array of digits without leading/trailing zeros.
577
+ for (t.e = r - n - 1, t.c = [], r = 0; n <= o; ) t.c[r++] = +e.charAt(n++);
578
+ }
579
+ }(n, r);
580
+ }
581
+ // Retain a reference to this Big constructor.
582
+ // Shadow Big.prototype.constructor which points to Object.
583
+ n.constructor = e;
584
+ }
585
+ return e.prototype = y, e.DP = 20, e.RM = 1, e.NE = -7, e.PE = 21, e.strict = false,
586
+ e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
587
+ })();
588
+ /// <reference types="https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/big.js/index.d.ts" />
589
+ /* harmony default export */ // ./node_modules/trading-signals/dist/error/NotEnoughDataError.js
590
+ function m(t) {
591
+ return m = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
592
+ return typeof t;
593
+ } : function(t) {
594
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
595
+ }, m(t);
596
+ }
597
+ function g(t, e) {
598
+ for (var r = 0; r < e.length; r++) {
599
+ var n = e[r];
600
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
601
+ Object.defineProperty(t, w(n.key), n);
602
+ }
603
+ }
604
+ function w(t) {
605
+ var e = function(t, e) {
606
+ if ("object" != m(t) || !t) return t;
607
+ var r = t[Symbol.toPrimitive];
608
+ if (void 0 !== r) {
609
+ var n = r.call(t, e || "default");
610
+ if ("object" != m(n)) return n;
611
+ throw new TypeError("@@toPrimitive must return a primitive value.");
612
+ }
613
+ return ("string" === e ? String : Number)(t);
614
+ }(t, "string");
615
+ return "symbol" == m(e) ? e : e + "";
616
+ }
617
+ function O(t, e, r) {
618
+ return e = P(e), function(t, e) {
619
+ if (e && ("object" == m(e) || "function" == typeof e)) return e;
620
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
621
+ return function(t) {
622
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
623
+ return t;
624
+ }(t);
625
+ }(t, _() ? Reflect.construct(e, r || [], P(t).constructor) : e.apply(t, r));
626
+ }
627
+ function S(t) {
628
+ var e = "function" == typeof Map ? new Map : void 0;
629
+ return S = function(t) {
630
+ if (null === t || !function(t) {
631
+ try {
632
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
633
+ } catch (e) {
634
+ return "function" == typeof t;
635
+ }
636
+ }(t)) return t;
637
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
638
+ if (void 0 !== e) {
639
+ if (e.has(t)) return e.get(t);
640
+ e.set(t, r);
641
+ }
642
+ function r() {
643
+ return function(t, e, r) {
644
+ if (_()) return Reflect.construct.apply(null, arguments);
645
+ var n = [ null ];
646
+ n.push.apply(n, e);
647
+ var o = new (t.bind.apply(t, n));
648
+ return r && j(o, r.prototype), o;
649
+ }(t, arguments, P(this).constructor);
650
+ }
651
+ return r.prototype = Object.create(t.prototype, {
652
+ constructor: {
653
+ value: r,
654
+ enumerable: !1,
655
+ writable: !0,
656
+ configurable: !0
657
+ }
658
+ }), j(r, t);
659
+ }, S(t);
660
+ }
661
+ function _() {
662
+ try {
663
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
664
+ } catch (t) {}
665
+ return (_ = function() {
666
+ return !!t;
667
+ })();
668
+ }
669
+ function j(t, e) {
670
+ return j = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
671
+ return t.__proto__ = e, t;
672
+ }, j(t, e);
673
+ }
674
+ function P(t) {
675
+ return P = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
676
+ return t.__proto__ || Object.getPrototypeOf(t);
677
+ }, P(t);
678
+ }
679
+ var A = function(t) {
680
+ function e() {
681
+ var t, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Not enough data";
682
+ return function(t, e) {
683
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
684
+ }(this, e), t = O(this, e, [ r ]), Object.setPrototypeOf(t, (this instanceof e ? this.constructor : void 0).prototype),
685
+ t.name = "NotEnoughDataError", t;
686
+ }
687
+ return function(t, e) {
688
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
689
+ t.prototype = Object.create(e && e.prototype, {
690
+ constructor: {
691
+ value: t,
692
+ writable: !0,
693
+ configurable: !0
694
+ }
695
+ }), Object.defineProperty(t, "prototype", {
696
+ writable: !1
697
+ }), e && j(t, e);
698
+ }(e, t), r = e, n && g(r.prototype, n), o && g(r, o), Object.defineProperty(r, "prototype", {
699
+ writable: !1
700
+ }), r;
701
+ var r, n, o;
702
+ }( S(Error));
703
+ // ./node_modules/trading-signals/dist/Indicator.js
704
+ function E(t) {
705
+ return E = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
706
+ return typeof t;
707
+ } : function(t) {
708
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
709
+ }, E(t);
710
+ }
711
+ function M(t, e) {
712
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
713
+ }
714
+ function x(t, e) {
715
+ for (var r = 0; r < e.length; r++) {
716
+ var n = e[r];
717
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
718
+ Object.defineProperty(t, I(n.key), n);
719
+ }
720
+ }
721
+ function k(t, e, r) {
722
+ return e && x(t.prototype, e), r && x(t, r), Object.defineProperty(t, "prototype", {
723
+ writable: !1
724
+ }), t;
725
+ }
726
+ function T(t, e, r) {
727
+ return (e = I(e)) in t ? Object.defineProperty(t, e, {
728
+ value: r,
729
+ enumerable: !0,
730
+ configurable: !0,
731
+ writable: !0
732
+ }) : t[e] = r, t;
733
+ }
734
+ function I(t) {
735
+ var e = function(t, e) {
736
+ if ("object" != E(t) || !t) return t;
737
+ var r = t[Symbol.toPrimitive];
738
+ if (void 0 !== r) {
739
+ var n = r.call(t, e || "default");
740
+ if ("object" != E(n)) return n;
741
+ throw new TypeError("@@toPrimitive must return a primitive value.");
742
+ }
743
+ return ("string" === e ? String : Number)(t);
744
+ }(t, "string");
745
+ return "symbol" == E(e) ? e : e + "";
746
+ }
747
+ var R = function() {
748
+ return k((function t() {
749
+ M(this, t), T(this, "previousHighest", void 0), T(this, "highest", void 0), T(this, "previousLowest", void 0),
750
+ T(this, "lowest", void 0), T(this, "previousResult", void 0), T(this, "result", void 0);
751
+ }), [ {
752
+ key: "isStable",
753
+ get: function() {
754
+ return void 0 !== this.result;
755
+ }
756
+ }, {
757
+ key: "getResult",
758
+ value: function() {
759
+ if (void 0 === this.result) throw new A;
760
+ return this.result;
761
+ }
762
+ }, {
763
+ key: "setResult",
764
+ value: function(t, e) {
765
+ return e && (this.highest = this.previousHighest, this.lowest = this.previousLowest,
766
+ this.result = this.previousResult), void 0 === this.highest ? this.highest = t : t > this.highest ? (this.previousHighest = this.highest,
767
+ this.highest = t) : this.previousHighest = this.highest, void 0 === this.lowest ? this.lowest = t : t < this.lowest ? (this.previousLowest = this.lowest,
768
+ this.lowest = t) : this.previousLowest = this.lowest, this.previousResult = this.result,
769
+ this.result = t;
770
+ }
771
+ }, {
772
+ key: "replace",
773
+ value: function(t) {
774
+ return this.update(t, !0);
775
+ }
776
+ } ]);
777
+ }();
778
+ // ./node_modules/trading-signals/dist/MA/MovingAverage.js
779
+ function C(t) {
780
+ return C = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
781
+ return typeof t;
782
+ } : function(t) {
783
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
784
+ }, C(t);
785
+ }
786
+ function D(t, e) {
787
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
788
+ }
789
+ function V(t, e) {
790
+ for (var r = 0; r < e.length; r++) {
791
+ var n = e[r];
792
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
793
+ Object.defineProperty(t, $(n.key), n);
794
+ }
795
+ }
796
+ function B(t, e, r) {
797
+ return e && V(t.prototype, e), r && V(t, r), Object.defineProperty(t, "prototype", {
798
+ writable: !1
799
+ }), t;
800
+ }
801
+ function N(t, e, r) {
802
+ return e = H(e), function(t, e) {
803
+ if (e && ("object" == C(e) || "function" == typeof e)) return e;
804
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
805
+ return function(t) {
806
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
807
+ return t;
808
+ }(t);
809
+ }(t, L() ? Reflect.construct(e, r || [], H(t).constructor) : e.apply(t, r));
810
+ }
811
+ function L() {
812
+ try {
813
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
814
+ } catch (t) {}
815
+ return (L = function() {
816
+ return !!t;
817
+ })();
818
+ }
819
+ function H(t) {
820
+ return H = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
821
+ return t.__proto__ || Object.getPrototypeOf(t);
822
+ }, H(t);
823
+ }
824
+ function U(t, e) {
825
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
826
+ t.prototype = Object.create(e && e.prototype, {
827
+ constructor: {
828
+ value: t,
829
+ writable: !0,
830
+ configurable: !0
831
+ }
832
+ }), Object.defineProperty(t, "prototype", {
833
+ writable: !1
834
+ }), e && z(t, e);
835
+ }
836
+ function z(t, e) {
837
+ return z = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
838
+ return t.__proto__ = e, t;
839
+ }, z(t, e);
840
+ }
841
+ function q(t, e, r) {
842
+ return (e = $(e)) in t ? Object.defineProperty(t, e, {
843
+ value: r,
844
+ enumerable: !0,
845
+ configurable: !0,
846
+ writable: !0
847
+ }) : t[e] = r, t;
848
+ }
849
+ function $(t) {
850
+ var e = function(t, e) {
851
+ if ("object" != C(t) || !t) return t;
852
+ var r = t[Symbol.toPrimitive];
853
+ if (void 0 !== r) {
854
+ var n = r.call(t, e || "default");
855
+ if ("object" != C(n)) return n;
856
+ throw new TypeError("@@toPrimitive must return a primitive value.");
857
+ }
858
+ return ("string" === e ? String : Number)(t);
859
+ }(t, "string");
860
+ return "symbol" == C(e) ? e : e + "";
861
+ }
862
+ var F = function(t) {
863
+ function e(t) {
864
+ var r;
865
+ return D(this, e), q(r = N(this, e), "interval", void 0), r.interval = t, r;
866
+ }
867
+ return U(e, t), B(e, [ {
868
+ key: "updates",
869
+ value: function(t) {
870
+ var e = this;
871
+ return t.forEach((function(t) {
872
+ return e.update(t);
873
+ })), this.result;
874
+ }
875
+ }, {
876
+ key: "replace",
877
+ value: function(t) {
878
+ return this.update(t, !0);
879
+ }
880
+ } ]);
881
+ }(R);
882
+ // ./node_modules/trading-signals/dist/SMA/SMA.js
883
+ function K(t) {
884
+ return K = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
885
+ return typeof t;
886
+ } : function(t) {
887
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
888
+ }, K(t);
889
+ }
890
+ function G(t, e) {
891
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
892
+ }
893
+ function J(t, e) {
894
+ for (var r = 0; r < e.length; r++) {
895
+ var n = e[r];
896
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
897
+ Object.defineProperty(t, rt(n.key), n);
898
+ }
899
+ }
900
+ function W(t, e, r) {
901
+ return e && J(t.prototype, e), r && J(t, r), Object.defineProperty(t, "prototype", {
902
+ writable: !1
903
+ }), t;
904
+ }
905
+ function Y(t, e, r) {
906
+ return e = X(e), function(t, e) {
907
+ if (e && ("object" == K(e) || "function" == typeof e)) return e;
908
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
909
+ return function(t) {
910
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
911
+ return t;
912
+ }(t);
913
+ }(t, Q() ? Reflect.construct(e, r || [], X(t).constructor) : e.apply(t, r));
914
+ }
915
+ function Q() {
916
+ try {
917
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
918
+ } catch (t) {}
919
+ return (Q = function() {
920
+ return !!t;
921
+ })();
922
+ }
923
+ function X(t) {
924
+ return X = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
925
+ return t.__proto__ || Object.getPrototypeOf(t);
926
+ }, X(t);
927
+ }
928
+ function Z(t, e) {
929
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
930
+ t.prototype = Object.create(e && e.prototype, {
931
+ constructor: {
932
+ value: t,
933
+ writable: !0,
934
+ configurable: !0
935
+ }
936
+ }), Object.defineProperty(t, "prototype", {
937
+ writable: !1
938
+ }), e && tt(t, e);
939
+ }
940
+ function tt(t, e) {
941
+ return tt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
942
+ return t.__proto__ = e, t;
943
+ }, tt(t, e);
944
+ }
945
+ function et(t, e, r) {
946
+ return (e = rt(e)) in t ? Object.defineProperty(t, e, {
947
+ value: r,
948
+ enumerable: !0,
949
+ configurable: !0,
950
+ writable: !0
951
+ }) : t[e] = r, t;
952
+ }
953
+ function rt(t) {
954
+ var e = function(t, e) {
955
+ if ("object" != K(t) || !t) return t;
956
+ var r = t[Symbol.toPrimitive];
957
+ if (void 0 !== r) {
958
+ var n = r.call(t, e || "default");
959
+ if ("object" != K(n)) return n;
960
+ throw new TypeError("@@toPrimitive must return a primitive value.");
961
+ }
962
+ return ("string" === e ? String : Number)(t);
963
+ }(t, "string");
964
+ return "symbol" == K(e) ? e : e + "";
965
+ }
966
+ var nt = function(t) {
967
+ function e() {
968
+ var t;
969
+ G(this, e);
970
+ for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
971
+ return et(t = Y(this, e, [].concat(n)), "prices", []), t;
972
+ }
973
+ return Z(e, t), W(e, [ {
974
+ key: "update",
975
+ value: function(t) {
976
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
977
+ if (this.prices.length && e ? this.prices[this.prices.length - 1] = t : this.prices.push(t),
978
+ this.prices.length > this.interval && this.prices.shift(), this.prices.length === this.interval) {
979
+ var r = this.prices.reduce((function(t, e) {
980
+ return t + e;
981
+ }), 0);
982
+ return this.setResult(r / this.prices.length, e);
983
+ }
984
+ }
985
+ } ]);
986
+ }(F);
987
+ // ./node_modules/trading-signals/dist/WSMA/WSMA.js
988
+ function ot(t) {
989
+ return ot = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
990
+ return typeof t;
991
+ } : function(t) {
992
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
993
+ }, ot(t);
994
+ }
995
+ function it(t, e) {
996
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
997
+ }
998
+ function at(t, e) {
999
+ for (var r = 0; r < e.length; r++) {
1000
+ var n = e[r];
1001
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1002
+ Object.defineProperty(t, pt(n.key), n);
1003
+ }
1004
+ }
1005
+ function ut(t, e, r) {
1006
+ return e && at(t.prototype, e), r && at(t, r), Object.defineProperty(t, "prototype", {
1007
+ writable: !1
1008
+ }), t;
1009
+ }
1010
+ function lt(t, e, r) {
1011
+ return e = st(e), function(t, e) {
1012
+ if (e && ("object" == ot(e) || "function" == typeof e)) return e;
1013
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1014
+ return function(t) {
1015
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1016
+ return t;
1017
+ }(t);
1018
+ }(t, ct() ? Reflect.construct(e, r || [], st(t).constructor) : e.apply(t, r));
1019
+ }
1020
+ function ct() {
1021
+ try {
1022
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1023
+ } catch (t) {}
1024
+ return (ct = function() {
1025
+ return !!t;
1026
+ })();
1027
+ }
1028
+ function st(t) {
1029
+ return st = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1030
+ return t.__proto__ || Object.getPrototypeOf(t);
1031
+ }, st(t);
1032
+ }
1033
+ function ft(t, e) {
1034
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1035
+ t.prototype = Object.create(e && e.prototype, {
1036
+ constructor: {
1037
+ value: t,
1038
+ writable: !0,
1039
+ configurable: !0
1040
+ }
1041
+ }), Object.defineProperty(t, "prototype", {
1042
+ writable: !1
1043
+ }), e && ht(t, e);
1044
+ }
1045
+ function ht(t, e) {
1046
+ return ht = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1047
+ return t.__proto__ = e, t;
1048
+ }, ht(t, e);
1049
+ }
1050
+ function yt(t, e, r) {
1051
+ return (e = pt(e)) in t ? Object.defineProperty(t, e, {
1052
+ value: r,
1053
+ enumerable: !0,
1054
+ configurable: !0,
1055
+ writable: !0
1056
+ }) : t[e] = r, t;
1057
+ }
1058
+ function pt(t) {
1059
+ var e = function(t, e) {
1060
+ if ("object" != ot(t) || !t) return t;
1061
+ var r = t[Symbol.toPrimitive];
1062
+ if (void 0 !== r) {
1063
+ var n = r.call(t, e || "default");
1064
+ if ("object" != ot(n)) return n;
1065
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1066
+ }
1067
+ return ("string" === e ? String : Number)(t);
1068
+ }(t, "string");
1069
+ return "symbol" == ot(e) ? e : e + "";
1070
+ }
1071
+ var vt = function(t) {
1072
+ function e(t) {
1073
+ var r;
1074
+ return it(this, e), yt(r = lt(this, e), "interval", void 0), yt(r, "indicator", void 0),
1075
+ yt(r, "smoothingFactor", void 0), r.interval = t, r.indicator = new nt(t), r.smoothingFactor = 1 / r.interval,
1076
+ r;
1077
+ }
1078
+ return ft(e, t), ut(e, [ {
1079
+ key: "updates",
1080
+ value: function(t) {
1081
+ var e = this;
1082
+ return t.forEach((function(t) {
1083
+ return e.update(t);
1084
+ })), this.result;
1085
+ }
1086
+ }, {
1087
+ key: "update",
1088
+ value: function(t) {
1089
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.indicator.update(t);
1090
+ if (e && void 0 !== this.previousResult) {
1091
+ var n = (t - this.previousResult) * this.smoothingFactor;
1092
+ return this.setResult(n + this.previousResult, e);
1093
+ }
1094
+ if (!e && void 0 !== this.result) {
1095
+ var o = (t - this.result) * this.smoothingFactor;
1096
+ return this.setResult(o + this.result, e);
1097
+ }
1098
+ if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
1099
+ }
1100
+ } ]);
1101
+ }(R);
1102
+ function dt(t) {
1103
+ return t.length ? t.reduce((function(t, e) {
1104
+ return t + e;
1105
+ }), 0) / t.length : 0;
1106
+ }
1107
+ // ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
1108
+ function bt(t) {
1109
+ return bt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1110
+ return typeof t;
1111
+ } : function(t) {
1112
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1113
+ }, bt(t);
1114
+ }
1115
+ function mt(t, e) {
1116
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1117
+ }
1118
+ function gt(t, e) {
1119
+ for (var r = 0; r < e.length; r++) {
1120
+ var n = e[r];
1121
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1122
+ Object.defineProperty(t, St(n.key), n);
1123
+ }
1124
+ }
1125
+ function wt(t, e, r) {
1126
+ return e && gt(t.prototype, e), r && gt(t, r), Object.defineProperty(t, "prototype", {
1127
+ writable: !1
1128
+ }), t;
1129
+ }
1130
+ function Ot(t, e, r) {
1131
+ return (e = St(e)) in t ? Object.defineProperty(t, e, {
1132
+ value: r,
1133
+ enumerable: !0,
1134
+ configurable: !0,
1135
+ writable: !0
1136
+ }) : t[e] = r, t;
1137
+ }
1138
+ function St(t) {
1139
+ var e = function(t, e) {
1140
+ if ("object" != bt(t) || !t) return t;
1141
+ var r = t[Symbol.toPrimitive];
1142
+ if (void 0 !== r) {
1143
+ var n = r.call(t, e || "default");
1144
+ if ("object" != bt(n)) return n;
1145
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1146
+ }
1147
+ return ("string" === e ? String : Number)(t);
1148
+ }(t, "string");
1149
+ return "symbol" == bt(e) ? e : e + "";
1150
+ }
1151
+ var _t = function() {
1152
+ return wt((function t(e) {
1153
+ var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
1154
+ mt(this, t), Ot(this, "interval", void 0), Ot(this, "deviationMultiplier", void 0),
1155
+ Ot(this, "prices", []), Ot(this, "result", void 0), this.interval = e, this.deviationMultiplier = r;
1156
+ }), [ {
1157
+ key: "update",
1158
+ value: function(t) {
1159
+ if (this.prices.push(t), this.prices.length > this.interval) {
1160
+ this.prices.shift();
1161
+ var e = dt(this.prices), r = function(t, e) {
1162
+ var r = e || dt(t), n = dt(t.map((function(t) {
1163
+ return t - r;
1164
+ })).map((function(t) {
1165
+ return t * t;
1166
+ })));
1167
+ return Math.sqrt(n);
1168
+ }(this.prices, e);
1169
+ return this.result = {
1170
+ lower: e - r * this.deviationMultiplier,
1171
+ middle: e,
1172
+ upper: e + r * this.deviationMultiplier
1173
+ };
1174
+ }
1175
+ }
1176
+ }, {
1177
+ key: "getResult",
1178
+ value: function() {
1179
+ if (void 0 === this.result) throw new A;
1180
+ return this.result;
1181
+ }
1182
+ }, {
1183
+ key: "isStable",
1184
+ get: function() {
1185
+ return void 0 !== this.result;
1186
+ }
1187
+ } ]);
1188
+ }();
1189
+ // ./node_modules/trading-signals/dist/EMA/EMA.js
1190
+ function jt(t) {
1191
+ return jt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1192
+ return typeof t;
1193
+ } : function(t) {
1194
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1195
+ }, jt(t);
1196
+ }
1197
+ function Pt(t, e) {
1198
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1199
+ }
1200
+ function At(t, e) {
1201
+ for (var r = 0; r < e.length; r++) {
1202
+ var n = e[r];
1203
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1204
+ Object.defineProperty(t, Ct(n.key), n);
1205
+ }
1206
+ }
1207
+ function Et(t, e, r) {
1208
+ return e && At(t.prototype, e), r && At(t, r), Object.defineProperty(t, "prototype", {
1209
+ writable: !1
1210
+ }), t;
1211
+ }
1212
+ function Mt(t, e, r) {
1213
+ return e = kt(e), function(t, e) {
1214
+ if (e && ("object" == jt(e) || "function" == typeof e)) return e;
1215
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1216
+ return function(t) {
1217
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1218
+ return t;
1219
+ }(t);
1220
+ }(t, xt() ? Reflect.construct(e, r || [], kt(t).constructor) : e.apply(t, r));
1221
+ }
1222
+ function xt() {
1223
+ try {
1224
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1225
+ } catch (t) {}
1226
+ return (xt = function() {
1227
+ return !!t;
1228
+ })();
1229
+ }
1230
+ function kt(t) {
1231
+ return kt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1232
+ return t.__proto__ || Object.getPrototypeOf(t);
1233
+ }, kt(t);
1234
+ }
1235
+ function Tt(t, e) {
1236
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1237
+ t.prototype = Object.create(e && e.prototype, {
1238
+ constructor: {
1239
+ value: t,
1240
+ writable: !0,
1241
+ configurable: !0
1242
+ }
1243
+ }), Object.defineProperty(t, "prototype", {
1244
+ writable: !1
1245
+ }), e && It(t, e);
1246
+ }
1247
+ function It(t, e) {
1248
+ return It = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1249
+ return t.__proto__ = e, t;
1250
+ }, It(t, e);
1251
+ }
1252
+ function Rt(t, e, r) {
1253
+ return (e = Ct(e)) in t ? Object.defineProperty(t, e, {
1254
+ value: r,
1255
+ enumerable: !0,
1256
+ configurable: !0,
1257
+ writable: !0
1258
+ }) : t[e] = r, t;
1259
+ }
1260
+ function Ct(t) {
1261
+ var e = function(t, e) {
1262
+ if ("object" != jt(t) || !t) return t;
1263
+ var r = t[Symbol.toPrimitive];
1264
+ if (void 0 !== r) {
1265
+ var n = r.call(t, e || "default");
1266
+ if ("object" != jt(n)) return n;
1267
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1268
+ }
1269
+ return ("string" === e ? String : Number)(t);
1270
+ }(t, "string");
1271
+ return "symbol" == jt(e) ? e : e + "";
1272
+ }
1273
+ var Dt = function(t) {
1274
+ function e(t) {
1275
+ var r;
1276
+ return Pt(this, e), Rt(r = Mt(this, e, [ t ]), "interval", void 0), Rt(r, "pricesCounter", 0),
1277
+ Rt(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
1278
+ r;
1279
+ }
1280
+ return Tt(e, t), Et(e, [ {
1281
+ key: "update",
1282
+ value: function(t) {
1283
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1284
+ return e ? e && 0 === this.pricesCounter && this.pricesCounter++ : this.pricesCounter++,
1285
+ e && void 0 !== this.previousResult ? this.setResult(t * this.weightFactor + this.previousResult * (1 - this.weightFactor), e) : this.setResult(t * this.weightFactor + (void 0 !== this.result ? this.result : t) * (1 - this.weightFactor), e);
1286
+ }
1287
+ }, {
1288
+ key: "getResult",
1289
+ value: function() {
1290
+ if (this.pricesCounter < this.interval) throw new A;
1291
+ return this.result;
1292
+ }
1293
+ }, {
1294
+ key: "isStable",
1295
+ get: function() {
1296
+ try {
1297
+ return this.getResult(), !0;
1298
+ } catch (t) {
1299
+ return !1;
1300
+ }
1301
+ }
1302
+ } ]);
1303
+ }(F);
1304
+ // ./node_modules/trading-signals/dist/MACD/MACD.js
1305
+ function Vt(t) {
1306
+ return Vt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1307
+ return typeof t;
1308
+ } : function(t) {
1309
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1310
+ }, Vt(t);
1311
+ }
1312
+ function Bt(t, e) {
1313
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1314
+ }
1315
+ function Nt(t, e) {
1316
+ for (var r = 0; r < e.length; r++) {
1317
+ var n = e[r];
1318
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1319
+ Object.defineProperty(t, Ut(n.key), n);
1320
+ }
1321
+ }
1322
+ function Lt(t, e, r) {
1323
+ return e && Nt(t.prototype, e), r && Nt(t, r), Object.defineProperty(t, "prototype", {
1324
+ writable: !1
1325
+ }), t;
1326
+ }
1327
+ function Ht(t, e, r) {
1328
+ return (e = Ut(e)) in t ? Object.defineProperty(t, e, {
1329
+ value: r,
1330
+ enumerable: !0,
1331
+ configurable: !0,
1332
+ writable: !0
1333
+ }) : t[e] = r, t;
1334
+ }
1335
+ function Ut(t) {
1336
+ var e = function(t, e) {
1337
+ if ("object" != Vt(t) || !t) return t;
1338
+ var r = t[Symbol.toPrimitive];
1339
+ if (void 0 !== r) {
1340
+ var n = r.call(t, e || "default");
1341
+ if ("object" != Vt(n)) return n;
1342
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1343
+ }
1344
+ return ("string" === e ? String : Number)(t);
1345
+ }(t, "string");
1346
+ return "symbol" == Vt(e) ? e : e + "";
1347
+ }
1348
+ var zt = function() {
1349
+ return Lt((function t(e, r, n) {
1350
+ Bt(this, t), Ht(this, "short", void 0), Ht(this, "long", void 0), Ht(this, "signal", void 0),
1351
+ Ht(this, "prices", []), Ht(this, "result", void 0), this.short = e, this.long = r,
1352
+ this.signal = n;
1353
+ }), [ {
1354
+ key: "getResult",
1355
+ value: function() {
1356
+ if (void 0 === this.result) throw new A;
1357
+ return this.result;
1358
+ }
1359
+ }, {
1360
+ key: "isStable",
1361
+ get: function() {
1362
+ return void 0 !== this.result;
1363
+ }
1364
+ }, {
1365
+ key: "update",
1366
+ value: function(t) {
1367
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1368
+ this.prices.length && e ? this.prices[this.prices.length - 1] = t : this.prices.push(t);
1369
+ var r = this.short.update(t, e), n = this.long.update(t, e);
1370
+ if (this.prices.length > this.long.interval && this.prices.shift(), this.prices.length === this.long.interval) {
1371
+ var o = r - n, i = this.signal.update(o, e);
1372
+ return this.result = {
1373
+ histogram: o - i,
1374
+ macd: o,
1375
+ signal: i
1376
+ };
1377
+ }
1378
+ }
1379
+ } ]);
1380
+ }();
1381
+ // ./node_modules/trading-signals/dist/RSI/RSI.js
1382
+ function qt(t) {
1383
+ return qt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1384
+ return typeof t;
1385
+ } : function(t) {
1386
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1387
+ }, qt(t);
1388
+ }
1389
+ function $t(t, e) {
1390
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1391
+ }
1392
+ function Ft(t, e) {
1393
+ for (var r = 0; r < e.length; r++) {
1394
+ var n = e[r];
1395
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1396
+ Object.defineProperty(t, Zt(n.key), n);
1397
+ }
1398
+ }
1399
+ function Kt(t, e, r) {
1400
+ return e && Ft(t.prototype, e), r && Ft(t, r), Object.defineProperty(t, "prototype", {
1401
+ writable: !1
1402
+ }), t;
1403
+ }
1404
+ function Gt(t, e, r) {
1405
+ return e = Wt(e), function(t, e) {
1406
+ if (e && ("object" == qt(e) || "function" == typeof e)) return e;
1407
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1408
+ return function(t) {
1409
+ if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1410
+ return t;
1411
+ }(t);
1412
+ }(t, Jt() ? Reflect.construct(e, r || [], Wt(t).constructor) : e.apply(t, r));
1413
+ }
1414
+ function Jt() {
1415
+ try {
1416
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1417
+ } catch (t) {}
1418
+ return (Jt = function() {
1419
+ return !!t;
1420
+ })();
1421
+ }
1422
+ function Wt(t) {
1423
+ return Wt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1424
+ return t.__proto__ || Object.getPrototypeOf(t);
1425
+ }, Wt(t);
1426
+ }
1427
+ function Yt(t, e) {
1428
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1429
+ t.prototype = Object.create(e && e.prototype, {
1430
+ constructor: {
1431
+ value: t,
1432
+ writable: !0,
1433
+ configurable: !0
1434
+ }
1435
+ }), Object.defineProperty(t, "prototype", {
1436
+ writable: !1
1437
+ }), e && Qt(t, e);
1438
+ }
1439
+ function Qt(t, e) {
1440
+ return Qt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1441
+ return t.__proto__ = e, t;
1442
+ }, Qt(t, e);
1443
+ }
1444
+ function Xt(t, e, r) {
1445
+ return (e = Zt(e)) in t ? Object.defineProperty(t, e, {
1446
+ value: r,
1447
+ enumerable: !0,
1448
+ configurable: !0,
1449
+ writable: !0
1450
+ }) : t[e] = r, t;
1451
+ }
1452
+ function Zt(t) {
1453
+ var e = function(t, e) {
1454
+ if ("object" != qt(t) || !t) return t;
1455
+ var r = t[Symbol.toPrimitive];
1456
+ if (void 0 !== r) {
1457
+ var n = r.call(t, e || "default");
1458
+ if ("object" != qt(n)) return n;
1459
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1460
+ }
1461
+ return ("string" === e ? String : Number)(t);
1462
+ }(t, "string");
1463
+ return "symbol" == qt(e) ? e : e + "";
1464
+ }
1465
+ var te = function(t) {
1466
+ function e(t) {
1467
+ var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : vt;
1468
+ return $t(this, e), Xt(r = Gt(this, e), "interval", void 0), Xt(r, "previousPrices", []),
1469
+ Xt(r, "avgGain", void 0), Xt(r, "avgLoss", void 0), Xt(r, "maxValue", 100), r.interval = t,
1470
+ r.avgGain = new n(r.interval), r.avgLoss = new n(r.interval), r;
1471
+ }
1472
+ return Yt(e, t), Kt(e, [ {
1473
+ key: "update",
1474
+ value: function(t) {
1475
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1476
+ if (this.previousPrices.length && e ? this.previousPrices[this.previousPrices.length - 1] = t : this.previousPrices.push(t),
1477
+ !(this.previousPrices.length < 2)) {
1478
+ var r = t, n = this.previousPrices[this.previousPrices.length - 2];
1479
+ if (r > n ? (this.avgLoss.update(0, e), this.avgGain.update(t - n, e)) : (this.avgLoss.update(n - r, e),
1480
+ this.avgGain.update(0, e)), this.avgGain.isStable) {
1481
+ var o = this.avgLoss.getResult();
1482
+ if (0 === o) return this.setResult(100, e);
1483
+ var i = this.avgGain.getResult() / o;
1484
+ return this.setResult(this.maxValue - this.maxValue / (i + 1), e);
1485
+ }
1486
+ }
1487
+ }
1488
+ } ]);
1489
+ }(R);
1490
+ // ./src/utilities/numberUtilities.js
1491
+ function ee(t, e) {
1492
+ return function(t) {
1493
+ if (Array.isArray(t)) return t;
1494
+ }(t) || function(t, e) {
1495
+ var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1496
+ if (null != r) {
1497
+ var n, o, i, a, u = [], l = !0, c = !1;
1498
+ try {
1499
+ if (i = (r = r.call(t)).next, 0 === e) {
1500
+ if (Object(r) !== r) return;
1501
+ l = !1;
1502
+ } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
1503
+ } catch (t) {
1504
+ c = !0, o = t;
1505
+ } finally {
1506
+ try {
1507
+ if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
1508
+ } finally {
1509
+ if (c) throw o;
1510
+ }
1511
+ }
1512
+ return u;
1513
+ }
1514
+ }(t, e) || function(t, e) {
1515
+ if (t) {
1516
+ if ("string" == typeof t) return re(t, e);
1517
+ var r = {}.toString.call(t).slice(8, -1);
1518
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? re(t, e) : void 0;
1519
+ }
1520
+ }(t, e) || function() {
1521
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1522
+ }();
1523
+ }
1524
+ function re(t, e) {
1525
+ (null == e || e > t.length) && (e = t.length);
1526
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1527
+ return n;
1528
+ }
1529
+ var ne = function(t) {
1530
+ var e = 1 / (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .1);
1531
+ return Math.round(t * e) / e;
1532
+ }, oe = function(t) {
1533
+ return t.replace(/(?!^-)[^0-9.]/g, "");
1534
+ };
1535
+ // Helper to clean non-numeric characters (except "-" at the start and decimal point)
1536
+ // ./src/oscillators/rsi.js
1537
+ function ie(t) {
1538
+ return ie = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1539
+ return typeof t;
1540
+ } : function(t) {
1541
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1542
+ }, ie(t);
1543
+ }
1544
+ function ae(t) {
1545
+ return function(t) {
1546
+ if (Array.isArray(t)) return ue(t);
1547
+ }(t) || function(t) {
1548
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1549
+ }(t) || function(t, e) {
1550
+ if (t) {
1551
+ if ("string" == typeof t) return ue(t, e);
1552
+ var r = {}.toString.call(t).slice(8, -1);
1553
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ue(t, e) : void 0;
1554
+ }
1555
+ }(t) || function() {
1556
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1557
+ }();
1558
+ }
1559
+ function ue(t, e) {
1560
+ (null == e || e > t.length) && (e = t.length);
1561
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1562
+ return n;
1563
+ }
1564
+ function le(t, e, r) {
1565
+ return (e = function(t) {
1566
+ var e = function(t, e) {
1567
+ if ("object" != ie(t) || !t) return t;
1568
+ var r = t[Symbol.toPrimitive];
1569
+ if (void 0 !== r) {
1570
+ var n = r.call(t, e || "default");
1571
+ if ("object" != ie(n)) return n;
1572
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1573
+ }
1574
+ return ("string" === e ? String : Number)(t);
1575
+ }(t, "string");
1576
+ return "symbol" == ie(e) ? e : e + "";
1577
+ }(e)) in t ? Object.defineProperty(t, e, {
1578
+ value: r,
1579
+ enumerable: !0,
1580
+ configurable: !0,
1581
+ writable: !0
1582
+ }) : t[e] = r, t;
1583
+ }
1584
+ var ce = function(t, e) {
1585
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .05, n = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
1586
+ // Validate that value and bollingerBands are not null/undefined
1587
+ if (null == t || null == e) return null;
1588
+ var o = t >= 0, i = Math.abs(t), a = e.upper, u = e.lower, l = ne((i - u) / (a - u), r);
1589
+ return n ? o ? Math.min(l, 1) : Math.max(-l, -1) : o ? l : -l;
1590
+ };
1591
+ // ./src/moving-averages/movingAverages.js
1592
+ function se(t) {
1593
+ return se = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1594
+ return typeof t;
1595
+ } : function(t) {
1596
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1597
+ }, se(t);
1598
+ }
1599
+ function fe(t, e) {
1600
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1601
+ if (!r) {
1602
+ if (Array.isArray(t) || (r = ye(t)) || e && t && "number" == typeof t.length) {
1603
+ r && (t = r);
1604
+ var n = 0, o = function() {};
1605
+ return {
1606
+ s: o,
1607
+ n: function() {
1608
+ return n >= t.length ? {
1609
+ done: !0
1610
+ } : {
1611
+ done: !1,
1612
+ value: t[n++]
1613
+ };
1614
+ },
1615
+ e: function(t) {
1616
+ throw t;
1617
+ },
1618
+ f: o
1619
+ };
1620
+ }
1621
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1622
+ }
1623
+ var i, a = !0, u = !1;
1624
+ return {
1625
+ s: function() {
1626
+ r = r.call(t);
1627
+ },
1628
+ n: function() {
1629
+ var t = r.next();
1630
+ return a = t.done, t;
1631
+ },
1632
+ e: function(t) {
1633
+ u = !0, i = t;
1634
+ },
1635
+ f: function() {
1636
+ try {
1637
+ a || null == r.return || r.return();
1638
+ } finally {
1639
+ if (u) throw i;
1640
+ }
1641
+ }
1642
+ };
1643
+ }
1644
+ function he(t) {
1645
+ return function(t) {
1646
+ if (Array.isArray(t)) return pe(t);
1647
+ }(t) || function(t) {
1648
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1649
+ }(t) || ye(t) || function() {
1650
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1651
+ }();
1652
+ }
1653
+ function ye(t, e) {
1654
+ if (t) {
1655
+ if ("string" == typeof t) return pe(t, e);
1656
+ var r = {}.toString.call(t).slice(8, -1);
1657
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? pe(t, e) : void 0;
1658
+ }
1659
+ }
1660
+ function pe(t, e) {
1661
+ (null == e || e > t.length) && (e = t.length);
1662
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1663
+ return n;
1664
+ }
1665
+ var ve = {
1666
+ ema: Dt,
1667
+ sma: nt
1668
+ }, de = function(t, e, r, n) {
1669
+ if (!r || "object" !== se(r)) throw new Error('"options" must be an object in '.concat(t, ". eg: {target, height, range}"));
1670
+ var o = r.target, i = void 0 === o ? "close" : o, a = r.diff, u = void 0 === a ? null : a;
1671
+ if ("string" != typeof i) throw new Error('"target" must be a valid keyName '.concat(t, "."));
1672
+ if ("number" != typeof e || e <= 0) throw new Error('"size" must be a positive number in '.concat(t, "."));
1673
+ //diff can be null, true, false or an object with optional {stdDev, scale, targets, and size}
1674
+ var l = {
1675
+ target: i,
1676
+ diff: null
1677
+ };
1678
+ if (null !== u && ("object" === se(u) || "boolean" == typeof u && !0 === u)) {
1679
+ var c = u = !0 === u ? {} : u, s = c.stdDev, f = void 0 === s ? 2 : s, h = c.scale, y = void 0 === h ? .05 : h, p = c.targets, v = void 0 === p ? [ "close" ] : p, d = c.size, b = void 0 === d ? e : d, m = c.lag, g = void 0 === m ? 0 : m, w = c.autoMinMax, O = void 0 !== w && w;
1680
+ if ("number" != typeof f || f <= 0) throw new Error('"diff.stdDev" must be a number greater than 0 in '.concat(t, "."));
1681
+ if ("number" != typeof y || !n.includes(y)) throw new Error('"diff.scale" must be a number between 0.01 and 1 in '.concat(t, "."));
1682
+ if ("number" != typeof b || !Number.isInteger(b) || b <= 0) throw new Error('"diff.size" must be an integer greater than or equal to size in '.concat(t, "."));
1683
+ if (!Array.isArray(v)) throw new Error('"diff.targest" must be an array of keyNames with at least 1 item in '.concat(t, "."));
1684
+ if ("number" != typeof g || !Number.isInteger(g) || g < 0) throw new Error('"diff.lag" must be an integer greater than 0 in '.concat(t, "."));
1685
+ if ("boolean" != typeof O) throw new Error('"diff.autoMinMax" must be an boolean in '.concat(t, "."));
1686
+ l.diff = {
1687
+ stdDev: f,
1688
+ scale: y,
1689
+ size: b,
1690
+ targets: v,
1691
+ lag: g,
1692
+ autoMinMax: O
1693
+ };
1694
+ }
1695
+ return l;
1696
+ };
1697
+ // ./src/moving-averages/macd.js
1698
+ function be(t) {
1699
+ return be = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1700
+ return typeof t;
1701
+ } : function(t) {
1702
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1703
+ }, be(t);
1704
+ }
1705
+ function me(t, e, r) {
1706
+ return (e = function(t) {
1707
+ var e = function(t, e) {
1708
+ if ("object" != be(t) || !t) return t;
1709
+ var r = t[Symbol.toPrimitive];
1710
+ if (void 0 !== r) {
1711
+ var n = r.call(t, e || "default");
1712
+ if ("object" != be(n)) return n;
1713
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1714
+ }
1715
+ return ("string" === e ? String : Number)(t);
1716
+ }(t, "string");
1717
+ return "symbol" == be(e) ? e : e + "";
1718
+ }(e)) in t ? Object.defineProperty(t, e, {
1719
+ value: r,
1720
+ enumerable: !0,
1721
+ configurable: !0,
1722
+ writable: !0
1723
+ }) : t[e] = r, t;
1724
+ }
1725
+ function ge(t) {
1726
+ return function(t) {
1727
+ if (Array.isArray(t)) return we(t);
1728
+ }(t) || function(t) {
1729
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1730
+ }(t) || function(t, e) {
1731
+ if (t) {
1732
+ if ("string" == typeof t) return we(t, e);
1733
+ var r = {}.toString.call(t).slice(8, -1);
1734
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? we(t, e) : void 0;
1735
+ }
1736
+ }(t) || function() {
1737
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1738
+ }();
1739
+ }
1740
+ function we(t, e) {
1741
+ (null == e || e > t.length) && (e = t.length);
1742
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1743
+ return n;
1744
+ }
1745
+ var Oe = "close";
1746
+ // ./src/moving-averages/relativeVolume.js
1747
+ function Se(t) {
1748
+ return function(t) {
1749
+ if (Array.isArray(t)) return _e(t);
1750
+ }(t) || function(t) {
1751
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1752
+ }(t) || function(t, e) {
1753
+ if (t) {
1754
+ if ("string" == typeof t) return _e(t, e);
1755
+ var r = {}.toString.call(t).slice(8, -1);
1756
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _e(t, e) : void 0;
1757
+ }
1758
+ }(t) || function() {
1759
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1760
+ }();
1761
+ }
1762
+ function _e(t, e) {
1763
+ (null == e || e > t.length) && (e = t.length);
1764
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1765
+ return n;
1766
+ }
1767
+ // ./src/moving-averages/donchianChannel.js
1768
+ function je(t) {
1769
+ return je = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1770
+ return typeof t;
1771
+ } : function(t) {
1772
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1773
+ }, je(t);
1774
+ }
1775
+ function Pe(t, e) {
1776
+ var r = Object.keys(t);
1777
+ if (Object.getOwnPropertySymbols) {
1778
+ var n = Object.getOwnPropertySymbols(t);
1779
+ e && (n = n.filter((function(e) {
1780
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
1781
+ }))), r.push.apply(r, n);
1782
+ }
1783
+ return r;
1784
+ }
1785
+ function Ae(t, e, r) {
1786
+ return (e = function(t) {
1787
+ var e = function(t, e) {
1788
+ if ("object" != je(t) || !t) return t;
1789
+ var r = t[Symbol.toPrimitive];
1790
+ if (void 0 !== r) {
1791
+ var n = r.call(t, e || "default");
1792
+ if ("object" != je(n)) return n;
1793
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1794
+ }
1795
+ return ("string" === e ? String : Number)(t);
1796
+ }(t, "string");
1797
+ return "symbol" == je(e) ? e : e + "";
1798
+ }(e)) in t ? Object.defineProperty(t, e, {
1799
+ value: r,
1800
+ enumerable: !0,
1801
+ configurable: !0,
1802
+ writable: !0
1803
+ }) : t[e] = r, t;
1804
+ }
1805
+ function Ee(t) {
1806
+ return function(t) {
1807
+ if (Array.isArray(t)) return ke(t);
1808
+ }(t) || function(t) {
1809
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1810
+ }(t) || xe(t) || function() {
1811
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1812
+ }();
1813
+ }
1814
+ function Me(t, e) {
1815
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1816
+ if (!r) {
1817
+ if (Array.isArray(t) || (r = xe(t)) || e && t && "number" == typeof t.length) {
1818
+ r && (t = r);
1819
+ var n = 0, o = function() {};
1820
+ return {
1821
+ s: o,
1822
+ n: function() {
1823
+ return n >= t.length ? {
1824
+ done: !0
1825
+ } : {
1826
+ done: !1,
1827
+ value: t[n++]
1828
+ };
1829
+ },
1830
+ e: function(t) {
1831
+ throw t;
1832
+ },
1833
+ f: o
1834
+ };
1835
+ }
1836
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1837
+ }
1838
+ var i, a = !0, u = !1;
1839
+ return {
1840
+ s: function() {
1841
+ r = r.call(t);
1842
+ },
1843
+ n: function() {
1844
+ var t = r.next();
1845
+ return a = t.done, t;
1846
+ },
1847
+ e: function(t) {
1848
+ u = !0, i = t;
1849
+ },
1850
+ f: function() {
1851
+ try {
1852
+ a || null == r.return || r.return();
1853
+ } finally {
1854
+ if (u) throw i;
1855
+ }
1856
+ }
1857
+ };
1858
+ }
1859
+ function xe(t, e) {
1860
+ if (t) {
1861
+ if ("string" == typeof t) return ke(t, e);
1862
+ var r = {}.toString.call(t).slice(8, -1);
1863
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ke(t, e) : void 0;
1864
+ }
1865
+ }
1866
+ function ke(t, e) {
1867
+ (null == e || e > t.length) && (e = t.length);
1868
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1869
+ return n;
1870
+ }
1871
+ // ./src/moving-averages/bollingerBands.js
1872
+ function Te(t) {
1873
+ return Te = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1874
+ return typeof t;
1875
+ } : function(t) {
1876
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1877
+ }, Te(t);
1878
+ }
1879
+ function Ie(t, e) {
1880
+ var r = Object.keys(t);
1881
+ if (Object.getOwnPropertySymbols) {
1882
+ var n = Object.getOwnPropertySymbols(t);
1883
+ e && (n = n.filter((function(e) {
1884
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
1885
+ }))), r.push.apply(r, n);
1886
+ }
1887
+ return r;
1888
+ }
1889
+ function Re(t, e, r) {
1890
+ return (e = function(t) {
1891
+ var e = function(t, e) {
1892
+ if ("object" != Te(t) || !t) return t;
1893
+ var r = t[Symbol.toPrimitive];
1894
+ if (void 0 !== r) {
1895
+ var n = r.call(t, e || "default");
1896
+ if ("object" != Te(n)) return n;
1897
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1898
+ }
1899
+ return ("string" === e ? String : Number)(t);
1900
+ }(t, "string");
1901
+ return "symbol" == Te(e) ? e : e + "";
1902
+ }(e)) in t ? Object.defineProperty(t, e, {
1903
+ value: r,
1904
+ enumerable: !0,
1905
+ configurable: !0,
1906
+ writable: !0
1907
+ }) : t[e] = r, t;
1908
+ }
1909
+ function Ce(t) {
1910
+ return function(t) {
1911
+ if (Array.isArray(t)) return Be(t);
1912
+ }(t) || function(t) {
1913
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1914
+ }(t) || Ve(t) || function() {
1915
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1916
+ }();
1917
+ }
1918
+ function De(t, e) {
1919
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1920
+ if (!r) {
1921
+ if (Array.isArray(t) || (r = Ve(t)) || e && t && "number" == typeof t.length) {
1922
+ r && (t = r);
1923
+ var n = 0, o = function() {};
1924
+ return {
1925
+ s: o,
1926
+ n: function() {
1927
+ return n >= t.length ? {
1928
+ done: !0
1929
+ } : {
1930
+ done: !1,
1931
+ value: t[n++]
1932
+ };
1933
+ },
1934
+ e: function(t) {
1935
+ throw t;
1936
+ },
1937
+ f: o
1938
+ };
1939
+ }
1940
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1941
+ }
1942
+ var i, a = !0, u = !1;
1943
+ return {
1944
+ s: function() {
1945
+ r = r.call(t);
1946
+ },
1947
+ n: function() {
1948
+ var t = r.next();
1949
+ return a = t.done, t;
1950
+ },
1951
+ e: function(t) {
1952
+ u = !0, i = t;
1953
+ },
1954
+ f: function() {
1955
+ try {
1956
+ a || null == r.return || r.return();
1957
+ } finally {
1958
+ if (u) throw i;
1959
+ }
1960
+ }
1961
+ };
1962
+ }
1963
+ function Ve(t, e) {
1964
+ if (t) {
1965
+ if ("string" == typeof t) return Be(t, e);
1966
+ var r = {}.toString.call(t).slice(8, -1);
1967
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Be(t, e) : void 0;
1968
+ }
1969
+ }
1970
+ function Be(t, e) {
1971
+ (null == e || e > t.length) && (e = t.length);
1972
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1973
+ return n;
1974
+ }
1975
+ // ./src/oscillators/volumeOscillator.js
1976
+ function Ne(t) {
1977
+ return function(t) {
1978
+ if (Array.isArray(t)) return Le(t);
1979
+ }(t) || function(t) {
1980
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1981
+ }(t) || function(t, e) {
1982
+ if (t) {
1983
+ if ("string" == typeof t) return Le(t, e);
1984
+ var r = {}.toString.call(t).slice(8, -1);
1985
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Le(t, e) : void 0;
1986
+ }
1987
+ }(t) || function() {
1988
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1989
+ }();
1990
+ }
1991
+ function Le(t, e) {
1992
+ (null == e || e > t.length) && (e = t.length);
1993
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1994
+ return n;
1995
+ }
1996
+ // ./src/studies/candleVectors.js
1997
+ function He(t) {
1998
+ return He = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1999
+ return typeof t;
2000
+ } : function(t) {
2001
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2002
+ }, He(t);
2003
+ }
2004
+ function Ue(t, e) {
2005
+ var r = Object.keys(t);
2006
+ if (Object.getOwnPropertySymbols) {
2007
+ var n = Object.getOwnPropertySymbols(t);
2008
+ e && (n = n.filter((function(e) {
2009
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
2010
+ }))), r.push.apply(r, n);
2011
+ }
2012
+ return r;
2013
+ }
2014
+ function ze(t) {
2015
+ for (var e = 1; e < arguments.length; e++) {
2016
+ var r = null != arguments[e] ? arguments[e] : {};
2017
+ e % 2 ? Ue(Object(r), !0).forEach((function(e) {
2018
+ qe(t, e, r[e]);
2019
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ue(Object(r)).forEach((function(e) {
2020
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
2021
+ }));
2022
+ }
2023
+ return t;
2024
+ }
2025
+ function qe(t, e, r) {
2026
+ return (e = function(t) {
2027
+ var e = function(t, e) {
2028
+ if ("object" != He(t) || !t) return t;
2029
+ var r = t[Symbol.toPrimitive];
2030
+ if (void 0 !== r) {
2031
+ var n = r.call(t, e || "default");
2032
+ if ("object" != He(n)) return n;
2033
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2034
+ }
2035
+ return ("string" === e ? String : Number)(t);
2036
+ }(t, "string");
2037
+ return "symbol" == He(e) ? e : e + "";
2038
+ }(e)) in t ? Object.defineProperty(t, e, {
2039
+ value: r,
2040
+ enumerable: !0,
2041
+ configurable: !0,
2042
+ writable: !0
2043
+ }) : t[e] = r, t;
2044
+ }
2045
+ function $e(t) {
2046
+ return function(t) {
2047
+ if (Array.isArray(t)) return Je(t);
2048
+ }(t) || function(t) {
2049
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2050
+ }(t) || Ge(t) || function() {
2051
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2052
+ }();
2053
+ }
2054
+ function Fe(t, e) {
2055
+ return function(t) {
2056
+ if (Array.isArray(t)) return t;
2057
+ }(t) || function(t, e) {
2058
+ var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2059
+ if (null != r) {
2060
+ var n, o, i, a, u = [], l = !0, c = !1;
2061
+ try {
2062
+ if (i = (r = r.call(t)).next, 0 === e) {
2063
+ if (Object(r) !== r) return;
2064
+ l = !1;
2065
+ } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2066
+ } catch (t) {
2067
+ c = !0, o = t;
2068
+ } finally {
2069
+ try {
2070
+ if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2071
+ } finally {
2072
+ if (c) throw o;
2073
+ }
2074
+ }
2075
+ return u;
2076
+ }
2077
+ }(t, e) || Ge(t, e) || function() {
2078
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2079
+ }();
2080
+ }
2081
+ function Ke(t, e) {
2082
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2083
+ if (!r) {
2084
+ if (Array.isArray(t) || (r = Ge(t)) || e && t && "number" == typeof t.length) {
2085
+ r && (t = r);
2086
+ var n = 0, o = function() {};
2087
+ return {
2088
+ s: o,
2089
+ n: function() {
2090
+ return n >= t.length ? {
2091
+ done: !0
2092
+ } : {
2093
+ done: !1,
2094
+ value: t[n++]
2095
+ };
2096
+ },
2097
+ e: function(t) {
2098
+ throw t;
2099
+ },
2100
+ f: o
2101
+ };
2102
+ }
2103
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2104
+ }
2105
+ var i, a = !0, u = !1;
2106
+ return {
2107
+ s: function() {
2108
+ r = r.call(t);
2109
+ },
2110
+ n: function() {
2111
+ var t = r.next();
2112
+ return a = t.done, t;
2113
+ },
2114
+ e: function(t) {
2115
+ u = !0, i = t;
2116
+ },
2117
+ f: function() {
2118
+ try {
2119
+ a || null == r.return || r.return();
2120
+ } finally {
2121
+ if (u) throw i;
2122
+ }
2123
+ }
2124
+ };
2125
+ }
2126
+ function Ge(t, e) {
2127
+ if (t) {
2128
+ if ("string" == typeof t) return Je(t, e);
2129
+ var r = {}.toString.call(t).slice(8, -1);
2130
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Je(t, e) : void 0;
2131
+ }
2132
+ }
2133
+ function Je(t, e) {
2134
+ (null == e || e > t.length) && (e = t.length);
2135
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2136
+ return n;
2137
+ }
2138
+ var We = function(t, e) {
2139
+ return (t - e) / e;
2140
+ };
2141
+ // crear una nueva instancia con la altura porcentual utilizando Bollinger Bands con una desviación estándar de 1.5
2142
+ // Las diferencias estarán basadas en (objetivo - lower) / (upper - lower). Esto arrojará un valor entre -1 y 1
2143
+ // ./src/studies/lag.js
2144
+ function Ye(t) {
2145
+ return function(t) {
2146
+ if (Array.isArray(t)) return tr(t);
2147
+ }(t) || function(t) {
2148
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2149
+ }(t) || Ze(t) || function() {
2150
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2151
+ }();
2152
+ }
2153
+ function Qe(t, e) {
2154
+ return function(t) {
2155
+ if (Array.isArray(t)) return t;
2156
+ }(t) || function(t, e) {
2157
+ var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2158
+ if (null != r) {
2159
+ var n, o, i, a, u = [], l = !0, c = !1;
2160
+ try {
2161
+ if (i = (r = r.call(t)).next, 0 === e) {
2162
+ if (Object(r) !== r) return;
2163
+ l = !1;
2164
+ } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2165
+ } catch (t) {
2166
+ c = !0, o = t;
2167
+ } finally {
2168
+ try {
2169
+ if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2170
+ } finally {
2171
+ if (c) throw o;
2172
+ }
2173
+ }
2174
+ return u;
2175
+ }
2176
+ }(t, e) || Ze(t, e) || function() {
2177
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2178
+ }();
2179
+ }
2180
+ function Xe(t, e) {
2181
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2182
+ if (!r) {
2183
+ if (Array.isArray(t) || (r = Ze(t)) || e && t && "number" == typeof t.length) {
2184
+ r && (t = r);
2185
+ var n = 0, o = function() {};
2186
+ return {
2187
+ s: o,
2188
+ n: function() {
2189
+ return n >= t.length ? {
2190
+ done: !0
2191
+ } : {
2192
+ done: !1,
2193
+ value: t[n++]
2194
+ };
2195
+ },
2196
+ e: function(t) {
2197
+ throw t;
2198
+ },
2199
+ f: o
2200
+ };
2201
+ }
2202
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2203
+ }
2204
+ var i, a = !0, u = !1;
2205
+ return {
2206
+ s: function() {
2207
+ r = r.call(t);
2208
+ },
2209
+ n: function() {
2210
+ var t = r.next();
2211
+ return a = t.done, t;
2212
+ },
2213
+ e: function(t) {
2214
+ u = !0, i = t;
2215
+ },
2216
+ f: function() {
2217
+ try {
2218
+ a || null == r.return || r.return();
2219
+ } finally {
2220
+ if (u) throw i;
2221
+ }
2222
+ }
2223
+ };
2224
+ }
2225
+ function Ze(t, e) {
2226
+ if (t) {
2227
+ if ("string" == typeof t) return tr(t, e);
2228
+ var r = {}.toString.call(t).slice(8, -1);
2229
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? tr(t, e) : void 0;
2230
+ }
2231
+ }
2232
+ function tr(t, e) {
2233
+ (null == e || e > t.length) && (e = t.length);
2234
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2235
+ return n;
2236
+ }
2237
+ function er(t) {
2238
+ return er = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2239
+ return typeof t;
2240
+ } : function(t) {
2241
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2242
+ }, er(t);
2243
+ }
2244
+ var rr = function(t, e) {
2245
+ var r = t.instances, n = t.verticalOhlcv, o = t.nullArray;
2246
+ if (0 === e) {
2247
+ var i = t.inputParams, a = t.priceBased, u = i.filter((function(t) {
2248
+ return "lag" === t.key;
2249
+ }));
2250
+ if ("object" !== er(u)) return;
2251
+ var l, c = u.map((function(t) {
2252
+ return t.params;
2253
+ })), s = Xe(c);
2254
+ try {
2255
+ for (s.s(); !(l = s.n()).done; ) {
2256
+ var f, h = Qe(l.value, 2), y = h[0], p = h[1], v = Xe(y);
2257
+ try {
2258
+ for (v.s(); !(f = v.n()).done; ) {
2259
+ var d = f.value;
2260
+ if (a.includes(d)) for (var b = 1; b <= p; b++) a.push("".concat(d, "_lag_").concat(b));
2261
+ }
2262
+ } catch (t) {
2263
+ v.e(t);
2264
+ } finally {
2265
+ v.f();
2266
+ }
2267
+ }
2268
+ } catch (t) {
2269
+ s.e(t);
2270
+ } finally {
2271
+ s.f();
2272
+ }
2273
+ r.lag = {
2274
+ lagParams: c
2275
+ };
2276
+ }
2277
+ var m, g = Xe(r.lag.lagParams);
2278
+ try {
2279
+ for (g.s(); !(m = g.n()).done; ) {
2280
+ var w, O = Qe(m.value, 2), S = O[0], _ = O[1], j = Xe(S);
2281
+ try {
2282
+ for (j.s(); !(w = j.n()).done; ) {
2283
+ var P = w.value, A = n[P];
2284
+ // Initialize lagged arrays only on the first index
2285
+ if (0 === e) for (var E = 1; E <= _; E++) {
2286
+ n["".concat(P, "_lag_").concat(E)] = Ye(o);
2287
+ }
2288
+ // Populate lagged values
2289
+ for (var M = 1; M <= _; M++) {
2290
+ var x = "".concat(P, "_lag_").concat(M), k = e - M, T = k <= 0 || void 0 === A[k] ? null : A[k];
2291
+ t.pushToMain({
2292
+ index: e,
2293
+ key: x,
2294
+ value: T
2295
+ });
2296
+ }
2297
+ }
2298
+ } catch (t) {
2299
+ j.e(t);
2300
+ } finally {
2301
+ j.f();
2302
+ }
2303
+ }
2304
+ } catch (t) {
2305
+ g.e(t);
2306
+ } finally {
2307
+ g.f();
2308
+ }
2309
+ return !0;
2310
+ };
2311
+ // ./src/studies/findCrosses.js
2312
+ function nr(t) {
2313
+ return function(t) {
2314
+ if (Array.isArray(t)) return ir(t);
2315
+ }(t) || function(t) {
2316
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2317
+ }(t) || or(t) || function() {
2318
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2319
+ }();
2320
+ }
2321
+ function or(t, e) {
2322
+ if (t) {
2323
+ if ("string" == typeof t) return ir(t, e);
2324
+ var r = {}.toString.call(t).slice(8, -1);
2325
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ir(t, e) : void 0;
2326
+ }
2327
+ }
2328
+ function ir(t, e) {
2329
+ (null == e || e > t.length) && (e = t.length);
2330
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2331
+ return n;
2332
+ }
2333
+ function ar(t) {
2334
+ return ar = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2335
+ return typeof t;
2336
+ } : function(t) {
2337
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2338
+ }, ar(t);
2339
+ }
2340
+ function ur(t, e) {
2341
+ for (var r = 0; r < e.length; r++) {
2342
+ var n = e[r];
2343
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
2344
+ Object.defineProperty(t, lr(n.key), n);
2345
+ }
2346
+ }
2347
+ function lr(t) {
2348
+ var e = function(t, e) {
2349
+ if ("object" != ar(t) || !t) return t;
2350
+ var r = t[Symbol.toPrimitive];
2351
+ if (void 0 !== r) {
2352
+ var n = r.call(t, e || "default");
2353
+ if ("object" != ar(n)) return n;
2354
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2355
+ }
2356
+ return ("string" === e ? String : Number)(t);
2357
+ }(t, "string");
2358
+ return "symbol" == ar(e) ? e : e + "";
2359
+ }
2360
+ var cr = function(t, e) {
2361
+ return t > e;
2362
+ }, sr = function(t, e) {
2363
+ return t < e;
2364
+ }, fr = function() {
2365
+ return t = function t() {
2366
+ !function(t, e) {
2367
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
2368
+ }(this, t), Object.assign(this, {
2369
+ interval: 0,
2370
+ prevState: .5,
2371
+ prevFast: null,
2372
+ prevSlow: null,
2373
+ prevHigh: null,
2374
+ prevLow: null,
2375
+ areHighAndLowUndefined: !1,
2376
+ index: 0,
2377
+ crossIndexes: {
2378
+ up: [],
2379
+ down: []
2380
+ }
2381
+ });
2382
+ }, (e = [ {
2383
+ key: "update",
2384
+ value: function(t) {
2385
+ var e = t.fast, r = t.high, n = t.slow, o = t.low, i = this.prevState;
2386
+ this.areHighAndLowUndefined || void 0 !== r && void 0 !== o || (this.areHighAndLowUndefined = !0),
2387
+ null === e || null === n || function(t, e) {
2388
+ return t === e;
2389
+ }(e, n) ? i = .5 : cr(e, n) ? i = this.areHighAndLowUndefined ? 1 : [ o, n, this.prevLow, this.prevSlow ].every((function(t) {
2390
+ return null !== t;
2391
+ })) && sr(o, n) && cr(this.prevLow, this.prevSlow) ? 0 : 1 : sr(e, n) && (i = this.areHighAndLowUndefined ? 0 : [ r, n, this.prevHigh, this.prevSlow ].every((function(t) {
2392
+ return null !== t;
2393
+ })) && cr(r, n) && sr(this.prevHigh, this.prevSlow) ? 1 : 0), .5 === i ? this.interval = 0 : 1 === i ? this.prevState <= .5 ? this.interval = 1 : this.interval++ : 0 === i && (this.prevState >= .5 ? this.interval = -1 : this.interval--),
2394
+ 1 === this.interval && this.crossIndexes.up.push(this.index), -1 === this.interval && this.crossIndexes.down.push(this.index),
2395
+ //save prev state
2396
+ Object.assign(this, {
2397
+ index: this.index + 1,
2398
+ prevState: i,
2399
+ prevFast: e,
2400
+ prevSlow: n,
2401
+ prevHigh: r,
2402
+ prevLow: o
2403
+ });
2404
+ }
2405
+ }, {
2406
+ key: "getResult",
2407
+ value: function() {
2408
+ return this.interval;
2409
+ }
2410
+ } ]) && ur(t.prototype, e), r && ur(t, r), Object.defineProperty(t, "prototype", {
2411
+ writable: !1
2412
+ }), t;
2413
+ var t, e, r;
2414
+ }(), hr = function(t, e) {
2415
+ var r = t.nullArray, n = t.verticalOhlcv, o = t.instances, i = t.len;
2416
+ if (0 === e) {
2417
+ var a = t.inputParams.filter((function(t) {
2418
+ return "crossPairs" === t.key;
2419
+ }));
2420
+ if ("object" !== ar(a)) return;
2421
+ o.crossPairs = {
2422
+ crossPairsList: a.flatMap((function(t) {
2423
+ return t.params.flat();
2424
+ }))
2425
+ };
2426
+ }
2427
+ var u, l = function(t, e) {
2428
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2429
+ if (!r) {
2430
+ if (Array.isArray(t) || (r = or(t)) || e && t && "number" == typeof t.length) {
2431
+ r && (t = r);
2432
+ var n = 0, o = function() {};
2433
+ return {
2434
+ s: o,
2435
+ n: function() {
2436
+ return n >= t.length ? {
2437
+ done: !0
2438
+ } : {
2439
+ done: !1,
2440
+ value: t[n++]
2441
+ };
2442
+ },
2443
+ e: function(t) {
2444
+ throw t;
2445
+ },
2446
+ f: o
2447
+ };
2448
+ }
2449
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2450
+ }
2451
+ var i, a = !0, u = !1;
2452
+ return {
2453
+ s: function() {
2454
+ r = r.call(t);
2455
+ },
2456
+ n: function() {
2457
+ var t = r.next();
2458
+ return a = t.done, t;
2459
+ },
2460
+ e: function(t) {
2461
+ u = !0, i = t;
2462
+ },
2463
+ f: function() {
2464
+ try {
2465
+ a || null == r.return || r.return();
2466
+ } finally {
2467
+ if (u) throw i;
2468
+ }
2469
+ }
2470
+ };
2471
+ }(o.crossPairs.crossPairsList);
2472
+ try {
2473
+ for (l.s(); !(u = l.n()).done; ) {
2474
+ var c = u.value, s = c.fast, f = c.slow;
2475
+ if (null != s && null != f) {
2476
+ var h = "".concat(s, "_x_").concat(f);
2477
+ if (0 === e) {
2478
+ if ("number" == typeof f && (n[f] = new Array(i).fill(f)), "price" !== s && !n.hasOwnProperty(s)) throw Error('fast "'.concat(s, ' not found in crossPairs"'));
2479
+ if (!n.hasOwnProperty(f)) throw Error('slow "'.concat(f, ' not found in crossPairs"'));
2480
+ o[h] = new fr, n[h] = nr(r);
2481
+ }
2482
+ var y = void 0, p = void 0, v = void 0, d = void 0, b = void 0;
2483
+ "price" === s ? (p = n.close[e], v = n.high[e], d = n.low[e], b = n[f][e], o[h].update({
2484
+ fast: p,
2485
+ slow: b,
2486
+ high: v,
2487
+ low: d
2488
+ })) : (y = n[s][e], b = n[f][e], o[h].update({
2489
+ fast: y,
2490
+ slow: b
2491
+ })), t.pushToMain({
2492
+ index: e,
2493
+ key: h,
2494
+ value: o[h].getResult()
2495
+ });
2496
+ }
2497
+ }
2498
+ } catch (t) {
2499
+ l.e(t);
2500
+ } finally {
2501
+ l.f();
2502
+ }
2503
+ };
2504
+ // ./src/studies/dateTime.js
2505
+ function yr(t) {
2506
+ return function(t) {
2507
+ if (Array.isArray(t)) return pr(t);
2508
+ }(t) || function(t) {
2509
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2510
+ }(t) || function(t, e) {
2511
+ if (t) {
2512
+ if ("string" == typeof t) return pr(t, e);
2513
+ var r = {}.toString.call(t).slice(8, -1);
2514
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? pr(t, e) : void 0;
2515
+ }
2516
+ }(t) || function() {
2517
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2518
+ }();
2519
+ }
2520
+ function pr(t, e) {
2521
+ (null == e || e > t.length) && (e = t.length);
2522
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2523
+ return n;
2524
+ }
2525
+ var vr = function(t) {
2526
+ var e = new Date(t), r = e.getMonth(), n = e.getFullYear(), o = e.getHours(), i = e.getMinutes(), a = e.getDay(), u = e.getDate(), l = new Date(e.getFullYear(), e.getMonth(), 1).getDay();
2527
+ return {
2528
+ month: r,
2529
+ year: n,
2530
+ hour: o,
2531
+ minute: i,
2532
+ day_of_the_week: a,
2533
+ day_of_the_month: u,
2534
+ week_of_the_month: Math.ceil((u + l) / 7)
2535
+ };
2536
+ };
2537
+ // ./src/studies/priceVariations.js
2538
+ function dr(t) {
2539
+ return function(t) {
2540
+ if (Array.isArray(t)) return br(t);
2541
+ }(t) || function(t) {
2542
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2543
+ }(t) || function(t, e) {
2544
+ if (t) {
2545
+ if ("string" == typeof t) return br(t, e);
2546
+ var r = {}.toString.call(t).slice(8, -1);
2547
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? br(t, e) : void 0;
2548
+ }
2549
+ }(t) || function() {
2550
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2551
+ }();
2552
+ }
2553
+ function br(t, e) {
2554
+ (null == e || e > t.length) && (e = t.length);
2555
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2556
+ return n;
2557
+ }
2558
+ var mr = [ "open", "high", "low", "close" ];
2559
+ function gr(t, e) {
2560
+ var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2561
+ if (!r) {
2562
+ if (Array.isArray(t) || (r = _r(t)) || e && t && "number" == typeof t.length) {
2563
+ r && (t = r);
2564
+ var n = 0, o = function() {};
2565
+ return {
2566
+ s: o,
2567
+ n: function() {
2568
+ return n >= t.length ? {
2569
+ done: !0
2570
+ } : {
2571
+ done: !1,
2572
+ value: t[n++]
2573
+ };
2574
+ },
2575
+ e: function(t) {
2576
+ throw t;
2577
+ },
2578
+ f: o
2579
+ };
2580
+ }
2581
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2582
+ }
2583
+ var i, a = !0, u = !1;
2584
+ return {
2585
+ s: function() {
2586
+ r = r.call(t);
2587
+ },
2588
+ n: function() {
2589
+ var t = r.next();
2590
+ return a = t.done, t;
2591
+ },
2592
+ e: function(t) {
2593
+ u = !0, i = t;
2594
+ },
2595
+ f: function() {
2596
+ try {
2597
+ a || null == r.return || r.return();
2598
+ } finally {
2599
+ if (u) throw i;
2600
+ }
2601
+ }
2602
+ };
2603
+ }
2604
+ function wr(t, e) {
2605
+ if (null == t) return {};
2606
+ var r, n, o = function(t, e) {
2607
+ if (null == t) return {};
2608
+ var r = {};
2609
+ for (var n in t) if ({}.hasOwnProperty.call(t, n)) {
2610
+ if (e.includes(n)) continue;
2611
+ r[n] = t[n];
2612
+ }
2613
+ return r;
2614
+ }(t, e);
2615
+ if (Object.getOwnPropertySymbols) {
2616
+ var i = Object.getOwnPropertySymbols(t);
2617
+ for (n = 0; n < i.length; n++) r = i[n], e.includes(r) || {}.propertyIsEnumerable.call(t, r) && (o[r] = t[r]);
2618
+ }
2619
+ return o;
2620
+ }
2621
+ function Or(t) {
2622
+ return function(t) {
2623
+ if (Array.isArray(t)) return jr(t);
2624
+ }(t) || function(t) {
2625
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2626
+ }(t) || _r(t) || function() {
2627
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2628
+ }();
2629
+ }
2630
+ function Sr(t, e) {
2631
+ return function(t) {
2632
+ if (Array.isArray(t)) return t;
2633
+ }
2634
+ // Map indicator keys to their respective functions
2635
+ (t) || function(t, e) {
2636
+ var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2637
+ if (null != r) {
2638
+ var n, o, i, a, u = [], l = !0, c = !1;
2639
+ try {
2640
+ if (i = (r = r.call(t)).next, 0 === e) {
2641
+ if (Object(r) !== r) return;
2642
+ l = !1;
2643
+ } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2644
+ } catch (t) {
2645
+ c = !0, o = t;
2646
+ } finally {
2647
+ try {
2648
+ if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2649
+ } finally {
2650
+ if (c) throw o;
2651
+ }
2652
+ }
2653
+ return u;
2654
+ }
2655
+ }(t, e) || _r(t, e) || function() {
2656
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2657
+ }();
2658
+ }
2659
+ function _r(t, e) {
2660
+ if (t) {
2661
+ if ("string" == typeof t) return jr(t, e);
2662
+ var r = {}.toString.call(t).slice(8, -1);
2663
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? jr(t, e) : void 0;
2664
+ }
2665
+ }
2666
+ function jr(t, e) {
2667
+ (null == e || e > t.length) && (e = t.length);
2668
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2669
+ return n;
2670
+ }
2671
+ var Pr = {
2672
+ dateTime: function(t, e) {
2673
+ var r = t.instances, n = t.verticalOhlcv;
2674
+ if (0 === e) {
2675
+ var o = t.nullArray;
2676
+ if (!t.isValidDate) throw Error('dateTime method found and invalid "date" in input ohlcv');
2677
+ var i = n.date[0].slice(0, 10);
2678
+ Object.assign(r, {
2679
+ dateTime: {
2680
+ prevDateStr: i,
2681
+ sessionDailyIndexCount: 0,
2682
+ sessionIntradayIndexCount: 0,
2683
+ cachedDayInfo: i
2684
+ }
2685
+ }), Object.assign(n, {
2686
+ day_of_the_week: yr(o),
2687
+ day_of_the_month: yr(o),
2688
+ week_of_the_month: yr(o),
2689
+ hour: yr(o),
2690
+ month: yr(o),
2691
+ year: yr(o),
2692
+ session_daily_index: yr(o),
2693
+ session_intraday_index: yr(o)
2694
+ });
2695
+ }
2696
+ var a = n.date[e], u = vr(a), l = u.day_of_the_week, c = u.day_of_the_month, s = u.week_of_the_month, f = u.month, h = u.year, y = u.hour, p = a.slice(0, 10);
2697
+ p !== r.dateTime.prevDateStr && (r.dateTime.prevDateStr = p, r.dateTime.sessionDailyIndexCount++,
2698
+ r.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
2699
+ index: e,
2700
+ key: "session_daily_index",
2701
+ value: r.dateTime.sessionDailyIndexCount
2702
+ }), t.pushToMain({
2703
+ index: e,
2704
+ key: "session_intraday_index",
2705
+ value: r.dateTime.sessionIntradayIndexCount
2706
+ }), t.pushToMain({
2707
+ index: e,
2708
+ key: "day_of_the_week",
2709
+ value: l
2710
+ }), t.pushToMain({
2711
+ index: e,
2712
+ key: "day_of_the_month",
2713
+ value: c
2714
+ }), t.pushToMain({
2715
+ index: e,
2716
+ key: "week_of_the_month",
2717
+ value: s
2718
+ }), t.pushToMain({
2719
+ index: e,
2720
+ key: "month",
2721
+ value: f
2722
+ }), t.pushToMain({
2723
+ index: e,
2724
+ key: "year",
2725
+ value: h
2726
+ }), t.pushToMain({
2727
+ index: e,
2728
+ key: "hour",
2729
+ value: y
2730
+ }), r.dateTime.sessionIntradayIndexCount++;
2731
+ },
2732
+ priceVariations: function(t, e) {
2733
+ 0 === e && (t.priceBased = dr(new Set([].concat(dr(t.priceBased), [ "mid_price_open_close", "mid_price_high_low" ]))),
2734
+ Object.assign(t.verticalOhlcv, {
2735
+ mid_price_open_close: dr(t.nullArray),
2736
+ mid_price_high_low: dr(t.nullArray)
2737
+ }));
2738
+ var r = t.verticalOhlcv.open[e], n = t.verticalOhlcv.high[e], o = t.verticalOhlcv.low[e], i = t.verticalOhlcv.close[e];
2739
+ t.pushToMain({
2740
+ index: e,
2741
+ key: "mid_price_open_close",
2742
+ value: (r + i) / 2
2743
+ }), t.pushToMain({
2744
+ index: e,
2745
+ key: "mid_price_high_low",
2746
+ value: (n + o) / 2
2747
+ });
2748
+ },
2749
+ rsi: function(t, e, r, n) {
2750
+ var o = n.scale, i = n.target, a = n.lag, u = n.autoMinMax, l = t.verticalOhlcv, c = t.instances, s = t.lastIndexReplace, f = "close" === i ? "" : "_".concat(i), h = "rsi_".concat(r).concat(f), y = "rsi_sma_".concat(r).concat(f);
2751
+ // Initialization on the first index.
2752
+ if (0 === e) {
2753
+ var p = t.crossPairsList, v = t.nullArray;
2754
+ if (!l.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for rsi."));
2755
+ p.push({
2756
+ fast: h,
2757
+ slow: y,
2758
+ isDefault: !0
2759
+ }), Object.assign(c, le(le({}, h, new te(r)), y, new nt(r))), Object.assign(l, le(le({}, h, ae(v)), y, ae(v))),
2760
+ a > 0 && t.lag([ h, y ], a), u && t.autoMinMaxKeys.push(h, y);
2761
+ }
2762
+ var d = l[i][e], b = null, m = null;
2763
+ // Update the RSI indicator.
2764
+ c[h].update(d, s);
2765
+ try {
2766
+ b = c[h].getResult();
2767
+ } catch (t) {
2768
+ b = null;
2769
+ }
2770
+ null !== b && "number" == typeof b && o && (b = ne(b, o)),
2771
+ // Always push the RSI value, using null as a fallback.
2772
+ t.pushToMain({
2773
+ index: e,
2774
+ key: h,
2775
+ value: b
2776
+ }),
2777
+ // Update the SMA indicator only if a valid RSI value is available.
2778
+ null !== b && "number" == typeof b && c[y].update(b, s);
2779
+ try {
2780
+ m = c[y].getResult();
2781
+ } catch (t) {
2782
+ m = null;
2783
+ }
2784
+ null !== m && "number" == typeof m && o && (m = ne(m, o)),
2785
+ // Always push the smoothed RSI value.
2786
+ t.pushToMain({
2787
+ index: e,
2788
+ key: y,
2789
+ value: m
2790
+ });
2791
+ },
2792
+ movingAverages: function(t, e, r, n, o) {
2793
+ var i = o.target, a = o.diff, u = (o.autoMinMax, t.verticalOhlcv), l = t.instances, c = t.priceBased, s = t.lastIndexReplace, f = "string" == typeof i && u.hasOwnProperty(i) && "close" !== i ? "_".concat(i) : "", h = "".concat(r, "_").concat(n).concat(f), y = "".concat(r, "_").concat(n, "_diff").concat(f);
2794
+ if (0 === e) {
2795
+ var p = t.nullArray;
2796
+ if (!u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
2797
+ // Create the main moving average instance.
2798
+ // If diff configuration is provided, create the diff indicator.
2799
+ if (l[h] = {
2800
+ maInstance: new ve[r](n)
2801
+ }, u[h] = he(p), null !== a) {
2802
+ l[h].diffInstance = new _t(a.size, a.stdDev);
2803
+ var v, d = [], b = fe(a.targets);
2804
+ try {
2805
+ for (b.s(); !(v = b.n()).done; ) {
2806
+ var m = v.value;
2807
+ u["".concat(y, "_").concat(m)] = he(p), a.autoMinMax && t.autoMinMaxKeys.push("".concat(y, "_").concat(m)),
2808
+ a.lag > 0 && d.push("".concat(y, "_").concat(m));
2809
+ }
2810
+ } catch (t) {
2811
+ b.e(t);
2812
+ } finally {
2813
+ b.f();
2814
+ }
2815
+ a.lag > 0 && t.lag(d, a.lag);
2816
+ }
2817
+ c.push(h);
2818
+ }
2819
+ // Retrieve the current price value.
2820
+ var g = u[i][e], w = l[h], O = w.maInstance, S = w.diffInstance;
2821
+ // Update the moving average instance.
2822
+ O.update(g, s);
2823
+ var _ = null;
2824
+ try {
2825
+ _ = O.getResult();
2826
+ } catch (t) {
2827
+ _ = null;
2828
+ }
2829
+ // Always push the MA value (even if null).
2830
+ // Process the diff values if a diff is requested.
2831
+ if (t.pushToMain({
2832
+ index: e,
2833
+ key: h,
2834
+ value: _
2835
+ }), null !== a) {
2836
+ var j, P = fe(a.targets);
2837
+ try {
2838
+ for (P.s(); !(j = P.n()).done; ) {
2839
+ var A = j.value, E = null;
2840
+ // Compute diffValue only if we have a valid MA value.
2841
+ null !== _ && "number" == typeof _ && (E = u[A][e] - _),
2842
+ // Update the diff indicator only if diffValue is a valid number.
2843
+ null !== E && "number" == typeof E && S.update(Math.abs(E), s);
2844
+ var M = null;
2845
+ try {
2846
+ M = S.getResult();
2847
+ } catch (t) {
2848
+ M = null;
2849
+ }
2850
+ var x = ce(E, M, a.scale, a.autoMinMax);
2851
+ t.pushToMain({
2852
+ index: e,
2853
+ key: "".concat(y, "_").concat(A),
2854
+ value: x
2855
+ });
2856
+ }
2857
+ } catch (t) {
2858
+ P.e(t);
2859
+ } finally {
2860
+ P.f();
2861
+ }
2862
+ }
2863
+ return !0;
2864
+ },
2865
+ macd: function(t, e, r, n, o, i) {
2866
+ var a = i.target, u = t.verticalOhlcv, l = t.instances, c = t.lastIndexReplace, s = "".concat(r, "_").concat(n, "_").concat(o).concat(a === Oe ? "" : "_".concat(a));
2867
+ // Initialization on the first index.
2868
+ if (0 === e) {
2869
+ var f = t.inputParams, h = t.crossPairsList, y = t.nullArray, p = t.priceBased;
2870
+ if (!u.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
2871
+ var v = f.filter((function(t) {
2872
+ return "macd" === t.key;
2873
+ })).length, d = v > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", b = a === Oe ? "".concat(d, "_diff") : "".concat(d, "_diff_").concat(a), m = a === Oe ? "".concat(d, "_dea") : "".concat(d, "_dea_").concat(a), g = a === Oe ? "".concat(d, "_histogram") : "".concat(d, "_histogram_").concat(a);
2874
+ // Choose a display prefix based on the number of indicators.
2875
+ h.push({
2876
+ fast: b,
2877
+ slow: m,
2878
+ isDefault: !0
2879
+ }), l.hasOwnProperty("macd") || (l.macd = {
2880
+ numberOfIndicators: v,
2881
+ settings: {}
2882
+ }), l.macd.settings[s] = new zt(new Dt(r), new Dt(n), new Dt(o)), Object.assign(u, me(me(me({}, b, ge(y)), m, ge(y)), g, ge(y))),
2883
+ p.push(b, m, g);
2884
+ }
2885
+ var w = l.macd, O = w.numberOfIndicators, S = w.settings, _ = O > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", j = a === Oe ? "".concat(_, "_diff") : "".concat(_, "_diff_").concat(a), P = a === Oe ? "".concat(_, "_dea") : "".concat(_, "_dea_").concat(a), A = a === Oe ? "".concat(_, "_histogram") : "".concat(_, "_histogram_").concat(a), E = S[s], M = u[a][e];
2886
+ E.update(M, c);
2887
+ var x = null;
2888
+ try {
2889
+ x = E.getResult();
2890
+ } catch (t) {
2891
+ // If the result is unavailable, macdResult remains null.
2892
+ x = null;
2893
+ }
2894
+ // Always push values; use null as fallback when macdResult is missing.
2895
+ return t.pushToMain({
2896
+ index: e,
2897
+ key: j,
2898
+ value: x ? x.macd : null
2899
+ }), t.pushToMain({
2900
+ index: e,
2901
+ key: P,
2902
+ value: x ? x.signal : null
2903
+ }), t.pushToMain({
2904
+ index: e,
2905
+ key: A,
2906
+ value: x ? x.histogram : null
2907
+ }), !0;
2908
+ },
2909
+ relativeVolume: function(t, e) {
2910
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 10, n = (arguments.length > 3 ? arguments[3] : void 0).scale, o = "relative_volume_".concat(r), i = t.instances, a = t.verticalOhlcv, u = t.lastIndexReplace;
2911
+ if (0 === e) {
2912
+ var l = t.nullArray;
2913
+ i[o] = {
2914
+ instance: new nt(r),
2915
+ prevRelativeVolumeSma: null
2916
+ }, a[o] = Se(l);
2917
+ }
2918
+ var c = a.volume[e], s = i[o].instance;
2919
+ s.update(c, u);
2920
+ var f = null;
2921
+ try {
2922
+ f = s.getResult();
2923
+ } catch (t) {
2924
+ f = null;
2925
+ }
2926
+ var h = i[o].prevRelativeVolumeSma, y = null;
2927
+ // Only calculate relative volume if both current SMA and previous SMA are valid numbers and prevSma is not zero.
2928
+ return "number" == typeof f && "number" == typeof h && 0 !== h && (y = c / h, n && (y = ne(y, n))),
2929
+ t.pushToMain({
2930
+ index: e,
2931
+ key: o,
2932
+ value: y
2933
+ }), i[o].prevRelativeVolumeSma = f, !0;
2934
+ },
2935
+ donchianChannels: function(t, e, r, n, o) {
2936
+ var i = o.height, a = o.range, u = o.scale, l = o.lag, c = o.autoMinMax, s = "".concat(r, "_").concat(n), f = t.verticalOhlcv, h = t.instances, y = t.len;
2937
+ // Initialization: create output arrays and indicator instance on the first call.
2938
+ if (0 === e) {
2939
+ var p = t.inputParams, v = t.priceBased, d = t.nullArray, b = p.filter((function(t) {
2940
+ return "donchianChannels" === t.key;
2941
+ })).length, m = b > 1 ? "donchian_channel_".concat(s) : "donchian_channel", g = [ "".concat(m, "_upper"), "".concat(m, "_basis"), "".concat(m, "_lower") ];
2942
+ i && g.push("".concat(m, "_height")), h.hasOwnProperty("donchian_channel") || (h.donchian_channel = {
2943
+ numberOfIndicators: b,
2944
+ settings: {}
2945
+ });
2946
+ // Set up additional arrays for each range property.
2947
+ var w, O = Me(a);
2948
+ try {
2949
+ for (O.s(); !(w = O.n()).done; ) {
2950
+ var S = w.value;
2951
+ if (!(S in f) || !v.includes(S)) throw new Error('Invalid range item value "'.concat(S, '" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(v)));
2952
+ g.push("".concat(m, "_range_").concat(S)), c && t.autoMinMaxKeys.push("".concat(m, "_range_").concat(S));
2953
+ }
2954
+ } catch (t) {
2955
+ O.e(t);
2956
+ } finally {
2957
+ O.f();
2958
+ }
2959
+ var _ = Object.fromEntries(g.map((function(t) {
2960
+ return [ t, Ee(d) ];
2961
+ })));
2962
+ Object.assign(f, function(t) {
2963
+ for (var e = 1; e < arguments.length; e++) {
2964
+ var r = null != arguments[e] ? arguments[e] : {};
2965
+ e % 2 ? Pe(Object(r), !0).forEach((function(e) {
2966
+ Ae(t, e, r[e]);
2967
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Pe(Object(r)).forEach((function(e) {
2968
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
2969
+ }));
2970
+ }
2971
+ return t;
2972
+ }({}, _)), l > 0 && t.lag(g, l), v.push("".concat(m, "_upper"), "".concat(m, "_basis"), "".concat(m, "_lower")),
2973
+ h.donchian_channel.settings[s] = {
2974
+ maxDeque: [],
2975
+ // will hold indices for highs in descending order
2976
+ minDeque: []
2977
+ };
2978
+ }
2979
+ var j = h.donchian_channel.numberOfIndicators > 1 ? "donchian_channel_".concat(s) : "donchian_channel", P = h.donchian_channel.settings[s], A = P.maxDeque, E = P.minDeque, M = e - n, x = M + 1, k = x - r;
2980
+ // window: [startIdx, endIdx)
2981
+ // If the window is not fully available, push null values for all computed outputs.
2982
+ if (k < 0 || x > y) {
2983
+ t.pushToMain({
2984
+ index: e,
2985
+ key: "".concat(j, "_upper"),
2986
+ value: null
2987
+ }), t.pushToMain({
2988
+ index: e,
2989
+ key: "".concat(j, "_basis"),
2990
+ value: null
2991
+ }), t.pushToMain({
2992
+ index: e,
2993
+ key: "".concat(j, "_lower"),
2994
+ value: null
2995
+ }), i && t.pushToMain({
2996
+ index: e,
2997
+ key: "".concat(j, "_height"),
2998
+ value: null
2999
+ });
3000
+ var T, I = Me(a);
3001
+ try {
3002
+ for (I.s(); !(T = I.n()).done; ) {
3003
+ var R = T.value;
3004
+ t.pushToMain({
3005
+ index: e,
3006
+ key: "".concat(j, "_range_").concat(R),
3007
+ value: null
3008
+ });
3009
+ }
3010
+ } catch (t) {
3011
+ I.e(t);
3012
+ } finally {
3013
+ I.f();
3014
+ }
3015
+ return !0;
3016
+ }
3017
+ // **Update the maximum deque:**
3018
+ for (var C = f.high, D = f.low; A.length && A[0] < k; ) A.shift();
3019
+ for (;A.length && C[A[A.length - 1]] <= C[M]; ) A.pop();
3020
+ // **Update the minimum deque:**
3021
+ for (A.push(M); E.length && E[0] < k; ) E.shift();
3022
+ for (;E.length && D[E[E.length - 1]] >= D[M]; ) E.pop();
3023
+ E.push(M);
3024
+ // Retrieve computed values with safety checks.
3025
+ var V = A.length ? C[A[0]] : null, B = E.length ? D[E[0]] : null, N = "number" == typeof V && "number" == typeof B ? (V + B) / 2 : null;
3026
+ // Process height if enabled.
3027
+ if (
3028
+ // Always push the main indicator values.
3029
+ t.pushToMain({
3030
+ index: e,
3031
+ key: "".concat(j, "_upper"),
3032
+ value: V
3033
+ }), t.pushToMain({
3034
+ index: e,
3035
+ key: "".concat(j, "_basis"),
3036
+ value: N
3037
+ }), t.pushToMain({
3038
+ index: e,
3039
+ key: "".concat(j, "_lower"),
3040
+ value: B
3041
+ }), i) {
3042
+ var L = null;
3043
+ "number" == typeof V && "number" == typeof B && 0 !== B && (L = ne((V - B) / B, .001)),
3044
+ t.pushToMain({
3045
+ index: e,
3046
+ key: "".concat(j, "_height"),
3047
+ value: L
3048
+ });
3049
+ }
3050
+ // Process each range property.
3051
+ var H, U = Me(a);
3052
+ try {
3053
+ for (U.s(); !(H = U.n()).done; ) {
3054
+ var z = H.value, q = null, $ = f[z][e];
3055
+ "number" == typeof $ && "number" == typeof V && "number" == typeof B && V - B != 0 && (q = c ? Math.max(Math.min(($ - B) / (V - B), 1), 0) : ($ - B) / (V - B),
3056
+ u && (q = ne(q, u))), t.pushToMain({
3057
+ index: e,
3058
+ key: "".concat(j, "_range_").concat(z),
3059
+ value: q
3060
+ });
3061
+ }
3062
+ } catch (t) {
3063
+ U.e(t);
3064
+ } finally {
3065
+ U.f();
3066
+ }
3067
+ return !0;
3068
+ },
3069
+ bollingerBands: function(t, e, r, n, o) {
3070
+ var i, a, u, l, c, s, f, h = o.height, y = o.range, p = void 0 === y ? [] : y, v = o.target, d = o.scale, b = o.lag, m = o.autoMinMax, g = t.verticalOhlcv, w = t.instances, O = t.lastIndexReplace, S = "close" === v ? "" : "_".concat(v), _ = "".concat(r, "_").concat(n).concat(S);
3071
+ // Initialization on the first call.
3072
+ if (0 === e) {
3073
+ var j = t.priceBased, P = t.inputParams, A = t.nullArray, E = t.verticalOhlcv;
3074
+ if (!(v in E)) throw new Error('bollingerBands could not find target "'.concat(v, '"'));
3075
+ var M = P.filter((function(t) {
3076
+ return "bollingerBands" === t.key;
3077
+ })).length;
3078
+ f = M > 1 ? "bollinger_bands_".concat(_) : "bollinger_bands".concat(S),
3079
+ // Only create the container if it doesn't already exist.
3080
+ w.bollinger_bands || (w.bollinger_bands = {
3081
+ numberOfIndicators: M,
3082
+ settings: {}
3083
+ }),
3084
+ // Add (or override) the indicator instance keyed by indicatorKey.
3085
+ w.bollinger_bands.settings[_] = new _t(r, n);
3086
+ var x = [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ];
3087
+ h && x.push("".concat(f, "_height"));
3088
+ // Set up additional arrays for each range property.
3089
+ var k, T = De(p);
3090
+ try {
3091
+ for (T.s(); !(k = T.n()).done; ) {
3092
+ var I = k.value;
3093
+ if (!(I in E) || !j.includes(I)) throw new Error('Invalid range item value "'.concat(I, '" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(j)));
3094
+ x.push("".concat(f, "_range_").concat(I)), m && t.autoMinMaxKeys.push("".concat(f, "_range_").concat(I));
3095
+ }
3096
+ } catch (t) {
3097
+ T.e(t);
3098
+ } finally {
3099
+ T.f();
3100
+ }
3101
+ var R = Object.fromEntries(x.map((function(t) {
3102
+ return [ t, Ce(A) ];
3103
+ })));
3104
+ Object.assign(E, function(t) {
3105
+ for (var e = 1; e < arguments.length; e++) {
3106
+ var r = null != arguments[e] ? arguments[e] : {};
3107
+ e % 2 ? Ie(Object(r), !0).forEach((function(e) {
3108
+ Re(t, e, r[e]);
3109
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ie(Object(r)).forEach((function(e) {
3110
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
3111
+ }));
3112
+ }
3113
+ return t;
3114
+ }({}, R)), b > 0 && t.lag(x, b), j.push("".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower"));
3115
+ }
3116
+ // Derive prefix for subsequent calls if not set.
3117
+ f || (f = w.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(_) : "bollinger_bands".concat(S));
3118
+ var C = f, D = w.bollinger_bands.settings[_], V = g[v][e];
3119
+ // Update the indicator with the current value.
3120
+ D.update(V, O);
3121
+ // Attempt to retrieve the result.
3122
+ var B = null;
3123
+ try {
3124
+ B = D.getResult();
3125
+ } catch (t) {
3126
+ // If not available, result stays null.
3127
+ }
3128
+ // Use null fallbacks for the primary values.
3129
+ var N = null !== (i = null === (a = B) || void 0 === a ? void 0 : a.upper) && void 0 !== i ? i : null, L = null !== (u = null === (l = B) || void 0 === l ? void 0 : l.middle) && void 0 !== u ? u : null, H = null !== (c = null === (s = B) || void 0 === s ? void 0 : s.lower) && void 0 !== c ? c : null;
3130
+ // Process height if requested.
3131
+ if (
3132
+ // Always push the indicator outputs.
3133
+ t.pushToMain({
3134
+ index: e,
3135
+ key: "".concat(C, "_upper"),
3136
+ value: N
3137
+ }), t.pushToMain({
3138
+ index: e,
3139
+ key: "".concat(C, "_middle"),
3140
+ value: L
3141
+ }), t.pushToMain({
3142
+ index: e,
3143
+ key: "".concat(C, "_lower"),
3144
+ value: H
3145
+ }), h) {
3146
+ var U = null;
3147
+ "number" == typeof N && "number" == typeof H && 0 !== H && (U = ne((N - H) / H, .001)),
3148
+ t.pushToMain({
3149
+ index: e,
3150
+ key: "".concat(C, "_height"),
3151
+ value: U
3152
+ });
3153
+ }
3154
+ // Process each range property.
3155
+ var z, q = De(p);
3156
+ try {
3157
+ for (q.s(); !(z = q.n()).done; ) {
3158
+ var $ = z.value, F = null, K = g[$][e];
3159
+ "number" == typeof K && "number" == typeof H && "number" == typeof N && N - H != 0 && (F = m ? Math.max(Math.min((K - H) / (N - H), 1), 0) : (K - H) / (N - H),
3160
+ d && (F = ne(F, d))), t.pushToMain({
3161
+ index: e,
3162
+ key: "".concat(C, "_range_").concat($),
3163
+ value: F
3164
+ });
3165
+ }
3166
+ } catch (t) {
3167
+ q.e(t);
3168
+ } finally {
3169
+ q.f();
3170
+ }
3171
+ return !0;
3172
+ },
3173
+ volumeOscillator: function(t, e, r, n, o) {
3174
+ var i = o.scale, a = t.verticalOhlcv, u = t.instances, l = t.lastIndexReplace, c = a.volume[e], s = "volume_oscillator";
3175
+ if (0 === e) {
3176
+ var f = t.crossPairsList, h = t.nullArray;
3177
+ Object.assign(u, {
3178
+ volume_oscillator: {
3179
+ fastEMA: new Dt(r),
3180
+ slowEMA: new Dt(n)
3181
+ }
3182
+ }), a[s] = Ne(h), f.push({
3183
+ fast: s,
3184
+ slow: 0,
3185
+ isDefault: !0
3186
+ });
3187
+ }
3188
+ var y = u[s], p = y.fastEMA, v = y.slowEMA;
3189
+ p.update(c, l), v.update(c, l);
3190
+ var d = null, b = null;
3191
+ try {
3192
+ d = p.getResult();
3193
+ } catch (t) {
3194
+ d = null;
3195
+ }
3196
+ try {
3197
+ b = v.getResult();
3198
+ } catch (t) {
3199
+ b = null;
3200
+ }
3201
+ var m = null;
3202
+ return "number" == typeof d && "number" == typeof b && 0 !== b && (m = 100 * (d - b) / b,
3203
+ i && (m = ne(m, i))), t.pushToMain({
3204
+ index: e,
3205
+ key: s,
3206
+ value: m
3207
+ }), !0;
3208
+ },
3209
+ candleVectors: function(t, e, r, n) {
3210
+ var o = n.stdDev, i = n.patternSize, a = n.lag, u = n.scale, l = n.autoMinMax, c = t.verticalOhlcv, s = t.instances, f = t.lastIndexReplace, h = function(t, e) {
3211
+ return ce(t, e, u, l);
3212
+ };
3213
+ if (0 === e) {
3214
+ console.log({
3215
+ autoMinMax: l
3216
+ });
3217
+ for (var y = t.nullArray, p = [ [ "close", "open" ], [ "close", "high" ], [ "close", "low" ], [ "open", "high" ], [ "open", "low" ], [ "high", "low" ] ], v = [ [ "open", "open" ], [ "high", "high" ], [ "low", "low" ], [ "close", "close" ] ].concat(p), d = [], b = {}, m = 0; m < i; m++) {
3218
+ var g, w = Ke(v);
3219
+ try {
3220
+ for (w.s(); !(g = w.n()).done; ) {
3221
+ var O = Fe(g.value, 2), S = O[0], _ = O[1];
3222
+ d.push("candle_change_".concat(m + 1, "_").concat(S, "_").concat(_)), b["candle_change_".concat(m + 1, "_").concat(S, "_").concat(_)] = $e(y),
3223
+ l && t.autoMinMaxKeys.push("candle_change_".concat(m + 1, "_").concat(S, "_").concat(_));
3224
+ }
3225
+ } catch (t) {
3226
+ w.e(t);
3227
+ } finally {
3228
+ w.f();
3229
+ }
3230
+ }
3231
+ for (var j = [], P = {}, A = 0, E = p; A < E.length; A++) {
3232
+ var M = Fe(E[A], 2), x = M[0], k = M[1];
3233
+ j.push("candle_body_".concat(x, "_").concat(k)), P["candle_body_".concat(x, "_").concat(k)] = $e(y),
3234
+ l && t.autoMinMaxKeys.push("candle_body_".concat(x, "_").concat(k));
3235
+ }
3236
+ var T = [].concat(j, d);
3237
+ Object.assign(c, ze(ze({}, P), b)), Object.assign(s, {
3238
+ candleVectors: {
3239
+ bodyVectors: p,
3240
+ lookBackVectors: v,
3241
+ keyNames: T,
3242
+ bodyInstance: new _t(r, o)
3243
+ }
3244
+ }), a > 0 && t.lag(T, a);
3245
+ }
3246
+ if (0 === e) return !0;
3247
+ var I = s.candleVectors, R = I.bodyVectors, C = I.lookBackVectors, D = I.bodyInstance, V = null, B = c.open[e], N = c.close[e], L = We(N, B);
3248
+ // Update instances with current absolute values
3249
+ D.update(L, f);
3250
+ try {
3251
+ V = D.getResult();
3252
+ } catch (t) {
3253
+ // If there's not enough data, means remain null
3254
+ }
3255
+ for (var H = 0; H < R.length; H++) {
3256
+ var U = Fe(R[H], 2), z = U[0], q = U[1], $ = c[z][e], F = c[q][e];
3257
+ t.pushToMain({
3258
+ index: e,
3259
+ key: "candle_body_".concat(z, "_").concat(q),
3260
+ value: h(We($, F), V)
3261
+ });
3262
+ }
3263
+ for (var K = 0; K < i; K++) {
3264
+ var G, J = Ke(C);
3265
+ try {
3266
+ for (J.s(); !(G = J.n()).done; ) {
3267
+ var W = Fe(G.value, 2), Y = W[0], Q = W[1], X = c[Y][e], Z = c[Q][e - (K + 1)];
3268
+ t.pushToMain({
3269
+ index: e,
3270
+ key: "candle_change_".concat(K + 1, "_").concat(Y, "_").concat(Q),
3271
+ value: void 0 === Z ? null : h(We(X, Z), V)
3272
+ });
3273
+ }
3274
+ } catch (t) {
3275
+ J.e(t);
3276
+ } finally {
3277
+ J.f();
3278
+ }
3279
+ }
3280
+ return !0;
3281
+ }
3282
+ }, Ar = function(t, e, r) {
3283
+ var n = function(t) {
3284
+ return r > 1 ? t * r : t;
3285
+ };
3286
+ if ("number" === e) return n(t);
3287
+ if ("string" === e) {
3288
+ var o = oe(t);
3289
+ return n(Number(o));
3290
+ }
3291
+ return 0;
3292
+ // Optionally: throw an error if type is not recognized
3293
+ }, Er = function(t, e) {
3294
+ return "number" === e ? t : "string" === e ? Number(oe(t)) : 0;
3295
+ }, Mr = function(t, e) {
3296
+ var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o = e.len, i = e.inputParams, a = e.hasVolume;
3297
+ //do not move nullArray from here
3298
+ e.nullArray = new Array(o).fill(null);
3299
+ var u = [ "open", "high", "low", "close" ];
3300
+ a && u.push("volume");
3301
+ var l = new Set(u);
3302
+ if (0 === n) {
3303
+ // Validate parameters and initialize base keys in verticalOhlcv
3304
+ !function(t) {
3305
+ var e, n = t.inputParams, o = t.len, i = r(n);
3306
+ try {
3307
+ for (i.s(); !(e = i.n()).done; ) {
3308
+ var a, u = r(e.value.params);
3309
+ try {
3310
+ for (u.s(); !(a = u.n()).done; ) {
3311
+ var l = a.value;
3312
+ if ("number" == typeof l && l > o) throw console.log(l, o), new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.");
3313
+ }
3314
+ } catch (t) {
3315
+ u.e(t);
3316
+ } finally {
3317
+ u.f();
3318
+ }
3319
+ }
3320
+ } catch (t) {
3321
+ i.e(t);
3322
+ } finally {
3323
+ i.f();
3324
+ }
3325
+ }(e), u.forEach((function(t) {
3326
+ e.verticalOhlcv[t] = Or(e.nullArray);
3327
+ }));
3328
+ // Identify any additional keys from the first input row and initialize them
3329
+ var c = Object.keys(t[0]).filter((function(t) {
3330
+ return !l.has(t);
3331
+ }));
3332
+ c.forEach((function(t) {
3333
+ e.verticalOhlcv[t] = Or(e.nullArray);
3334
+ })), e.otherKeys = c,
3335
+ // Set the input types once using the first row
3336
+ function(t, e) {
3337
+ for (var r = 0, n = Object.keys(e.inputTypes); r < n.length; r++) {
3338
+ var o = n[r];
3339
+ if (!(o in t)) throw new Error('Property "'.concat(o, '" not found in ohlcv array. ').concat(e.ticker));
3340
+ var i = t[o];
3341
+ if ("number" == typeof i && i > 0) e.inputTypes[o] = "number"; else {
3342
+ if ("string" != typeof i || !/^(\d+(\.\d*)?|\.\d+)$/.test(i)) throw new Error('Invalid property "'.concat(o, '" in ohlcv array. ').concat(e.ticker));
3343
+ // Determine precisionMultiplier if not already set
3344
+ e.inputTypes[o] = "string", i = oe(i);
3345
+ }
3346
+ if (0 === e.precisionMultiplier && !0 === e.precision) {
3347
+ var a = Sr(String(i).split("."), 2)[1], u = void 0 === a ? "" : a, l = Math.max(4, u.length);
3348
+ e.precisionMultiplier = l > 1 ? Math.pow(10, l - 1) : 1;
3349
+ }
3350
+ }
3351
+ }(t[0], e);
3352
+ } else if (!e.otherKeys) throw new Error("otherKeys not found in main. Ensure you run with startIndex=0 first to initialize.");
3353
+ // Prepare the list of indicator function calls
3354
+ // Process each row in the input
3355
+ for (var s = function(t) {
3356
+ return Array.isArray(t) ? t.map((function(t) {
3357
+ var e = t.key, r = t.params;
3358
+ return {
3359
+ key: e,
3360
+ fn: Pr[e],
3361
+ args: r
3362
+ };
3363
+ })) : [];
3364
+ }(i), f = n; f < o; f++) {
3365
+ var h = t[f], y = h.open, p = h.high, v = h.low, d = h.close, b = wr(h, mr), m = e.precisionMultiplier, g = Ar(y, e.inputTypes.open, m), w = Ar(p, e.inputTypes.high, m), O = Ar(v, e.inputTypes.low, m), S = Ar(d, e.inputTypes.close, m);
3366
+ // Destructure the base keys and use the rest for other properties
3367
+ //sets volume to 0
3368
+ if (e.pushToMain({
3369
+ index: f,
3370
+ key: "open",
3371
+ value: g
3372
+ }), e.pushToMain({
3373
+ index: f,
3374
+ key: "high",
3375
+ value: w
3376
+ }), e.pushToMain({
3377
+ index: f,
3378
+ key: "low",
3379
+ value: O
3380
+ }), e.pushToMain({
3381
+ index: f,
3382
+ key: "close",
3383
+ value: S
3384
+ }), a) {
3385
+ var _ = h.volume, j = Er(_, e.inputTypes.volume);
3386
+ e.pushToMain({
3387
+ index: f,
3388
+ key: "volume",
3389
+ value: j
3390
+ });
3391
+ } else delete b.volume;
3392
+ // Populate any extra keys identified during initialization
3393
+ var P, A = gr(e.otherKeys);
3394
+ try {
3395
+ for (A.s(); !(P = A.n()).done; ) {
3396
+ var E = P.value;
3397
+ e.pushToMain({
3398
+ index: f,
3399
+ key: E,
3400
+ value: b[E]
3401
+ });
3402
+ }
3403
+ // Run all indicator functions except for the ones processed later
3404
+ } catch (t) {
3405
+ A.e(t);
3406
+ } finally {
3407
+ A.f();
3408
+ }
3409
+ var M, x = gr(s);
3410
+ try {
3411
+ for (x.s(); !(M = x.n()).done; ) {
3412
+ var k = M.value, T = k.key, I = k.fn, R = k.args;
3413
+ [ "crossPairs", "lag" ].includes(T) || I.apply(void 0, [ e, f ].concat(Or(R)));
3414
+ }
3415
+ // Process these indicators separately (ensuring their execution order)
3416
+ } catch (t) {
3417
+ x.e(t);
3418
+ } finally {
3419
+ x.f();
3420
+ }
3421
+ rr(e, f), hr(e, f), e.lastComputedIndex++;
3422
+ }
3423
+ }, xr = function(t, e) {
3424
+ for (var r = t.length, n = new nt(e), o = new Array(r), i = 0, a = 0, u = 0, l = 0; l < r; l++) if (n.update(t[l]),
3425
+ n.isStable) {
3426
+ var c = n.getResult();
3427
+ o[l] = c, i += c, a += c * c, u++;
3428
+ } else o[l] = null;
3429
+ var s = i / u, f = a / u - s * s, h = Math.sqrt(f);
3430
+ return o.map((function(t) {
3431
+ return null !== t ? (t - s) / h : null;
3432
+ }));
3433
+ }, kr = function(t, e) {
3434
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
3435
+ if (t.length !== e.length) throw new Error("Both arrays must have the same length");
3436
+ for (var n = xr(t, r), o = xr(e, r), i = t.length, a = [], u = 0, l = 0, c = 0, s = 0, f = 0, h = 0, y = -1, p = 0; p < i; p++) {
3437
+ if (null !== n[p] && null !== o[p]) {
3438
+ y = p;
3439
+ break;
3440
+ }
3441
+ a.push(0);
3442
+ }
3443
+ if (-1 === y)
3444
+ // No valid data points
3445
+ return new Array(i).fill(0);
3446
+ for (var v = y; v < i; v++) {
3447
+ var d = n[v], b = o[v];
3448
+ if (null !== d && null !== b) if (u += d, l += b, c += d * b, s += d * d, f += b * b,
3449
+ ++h < 2) a.push(0); else {
3450
+ var m = h * c - u * l, g = Math.sqrt((h * s - u * u) * (h * f - l * l)), w = 0 === g ? 0 : m / g;
3451
+ a.push(w);
3452
+ } else
3453
+ // Reset sums and counts when encountering null values
3454
+ u = l = c = s = f = h = 0, a.push(0);
3455
+ }
3456
+ return a;
3457
+ };
3458
+ // Processes the inputParams into a list of indicator calls
3459
+ // ./index.js
3460
+ function Tr(t) {
3461
+ return function(t) {
3462
+ if (Array.isArray(t)) return Dr(t);
3463
+ }(t) || function(t) {
3464
+ if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
3465
+ }(t) || Cr(t) || function() {
3466
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3467
+ }();
3468
+ }
3469
+ function Ir(t) {
3470
+ return Ir = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
3471
+ return typeof t;
3472
+ } : function(t) {
3473
+ return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
3474
+ }, Ir(t);
3475
+ }
3476
+ function Rr(t, e) {
3477
+ return function(t) {
3478
+ if (Array.isArray(t)) return t;
3479
+ }(t) || function(t, e) {
3480
+ var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3481
+ if (null != r) {
3482
+ var n, o, i, a, u = [], l = !0, c = !1;
3483
+ try {
3484
+ if (i = (r = r.call(t)).next, 0 === e) {
3485
+ if (Object(r) !== r) return;
3486
+ l = !1;
3487
+ } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
3488
+ } catch (t) {
3489
+ c = !0, o = t;
3490
+ } finally {
3491
+ try {
3492
+ if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
3493
+ } finally {
3494
+ if (c) throw o;
3495
+ }
3496
+ }
3497
+ return u;
3498
+ }
3499
+ }(t, e) || Cr(t, e) || function() {
3500
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3501
+ }();
3502
+ }
3503
+ function Cr(t, e) {
3504
+ if (t) {
3505
+ if ("string" == typeof t) return Dr(t, e);
3506
+ var r = {}.toString.call(t).slice(8, -1);
3507
+ return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Dr(t, e) : void 0;
3508
+ }
3509
+ }
3510
+ function Dr(t, e) {
3511
+ (null == e || e > t.length) && (e = t.length);
3512
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
3513
+ return n;
3514
+ }
3515
+ function Vr(t, e) {
3516
+ for (var r = 0; r < e.length; r++) {
3517
+ var n = e[r];
3518
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
3519
+ Object.defineProperty(t, Br(n.key), n);
3520
+ }
3521
+ }
3522
+ function Br(t) {
3523
+ var e = function(t, e) {
3524
+ if ("object" != Ir(t) || !t) return t;
3525
+ var r = t[Symbol.toPrimitive];
3526
+ if (void 0 !== r) {
3527
+ var n = r.call(t, e || "default");
3528
+ if ("object" != Ir(n)) return n;
3529
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3530
+ }
3531
+ return ("string" === e ? String : Number)(t);
3532
+ }
3533
+ /**
3534
+ * Class OHLCV_INDICATORS
3535
+ *
3536
+ * This class provides methods for calculating and managing technical indicators
3537
+ * on financial OHLCV (Open, High, Low, Close, Volume) data. It enables users
3538
+ * to parallel compute various technical indicators in 1 single loop.
3539
+ * OHLCV datasets.
3540
+ */ (t, "string");
3541
+ return "symbol" == Ir(e) ? e : e + "";
3542
+ }
3543
+ var Nr = [ .001, .002, .0025, .005, .01, .02, .025, .05, .1, .2, .25, .5, 1, 2, 2.5, 5, 10 ], Lr = function() {
3544
+ return t = function t(e) {
3545
+ var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision, u = void 0 === a || a, l = e.inputParams, c = void 0 === l ? null : l;
3546
+ if (function(t, e) {
3547
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
3548
+ }(this, t), !Array.isArray(n)) throw Error("input OHLCV must be an array: " + i);
3549
+ if (0 === n.length) throw Error("input OHLCV must not be empty: " + i);
3550
+ if (!n[0].hasOwnProperty("close")) throw Error("input OHLCV array objects require at least close property: " + i);
3551
+ return this.hasVolume = !!("number" == typeof n[0].volume && n[0].volume > 0 || "string" == typeof n[0].volume && n[0].volume),
3552
+ this.isComputed = !1, this.lastComputedIndex = 0, this.input = n, this.inputTypes = this.hasVolume ? {
3553
+ open: "",
3554
+ high: "",
3555
+ low: "",
3556
+ close: "",
3557
+ volume: ""
3558
+ } : {
3559
+ open: "",
3560
+ high: "",
3561
+ low: "",
3562
+ close: ""
3563
+ }, this.priceBased = [ "open", "high", "low", "close" ], this.len = n.length, this.lastIndexReplace = !1,
3564
+ this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.studies = {},
3565
+ this.utilities = {
3566
+ correlation: kr
3567
+ }, this.invalidValueIndex = -1, this.precision = u, this.precisionMultiplier = !0 === this.precision ? 0 : 1,
3568
+ this.autoMinMaxKeys = [], this.minMaxRanges = {}, Array.isArray(c) && (this.inputParams = c,
3569
+ this.compute()), this.inputParams = [], this.pushToMain = function(t) {
3570
+ var e = t.index, n = t.key, o = t.value;
3571
+ return function(t) {
3572
+ var e = t.main, r = t.index, n = t.key, o = t.value, i = e.precision, a = e.priceBased, u = e.minMaxRanges, l = e.verticalOhlcv, c = e.autoMinMaxKeys;
3573
+ if (e.invalidValueIndex, null == o) for (var s in u) u[s] = {
3574
+ min: 1 / 0,
3575
+ max: -1 / 0
3576
+ };
3577
+ if (l[n][r] = o, "number" == typeof o && !n.includes("_x_")) {
3578
+ var f = c.includes(n);
3579
+ if (n.includes("_diff_") && f) u.hasOwnProperty(n) && u[n].min !== 1 / 0 && u[n].max !== -1 / 0 || (u[n] = {
3580
+ min: -1,
3581
+ max: 1
3582
+ }); else if (n.startsWith("candle_") && f) u[n] = {
3583
+ min: -1,
3584
+ max: 1
3585
+ }; else if (n.includes("_range_") && f) u[n] = {
3586
+ min: 0,
3587
+ max: 1
3588
+ }; else if (n.startsWith("rsi_") && f) u[n] = {
3589
+ min: 0,
3590
+ max: 1
3591
+ }; else {
3592
+ var h = i && a.includes(n) ? o / precisionMultiplier : o;
3593
+ u.hasOwnProperty(n) || (u[n] = {
3594
+ min: 1 / 0,
3595
+ max: -1 / 0
3596
+ }), h < u[n].min && (u[n].min = h), h > u[n].max && (u[n].max = h);
3597
+ }
3598
+ }
3599
+ return !0;
3600
+ }({
3601
+ main: r,
3602
+ index: e,
3603
+ key: n,
3604
+ value: o
3605
+ });
3606
+ }, this;
3607
+ }, e = [ {
3608
+ key: "getDataAsCols",
3609
+ value: function() {
3610
+ var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
3611
+ this.compute();
3612
+ for (var e = this.precisionMultiplier, r = this.precision, n = this.invalidValueIndex, o = this.len, i = this.verticalOhlcv, a = this.priceBased, u = {}, l = n >= 0 && t, c = o - (n + 1), s = 0, f = Object.entries(i); s < f.length; s++) {
3613
+ var h = Rr(f[s], 2), y = h[0], p = h[1], v = l ? p.slice(-c) : p;
3614
+ // If slicing is needed, create a sliced copy, otherwise re-use the array.
3615
+ // If this key is price based and precision is enabled, map over the array.
3616
+ r && a.includes(y) && (v = v.map((function(t) {
3617
+ return null == t ? null : t / e;
3618
+ }))), u[y] = v;
3619
+ }
3620
+ return u;
3621
+ }
3622
+ }, {
3623
+ key: "getData",
3624
+ value: function() {
3625
+ var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
3626
+ //getData method returns the last object (row) of the new OHLCV with indicators: {open, high, low, close, rsi_14, bollinger_bands_upper}
3627
+ this.compute();
3628
+ var e = this.precisionMultiplier, r = this.priceBased, n = this.precision;
3629
+ return function(t) {
3630
+ var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = arguments.length > 2 ? arguments[2] : void 0, n = arguments.length > 3 ? arguments[3] : void 0, o = arguments.length > 4 ? arguments[4] : void 0, i = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, a = Object.keys(t);
3631
+ if (0 === a.length) return [];
3632
+ for (var u = e && i >= 0 ? i + 1 : 0, l = t[a[0]].length, c = new Array(l - u), s = u; s < l; s++) {
3633
+ for (var f = {}, h = 0; h < a.length; h++) {
3634
+ var y = a[h], p = t[y][s];
3635
+ f[y] = r && o.includes(y) ? p / n : p;
3636
+ }
3637
+ c[s - u] = f;
3638
+ }
3639
+ return c;
3640
+ }(this.verticalOhlcv, t, n, e, r, this.invalidValueIndex);
3641
+ }
3642
+ }, {
3643
+ key: "getLastValues",
3644
+ value: function() {
3645
+ this.compute();
3646
+ for (var t = this.precisionMultiplier, e = this.priceBased, r = this.precision, n = this.verticalOhlcv, o = this.len, i = {}, a = 0, u = Object.keys(n); a < u.length; a++) {
3647
+ var l = u[a];
3648
+ i[l] = n[l][o - 1];
3649
+ }
3650
+ return r ? function(t) {
3651
+ for (var e = t.row, r = t.precisionMultiplier, n = t.priceBased, o = {}, i = 0, a = Object.entries(e); i < a.length; i++) {
3652
+ var u = ee(a[i], 2), l = u[0], c = u[1];
3653
+ n.includes(l) && (c /= r), o[l] = c;
3654
+ }
3655
+ return o;
3656
+ }({
3657
+ row: i,
3658
+ precisionMultiplier: t,
3659
+ priceBased: e
3660
+ }) : i;
3661
+ }
3662
+ }, {
3663
+ key: "compute",
3664
+ value: function(t) {
3665
+ //if change is a valid object and change.date is after the last row in this.input[this.input.length - 1].date pushes change to this.input using the parseOhlcvToVertical function.
3666
+ //stops the compute if compute is called from getData, getDataAsCols or getLastValues an isComputed is false
3667
+ if (!0 === this.isComputed && !t) return this;
3668
+ //checks the first row in OHLCV input to verify if the date property is valid
3669
+ //compute method can be used to add new or update the last datapoints if a new OHLCV object is passed with a valid date property
3670
+ //valid date properties: "2024-12-16 15:45:00" or "2024-12-16"
3671
+ if (this.isComputed = !1, this.isValidDate = this.input[0].hasOwnProperty("date") && o(this.input[0].date),
3672
+ //compute method can be used to process indicators if no arguments are provided
3673
+ //compute method can be called to access the .verticalOhlcv object
3674
+ //compute method is called automatically if getLastValues or getDate methods are called
3675
+ this.len > this.lastComputedIndex && !t && Mr(this.input, this, 0), t && "object" === Ir(t)) {
3676
+ var e;
3677
+ if (![ "open", "high", "low", "close", "volume", "date" ].every((function(e) {
3678
+ return Object.keys(t).includes(e);
3679
+ }))) throw Error('Invalid OHLCV object sent in "compute". Correct usage: .compute({open: 108.25, high: 108.410004, low: 108.25, close: 99999999, volume: 875903, date: "2024-12-16 15:45:00" || "2024-12-16"})');
3680
+ if (!this.isValidDate) throw Error('All the OHLCV rows require a valid date property to access the compute change method. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');
3681
+ if (!o(t.date)) throw Error('The date in the new OHLCV row is invalid. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');
3682
+ var r = t.date, n = this.len - 1, i = null === (e = this.input[n]) || void 0 === e ? void 0 : e.date;
3683
+ //fallback if .compute(change) is triggered before .compute() alone
3684
+ 0 === this.lastComputedIndex && this.compute(), i !== r ? (
3685
+ // Add new item
3686
+ this.len++, this.input.push(t), Mr(this.input, this, this.len)) : (
3687
+ // Modify the last item
3688
+ this.input[n] = t, Mr(this.input, this, n));
3689
+ }
3690
+ return this;
3691
+ }
3692
+ }, {
3693
+ key: "crossPairs",
3694
+ value: function(t) {
3695
+ return i(this), this.crossPairsList = [].concat(Tr(this.crossPairsList), Tr(t)),
3696
+ this.inputParams.push({
3697
+ key: "crossPairs",
3698
+ params: [ this.crossPairsList ]
3699
+ }), this;
3700
+ }
3701
+ }, {
3702
+ key: "lag",
3703
+ value: function() {
3704
+ var t = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ "close" ], r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1;
3705
+ if (i(this), !Array.isArray(e)) throw new Error('Param "colKeys" must be a valid array of keyNames in lag.');
3706
+ if ("number" != typeof r || !Number.isInteger(r) || r < 0) throw new Error('Param "lags" must be a integer greater or equal to 0: '.concat(JSON.stringify(e)));
3707
+ this.inputParams.push({
3708
+ key: "lag",
3709
+ params: [ e, r ]
3710
+ });
3711
+ for (var n = function() {
3712
+ var r = e[o];
3713
+ t.priceBased.find((function(t) {
3714
+ return r === t;
3715
+ })) && t.priceBased.push(r);
3716
+ }, o = 0; o < e.length; o++) n();
3717
+ return this;
3718
+ }
3719
+ }, {
3720
+ key: "relativeVolume",
3721
+ value: function(t) {
3722
+ var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3723
+ if (!1 === this.hasVolume) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
3724
+ i(this);
3725
+ var r = e.scale, n = void 0 === r ? null : r;
3726
+ if ("number" == typeof n && !Nr.includes(n)) throw new Error('"scale" value in relativeVolume must be any of the following numbers: '.concat(Nr.join(", ")));
3727
+ return this.inputParams.push({
3728
+ key: "relativeVolume",
3729
+ params: [ t, {
3730
+ scale: n
3731
+ } ]
3732
+ }), this;
3733
+ }
3734
+ }, {
3735
+ key: "ema",
3736
+ value: function(t) {
3737
+ var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3738
+ i(this);
3739
+ var r = de("ema", t, e, Nr);
3740
+ return this.inputParams.push({
3741
+ key: "movingAverages",
3742
+ params: [ "ema", t, r ]
3743
+ }), this;
3744
+ }
3745
+ }, {
3746
+ key: "sma",
3747
+ value: function(t) {
3748
+ var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3749
+ i(this);
3750
+ var r = de("sma", t, e, Nr);
3751
+ return this.inputParams.push({
3752
+ key: "movingAverages",
3753
+ params: [ "sma", t, r ]
3754
+ }), this;
3755
+ }
3756
+ }, {
3757
+ key: "macd",
3758
+ value: function() {
3759
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 12, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 26, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 9, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
3760
+ if (i(this), "number" != typeof t || t <= 0) throw new Error('"fast" must be a positive number in macd.');
3761
+ if ("number" != typeof e || e <= t) throw new Error('"slow" must be a positive number greater than "fast" in macd.');
3762
+ if ("number" != typeof r || r <= 0) throw new Error('"signal" must be a positive number in macd.');
3763
+ if ("object" !== Ir(n)) throw new Error('"options" must be an object in macd. eg: {target}');
3764
+ var o = n.target, a = void 0 === o ? "close" : o;
3765
+ return this.inputParams.push({
3766
+ key: "macd",
3767
+ params: [ t, e, r, {
3768
+ target: a
3769
+ } ]
3770
+ }), this;
3771
+ }
3772
+ }, {
3773
+ key: "bollingerBands",
3774
+ value: function() {
3775
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
3776
+ if (i(this), !r || "object" !== Ir(r)) throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');
3777
+ var n = r.target, o = void 0 === n ? "close" : n, a = r.height, u = void 0 !== a && a, l = r.range, c = void 0 === l ? [] : l, s = r.scale, f = void 0 === s ? null : s, h = r.lag, y = void 0 === h ? 0 : h, p = r.autoMinMax;
3778
+ // Validate size and times
3779
+ if ("number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in bollingerBands.');
3780
+ if ("number" != typeof e || e <= 0) throw new Error('"stdDev" must be a positive number in bollingerBands.');
3781
+ if (!Array.isArray(c)) throw new Error('If set, "range" must be a array of column names in bollingerBands.');
3782
+ if ("number" != typeof y) throw new Error('"lag" value in rsi must be a number in bollingerBands.');
3783
+ if ("boolean" != typeof p) throw new Error('"autoMinMax" value in rsi must be a number in bollingerBands.');
3784
+ if ("boolean" != typeof u) throw new Error('"height" must be a boolean in bollingerBands.');
3785
+ if ("number" == typeof f && !Nr.includes(f)) throw new Error('"scale" value in bollingerBands must be any of the following numbers: '.concat(Nr.join(", ")));
3786
+ return this.inputParams.push({
3787
+ key: "bollingerBands",
3788
+ params: [ t, e, {
3789
+ target: o,
3790
+ height: u,
3791
+ scale: f,
3792
+ range: c,
3793
+ lag: y,
3794
+ autoMinMax: p
3795
+ } ]
3796
+ }), this;
3797
+ }
3798
+ }, {
3799
+ key: "rsi",
3800
+ value: function(t) {
3801
+ var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3802
+ // Validate size and times
3803
+ if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in rsi.');
3804
+ var r = e.scale, n = void 0 === r ? null : r, o = e.target, a = void 0 === o ? "close" : o, u = e.lag, l = void 0 === u ? 0 : u, c = e.autoMinMax, s = void 0 !== c && c;
3805
+ if ("number" == typeof n && !Nr.includes(n)) throw new Error('"scale" value in rsi must be any of the following numbers: '.concat(Nr.join(", ")));
3806
+ if ("number" != typeof l) throw new Error('"lag" value in rsi must be a number in rsi.');
3807
+ if ("boolean" != typeof s) throw new Error('"autoMinMax" value in rsi must be a number in rsi.');
3808
+ return this.inputParams.push({
3809
+ key: "rsi",
3810
+ params: [ t, {
3811
+ scale: n,
3812
+ target: a,
3813
+ lag: l,
3814
+ autoMinMax: s
3815
+ } ]
3816
+ }), this;
3817
+ }
3818
+ }, {
3819
+ key: "donchianChannels",
3820
+ value: function() {
3821
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
3822
+ if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number greater than 0 in donchianChannels.');
3823
+ if ("number" != typeof e || e < 0) throw new Error('"offset" must be a number greater than or equal to 0 in donchianChannels.');
3824
+ var n = r.height, o = void 0 !== n && n, a = r.range, u = void 0 === a ? [] : a, l = r.scale, c = void 0 === l ? null : l, s = r.lag, f = void 0 === s ? 0 : s, h = r.autoMinMax, y = void 0 !== h && h;
3825
+ if (!Array.isArray(u)) throw new Error('If set, "range" must be an array of column names in donchianChannels.');
3826
+ if ("number" != typeof f) throw new Error('"lag" value in rsi must be a number in donchianChannels.');
3827
+ if ("boolean" != typeof y) throw new Error('"autoMinMax" value in rsi must be a number in donchianChannels.');
3828
+ if ("boolean" != typeof o) throw new Error('"height" must be a boolean in donchianChannels.');
3829
+ if ("number" == typeof c && !Nr.includes(c)) throw new Error('"scale" value in donchianChannels must be any of the following numbers: '.concat(Nr.join(", ")));
3830
+ return this.inputParams.push({
3831
+ key: "donchianChannels",
3832
+ params: [ t, e, {
3833
+ height: o,
3834
+ range: u,
3835
+ scale: c,
3836
+ lag: f,
3837
+ autoMinMax: y
3838
+ } ]
3839
+ }), this;
3840
+ }
3841
+ }, {
3842
+ key: "candleVectors",
3843
+ value: function() {
3844
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3845
+ if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number greater than 0 in candleVectors.');
3846
+ var r = e.stdDev, n = void 0 === r ? .5 : r, o = e.lag, a = void 0 === o ? 0 : o, u = e.scale, l = void 0 === u ? .05 : u, c = e.patternSize, s = void 0 === c ? 1 : c, f = e.autoMinMax, h = void 0 !== f && f;
3847
+ if ("number" != typeof n || n <= 0) throw new Error('"stdDev" must be a positive number greater than 0 in candleVectors.');
3848
+ if ("number" == typeof l && !Nr.includes(l)) throw new Error('"scale" value in candleVectors must be any of the following numbers: '.concat(Nr.join(", ")));
3849
+ if ("number" != typeof s || !Number.isInteger(s) || s < 1) throw new Error('"patternSize" value in candleVectors must be an integer greater than 0.');
3850
+ if ("boolean" != typeof h) throw new Error('"autoMinMax" value in candleVectors must be boolean');
3851
+ return this.inputParams.push({
3852
+ key: "candleVectors",
3853
+ params: [ t, {
3854
+ stdDev: n,
3855
+ patternSize: s,
3856
+ lag: a,
3857
+ scale: l,
3858
+ autoMinMax: h
3859
+ } ]
3860
+ }), this;
3861
+ }
3862
+ }, {
3863
+ key: "volumeOscillator",
3864
+ value: function() {
3865
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
3866
+ if (!1 === this.hasVolume) throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');
3867
+ if (i(this), "number" != typeof t || t <= 1) throw new Error('fastSize" must be a positive number greater than 1 in volumeOscillator.');
3868
+ if ("number" != typeof e || e <= t) throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');
3869
+ var n = r.scale, o = void 0 === n ? null : n;
3870
+ if ("number" == typeof o && !Nr.includes(o)) throw new Error('"scale" value in volumeOscillator must be any of the following numbers: '.concat(Nr.join(", ")));
3871
+ return this.inputParams.push({
3872
+ key: "volumeOscillator",
3873
+ params: [ t, e, {
3874
+ scale: o
3875
+ } ]
3876
+ }), this;
3877
+ }
3878
+ }, {
3879
+ key: "dateTime",
3880
+ value: function() {
3881
+ return i(this), this.inputParams.push({
3882
+ key: "dateTime",
3883
+ params: []
3884
+ }), this;
3885
+ }
3886
+ }, {
3887
+ key: "priceVariations",
3888
+ value: function() {
3889
+ return i(this), this.inputParams.push({
3890
+ key: "priceVariations",
3891
+ params: []
3892
+ }), this;
3893
+ }
3894
+ } ], e && Vr(t.prototype, e), r && Vr(t, r), Object.defineProperty(t, "prototype", {
3895
+ writable: !1
3896
+ }), t;
3897
+ var t, e, r;
3898
+ }();
3899
+ })(), OHLCV_INDICATORS = e;
3900
+ })
3901
+ /******/ ();