ohlcv-indicators 3.5.61 → 3.5.63
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.
- package/dist/ohlcv-indicators.min.js +1 -1
- package/index.js +7 -42
- package/package.json +1 -1
- package/src/machine-learning/ml-utilities.js +0 -8
- package/src/machine-learning/scaler.js +1 -1
- package/src/oscillators/rsi.js +5 -17
- package/src/oscillators/stochastic.js +6 -19
- package/src/utilities/dateUtilities.js +5 -1
|
@@ -1 +1 @@
|
|
|
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={};(()=>{t.r(e),t.d(e,{default:()=>Wr});var r=function(t,e,r){if(0===r.length)return!1;for(var n=t.verticalOhlcv,o=!0,i=0;i<r.length;i++){var a=r[i];if(!n.hasOwnProperty(a)){o=!1;break}var u=n[a][e];if(null==u||Number.isNaN(u)){o=!1;break}}return o};function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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 o(t,e){if(t){if("string"==typeof t)return i(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)?i(t,e):void 0}}function i(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 a=function(t,e){if(!Array.isArray(t))throw new Error('Property "inputParams" must be an "Array" or "Set".');var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i,a=n(r.value.params);try{for(a.s();!(i=a.n()).done;){var u=i.value;if("number"==typeof u&&u>e)throw console.log(u,e),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){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}},u=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},l=function(t,e,r){if(!Array.isArray(t))throw new Error('Param "'.concat(e,'" must be an array in "').concat(r,'".'));return!0},c=function(t,e,r){if(t instanceof Object==0)throw new Error('Param "'.concat(e,'" must be an object in "').concat(r,'".'));return!0},s=function(t,e,r,n){if(l(t,"arrayOptions","".concat(n,".").concat(r,".validateArrayOptions")),!t.includes(e.toString()))throw new Error('Param "'.concat(r,'" must be any of the following values [').concat(t.join(", "),'] in "').concat(n,'".'));return!0},f=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},y=function(t,e,r,n){c(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,u=e.max,l=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an ').concat(l,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==u&&"number"!=typeof u)throw new Error('Param "max" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&void 0!==u&&a>=u)throw new Error('Param "min" must be less than "max" in "'.concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&t<a)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==u&&t>u)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≤ ").concat(u,' in "').concat(n,'".'));return!0},p=function(t,e,r){if(l(t,e,r),2!==t.length)throw new Error('Invalid "'.concat(e,'" array length: expected 2 items, but got ').concat(t.length,' in "').concat(r,".").concat(e,'".'));var n,i,a=(i=2,function(t){if(Array.isArray(t))return t}(n=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}}(n,i)||o(n,i)||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.")}()),u=a[0],c=a[1];if(y(u,{min:-100,max:c,allowDecimals:!1},"".concat(e,"[0] (min)"),r),y(c,{min:u,max:100,allowDecimals:!1},"".concat(e,"[1] (max)"),r),u===c)throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(r,".").concat(e,'".'));return!0},h=function(t,e,r){if("string"!=typeof t||!t.length)throw new Error('Invalid "'.concat(e,'" property in "').concat(r,'". Only strings are accepted.'));return!0},v=1e6,m="[big.js] ",d=m+"Invalid ",b=d+"decimal places",g=d+"rounding mode",w=m+"Division by zero",O={},S=void 0,j=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function N(t,e,r,n){var o=t.c;if(r===S&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(g);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]!==S))),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]!==S||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 _(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 P(t){return P="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},P(t)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=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(x())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&k(o,r.prototype),o}(t,arguments,T(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),k(r,t)},A(t)}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(x=function(){return!!t})()}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},k(t,e)}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}O.abs=function(){var t=new this.constructor(this);return t.s=1,t},O.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},O.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,a=r.DP;if(a!==~~a||a<0||a>v)throw Error(b);if(!o[0])throw Error(w);if(!n[0])return t.s=i,t.c=[t.e=0],t;var u,l,c,s,f,y=o.slice(),p=u=o.length,h=n.length,m=n.slice(0,u),d=m.length,g=t,O=g.c=[],j=0,_=a+(g.e=e.e-t.e)+1;for(g.s=i,i=_<0?0:_,y.unshift(0);d++<u;)m.push(0);do{for(c=0;c<10;c++){if(u!=(d=m.length))s=u>d?1:-1;else for(f=-1,s=0;++f<u;)if(o[f]!=m[f]){s=o[f]>m[f]?1:-1;break}if(!(s<0))break;for(l=d==u?o:y;d;){if(m[--d]<l[d]){for(f=d;f&&!m[--f];)m[f]=9;--m[f],m[d]+=10}m[d]-=l[d]}for(;!m[0];)m.shift()}O[j++]=s?c:++c,m[0]&&s?m[d]=n[p]||0:m=[n[p]]}while((p++<h||m[0]!==S)&&i--);return O[0]||1==j||(O.shift(),g.e--,_--),j>_&&N(g,_,r.RM,m[0]!==S),g},O.eq=function(t){return 0===this.cmp(t)},O.gt=function(t){return this.cmp(t)>0},O.gte=function(t){return this.cmp(t)>-1},O.lt=function(t){return this.cmp(t)<0},O.lte=function(t){return this.cmp(t)<1},O.minus=O.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,y=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-y){for((o=u<0)?(u=-u,n=c):(y=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(),--y;return c[0]||(t.s=1,c=[y=0]),t.c=c,t.e=y,t},O.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(w);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)))},O.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},O.plus=O.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},O.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(d+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},O.prec=function(t,e){if(t!==~~t||t<1||t>v)throw Error(d+"precision");return N(new this.constructor(this),t,e)},O.round=function(t,e){if(t===S)t=0;else if(t!==~~t||t<-v||t>v)throw Error(b);return N(new this.constructor(this),t+this.e+1,e)},O.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,u=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(m+"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=u.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return N(t,(o.DP-=4)+t.e+1,o.RM)},O.times=O.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},O.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(r=N(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return _(r,!0,!!n)},O.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(t=t+(r=N(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return _(r,!1,!!n)},O[Symbol.for("nodejs.util.inspect.custom")]=O.toJSON=O.toString=function(){var t=this,e=t.constructor;return _(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},O.toNumber=function(){var t=Number(_(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(m+"Imprecise conversion");return t},O.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==S){if(t!==~~t||t<1||t>v)throw Error(d+"precision");for(r=N(new n(r),t,e);r.c.length<t;)r.c.push(0)}return _(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},O.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(m+"valueOf disallowed");return _(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===S?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(d+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!j.test(e))throw Error(d+"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=O,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 E=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=T(e),function(t,e){if(e&&("object"==P(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,x()?Reflect.construct(e,r||[],T(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&&k(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(A(Error));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 I(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,R(n.key),n)}}function D(t,e,r){return(e=R(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:e+""}var C=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),D(this,"previousHighest",void 0),D(this,"highest",void 0),D(this,"previousLowest",void 0),D(this,"lowest",void 0),D(this,"previousResult",void 0),D(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 E;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)}}])&&I(t.prototype,e),r&&I(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function F(t){return F="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},F(t)}function B(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,L(n.key),n)}}function U(t,e,r){return e=H(e),function(t,e){if(e&&("object"==F(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,V()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},q(t,e)}function L(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}var $=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=U(this,e),i=void 0,(o=L(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&&q(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)}}])&&B(r.prototype,n),o&&B(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 z(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 G(t,e,r){return e=J(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,Y()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function Y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Y=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 Z(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 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=G(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&&W(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&&z(r.prototype,n),o&&z(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function X(t){return X="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},X(t)}function tt(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 et(t,e,r){return e=nt(e),function(t,e){if(e&&("object"==X(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,rt()?Reflect.construct(e,r||[],nt(t).constructor):e.apply(t,r))}function rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rt=function(){return!!t})()}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}function it(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"!=X(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}var ut=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),it(r=et(this,e),"interval",void 0),it(r,"indicator",void 0),it(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&&ot(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&&tt(r.prototype,n),o&&tt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function lt(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function ct(t){return ct="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},ct(t)}function st(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 ft(t,e,r){return e=pt(e),function(t,e){if(e&&("object"==ct(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,yt()?Reflect.construct(e,r||[],pt(t).constructor):e.apply(t,r))}function yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yt=function(){return!!t})()}function pt(t){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pt(t)}function ht(t,e){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ht(t,e)}function vt(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"!=ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:e+""}var dt=function(t){function e(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return vt(t=ft(this,e,[].concat(n)),"previousCandle",void 0),vt(t,"twoPreviousCandle",void 0),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&&ht(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.high,n=t.low,o=r-n;if(this.previousCandle&&e&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){var i=Math.abs(r-this.previousCandle.close),a=Math.abs(n-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(Math.max(o,i,a),e)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(o,e)}}],n&&st(r.prototype,n),o&&st(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function bt(t){return bt="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},bt(t)}function gt(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,_t(n.key),n)}}function wt(t,e,r){return e=St(e),function(t,e){if(e&&("object"==bt(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||[],St(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 St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function Nt(t,e,r){return(e=_t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _t(t){var e=function(t,e){if("object"!=bt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bt(e)?e:e+""}var Pt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Nt(r=wt(this,e),"interval",void 0),Nt(r,"tr",void 0),Nt(r,"smoothing",void 0),r.interval=t,r.tr=new dt,r.smoothing=new n(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&&jt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.tr.update(t,e);if(this.smoothing.update(r,e),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),e)}}],n&>(r.prototype,n),o&>(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function At(t){return At="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},At(t)}function xt(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,Tt(n.key),n)}}function kt(t,e,r){return(e=Tt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==At(e)?e:e+""}var Et=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),kt(this,"interval",void 0),kt(this,"deviationMultiplier",void 0),kt(this,"prices",[]),kt(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=lt(this.prices),r=function(t,e){var r=e||lt(t),n=lt(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 E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();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 It(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,Ut(n.key),n)}}function Dt(t,e,r){return e=Ct(e),function(t,e){if(e&&("object"==Mt(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,Rt()?Reflect.construct(e,r||[],Ct(t).constructor):e.apply(t,r))}function Rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rt=function(){return!!t})()}function Ct(t){return Ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ct(t)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(t,e)}function Bt(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ut(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+""}var Vt=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),Bt(r=Dt(this,e,[t]),"interval",void 0),Bt(r,"pricesCounter",0),Bt(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&&Ft(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 E;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&It(r.prototype,n),o&&It(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function Ht(t){return Ht="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},Ht(t)}function qt(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,$t(n.key),n)}}function Lt(t,e,r){return(e=$t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $t(t){var e=function(t,e){if("object"!=Ht(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ht(e)?e:e+""}var Kt=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),Lt(this,"short",void 0),Lt(this,"long",void 0),Lt(this,"signal",void 0),Lt(this,"prices",[]),Lt(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 E;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&&qt(t.prototype,e),r&&qt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function zt(t){return zt="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},zt(t)}function Gt(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,Xt(n.key),n)}}function Yt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"==zt(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,Jt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Jt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function Qt(t,e,r){return(e=Xt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xt(t){var e=function(t,e){if("object"!=zt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zt(e)?e:e+""}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qt(r=Yt(this,e),"interval",void 0),Qt(r,"previousPrices",[]),Qt(r,"avgGain",void 0),Qt(r,"avgLoss",void 0),Qt(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&&Zt(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&&Gt(r.prototype,n),o&&Gt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 re(t){return function(t){if(Array.isArray(t))return ne(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 ne(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)?ne(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 ne(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 oe(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,ae(n.key),n)}}function ie(t,e,r){return(e=ae(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(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 ue=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),ie(this,"n",void 0),ie(this,"m",void 0),ie(this,"p",void 0),ie(this,"candles",[]),ie(this,"result",void 0),ie(this,"periodM",void 0),ie(this,"periodP",void 0),this.n=e,this.m=r,this.p=n,this.periodM=new Q(r),this.periodP=new Q(n)},(e=[{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){if(this.candles.push(t),this.candles.length>this.n&&this.candles.shift(),this.candles.length===this.n){var e=Math.max.apply(Math,re(this.candles.map((function(t){return t.high})))),r=Math.min.apply(Math,re(this.candles.map((function(t){return t.low})))),n=e-r,o=100*(t.close-r);o/=0===n?1:n;var i=this.periodM.update(o),a=i&&this.periodP.update(i);if(void 0!==i&&void 0!==a)return this.result={stochD:a,stochK:i}}}}])&&oe(t.prototype,e),r&&oe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function le(t){return le="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},le(t)}function ce(t){return function(t){if(Array.isArray(t))return se(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 se(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)?se(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 se(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 fe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(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 ye="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},ye(t)}function pe(t){return function(t){if(Array.isArray(t))return he(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 he(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)?he(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 he(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 ve(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=ye(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ye(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var me={ema:Vt,sma:Q},de=function(t,e,r,n,o){var i=o.target,a=o.lag,u=t.verticalOhlcv,l=t.instances,c=t.priceBased,s="close"!==i?"_".concat(i):"",f="".concat(r,"_").concat(n).concat(s);if(0===e){var y=t.len;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));l[f]=new me[r](n),u[f]=new Float64Array(y).fill(NaN),c.has(i)&&c.add(f),a>0&&t.lag([f],a)}var p=u[i][e],h=l[f];h.update(p);var v=NaN;try{v=h.getResult()}catch(t){}return t.pushToMain({index:e,key:f,value:v}),!0};function be(t){return be="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},be(t)}function ge(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 we(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=be(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==be(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oe(t,e){if(t){if("string"==typeof t)return Se(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)?Se(t,e):void 0}}function Se(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 function(t){if(Array.isArray(t))return Ne(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 Ne(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)?Ne(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 Ne(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 _e(t){return _e="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},_e(t)}function Pe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=_e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=_e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_e(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}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}var xe="close";function ke(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)||Ee(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 Te(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ee(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 Ee(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}function Ie(t){return Ie="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},Ie(t)}function De(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 Re(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ce(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 Fe(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)?Fe(t,e):void 0}}(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 Fe(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="close";function Ue(t){return Ue="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},Ue(t)}function Ve(t){return Ve="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},Ve(t)}function He(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 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}}(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 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 Le=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=He((r?t.slice(1):t).split("."),2),o=n[0],i=n[1],a=void 0===i?"":i,u=String(e),l=1===e?0:u.length-1,c=a.padEnd(l,"0").slice(0,l),s=parseInt(o+c||"0",10);return r&&(s=-s),s};function $e(t){return $e="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},$e(t)}var Ke={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return Le(t,e)}},ze=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof t&&!Number.isNaN(t),o="string"==typeof t&&/^-?\d+(\.\d+)?$/.test(t);if(!0===r){if(o)return"precisionNumberCleanString";if(e)throw new Error("Invalid number forma");return $e(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return $e(t)};function Ge(t){return Ge="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},Ge(t)}var Ye={string:function(t){return t.toString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},Je={dateObject:function(t){return t},dateMilliseconds:function(t){return new Date(t)},dateSeconds:function(t){return new Date(1e3*t)},dateIncompleteDayString:function(t){return new Date("".concat(t," 00:00:00"))},dateCompleteDateString:function(t){return new Date(t)}},We=function(t){var e=["Date -> object","Milliseconds Timestamp -> integer","Seconds Timestamp -> integer","UTC Time Format (ISO 8601) -> string","Including a Timezone Offset (ISO 8601) -> string","Local Time Format (ISO 8601) -> string","YYYY/MM/DD or YYYY-MM-DD -> string"],r=function(){throw new Error('Invalid "'.concat(Ge(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===Ge(t)){if(t instanceof Date&&!isNaN(t.valueOf()))return"dateObject";r()}else{if("number"==typeof t)return Math.abs(t)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)&&t.length>10||/^\d{4}\/\d{2}\/\d{2}$/.test(t))return"dateCompleteDateString";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return"dateIncompleteDayString";r()}else r()}};function Ze(t){return Ze="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},Ze(t)}function Qe(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 Xe(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)?Xe(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 Xe(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 tr=function(t,e,r){var n,o={Array,Float64Array,Float32Array,Int32Array,Uint8Array,Int8Array,Int16Array}[t];if(!o||"function"!=typeof o.from)throw new Error("Unsupported array type: ".concat(t));return n=void 0!==r?r:"Array"===t?null:NaN,o.from({length:e},(function(){return n}))},er=function(t,e){if(!e||"object"!==Ze(e))throw new TypeError('Invalid array type: "'.concat(t,'"'));return e.constructor.name};function rr(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 nr(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)?nr(t,e):void 0}}(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 nr(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 or(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 ir=function(t,e){var r=new Uint8Array(e);return r[t]=1,r},ar=function(t,e,r,n){var o,i,a=(i=2,function(t){if(Array.isArray(t))return t}(o=n)||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}}(o,i)||function(t,e){if(t){if("string"==typeof t)return or(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)?or(t,e):void 0}}(o,i)||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.")}()),u=a[0],l=a[1];return(Math.min(Math.max(t,e),r)-e)/(r-e)*(l-u)+u},ur=function(t,e,r){return 0===r?0:(t-e)/r};function lr(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 cr(t){return cr="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},cr(t)}function sr(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,fr(n.key),n)}}function fr(t){var e=function(t,e){if("object"!=cr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cr(e)?e:e+""}var yr=function(t,e){return t>e},pr=function(t,e){return t<e},hr=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:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t,e){var r=e.fast,n=e.high,o=e.slow,i=e.low,a=this.prevState;this.areHighAndLowUndefined||void 0!==n&&void 0!==i||(this.areHighAndLowUndefined=!0),Number.isNaN(r)||Number.isNaN(o)||function(t,e){return t===e}(r,o)?a=.5:yr(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&pr(i,o)&&yr(this.prevLow,this.prevSlow)?0:1:pr(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&yr(n,o)&&pr(this.prevHigh,this.prevSlow)?1:0),.5===a?this.interval=0:1===a?this.prevState<=.5?this.interval=1:this.interval++:0===a&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(t),-1===this.interval&&this.crossIndexes.down.push(t),Object.assign(this,{prevState:a,prevFast:r,prevSlow:o,prevHigh:n,prevLow:i})}},{key:"getResult",value:function(){return this.interval}}])&&sr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function vr(t){return vr="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},vr(t)}function mr(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)||wr(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 dr(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 br(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?dr(Object(r),!0).forEach((function(e){gr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function gr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=vr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wr(t,e){if(t){if("string"==typeof t)return Or(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)?Or(t,e):void 0}}function Or(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 Sr(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)||Nr(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 jr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Nr(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 Nr(t,e){if(t){if("string"==typeof t)return _r(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)?_r(t,e):void 0}}function _r(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 Pr=function(t){return null==t||!Number.isFinite(t)};function Ar(t,e){if(t){if("string"==typeof t)return xr(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)?xr(t,e):void 0}}function xr(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 kr=function(t){var e=t.main,r=t.index,n=e.verticalOhlcv,o=n.close[r],i=n.open[r-1];return{change:(o-i)/i*100}};function Tr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Er(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 Er(t,e){if(t){if("string"==typeof t)return Mr(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)?Mr(t,e):void 0}}function Mr(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 Ir=function(t,e){return(t-e)/e};function Dr(t){return function(t){if(Array.isArray(t))return Br(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fr(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 Rr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Fr(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 Cr(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)||Fr(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 Fr(t,e){if(t){if("string"==typeof t)return Br(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)?Br(t,e):void 0}}function Br(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 Ur={priceFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=t.verticalOhlcv;if(0===e){var a,u=t.len,l={ret_change:new Float64Array(u).fill(NaN),ret_upper_wick:new Float64Array(u).fill(NaN),ret_lower_wick:new Float64Array(u).fill(NaN),ret_gap:new Float64Array(u).fill(NaN),ret_body:new Float64Array(u).fill(NaN),ret_range:new Float64Array(u).fill(NaN)},c=Tr(o);try{for(c.s();!(a=c.n()).done;){var s=a.value;if(!i.hasOwnProperty(s))throw new Error("Target property ".concat(s,' not found in verticalOhlcv for "priceFeatures".'));l["ret_".concat(s)]=new Float64Array(u).fill(NaN)}}catch(t){c.e(t)}finally{c.f()}Object.assign(i,l),n&&t.lag(Object.keys(l),n)}var f,y,p=i.close[e-1];if(void 0!==p){var h,v,m=i.open[e],d=i.high[e],b=i.low[e],g=i.close[e],w=Math.max(m,g),O=Math.min(m,g),S={ret_change:Ir(g,p),ret_upper_wick:Ir(d,w),ret_lower_wick:Ir(O,b),ret_gap:Ir(m,p),ret_body:Ir(g,m),ret_range:Ir(d,b)},j=!1,N=Tr(o);try{for(N.s();!(h=N.n()).done;){var _=h.value,P=i[_][e];if(null==(v=P)||!Number.isFinite(v)){j=!0;break}var A=Ir(g,P);S["ret_".concat(_)]=A}}catch(t){N.e(t)}finally{N.f()}if(!j)for(var x=0,k=Object.entries(S);x<k.length;x++){var T=(f=k[x],y=2,function(t){if(Array.isArray(t))return t}(f)||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}}(f,y)||Er(f,y)||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.")}()),E=T[0],M=T[1];t.pushToMain({index:e,key:E,value:M})}}},dateTime:function(t,e,r){var n,o=r.lag,i=r.oneHot,a=r.precompute,u=t.instances,l=t.verticalOhlcv,c=a.prefix;if(0===e){var s=t.len;if(!t.dateType)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(u,{dateTime:{colKeys:[].concat((n=a.colKeys,function(t){if(Array.isArray(t))return Or(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||wr(n)||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.")}()),["".concat(c,"year")]),colKeySizes:br({},a.colKeySizes)}});var f,y=u.dateTime.colKeys,p=i?Array:Int16Array,h=i?null:NaN,v=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=wr(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}}}}(y);try{for(v.s();!(f=v.n()).done;)l[f.value]=new p(s).fill(h)}catch(t){v.e(t)}finally{v.f()}o>0&&t.lag(y,o)}for(var m=u.dateTime.colKeySizes,d=function(t,e,r){var n=t.getFullYear(),o=t.getMonth(),i=t.getHours(),a=t.getMinutes(),u=t.getDay(),l=t.getDate()-1;return e?{one_hot_month:ir(o,r.one_hot_month),one_hot_hour:ir(i,r.one_hot_hour),one_hot_minute:ir(a,r.one_hot_minute),one_hot_day_of_the_week:ir(u,r.one_hot_day_of_the_week),one_hot_day_of_the_month:ir(l,r.one_hot_day_of_the_month)}:{year:n,month:o+1,hour:i,minute:a,day_of_the_week:(u+6)%7+1,day_of_the_month:l+1}}(l.date[e],i,m),b=0,g=Object.entries(d);b<g.length;b++){var w=mr(g[b],2),O=w[0],S=w[1];t.pushToMain({index:e,key:O,value:S})}},heikenAshi:function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i.lag,u=void 0===a?0:a,l=i.bothNull,c=void 0!==l&&l,s=t.verticalOhlcv,f=t.instances,y=t.len,p=t.priceBased,h=c?"heiken_ashi":"heiken_ashi_".concat(r,"_").concat(n),v=["open","high","low","close"];if(0===e){f[h]={emaPre:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(r)]}))),emaPost:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,isTrendUp:!1};var m,d=v.map((function(t){return"".concat(h,"_").concat(t)})),b=Object.fromEntries([].concat((o=d,function(t){if(Array.isArray(t))return Se(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||Oe(o)||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.")}()),["".concat(h,"_cross")]).map((function(t){return[t,new Float64Array(y).fill(NaN)]}))),g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Oe(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}}}}(d);try{for(g.s();!(m=g.n()).done;){var w=m.value;p.add(w)}}catch(t){g.e(t)}finally{g.f()}Object.assign(s,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ge(Object(r),!0).forEach((function(e){we(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},b)),u>0&&t.lag(d,u)}var O,S,j,N,_=s.open[e],P=s.high[e],A=s.low[e],x=s.close[e],k=f[h];if(c)O=_,S=P,j=A,N=x;else{k.emaPre.open.update(_),k.emaPre.high.update(P),k.emaPre.low.update(A),k.emaPre.close.update(x);try{O=k.emaPre.open.getResult(),S=k.emaPre.high.getResult(),j=k.emaPre.low.getResult(),N=k.emaPre.close.getResult()}catch(t){return!0}}var T,E,M,I,D=(O+S+j+N)/4,R=Number.isNaN(k.prevHaOpen)||Number.isNaN(k.prevHaClose)?(O+N)/2:(k.prevHaOpen+k.prevHaClose)/2,C=Math.max(S,R,D),F=Math.min(j,R,D);if(k.prevHaOpen=R,k.prevHaClose=D,c)T=R,E=C,M=F,I=D;else{k.emaPost.open.update(R),k.emaPost.high.update(C),k.emaPost.low.update(F),k.emaPost.close.update(D);try{T=k.emaPost.open.getResult(),E=k.emaPost.high.getResult(),M=k.emaPost.low.getResult(),I=k.emaPost.close.getResult()}catch(t){return!0}}var B=e>0?s["".concat(h,"_cross")][e-1]:0,U=e>0?s["".concat(h,"_open")][e-1]:NaN,V=e>0?s["".concat(h,"_close")][e-1]:NaN,H=!Number.isNaN(V)&&V<=U&&I>T,q=!Number.isNaN(V)&&V>=U&&I<T;H&&(k.isTrendUp=!0),q&&(k.isTrendUp=!1);var L=0;return e>0&&(L=k.isTrendUp?B>0?B+1:1:B<0?B-1:-1),t.pushToMain({index:e,key:"".concat(h,"_open"),value:T}),t.pushToMain({index:e,key:"".concat(h,"_high"),value:E}),t.pushToMain({index:e,key:"".concat(h,"_low"),value:M}),t.pushToMain({index:e,key:"".concat(h,"_close"),value:I}),t.pushToMain({index:e,key:"".concat(h,"_cross"),value:L}),!0},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=n.parser,u=n.prefix,l=n.minmax,c=t.verticalOhlcv,s=t.instances,f="close"===o?"":"_".concat(o),y="".concat(u,"rsi_").concat(r).concat(f),p="".concat(u,"rsi_sma_").concat(r).concat(f);if(0===e){var h=t.len;if(!c.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(s,fe(fe({},y,new te(r)),p,new Q(r))),Object.assign(c,fe(fe({},y,new Float64Array(h).fill(NaN)),p,new Float64Array(h).fill(NaN)));var v=[y,p];i>0&&t.lag(v,i);var m=i>0?v.flatMap((function(t){return[t].concat(ce(Array.from({length:i},(function(e,r){return"".concat(t,"_lag_").concat(r+1)}))))})):v;if(Array.isArray(l)){var d,b,g=null!==(b=(d=t.scaledGroups).minmax_rsi)&&void 0!==b?b:d.minmax_rsi=[];g.push.apply(g,ce(m))}}var w=c[o][e],O=NaN,S=NaN;s[y].update(w);try{O=s[y].getResult()}catch(t){O=NaN}t.pushToMain({index:e,key:y,value:Number.isNaN(O)?NaN:a(O)}),Number.isNaN(O)||s[p].update(O);try{S=s[p].getResult()}catch(t){S=NaN}t.pushToMain({index:e,key:p,value:Number.isNaN(S)?NaN:a(S)})},stochastic:function(t,e,r,n,o,i){var a=i.minmax,u=i.prefix,l=i.lag,c=i.parser,s=t.verticalOhlcv,f=t.instances,y=14===r&&3===n&&3===o?"":"".concat(r,"_").concat(n,"_").concat(o),p="".concat(u,"stoch_d").concat(y),h="".concat(u,"stoch_k").concat(y),v="".concat(u).concat(y);if(0===e){var m=t.len;Object.assign(f,ve({},v,new ue(r,n,o))),Object.assign(s,ve(ve({},p,new Float64Array(m).fill(NaN)),h,new Float64Array(m).fill(NaN)));var d=[p,h];l>0&&t.lag(d,l);var b=l>0?d.flatMap((function(t){return[t].concat(pe(Array.from({length:l},(function(e,r){return"".concat(t,"_lag_").concat(r+1)}))))})):d;if(Array.isArray(a)){var g,w,O=null!==(w=(g=t.scaledGroups).minmax_rsi)&&void 0!==w?w:g.minmax_rsi=[];O.push.apply(O,pe(b))}}var S=s.close[e],j=s.low[e],N=s.high[e],_=null;f[v].update({close:S,low:j,high:N});try{_=f[v].getResult()}catch(t){_=null}var P=_?c(_.stochK):NaN,A=_?c(_.stochD):NaN;t.pushToMain({index:e,key:h,value:P}),t.pushToMain({index:e,key:p,value:A})},atr:function(t,e,r,n){var o=n.lag,i=n.percentage,a=n.upper,u=n.lower,l=t.verticalOhlcv,c=t.instances,s=t.priceBased,f="atr_".concat(r);if(0===e){var y=t.instances,p=t.verticalOhlcv,h=t.len;y[f]=new Pt(r,ut);var v=[f];i&&v.push("".concat(f,"_percentage")),null!==a&&v.push("".concat(f,"_upper")),null!==u&&v.push("".concat(f,"_lower"));for(var m=0,d=v;m<d.length;m++){var b=d[m];p[b]=new Float64Array(h).fill(NaN),s.add(b)}o>0&&t.lag(v,o)}var g={high:l.high[e],low:l.low[e],close:l.close[e]},w=c[f];w.update(g);var O=NaN;try{O=w.getResult()}catch(t){}if(i){var S=Number.isNaN(O)?NaN:O/g.close;t.pushToMain({index:e,key:"".concat(f,"_percentage"),value:S})}if(null!==a){var j=Number.isNaN(O)?NaN:g.close+O*a;t.pushToMain({index:e,key:"".concat(f,"_upper"),value:j})}if(null!==u){var N=Number.isNaN(O)?NaN:g.close-O*u;t.pushToMain({index:e,key:"".concat(f,"_lower"),value:N})}return t.pushToMain({index:e,key:f,value:O}),!0},ema:de,sma:de,vidya:function(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.priceBased,c=o.target,s=o.lag,f=o.atrLength,y=void 0===f?200:f,p=o.bandDistance,h=void 0===p?2:p,v=o.liquidityLookback,m=void 0===v?5:v,d="".concat(r,"_").concat(n);if(0===e){if(!(c in i))throw new Error('VIDYA could not find target "'.concat(c,'"'));for(var b="vidya_".concat(d),g="close"===c?b:"".concat(b,"_").concat(c),w={vidya:g,upper:"".concat(b,"_upper"),lower:"".concat(b,"_lower"),delta_vol:"".concat(b,"_delta_vol"),cross:"".concat(b,"_cross"),liquidity:"".concat(b,"_liquidity")},O=0,S=[g,w.upper,w.lower,w.liquidity];O<S.length;O++){var j=S[O];l.add(j)}a.vidya||(a.vidya={settings:{}}),a.vidya.settings[d]={momentumBuffer:[],prevVidya:NaN,sma:new Q(15),atrBuffer:[],isTrendUp:!1,upVol:0,downVol:0,liquidity:{high:[],low:[]}},Object.values(w).forEach((function(t){i[t]=new Float64Array(u).fill(NaN)})),s>0&&t.lag(Object.values(w),s)}var N=a.vidya.settings[d],_="vidya_".concat(d),P={vidya:"close"===c?_:"".concat(_,"_").concat(c),upper:"".concat(_,"_upper"),lower:"".concat(_,"_lower"),delta_vol:"".concat(_,"_delta_vol"),cross:"".concat(_,"_cross"),liquidity:"".concat(_,"_liquidity")},A=i[c][e],x=i.high[e],k=i.low[e],T=i.close[e],E=i.open[e],M=i.volume[e],I=e>0?i[P.cross][e-1]:0,D=N.liquidity.high.length===m?Math.max.apply(Math,je(N.liquidity.high)):NaN,R=N.liquidity.low.length===m?Math.min.apply(Math,je(N.liquidity.low)):NaN;if(e>0){var C=i.close[e-1],F=Math.max(x-k,Math.abs(x-C),Math.abs(k-C));N.atrBuffer.push(F),N.atrBuffer.length>y&&N.atrBuffer.shift()}var B=N.atrBuffer.length===y?N.atrBuffer.reduce((function(t,e){return t+e}),0)/y:NaN,U=NaN,V=NaN;if(e>0&&(V=A-i[c][e-1]),N.momentumBuffer.push(V),N.momentumBuffer.length>n&&N.momentumBuffer.shift(),N.momentumBuffer.length===n){var H=0,q=0;N.momentumBuffer.forEach((function(t){return t>=0?H+=t:q+=-t}));var L=H+q,$=2/(r+1)*((0===L?0:100*Math.abs((H-q)/L))/100);U=isNaN(N.prevVidya)?A:$*A+(1-$)*N.prevVidya,N.prevVidya=U}N.sma.update(U);var K=NaN;try{K=N.sma.getResult()}catch(t){}var z=isNaN(B)||isNaN(K)?NaN:K+B*h,G=isNaN(B)||isNaN(K)?NaN:K-B*h,Y=e>0?i[c][e-1]:NaN,J=e>0?i[P.upper][e-1]:NaN,W=e>0?i[P.lower][e-1]:NaN,Z=e>0&&Y<=J&&A>z,X=e>0&&Y>=W&&A<G;Z&&(N.isTrendUp=!0),X&&(N.isTrendUp=!1);var tt=0;e>0&&(tt=N.isTrendUp?I>0?I+1:1:I<0?I-1:-1),Z||X?N.upVol=N.downVol=0:(N.upVol+=T>E?M:0,N.downVol+=T<E?M:0);var et=(N.upVol+N.downVol)/2||1,rt=(N.upVol-N.downVol)/et,nt=N.isTrendUp?G:z,ot=NaN;return tt>0?ot=R:tt<0&&(ot=D),t.pushToMain({index:e,key:P.vidya,value:nt}),t.pushToMain({index:e,key:P.upper,value:z}),t.pushToMain({index:e,key:P.lower,value:G}),t.pushToMain({index:e,key:P.delta_vol,value:rt}),t.pushToMain({index:e,key:P.cross,value:tt}),t.pushToMain({index:e,key:P.liquidity,value:ot}),N.liquidity.high.push(x),N.liquidity.low.push(k),N.liquidity.high.length>m&&N.liquidity.high.shift(),N.liquidity.low.length>m&&N.liquidity.low.shift(),!0},macd:function(t,e,r,n,o,i){var a=i.target,u=i.lag,l=i.precomputed,c=t.verticalOhlcv,s=t.instances,f=t.priceBased,y=l.instanceKey;if(0===e){var p=t.inputParams,h=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var v,m=0,d=function(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 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}}(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}}}}(p);try{for(d.s();!(v=d.n()).done;)"macd"===v.value.key&&m++}catch(t){d.e(t)}finally{d.f()}var b=m>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",g=a===xe?"".concat(b,"_diff"):"".concat(b,"_diff_").concat(a),w=a===xe?"".concat(b,"_dea"):"".concat(b,"_dea_").concat(a),O=a===xe?"".concat(b,"_histogram"):"".concat(b,"_histogram_").concat(a);s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:m,settings:{}}),s.macd.settings[y]=new Kt(new Vt(r),new Vt(n),new Vt(o)),Object.assign(c,Pe(Pe(Pe({},g,new Float64Array(h).fill(NaN)),w,new Float64Array(h).fill(NaN)),O,new Float64Array(h).fill(NaN)));for(var S=[g,w,O],j=0,N=S;j<N.length;j++){var _=N[j];f.add(_)}u>0&&t.lag(S,u)}var P=s.macd,A=P.numberOfIndicators,x=P.settings,k=A>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",T=a===xe?"".concat(k,"_diff"):"".concat(k,"_diff_").concat(a),E=a===xe?"".concat(k,"_dea"):"".concat(k,"_dea_").concat(a),M=a===xe?"".concat(k,"_histogram"):"".concat(k,"_histogram_").concat(a),I=x[y],D=c[a][e];I.update(D);var R={};try{R=I.getResult()}catch(t){}return t.pushToMain({index:e,key:T,value:R?R.macd:NaN}),t.pushToMain({index:e,key:E,value:R?R.signal:NaN}),t.pushToMain({index:e,key:M,value:R?R.histogram:NaN}),!0},volumeDelta:function(t,e,r){var n=r.lag,o=void 0===n?0:n,i=t.verticalOhlcv,a=t.instances,u=t.len,l="volume_delta";if(0===e){a[l]||(a[l]={isBuyVolume:!0,cross:0});for(var c=["".concat(l,"_open"),"".concat(l,"_high"),"".concat(l,"_low"),"".concat(l,"_close"),"".concat(l,"_cross")],s=0,f=c;s<f.length;s++)i[f[s]]=new Float64Array(u).fill(NaN);o>0&&t.lag(c,o)}var y=a[l],p=i.volume[e],h=i.open[e],v=i.close[e],m=e>0?i.close[e-1]:NaN,d=y.isBuyVolume;v>h?d=!0:v<h?d=!1:v>m?d=!0:v<m&&(d=!1),y.isBuyVolume=d,e<1?y.cross=d?1:-1:d?y.cross>0?y.cross=y.cross+1:y.cross=1:y.cross>0?y.cross=-1:y.cross=y.cross-1;var b=Number.isFinite(p)?d?p:-p:NaN,g=Number.isNaN(b)?NaN:0,w=b,O=Number.isNaN(b)?NaN:Math.max(b,0),S=Number.isNaN(b)?NaN:Math.min(b,0);return t.pushToMain({index:e,key:"".concat(l,"_open"),value:g}),t.pushToMain({index:e,key:"".concat(l,"_high"),value:O}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:S}),t.pushToMain({index:e,key:"".concat(l,"_close"),value:w}),t.pushToMain({index:e,key:"".concat(l,"_cross"),value:y.cross}),!0},relativeVolume:function(t,e,r,n){var o=n.lag,i="relative_volume_".concat(r),a=t.instances,u=t.verticalOhlcv;if(0===e){var l=t.len;a[i]={instance:new Q(r),prevRelativeVolumeSma:NaN},u[i]=new Float64Array(l).fill(NaN),o>0&&t.lag([i],o)}var c=u.volume[e],s=a[i].instance;s.update(c);var f=NaN;try{f=s.getResult()}catch(t){}var y=a[i].prevRelativeVolumeSma,p=NaN;return Number.isNaN(f)||Number.isNaN(y)||(p=c/y),t.pushToMain({index:e,key:i,value:p}),a[i].prevRelativeVolumeSma=f,!0},donchianChannels:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.inputParams,c=t.lag,s=t.priceBased,f=o.height,y=o.range,p="".concat(r,"_").concat(n);if(0===e){var h=l.filter((function(t){return"donchianChannels"===t.key})).length,v="donchian_channel",m=h>1?"".concat(v,"_").concat(p):v,d=["upper","basis","lower"].map((function(t){return"".concat(m,"_").concat(t)}));f&&d.push("".concat(m,"_height"));var b,g=Te(y);try{for(g.s();!(b=g.n()).done;){var w=b.value;if(!(w in i))throw new Error('Invalid range key "'.concat(w,'".'));d.push("".concat(m,"_range_").concat(w))}}catch(t){g.e(t)}finally{g.f()}var O,S=Te(d);try{for(S.s();!(O=S.n()).done;){var j=O.value;s.add(j)}}catch(t){S.e(t)}finally{S.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:h,settings:{}}),a.donchian_channel.numberOfIndicators=h,a.donchian_channel.settings[p]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(d.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),c>0&&t.lag(d,c)}var N=a.donchian_channel,_=N.numberOfIndicators,P=N.settings,A=_>1?"donchian_channel_".concat(p):"donchian_channel",x=P[p],k=x.maxDeque,T=x.minDeque,E=e-n,M=E-r+1,I=["upper","basis","lower"].map((function(t){return"".concat(A,"_").concat(t)}));f&&I.push("".concat(A,"_height"));var D=y.map((function(t){return"".concat(A,"_range_").concat(t)}));if(M<0||E+1>u)return[].concat(ke(I),ke(D)).forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var R=i.high,C=i.low,F=function(t,e,r){for(;t.length&&t[0]<M;)t.shift();for(;t.length&&r(e[t.at(-1)],e[E]);)t.pop();t.push(E)};F(k,R,(function(t,e){return t<=e})),F(T,C,(function(t,e){return t>=e}));var B=k.length&&T.length,U=B?R[k[0]]:NaN,V=B?C[T[0]]:NaN,H=B?(U+V)/2:NaN;if(t.pushToMain({index:e,key:"".concat(A,"_upper"),value:U}),t.pushToMain({index:e,key:"".concat(A,"_basis"),value:H}),t.pushToMain({index:e,key:"".concat(A,"_lower"),value:V}),f){var q=B&&V?(U-V)/V:NaN;t.pushToMain({index:e,key:"".concat(A,"_height"),value:q})}for(var L=B?U-V:NaN,$=0;$<y.length;$++){var K=i[y[$]][e],z=B&&K==K&&L?(K-V)/L:NaN;t.pushToMain({index:e,key:D[$],value:z})}return!0},bollingerBands:function(t,e,r,n,o){var i,a,u,l,c,s,f=o.height,y=o.range,p=void 0===y?[]:y,h=o.target,v=o.lag,m=t.verticalOhlcv,d=t.instances,b="".concat(r,"_").concat(n),g="bollinger_bands";if(0===e){var w=t.inputParams,O=t.verticalOhlcv,S=t.len,j=t.priceBased;if(!(h in O))throw new Error('bollingerBands could not find target "'.concat(h,'"'));var N,_=0,P=Ce(w);try{for(P.s();!(N=P.n()).done;)"bollingerBands"===N.value.key&&_++}catch(t){P.e(t)}finally{P.f()}d.bollinger_bands||(d.bollinger_bands={numberOfIndicators:_,settings:{}}),d.bollinger_bands.settings[b]=new Et(r,n);var A="";_>1&&(A+="_".concat(b)),h!==Be&&(A+="_".concat(h));var x=["".concat(g,"_upper"),"".concat(g,"_middle"),"".concat(g,"_lower")].map((function(t){return"".concat(t).concat(A)}));f&&x.push("".concat(g,"_height").concat(A));var k,T=Ce(p);try{for(T.s();!(k=T.n()).done;){var E=k.value;if(!(E in O))throw new Error('Invalid range item value "'.concat(E,'" property for bollingerBands.'));x.push("".concat(g,"_range_").concat(E).concat(A))}}catch(t){T.e(t)}finally{T.f()}if(j.has(h)){var M,I=Ce(x);try{for(I.s();!(M=I.n()).done;){var D=M.value;j.add(D)}}catch(t){I.e(t)}finally{I.f()}}var R=Object.fromEntries(x.map((function(t){return[t,new Float64Array(S).fill(NaN)]})));Object.assign(O,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?De(Object(r),!0).forEach((function(e){Re(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},R)),v>0&&t.lag(x,v)}var C="";d.bollinger_bands.numberOfIndicators>1&&(C+="_".concat(b)),h!==Be&&(C+="_".concat(h));var F=d.bollinger_bands.settings[b],B=m[h][e];F.update(B);var U={};try{U=F.getResult()}catch(t){}var V=null!==(i=null===(a=U)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,H=null!==(u=null===(l=U)||void 0===l?void 0:l.middle)&&void 0!==u?u:NaN,q=null!==(c=null===(s=U)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:e,key:"".concat(g,"_upper").concat(C),value:V}),t.pushToMain({index:e,key:"".concat(g,"_middle").concat(C),value:H}),t.pushToMain({index:e,key:"".concat(g,"_lower").concat(C),value:q}),f){var L=NaN;Number.isNaN(q)||Number.isNaN(V)||(L=(V-q)/q),t.pushToMain({index:e,key:"".concat(g,"_height").concat(C),value:L})}var $,K=Ce(p);try{for(K.s();!($=K.n()).done;){var z=$.value,G=NaN,Y=m[z][e];Number.isNaN(Y)||Number.isNaN(q)||Number.isNaN(V)||(G=(Y-q)/(V-q)),t.pushToMain({index:e,key:"".concat(g,"_range_").concat(z).concat(C),value:G})}}catch(t){K.e(t)}finally{K.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a,u,l=o.lag,c=t.verticalOhlcv,s=t.instances,f=c.volume[e],y="volume_oscillator_".concat(r,"_").concat(n);if(0===e){var p=t.len;Object.assign(s,(i={},a=y,u={fastEMA:new Vt(r),slowEMA:new Vt(n)},(a=function(t){var e=function(t,e){if("object"!=Ue(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ue(e)?e:e+""}(a))in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,i)),c[y]=new Float64Array(p).fill(NaN),l>0&&t.lag([y],l)}var h=s[y],v=h.fastEMA,m=h.slowEMA;v.update(f),m.update(f);var d=NaN,b=NaN;try{d=v.getResult()}catch(t){}try{b=m.getResult()}catch(t){}var g=NaN;return Number.isNaN(d)||Number.isNaN(b)||(g=100*(d-b)/b),t.pushToMain({index:e,key:y,value:g}),!0},mapCols:function(t,e,r,n,o){var i=o.lag,a=o.isPriceBased,u=t.verticalOhlcv,l=t.len,c=t.priceBased,s=t.precision;if(0===e){var f,y=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ar(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}}}}(r);try{for(y.s();!(f=y.n()).done;){var p=f.value;if(u.hasOwnProperty(p))throw new Error('New property "'.concat(p,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'));u[p]=new Array(l).fill(0),s&&a&&c.add(p)}}catch(t){y.e(t)}finally{y.f()}i>0&&t.lag(r,i)}var h,v,m=n({index:e,main:t});if(null==m)return!0;for(var d=0,b=Object.entries(m);d<b.length;d++){var g=(h=b[d],v=2,function(t){if(Array.isArray(t))return t}(h)||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}}(h,v)||Ar(h,v)||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.")}()),w=g[0],O=g[1];t.pushToMain({index:e,key:w,value:O})}},scaler:function(t,e,r,n,o){var i=o.type,a=o.minMaxRange,u=o.lookback,l=o.weights,c=o.euclideanWeights,s=o.byFeatureRange,f=t.verticalOhlcv,y=t.instances,p="".concat(i,"_").concat(r);if(0===e){var h=t.len;if(t.isAlreadyComputed.has(p))throw new Error('In scaler method can not repeat params "size" and "options.type" together between indicators.');y.hasOwnProperty("scaler")||(y.scaler={}),y.scaler.hasOwnProperty(p)||(y.scaler[p]={extectedFeatures:0===u?n.length:n.length+u*n.length});var v,m=[],d=jr(n);try{var b=function(){var e=v.value;if(!f.hasOwnProperty(e))throw new Error('Target property "'.concat(e,'" not found in verticalOhlcv'));var r,n="".concat(p,"_").concat(e);if(f[n]=new Float64Array(h).fill(NaN),t.scaledGroups[p]||(t.scaledGroups[p]=[]),t.scaledGroups[p].push(n),u>0){var o,i,a=Array.from({length:u}).map((function(t,e){return"".concat(n,"_lag_").concat(e+1)})),l=jr(a);try{for(l.s();!(i=l.n()).done;){var c=i.value;f[c]=new Float64Array(h).fill(NaN)}}catch(t){l.e(t)}finally{l.f()}(o=t.scaledGroups[p]).push.apply(o,function(t){if(Array.isArray(t))return _r(t)}(r=a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||Nr(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.")}()),m.push(n)}};for(d.s();!(v=d.n()).done;)b()}catch(t){d.e(t)}finally{d.f()}for(var g=0,w=Object.keys(l);g<w.length;g++){var O=w[g];if(!f.hasOwnProperty(O))throw new Error('Target property "'.concat(O,'" not found in verticalOhlcv'))}}for(var S=y.scaler[p].extectedFeatures,j=!1,N={},_=[],P=0,A=0;A<n.length;A++){var x,k,T=n[A],E=f[T],M=null!==(x=null==l||null===(k=l[T])||void 0===k?void 0:k[0])&&void 0!==x?x:1,I=E[e];if(Pr(I)){j=!0;break}if(N[T]={val:I,weight:c?Math.sqrt(M):M},_.push(I),P++,u>0){for(var D=1;D<=u;D++){var R,C,F=null!==(R=null==l||null===(C=l[T])||void 0===C?void 0:C[D])&&void 0!==R?R:1,B=E[e-D];if(Pr(B)){j=!0;break}N["".concat(T,"_lag_").concat(D)]={val:B,weight:c?Math.sqrt(F):F},_.push(B),P++}if(j)break}}if(!j&&P===S){if("minmax"===i)for(var U=Math.min.apply(Math,_),V=Math.max.apply(Math,_),H=0,q=Object.entries(N);H<q.length;H++){var L=Sr(q[H],2),$=L[0],K=L[1],z=K.val,G=K.weight,Y=ar(z,U,V,a),J=0===Y?0:Y*G;t.pushToMain({index:e,key:"".concat(p,"_").concat($),value:J})}if("zscore"===i)for(var W=_.length,Z=_.reduce((function(t,e){return t+e}),0)/W,Q=_.reduce((function(t,e){return t+Math.pow(e-Z,2)}),0)/W,X=Math.sqrt(Q),tt=0,et=Object.entries(N);tt<et.length;tt++){var rt=Sr(et[tt],2),nt=rt[0],ot=rt[1],it=ot.val,at=ot.weight,ut=ur(it,Z,X),lt=0===ut?0:ut*at;t.pushToMain({index:e,key:"".concat(p,"_").concat(nt),value:lt})}if("byfeature"===i)for(var ct=Sr(s,2),st=ct[0],ft=ct[1],yt=0,pt=Object.entries(N);yt<pt.length;yt++){var ht=Sr(pt[yt],2),vt=ht[0],mt=ht[1],dt=mt.val,bt=mt.weight,gt=ar(dt,st,ft,a),wt=0===gt?0:gt*bt;t.pushToMain({index:e,key:"".concat(p,"_").concat(vt),value:wt})}}},crossPairs:function(t,e,r,n){var o,i=n.oneHot,a=n.limit,u=t.verticalOhlcv,l=t.verticalOhlcvTempCols,c=t.instances,s=t.len,f=t.precision,y=t.precisionMultiplier,p=t.priceBased,h=function(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 lr(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)?lr(t,e):void 0}}(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}}}}(r);try{for(h.s();!(o=h.n()).done;){var v=o.value,m=v.fast,d=v.slow,b="".concat(m,"_x_").concat(d);if(0===e){if("number"==typeof d){var g=d.toString();l.add(g);var w=f&&("price"===m||p.has(m)),O=w?Le(g,y):d,S=d>=-125&&d<=125&&!1===w?"Int8Array":"Float64Array";u[g]=tr(S,s,O)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new hr,min:1/0,max:-1/0};var j=null!==a&&a<=125?"Int8Array":"Float64Array";u[b]=tr(j,s,0),i&&(u["one_hot_".concat(b)]=tr("Array",s,null))}else if(e+1===s){if("price"!==m&&!u.hasOwnProperty(m))throw new Error('crossPairs invalid param: fast "'.concat(m,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))));if(!u.hasOwnProperty(d))throw new Error('crossPairs invalid param: slow "'.concat(d,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))))}if("price"!==m&&!u.hasOwnProperty(m))return;if(!u.hasOwnProperty(d))return;var N=c.crossPairs[b].run;if("price"===m){var _=u.close[e],P=u[d][e];N.update(e,{fast:_,slow:P,high:u.high[e],low:u.low[e]})}else{var A=u[m][e],x=u[d][e];N.update(e,{fast:A,slow:x})}var k=N.getResult(),T=null!==a?Math.min(Math.max(k,-a),a):k;if(t.pushToMain({index:e,key:b,value:T}),i){var E=T+a,M=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(b),value:ir(E,M)})}}}catch(t){h.e(t)}finally{h.f()}return!0},lag:function(t,e,r,n){var o=t.verticalOhlcv,i=t.len,a=t.priceBased;if(0===e){var u,l=rr(r);try{for(l.s();!(u=l.n()).done;){var c=u.value;if(!o.hasOwnProperty(c))throw new Error('Lag processing invoked by col "'.concat(c,'" was not found in "verticalOhlcv".'));for(var s=a.has(c),f=1;f<=n;f++){var y="".concat(c,"_lag_").concat(f);s&&a.add(y);var p=er(c,o[c]);o[y]=tr(p,i)}}}catch(t){l.e(t)}finally{l.f()}}var h,v=rr(r);try{for(v.s();!(h=v.n()).done;)for(var m=h.value,d=o[m],b=1;b<=n;b++){var g="".concat(m,"_lag_").concat(b),w=e-b,O=w<0||void 0===d[w]?null:d[w];t.pushToMain({index:e,key:g,value:O})}}catch(t){v.e(t)}finally{v.f()}return!0}};function Vr(t,e){if(t){if("string"==typeof t)return Hr(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)?Hr(t,e):void 0}}function Hr(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 qr=function(t){var e=t.main,r=t.skipNull,n=void 0!==r&&r,o=t.startIndex,i=void 0===o?0:o,a=t.dateFormat,u=e.verticalOhlcv,l=e.invalidValueIndex,c=e.len,s=e.verticalOhlcvKeyNames,f=e.verticalOhlcvTempCols,y=e.priceBased,p=e.precision,h=e.precisionMultiplier;if(0===s.length)return[];var v,m,d,b=n&&l>=0?l+1:0,g=Math.max(b,i),w=c-g,O=Array.from({length:w},(function(){return{}})),S={},j=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Vr(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}}}}(s);try{for(j.s();!(v=j.n()).done;){var N=v.value;p&&y.has(N)?S[N]=function(t,e){return function(t,e){if("number"!=typeof t||!Number.isFinite(t))throw new Error("revertPrecisionAsNumber expects a finite number");var r=t<0,n=Math.abs(t);n=Math.trunc(n);var o=1===e?0:String(e).length-1;if(0===o)return r?-n:n;var i=Math.trunc(n/e),a=String(n%e).padStart(o,"0"),u=0===(a=a.replace(/0+$/,"")).length?String(i):"".concat(i,".").concat(a);return Number(r?"-".concat(u):u)}(t,e)}:S[N]=function(t){return t}}}catch(t){j.e(t)}finally{j.f()}for(var _=0,P=Object.entries(u);_<P.length;_++){var A=(m=P[_],d=2,function(t){if(Array.isArray(t))return t}(m)||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}}(m,d)||Vr(m,d)||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.")}()),x=A[0],k=A[1];if(!f.has(x))for(var T=g;T<c;T++)O[T-g][x]="date"===x?Ye[a](k[T]):S[x](k[T],h)}return O};function Lr(t){return Lr="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},Lr(t)}function $r(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)||zr(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 Kr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zr(t,e){if(t){if("string"==typeof t)return Gr(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)?Gr(t,e):void 0}}function Gr(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 Yr(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,Jr(n.key),n)}}function Jr(t){var e=function(t,e){if("object"!=Lr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lr(e)?e:e+""}var Wr=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,i=void 0===o?null:o,u=e.inputParams,c=void 0===u?null:u,s=e.chunkProcess,p=void 0===s?2e3:s,h=e.precision,v=void 0!==h&&h;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l(n,"input",null!==i?"contructor ".concat(i):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+i);y(p,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),f(v,"precision","contructor"),this.chunkProcess=p,this.input=function(t){return function(t){if(Array.isArray(t))return Gr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zr(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.")}()}(n),this.len=this.input.length,this.firstRow=this.input[0],this.precision=v;var m=["open","high","low","close"];this.initialPriceBased=new Set(m),this.priceBased=new Set(m),this.precisionMultiplier=function(t){var e=t.precision,r=t.firstRow,n=t.initialPriceBased;if(!1===e)return 1;for(var o=1,i=0,a=Object.entries(r);i<a.length;i++){var u=He(a[i],2),l=u[0],c=u[1];if(n.has(l)){if("string"!=typeof c||!/^\d+(\.\d+)?$/.test(c))throw new Error('If "precision" is set to true all the "open", "high", "low" and "close" values must be numeric strings like "123.45" with no commas or currency symbols. Property "'.concat(l,'" had the value "').concat(c,'" type ').concat(Ve(c),"."));var s=He(c.split("."),2),f=s[0],y=s[1],p=void 0===y?"":y,h=Number(f),v=4;if(0===Math.abs(h)){var m=p.length,d=Math.max(4,m),b=p.search(/[1-9]/);if(-1===b)v=d;else{var g=b+1+5;v=Math.max(d,g)}}var w=Math.pow(10,v);w>o&&(o=w)}}return o}(this);var d=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=0,u=Object.entries(e);a<u.length;a++){var l=Qe(u[a],2),c=l[0],s=l[1];if("date"===c)o[c]=We(s),i[c]="Array";else if("volume"===c)o[c]=ze(s,!0),i[c]="Int32Array";else if(n.has(c))o[c]=ze(s,!0,r),i[c]="Float64Array";else{var f=ze(s,!1,r);o[c]=f,i[c]="number"===f?"Float64Array":"Array"}}return{inputTypes:o,arrayTypes:i}}(this),b=d.inputTypes,g=d.arrayTypes;if(this.inputTypes=b,this.arrayTypes=g,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(i));return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.instances={},this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set,this.pushToMain=function(t){var e=t.index,n=t.key,o=t.value;return function(t){var e=t.index,r=t.key,n=t.value;return t.main.verticalOhlcv[r][e]=n,!0}({main:r,index:e,key:n,value:o})},null!==c?(a(c,this.len),this.inputParams=c.sort((function(t,e){return t.order-e.order})),this.compute()):this.inputParams=[],this},e=[{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.skipNull,r=void 0===e||e,n=t.dateFormat,o=void 0===n?"string":n;return s(Object.keys(Ye),o,"dateFormat","getData"),c(t,"options","getData"),qr({main:this,skipNull:r,startIndex:0,dateFormat:o})}},{key:"getLastValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.dateFormat,r=void 0===e?"string":e;return s(Object.keys(Ye),r,"dateFormat","getData"),qr({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:r})[0]}},{key:"compute",value:function(){return this.isComputed||(this.inputParams=this.inputParams.sort((function(t,e){return t.order-e.order})),this.isComputed=!1,this.len>0&&(function(t,e){var n=e.len,o=e.arrayTypes,i=e.verticalOhlcv,u=e.verticalOhlcvKeyNames,l=e.inputTypes,c=e.chunkProcess,s=e.precisionMultiplier,f=e.inputParams;a(f,n);for(var y=0,p=Object.keys(l);y<p.length;y++){var h=p[y];i[h]=tr(o[h],n)}for(var v=0;v<n;v+=c)for(var m=Math.min(v+c,n),d=v;d<m;d++){for(var b=t[d],g=0,w=Object.entries(l);g<w.length;g++){var O=Cr(w[g],2),S=O[0],j=O[1],N=b[S];if(Ke.hasOwnProperty(j)){void 0===N&&console.log({index:d,formaterKey:j,key:S});var _=Ke[j](N,s);e.pushToMain({index:d,key:S,value:_})}else Je.hasOwnProperty(j)?e.pushToMain({index:d,key:S,value:Je[j](N)}):e.pushToMain({index:d,key:S,value:N})}var P,A=Rr(f);try{for(A.s();!(P=A.n()).done;){var x=P.value,k=x.key,T=x.params;Ur[k].apply(Ur,[e,d].concat(Dr(T)))}}catch(t){A.e(t)}finally{A.f()}t[d]=null;var E=Object.keys(i);r(e,d,E)||(e.invalidValueIndex=d)}u.push.apply(u,Dr(Object.keys(i)))}(this.input,this),this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[])),this}},{key:"crossPairs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="crossPairs";u(this),l(t,"arr",r),c(e,"options",r);var n=e.limit,o=void 0===n?null:n,i=e.oneHot,a=void 0!==i&&i;null!==o&&y(o,{min:2,max:this.len},"options.limit",r),f(a,"options.oneHot",r);var s,p=[],h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=zr(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}}}}(t);try{for(h.s();!(s=h.n()).done;){var v=s.value,m=v.fast,d=void 0===m?"":m,b=v.slow,g=void 0===b?"":b;if(""===d||""===g)throw new Error("Invalid crossPairs[".concat(d,"_").concat(g,"]: Object property “fast” must be a non-null column name and “slow” must be a non-null column name or integer."));p.push(d.toString(),g.toString())}}catch(t){h.e(t)}finally{h.f()}if(this.isAlreadyComputed.has(r))throw new Error('You can only call the "'.concat(r,'" method once.'));return this.isAlreadyComputed.add(r),this.inputParams.push({key:r,params:[t,{limit:o,oneHot:a}]}),this}},{key:"lag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r="lag";return u(this),l(t,"colKeys",r),y(e,{min:1,max:this.len,allowDecimals:!1},"lookback",r),this.inputParams.push({key:r,params:[t,e]}),this}},{key:"relativeVolume",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n;return y(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o}]}),this}},{key:"volumeDelta",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="volumeDelta";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeDelta" is called the input ohlcv must contain valid volume properties.');u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r;return y(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this.inputParams.push({key:e,order:0,params:[{lag:n}]}),this}},{key:"atr",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="atr";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.percentage,a=void 0!==i&&i,l=e.upper,s=void 0===l?null:l,p=e.lower,h=void 0===p?null:p;return y(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.percentage","atr"),null!==s&&y(s,{min:.001,max:100,allowDecimals:!0},"options.upper","atr"),null!==h&&y(h,{min:.001,max:100,allowDecimals:!0},"options.lower","atr"),this.inputParams.push({key:r,order:0,params:[t,{lag:o,percentage:a,upper:s,lower:h}]}),this}},{key:"ema",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="ema";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return h(o,"options.target",r),y(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"sma",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="sma";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return h(o,"options.target",r),y(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"heikenAshi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="heikenAshi";u(this);var o=null===t&&null===e;!1===o&&(y(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),y(e,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),c(r,"options",n);var i=r.lag,a=void 0===i?0:i;return y(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:a,bothNull:o}]}),this}},{key:"vidya",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="vidya";u(this),y(t,{min:2,max:this.len,allowDecimals:!1},"size",n),y(e,{min:1,max:this.len,allowDecimals:!1},"momentum",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.lag,l=void 0===a?0:a,s=r.atrLength,f=void 0===s?200:s,p=r.bandDistance,v=void 0===p?2:p,m=r.liquidityLookback,d=void 0===m?20:m;return h(i,"options.target",n),y(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),y(v,{min:.01,max:10,allowDecimals:!0},"options.bandDistance",n),y(f,{min:2,max:this.len,allowDecimals:!1},"options.atrLength",n),y(d,{min:1,max:this.len,allowDecimals:!1},"options.liquidityLookback",n),this.inputParams.push({key:n,params:[t,e,{target:i,lag:l}]}),this}},{key:"stochastic",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="stochastic",i=this.len;y(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),y(e,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),y(r,{min:1,max:i,allowDecimals:!1},"dPeriod",o),c(n,"options",o);var a=function(t){return t},u="",l=n.lag,s=void 0===l?0:l;y(s,{min:0,max:i,allowDecimals:!1},"options.lag",o);var h=n.minmax;return(Array.isArray(h)||"boolean"==typeof h&&!0===h)&&(Array.isArray(h)?(p(h,"options.minmax",o),a=function(t){return null!==h?ar(t,0,100,h):t}):(f(h,"options.minmax",o),h=[0,1],a=function(t){return null!==h?ar(t,0,100,h):t}),u="minmax_"),this.inputParams.push({key:o,order:0,params:[t,e,r,{minmax:h,prefix:u,parser:a,lag:s}]}),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]:{},o="macd";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),y(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),y(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),c(n,"options",o);var i=n.target,a=void 0===i?"close":i,l=n.lag,s=void 0===l?0:l;h(a,"options.target",o),y(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var f={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===a?"":"_".concat(a))};return this.inputParams.push({key:o,params:[t,e,r,{target:a,lag:s,precomputed:f}]}),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]:{},n="bollingerBands";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",n),y(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.height,s=void 0!==a&&a,p=r.range,v=void 0===p?[]:p,m=r.lag,d=void 0===m?0:m;return h(i,"options.target",n),l(v,"options.range",n),y(d,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"options.height",n),this.inputParams.push({key:n,params:[t,e,{target:i,height:s,range:v,lag:d}]}),this}},{key:"rsi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="rsi";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i,l=e.minmax;h(o,"options.target",r),y(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r);var s=function(t){return t},v="";return(Array.isArray(l)||"boolean"==typeof l&&!0===l)&&(Array.isArray(l)?(p(l,"options.minmax",r),s=function(t){return null!==l?ar(t,0,100,l):t}):(f(l,"options.minmax",r),l=[0,1],s=function(t){return null!==l?ar(t,0,100,l):t}),v="minmax_"),this.inputParams.push({key:r,params:[t,{target:o,lag:a,parser:s,prefix:v,minmax: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]:{},n="donchianChannels";u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"size",n),y(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),c(r,"options",n);var o=r.height,i=void 0!==o&&o,a=r.range,s=void 0===a?[]:a,p=r.lag,h=void 0===p?0:p;return l(s,"options.range",n),y(h,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),this.inputParams.push({key:n,order:0,params:[t,e,{height:i,range:s,lag:h}]}),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]:{},n="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');u(this),y(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),y(e,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),c(r,"options",n);var o=r.lag,i=void 0===o?0:o;return y(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:i}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="dateTime";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.oneHot,i=void 0!==o&&o;y(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),f(i,"options.oneHot",e);var a=i?"one_hot_":"",l=Kr(Kr(Kr(Kr(Kr({},"".concat(a,"month"),12),"".concat(a,"day_of_the_month"),31),"".concat(a,"day_of_the_week"),7),"".concat(a,"hour"),24),"".concat(a,"minute"),60),s={prefix:a,colKeySizes:l,colKeys:Object.keys(l)};return this.inputParams.push({key:e,order:0,params:[{lag:n,oneHot:i,precompute:s}]}),this}},{key:"priceFeatures",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="priceFeatures";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.colKeys,i=void 0===o?[]:o;return y(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),l(i,"options.colKeys",e),this.inputParams.push({key:e,params:[{lag:n,colKeys:i}]}),this}},{key:"scaler",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zscore",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="scaler";u(this),s(["minmax","zscore","byfeature"],t,"options.type",n),y(e,{min:1,max:this.len,allowDecimals:!1},"size",n);var o="".concat(n,"(").concat(t,", ").concat(e,", options = {})");c(r,"options",o);var i=r.minMaxRange,a=void 0===i?null:i,h=r.lag,v=void 0!==h&&h,m=r.colKeys,d=void 0===m?[]:m,b=r.weights,g=void 0===b?{}:b,w=r.euclideanWeights,O=void 0!==w&&w,S=r.byFeatureRange,j=void 0===S?null:S;l(d,"options.colKeys",o),f(v,"options.lag",o),c(g,"options.weights",o);var N=v?e-1:0;if(0===d.length)throw new Error('The property "options.colKeys" must be an array with target keys in '.concat(o,"."));for(var _=0,P=Object.entries(g);_<P.length;_++){var A=$r(P[_],2),x=A[0],k=A[1];if(l(k,"options.weights.".concat(x)),!v&&k.size>0)throw new Error('If "options.lag" is set to false "options.weights.'.concat(x,'" can only contain 1 item (float) in ').concat(o,"."));if(k.length>e)throw new Error('The length of the property "options.weights.'.concat(x,'" can not be longer than "size" in ').concat(o,"."));for(var T=0;T<k.length;T++){var E=k[T];y(E,{min:.01,max:10,allowDecimals:!0},"options.weights.".concat(x,"[").concat(T,"]"),o)}}if("byfeature"!==t){if(null==!j)throw new Error('"options.byFeatureRange" is only valid when "type" is "byfeature".')}else p(j,"options.byFeatureRange",o);return["minmax","byfeature"].includes(t)&&p(a,"options.minMaxRange",o),this.inputParams.push({key:n,params:[e,d,{type:t,minMaxRange:a,lookback:N,weights:g,euclideanWeights:O,byFeatureRange:j}]}),this}},{key:"mapCols",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["change"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this);var n="mapCols";null==e&&(e=kr),c(r,"options",n);var o=r.lag,i=void 0===o?0:o,a=r.isPriceBased,s=void 0!==a&&a;if(l(t,"newCols",n),y(i,{min:0,allowDecimals:!1},"options.lag",n),f(s,"isPriceBased","mapCols"),!1===this.precision&&s)throw new Error('Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.');return this.inputParams.push({key:n,params:[t,e,{lag:i,isPriceBased:s}]}),this}}],e&&Yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
|
|
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={};(()=>{t.r(e),t.d(e,{default:()=>zr});var r=function(t,e,r){if(0===r.length)return!1;for(var n=t.verticalOhlcv,o=!0,i=0;i<r.length;i++){var a=r[i];if(!n.hasOwnProperty(a)){o=!1;break}var u=n[a][e];if(null==u||Number.isNaN(u)){o=!1;break}}return o};function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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 o(t,e){if(t){if("string"==typeof t)return i(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)?i(t,e):void 0}}function i(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 a=function(t,e){if(!Array.isArray(t))throw new Error('Property "inputParams" must be an "Array" or "Set".');var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i,a=n(r.value.params);try{for(a.s();!(i=a.n()).done;){var u=i.value;if("number"==typeof u&&u>e)throw console.log(u,e),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){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}},u=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},l=function(t,e,r){if(!Array.isArray(t))throw new Error('Param "'.concat(e,'" must be an array in "').concat(r,'".'));return!0},c=function(t,e,r){if(t instanceof Object==0)throw new Error('Param "'.concat(e,'" must be an object in "').concat(r,'".'));return!0},s=function(t,e,r,n){if(l(t,"arrayOptions","".concat(n,".").concat(r,".validateArrayOptions")),!t.includes(e.toString()))throw new Error('Param "'.concat(r,'" must be any of the following values [').concat(t.join(", "),'] in "').concat(n,'".'));return!0},f=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},h=function(t,e,r,n){c(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,u=e.max,l=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an ').concat(l,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==u&&"number"!=typeof u)throw new Error('Param "max" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&void 0!==u&&a>=u)throw new Error('Param "min" must be less than "max" in "'.concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&t<a)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==u&&t>u)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≤ ").concat(u,' in "').concat(n,'".'));return!0},y=function(t,e,r){if(l(t,e,r),2!==t.length)throw new Error('Invalid "'.concat(e,'" array length: expected 2 items, but got ').concat(t.length,' in "').concat(r,".").concat(e,'".'));var n,i,a=(i=2,function(t){if(Array.isArray(t))return t}(n=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}}(n,i)||o(n,i)||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.")}()),u=a[0],c=a[1];if(h(u,{min:-100,max:c,allowDecimals:!1},"".concat(e,"[0] (min)"),r),h(c,{min:u,max:100,allowDecimals:!1},"".concat(e,"[1] (max)"),r),u===c)throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(r,".").concat(e,'".'));return!0},p=function(t,e,r){if("string"!=typeof t||!t.length)throw new Error('Invalid "'.concat(e,'" property in "').concat(r,'". Only strings are accepted.'));return!0},v=1e6,m="[big.js] ",d=m+"Invalid ",b=d+"decimal places",g=d+"rounding mode",w=m+"Division by zero",O={},S=void 0,j=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function N(t,e,r,n){var o=t.c;if(r===S&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(g);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]!==S))),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]!==S||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 P(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 _(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 A(t){var e="function"==typeof Map?new Map:void 0;return A=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(k())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&T(o,r.prototype),o}(t,arguments,x(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T(r,t)},A(t)}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function T(t,e){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},T(t,e)}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}O.abs=function(){var t=new this.constructor(this);return t.s=1,t},O.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},O.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,a=r.DP;if(a!==~~a||a<0||a>v)throw Error(b);if(!o[0])throw Error(w);if(!n[0])return t.s=i,t.c=[t.e=0],t;var u,l,c,s,f,h=o.slice(),y=u=o.length,p=n.length,m=n.slice(0,u),d=m.length,g=t,O=g.c=[],j=0,P=a+(g.e=e.e-t.e)+1;for(g.s=i,i=P<0?0:P,h.unshift(0);d++<u;)m.push(0);do{for(c=0;c<10;c++){if(u!=(d=m.length))s=u>d?1:-1;else for(f=-1,s=0;++f<u;)if(o[f]!=m[f]){s=o[f]>m[f]?1:-1;break}if(!(s<0))break;for(l=d==u?o:h;d;){if(m[--d]<l[d]){for(f=d;f&&!m[--f];)m[f]=9;--m[f],m[d]+=10}m[d]-=l[d]}for(;!m[0];)m.shift()}O[j++]=s?c:++c,m[0]&&s?m[d]=n[y]||0:m=[n[y]]}while((y++<p||m[0]!==S)&&i--);return O[0]||1==j||(O.shift(),g.e--,P--),j>P&&N(g,P,r.RM,m[0]!==S),g},O.eq=function(t){return 0===this.cmp(t)},O.gt=function(t){return this.cmp(t)>0},O.gte=function(t){return this.cmp(t)>-1},O.lt=function(t){return this.cmp(t)<0},O.lte=function(t){return this.cmp(t)<1},O.minus=O.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},O.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(w);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)))},O.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},O.plus=O.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},O.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(d+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},O.prec=function(t,e){if(t!==~~t||t<1||t>v)throw Error(d+"precision");return N(new this.constructor(this),t,e)},O.round=function(t,e){if(t===S)t=0;else if(t!==~~t||t<-v||t>v)throw Error(b);return N(new this.constructor(this),t+this.e+1,e)},O.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,u=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(m+"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=u.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return N(t,(o.DP-=4)+t.e+1,o.RM)},O.times=O.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},O.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(r=N(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return P(r,!0,!!n)},O.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(t=t+(r=N(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return P(r,!1,!!n)},O[Symbol.for("nodejs.util.inspect.custom")]=O.toJSON=O.toString=function(){var t=this,e=t.constructor;return P(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},O.toNumber=function(){var t=Number(P(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(m+"Imprecise conversion");return t},O.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==S){if(t!==~~t||t<1||t>v)throw Error(d+"precision");for(r=N(new n(r),t,e);r.c.length<t;)r.c.push(0)}return P(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},O.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(m+"valueOf disallowed");return P(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===S?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(d+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!j.test(e))throw Error(d+"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=O,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 E=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=x(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||[],x(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&&T(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(A(Error));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 I(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,R(n.key),n)}}function D(t,e,r){return(e=R(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:e+""}var C=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),D(this,"previousHighest",void 0),D(this,"highest",void 0),D(this,"previousLowest",void 0),D(this,"lowest",void 0),D(this,"previousResult",void 0),D(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 E;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)}}])&&I(t.prototype,e),r&&I(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function F(t){return F="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},F(t)}function B(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,L(n.key),n)}}function U(t,e,r){return e=H(e),function(t,e){if(e&&("object"==F(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,V()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},q(t,e)}function L(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}var $=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=U(this,e),i=void 0,(o=L(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&&q(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)}}])&&B(r.prototype,n),o&&B(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 z(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 G(t,e,r){return e=J(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,Y()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function Y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Y=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 Z(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 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=G(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&&W(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&&z(r.prototype,n),o&&z(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function X(t){return X="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},X(t)}function tt(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 et(t,e,r){return e=nt(e),function(t,e){if(e&&("object"==X(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,rt()?Reflect.construct(e,r||[],nt(t).constructor):e.apply(t,r))}function rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rt=function(){return!!t})()}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}function it(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"!=X(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}var ut=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),it(r=et(this,e),"interval",void 0),it(r,"indicator",void 0),it(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&&ot(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&&tt(r.prototype,n),o&&tt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function lt(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function ct(t){return ct="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},ct(t)}function st(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 ft(t,e,r){return e=yt(e),function(t,e){if(e&&("object"==ct(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,ht()?Reflect.construct(e,r||[],yt(t).constructor):e.apply(t,r))}function ht(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ht=function(){return!!t})()}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(t)}function pt(t,e){return pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pt(t,e)}function vt(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"!=ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:e+""}var dt=function(t){function e(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return vt(t=ft(this,e,[].concat(n)),"previousCandle",void 0),vt(t,"twoPreviousCandle",void 0),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&&pt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.high,n=t.low,o=r-n;if(this.previousCandle&&e&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){var i=Math.abs(r-this.previousCandle.close),a=Math.abs(n-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(Math.max(o,i,a),e)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(o,e)}}],n&&st(r.prototype,n),o&&st(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function bt(t){return bt="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},bt(t)}function gt(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,Pt(n.key),n)}}function wt(t,e,r){return e=St(e),function(t,e){if(e&&("object"==bt(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||[],St(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 St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function Nt(t,e,r){return(e=Pt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pt(t){var e=function(t,e){if("object"!=bt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bt(e)?e:e+""}var _t=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Nt(r=wt(this,e),"interval",void 0),Nt(r,"tr",void 0),Nt(r,"smoothing",void 0),r.interval=t,r.tr=new dt,r.smoothing=new n(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&&jt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.tr.update(t,e);if(this.smoothing.update(r,e),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),e)}}],n&>(r.prototype,n),o&>(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);function At(t){return At="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},At(t)}function kt(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,xt(n.key),n)}}function Tt(t,e,r){return(e=xt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==At(e)?e:e+""}var Et=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),Tt(this,"interval",void 0),Tt(this,"deviationMultiplier",void 0),Tt(this,"prices",[]),Tt(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=lt(this.prices),r=function(t,e){var r=e||lt(t),n=lt(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 E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&kt(t.prototype,e),r&&kt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();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 It(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,Ut(n.key),n)}}function Dt(t,e,r){return e=Ct(e),function(t,e){if(e&&("object"==Mt(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,Rt()?Reflect.construct(e,r||[],Ct(t).constructor):e.apply(t,r))}function Rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rt=function(){return!!t})()}function Ct(t){return Ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ct(t)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(t,e)}function Bt(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ut(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+""}var Vt=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),Bt(r=Dt(this,e,[t]),"interval",void 0),Bt(r,"pricesCounter",0),Bt(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&&Ft(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 E;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&It(r.prototype,n),o&&It(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function Ht(t){return Ht="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},Ht(t)}function qt(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,$t(n.key),n)}}function Lt(t,e,r){return(e=$t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $t(t){var e=function(t,e){if("object"!=Ht(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ht(e)?e:e+""}var Kt=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),Lt(this,"short",void 0),Lt(this,"long",void 0),Lt(this,"signal",void 0),Lt(this,"prices",[]),Lt(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 E;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&&qt(t.prototype,e),r&&qt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function zt(t){return zt="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},zt(t)}function Gt(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,Xt(n.key),n)}}function Yt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"==zt(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,Jt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Jt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function Qt(t,e,r){return(e=Xt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xt(t){var e=function(t,e){if("object"!=zt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zt(e)?e:e+""}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qt(r=Yt(this,e),"interval",void 0),Qt(r,"previousPrices",[]),Qt(r,"avgGain",void 0),Qt(r,"avgLoss",void 0),Qt(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&&Zt(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&&Gt(r.prototype,n),o&&Gt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 re(t){return function(t){if(Array.isArray(t))return ne(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 ne(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)?ne(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 ne(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 oe(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,ae(n.key),n)}}function ie(t,e,r){return(e=ae(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(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 ue=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),ie(this,"n",void 0),ie(this,"m",void 0),ie(this,"p",void 0),ie(this,"candles",[]),ie(this,"result",void 0),ie(this,"periodM",void 0),ie(this,"periodP",void 0),this.n=e,this.m=r,this.p=n,this.periodM=new Q(r),this.periodP=new Q(n)},(e=[{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){if(this.candles.push(t),this.candles.length>this.n&&this.candles.shift(),this.candles.length===this.n){var e=Math.max.apply(Math,re(this.candles.map((function(t){return t.high})))),r=Math.min.apply(Math,re(this.candles.map((function(t){return t.low})))),n=e-r,o=100*(t.close-r);o/=0===n?1:n;var i=this.periodM.update(o),a=i&&this.periodP.update(i);if(void 0!==i&&void 0!==a)return this.result={stochD:a,stochK:i}}}}])&&oe(t.prototype,e),r&&oe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function le(t){return le="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},le(t)}function ce(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function se(t){return se="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},se(t)}function fe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var he={ema:Vt,sma:Q},ye=function(t,e,r,n,o){var i=o.target,a=o.lag,u=t.verticalOhlcv,l=t.instances,c=t.priceBased,s="close"!==i?"_".concat(i):"",f="".concat(r,"_").concat(n).concat(s);if(0===e){var h=t.len;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));l[f]=new he[r](n),u[f]=new Float64Array(h).fill(NaN),c.has(i)&&c.add(f),a>0&&t.lag([f],a)}var y=u[i][e],p=l[f];p.update(y);var v=NaN;try{v=p.getResult()}catch(t){}return t.pushToMain({index:e,key:f,value:v}),!0};function pe(t){return pe="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},pe(t)}function ve(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 me(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function de(t,e){if(t){if("string"==typeof t)return be(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)?be(t,e):void 0}}function be(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 ge(t){return function(t){if(Array.isArray(t))return we(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 we(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)?we(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 we(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 Oe(t){return Oe="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},Oe(t)}function Se(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function je(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 Ne="close";function Pe(t){return function(t){if(Array.isArray(t))return ke(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ae(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 _e(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 ke(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)?ke(t,e):void 0}}function ke(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 Te(t){return Te="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},Te(t)}function xe(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 Ee(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Te(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Te(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Me(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 Ie(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)?Ie(t,e):void 0}}(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 Ie(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 De="close";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 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 Fe(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 Be(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)?Be(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 Be(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 Ue=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=Fe((r?t.slice(1):t).split("."),2),o=n[0],i=n[1],a=void 0===i?"":i,u=String(e),l=1===e?0:u.length-1,c=a.padEnd(l,"0").slice(0,l),s=parseInt(o+c||"0",10);return r&&(s=-s),s};function Ve(t){return Ve="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},Ve(t)}var He={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return Ue(t,e)}},qe=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof t&&!Number.isNaN(t),o="string"==typeof t&&/^-?\d+(\.\d+)?$/.test(t);if(!0===r){if(o)return"precisionNumberCleanString";if(e)throw new Error("Invalid number forma");return Ve(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return Ve(t)};function Le(t){return Le="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},Le(t)}var $e={toString:function(t){return t.toString()},toISOString:function(t){return t.toISOString()},toUTCString:function(t){return t.toUTCString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},Ke={dateObject:function(t){return t},dateMilliseconds:function(t){return new Date(t)},dateSeconds:function(t){return new Date(1e3*t)},dateIncompleteDayString:function(t){return new Date("".concat(t," 00:00:00"))},dateCompleteDateString:function(t){return new Date(t)}},ze=function(t){var e=["Date -> object","Milliseconds Timestamp -> integer","Seconds Timestamp -> integer","UTC Time Format (ISO 8601) -> string","Including a Timezone Offset (ISO 8601) -> string","Local Time Format (ISO 8601) -> string","YYYY/MM/DD or YYYY-MM-DD -> string"],r=function(){throw new Error('Invalid "'.concat(Le(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===Le(t)){if(t instanceof Date&&!isNaN(t.valueOf()))return"dateObject";r()}else{if("number"==typeof t)return Math.abs(t)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)&&t.length>10||/^\d{4}\/\d{2}\/\d{2}$/.test(t))return"dateCompleteDateString";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return"dateIncompleteDayString";r()}else r()}};function Ge(t){return Ge="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},Ge(t)}function Ye(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 Je(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)?Je(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 Je(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 We=function(t,e,r){var n,o={Array,Float64Array,Float32Array,Int32Array,Uint8Array,Int8Array,Int16Array}[t];if(!o||"function"!=typeof o.from)throw new Error("Unsupported array type: ".concat(t));return n=void 0!==r?r:"Array"===t?null:NaN,o.from({length:e},(function(){return n}))},Ze=function(t,e){if(!e||"object"!==Ge(e))throw new TypeError('Invalid array type: "'.concat(t,'"'));return e.constructor.name};function Qe(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 Xe(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)?Xe(t,e):void 0}}(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 Xe(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 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}var er=function(t,e){var r=new Uint8Array(e);return r[t]=1,r},rr=function(t,e,r,n){var o,i,a=(i=2,function(t){if(Array.isArray(t))return t}(o=n)||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}}(o,i)||function(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}}(o,i)||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.")}()),u=a[0],l=a[1];return(Math.min(Math.max(t,e),r)-e)/(r-e)*(l-u)+u},nr=function(t,e,r){return 0===r?0:(t-e)/r};function or(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 ir(t){return ir="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},ir(t)}function ar(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,ur(n.key),n)}}function ur(t){var e=function(t,e){if("object"!=ir(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ir(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ir(e)?e:e+""}var lr=function(t,e){return t>e},cr=function(t,e){return t<e},sr=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:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t,e){var r=e.fast,n=e.high,o=e.slow,i=e.low,a=this.prevState;this.areHighAndLowUndefined||void 0!==n&&void 0!==i||(this.areHighAndLowUndefined=!0),Number.isNaN(r)||Number.isNaN(o)||function(t,e){return t===e}(r,o)?a=.5:lr(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&cr(i,o)&&lr(this.prevLow,this.prevSlow)?0:1:cr(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&lr(n,o)&&cr(this.prevHigh,this.prevSlow)?1:0),.5===a?this.interval=0:1===a?this.prevState<=.5?this.interval=1:this.interval++:0===a&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(t),-1===this.interval&&this.crossIndexes.down.push(t),Object.assign(this,{prevState:a,prevFast:r,prevSlow:o,prevHigh:n,prevLow:i})}},{key:"getResult",value:function(){return this.interval}}])&&ar(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function fr(t){return fr="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},fr(t)}function hr(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)||mr(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 yr(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 pr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yr(Object(r),!0).forEach((function(e){vr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function vr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=fr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mr(t,e){if(t){if("string"==typeof t)return dr(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)?dr(t,e):void 0}}function dr(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 br(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)||wr(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 gr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=wr(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 wr(t,e){if(t){if("string"==typeof t)return Or(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)?Or(t,e):void 0}}function Or(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 Sr=function(t){return null==t||!Number.isFinite(t)};function jr(t,e){if(t){if("string"==typeof t)return Nr(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)?Nr(t,e):void 0}}function Nr(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 Pr=function(t){var e=t.main,r=t.index,n=e.verticalOhlcv,o=n.close[r],i=n.open[r-1];return{change:(o-i)/i*100}};function _r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ar(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 Ar(t,e){if(t){if("string"==typeof t)return kr(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)?kr(t,e):void 0}}function kr(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 Tr=function(t,e){return(t-e)/e};function xr(t){return function(t){if(Array.isArray(t))return Dr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ir(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 Er(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ir(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 Mr(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)||Ir(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 Ir(t,e){if(t){if("string"==typeof t)return Dr(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)?Dr(t,e):void 0}}function Dr(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 Rr={priceFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=t.verticalOhlcv;if(0===e){var a,u=t.len,l={ret_change:new Float64Array(u).fill(NaN),ret_upper_wick:new Float64Array(u).fill(NaN),ret_lower_wick:new Float64Array(u).fill(NaN),ret_gap:new Float64Array(u).fill(NaN),ret_body:new Float64Array(u).fill(NaN),ret_range:new Float64Array(u).fill(NaN)},c=_r(o);try{for(c.s();!(a=c.n()).done;){var s=a.value;if(!i.hasOwnProperty(s))throw new Error("Target property ".concat(s,' not found in verticalOhlcv for "priceFeatures".'));l["ret_".concat(s)]=new Float64Array(u).fill(NaN)}}catch(t){c.e(t)}finally{c.f()}Object.assign(i,l),n&&t.lag(Object.keys(l),n)}var f,h,y=i.close[e-1];if(void 0!==y){var p,v,m=i.open[e],d=i.high[e],b=i.low[e],g=i.close[e],w=Math.max(m,g),O=Math.min(m,g),S={ret_change:Tr(g,y),ret_upper_wick:Tr(d,w),ret_lower_wick:Tr(O,b),ret_gap:Tr(m,y),ret_body:Tr(g,m),ret_range:Tr(d,b)},j=!1,N=_r(o);try{for(N.s();!(p=N.n()).done;){var P=p.value,_=i[P][e];if(null==(v=_)||!Number.isFinite(v)){j=!0;break}var A=Tr(g,_);S["ret_".concat(P)]=A}}catch(t){N.e(t)}finally{N.f()}if(!j)for(var k=0,T=Object.entries(S);k<T.length;k++){var x=(f=T[k],h=2,function(t){if(Array.isArray(t))return t}(f)||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}}(f,h)||Ar(f,h)||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.")}()),E=x[0],M=x[1];t.pushToMain({index:e,key:E,value:M})}}},dateTime:function(t,e,r){var n,o=r.lag,i=r.oneHot,a=r.precompute,u=t.instances,l=t.verticalOhlcv,c=a.prefix;if(0===e){var s=t.len;if(!t.dateType)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(u,{dateTime:{colKeys:[].concat((n=a.colKeys,function(t){if(Array.isArray(t))return dr(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||mr(n)||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.")}()),["".concat(c,"year")]),colKeySizes:pr({},a.colKeySizes)}});var f,h=u.dateTime.colKeys,y=i?Array:Int16Array,p=i?null:NaN,v=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=mr(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}}}}(h);try{for(v.s();!(f=v.n()).done;)l[f.value]=new y(s).fill(p)}catch(t){v.e(t)}finally{v.f()}o>0&&t.lag(h,o)}for(var m=u.dateTime.colKeySizes,d=function(t,e,r){var n=t.getFullYear(),o=t.getMonth(),i=t.getHours(),a=t.getMinutes(),u=t.getDay(),l=t.getDate()-1;return e?{one_hot_month:er(o,r.one_hot_month),one_hot_hour:er(i,r.one_hot_hour),one_hot_minute:er(a,r.one_hot_minute),one_hot_day_of_the_week:er(u,r.one_hot_day_of_the_week),one_hot_day_of_the_month:er(l,r.one_hot_day_of_the_month)}:{year:n,month:o+1,hour:i,minute:a,day_of_the_week:(u+6)%7+1,day_of_the_month:l+1}}(l.date[e],i,m),b=0,g=Object.entries(d);b<g.length;b++){var w=hr(g[b],2),O=w[0],S=w[1];t.pushToMain({index:e,key:O,value:S})}},heikenAshi:function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i.lag,u=void 0===a?0:a,l=i.bothNull,c=void 0!==l&&l,s=t.verticalOhlcv,f=t.instances,h=t.len,y=t.priceBased,p=c?"heiken_ashi":"heiken_ashi_".concat(r,"_").concat(n),v=["open","high","low","close"];if(0===e){f[p]={emaPre:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(r)]}))),emaPost:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,isTrendUp:!1};var m,d=v.map((function(t){return"".concat(p,"_").concat(t)})),b=Object.fromEntries([].concat((o=d,function(t){if(Array.isArray(t))return be(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||de(o)||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.")}()),["".concat(p,"_cross")]).map((function(t){return[t,new Float64Array(h).fill(NaN)]}))),g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=de(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}}}}(d);try{for(g.s();!(m=g.n()).done;){var w=m.value;y.add(w)}}catch(t){g.e(t)}finally{g.f()}Object.assign(s,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ve(Object(r),!0).forEach((function(e){me(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},b)),u>0&&t.lag(d,u)}var O,S,j,N,P=s.open[e],_=s.high[e],A=s.low[e],k=s.close[e],T=f[p];if(c)O=P,S=_,j=A,N=k;else{T.emaPre.open.update(P),T.emaPre.high.update(_),T.emaPre.low.update(A),T.emaPre.close.update(k);try{O=T.emaPre.open.getResult(),S=T.emaPre.high.getResult(),j=T.emaPre.low.getResult(),N=T.emaPre.close.getResult()}catch(t){return!0}}var x,E,M,I,D=(O+S+j+N)/4,R=Number.isNaN(T.prevHaOpen)||Number.isNaN(T.prevHaClose)?(O+N)/2:(T.prevHaOpen+T.prevHaClose)/2,C=Math.max(S,R,D),F=Math.min(j,R,D);if(T.prevHaOpen=R,T.prevHaClose=D,c)x=R,E=C,M=F,I=D;else{T.emaPost.open.update(R),T.emaPost.high.update(C),T.emaPost.low.update(F),T.emaPost.close.update(D);try{x=T.emaPost.open.getResult(),E=T.emaPost.high.getResult(),M=T.emaPost.low.getResult(),I=T.emaPost.close.getResult()}catch(t){return!0}}var B=e>0?s["".concat(p,"_cross")][e-1]:0,U=e>0?s["".concat(p,"_open")][e-1]:NaN,V=e>0?s["".concat(p,"_close")][e-1]:NaN,H=!Number.isNaN(V)&&V<=U&&I>x,q=!Number.isNaN(V)&&V>=U&&I<x;H&&(T.isTrendUp=!0),q&&(T.isTrendUp=!1);var L=0;return e>0&&(L=T.isTrendUp?B>0?B+1:1:B<0?B-1:-1),t.pushToMain({index:e,key:"".concat(p,"_open"),value:x}),t.pushToMain({index:e,key:"".concat(p,"_high"),value:E}),t.pushToMain({index:e,key:"".concat(p,"_low"),value:M}),t.pushToMain({index:e,key:"".concat(p,"_close"),value:I}),t.pushToMain({index:e,key:"".concat(p,"_cross"),value:L}),!0},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=t.verticalOhlcv,u=t.instances,l="close"===o?"":"_".concat(o),c="rsi_".concat(r).concat(l),s="rsi_sma_".concat(r).concat(l);if(0===e){var f=t.len;if(!a.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(u,ce(ce({},c,new te(r)),s,new Q(r))),Object.assign(a,ce(ce({},c,new Float64Array(f).fill(NaN)),s,new Float64Array(f).fill(NaN)));var h=[c,s];i>0&&t.lag(h,i)}var y=a[o][e],p=NaN,v=NaN;u[c].update(y);try{p=u[c].getResult()}catch(t){p=NaN}t.pushToMain({index:e,key:c,value:Number.isNaN(p)?NaN:p}),Number.isNaN(p)||u[s].update(p);try{v=u[s].getResult()}catch(t){v=NaN}t.pushToMain({index:e,key:s,value:Number.isNaN(v)?NaN:v})},stochastic:function(t,e,r,n,o,i){var a=i.lag,u=t.verticalOhlcv,l=t.instances,c=14===r&&3===n&&3===o?"":"".concat(r,"_").concat(n,"_").concat(o),s="stoch_d".concat(c),f="stoch_k".concat(c),h=c;if(0===e){var y=t.len;Object.assign(l,fe({},h,new ue(r,n,o))),Object.assign(u,fe(fe({},s,new Float64Array(y).fill(NaN)),f,new Float64Array(y).fill(NaN)));var p=[s,f];a>0&&t.lag(p,a)}var v=u.close[e],m=u.low[e],d=u.high[e],b=null;l[h].update({close:v,low:m,high:d});try{b=l[h].getResult()}catch(t){b=null}var g=b?b.stochK:NaN,w=b?b.stochD:NaN;t.pushToMain({index:e,key:f,value:g}),t.pushToMain({index:e,key:s,value:w})},atr:function(t,e,r,n){var o=n.lag,i=n.percentage,a=n.upper,u=n.lower,l=t.verticalOhlcv,c=t.instances,s=t.priceBased,f="atr_".concat(r);if(0===e){var h=t.instances,y=t.verticalOhlcv,p=t.len;h[f]=new _t(r,ut);var v=[f];i&&v.push("".concat(f,"_percentage")),null!==a&&v.push("".concat(f,"_upper")),null!==u&&v.push("".concat(f,"_lower"));for(var m=0,d=v;m<d.length;m++){var b=d[m];y[b]=new Float64Array(p).fill(NaN),s.add(b)}o>0&&t.lag(v,o)}var g={high:l.high[e],low:l.low[e],close:l.close[e]},w=c[f];w.update(g);var O=NaN;try{O=w.getResult()}catch(t){}if(i){var S=Number.isNaN(O)?NaN:O/g.close;t.pushToMain({index:e,key:"".concat(f,"_percentage"),value:S})}if(null!==a){var j=Number.isNaN(O)?NaN:g.close+O*a;t.pushToMain({index:e,key:"".concat(f,"_upper"),value:j})}if(null!==u){var N=Number.isNaN(O)?NaN:g.close-O*u;t.pushToMain({index:e,key:"".concat(f,"_lower"),value:N})}return t.pushToMain({index:e,key:f,value:O}),!0},ema:ye,sma:ye,vidya:function(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.priceBased,c=o.target,s=o.lag,f=o.atrLength,h=void 0===f?200:f,y=o.bandDistance,p=void 0===y?2:y,v=o.liquidityLookback,m=void 0===v?5:v,d="".concat(r,"_").concat(n);if(0===e){if(!(c in i))throw new Error('VIDYA could not find target "'.concat(c,'"'));for(var b="vidya_".concat(d),g="close"===c?b:"".concat(b,"_").concat(c),w={vidya:g,upper:"".concat(b,"_upper"),lower:"".concat(b,"_lower"),delta_vol:"".concat(b,"_delta_vol"),cross:"".concat(b,"_cross"),liquidity:"".concat(b,"_liquidity")},O=0,S=[g,w.upper,w.lower,w.liquidity];O<S.length;O++){var j=S[O];l.add(j)}a.vidya||(a.vidya={settings:{}}),a.vidya.settings[d]={momentumBuffer:[],prevVidya:NaN,sma:new Q(15),atrBuffer:[],isTrendUp:!1,upVol:0,downVol:0,liquidity:{high:[],low:[]}},Object.values(w).forEach((function(t){i[t]=new Float64Array(u).fill(NaN)})),s>0&&t.lag(Object.values(w),s)}var N=a.vidya.settings[d],P="vidya_".concat(d),_={vidya:"close"===c?P:"".concat(P,"_").concat(c),upper:"".concat(P,"_upper"),lower:"".concat(P,"_lower"),delta_vol:"".concat(P,"_delta_vol"),cross:"".concat(P,"_cross"),liquidity:"".concat(P,"_liquidity")},A=i[c][e],k=i.high[e],T=i.low[e],x=i.close[e],E=i.open[e],M=i.volume[e],I=e>0?i[_.cross][e-1]:0,D=N.liquidity.high.length===m?Math.max.apply(Math,ge(N.liquidity.high)):NaN,R=N.liquidity.low.length===m?Math.min.apply(Math,ge(N.liquidity.low)):NaN;if(e>0){var C=i.close[e-1],F=Math.max(k-T,Math.abs(k-C),Math.abs(T-C));N.atrBuffer.push(F),N.atrBuffer.length>h&&N.atrBuffer.shift()}var B=N.atrBuffer.length===h?N.atrBuffer.reduce((function(t,e){return t+e}),0)/h:NaN,U=NaN,V=NaN;if(e>0&&(V=A-i[c][e-1]),N.momentumBuffer.push(V),N.momentumBuffer.length>n&&N.momentumBuffer.shift(),N.momentumBuffer.length===n){var H=0,q=0;N.momentumBuffer.forEach((function(t){return t>=0?H+=t:q+=-t}));var L=H+q,$=2/(r+1)*((0===L?0:100*Math.abs((H-q)/L))/100);U=isNaN(N.prevVidya)?A:$*A+(1-$)*N.prevVidya,N.prevVidya=U}N.sma.update(U);var K=NaN;try{K=N.sma.getResult()}catch(t){}var z=isNaN(B)||isNaN(K)?NaN:K+B*p,G=isNaN(B)||isNaN(K)?NaN:K-B*p,Y=e>0?i[c][e-1]:NaN,J=e>0?i[_.upper][e-1]:NaN,W=e>0?i[_.lower][e-1]:NaN,Z=e>0&&Y<=J&&A>z,X=e>0&&Y>=W&&A<G;Z&&(N.isTrendUp=!0),X&&(N.isTrendUp=!1);var tt=0;e>0&&(tt=N.isTrendUp?I>0?I+1:1:I<0?I-1:-1),Z||X?N.upVol=N.downVol=0:(N.upVol+=x>E?M:0,N.downVol+=x<E?M:0);var et=(N.upVol+N.downVol)/2||1,rt=(N.upVol-N.downVol)/et,nt=N.isTrendUp?G:z,ot=NaN;return tt>0?ot=R:tt<0&&(ot=D),t.pushToMain({index:e,key:_.vidya,value:nt}),t.pushToMain({index:e,key:_.upper,value:z}),t.pushToMain({index:e,key:_.lower,value:G}),t.pushToMain({index:e,key:_.delta_vol,value:rt}),t.pushToMain({index:e,key:_.cross,value:tt}),t.pushToMain({index:e,key:_.liquidity,value:ot}),N.liquidity.high.push(k),N.liquidity.low.push(T),N.liquidity.high.length>m&&N.liquidity.high.shift(),N.liquidity.low.length>m&&N.liquidity.low.shift(),!0},macd:function(t,e,r,n,o,i){var a=i.target,u=i.lag,l=i.precomputed,c=t.verticalOhlcv,s=t.instances,f=t.priceBased,h=l.instanceKey;if(0===e){var y=t.inputParams,p=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var v,m=0,d=function(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 je(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)?je(t,e):void 0}}(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}}}}(y);try{for(d.s();!(v=d.n()).done;)"macd"===v.value.key&&m++}catch(t){d.e(t)}finally{d.f()}var b=m>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",g=a===Ne?"".concat(b,"_diff"):"".concat(b,"_diff_").concat(a),w=a===Ne?"".concat(b,"_dea"):"".concat(b,"_dea_").concat(a),O=a===Ne?"".concat(b,"_histogram"):"".concat(b,"_histogram_").concat(a);s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:m,settings:{}}),s.macd.settings[h]=new Kt(new Vt(r),new Vt(n),new Vt(o)),Object.assign(c,Se(Se(Se({},g,new Float64Array(p).fill(NaN)),w,new Float64Array(p).fill(NaN)),O,new Float64Array(p).fill(NaN)));for(var S=[g,w,O],j=0,N=S;j<N.length;j++){var P=N[j];f.add(P)}u>0&&t.lag(S,u)}var _=s.macd,A=_.numberOfIndicators,k=_.settings,T=A>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",x=a===Ne?"".concat(T,"_diff"):"".concat(T,"_diff_").concat(a),E=a===Ne?"".concat(T,"_dea"):"".concat(T,"_dea_").concat(a),M=a===Ne?"".concat(T,"_histogram"):"".concat(T,"_histogram_").concat(a),I=k[h],D=c[a][e];I.update(D);var R={};try{R=I.getResult()}catch(t){}return t.pushToMain({index:e,key:x,value:R?R.macd:NaN}),t.pushToMain({index:e,key:E,value:R?R.signal:NaN}),t.pushToMain({index:e,key:M,value:R?R.histogram:NaN}),!0},volumeDelta:function(t,e,r){var n=r.lag,o=void 0===n?0:n,i=t.verticalOhlcv,a=t.instances,u=t.len,l="volume_delta";if(0===e){a[l]||(a[l]={isBuyVolume:!0,cross:0});for(var c=["".concat(l,"_open"),"".concat(l,"_high"),"".concat(l,"_low"),"".concat(l,"_close"),"".concat(l,"_cross")],s=0,f=c;s<f.length;s++)i[f[s]]=new Float64Array(u).fill(NaN);o>0&&t.lag(c,o)}var h=a[l],y=i.volume[e],p=i.open[e],v=i.close[e],m=e>0?i.close[e-1]:NaN,d=h.isBuyVolume;v>p?d=!0:v<p?d=!1:v>m?d=!0:v<m&&(d=!1),h.isBuyVolume=d,e<1?h.cross=d?1:-1:d?h.cross>0?h.cross=h.cross+1:h.cross=1:h.cross>0?h.cross=-1:h.cross=h.cross-1;var b=Number.isFinite(y)?d?y:-y:NaN,g=Number.isNaN(b)?NaN:0,w=b,O=Number.isNaN(b)?NaN:Math.max(b,0),S=Number.isNaN(b)?NaN:Math.min(b,0);return t.pushToMain({index:e,key:"".concat(l,"_open"),value:g}),t.pushToMain({index:e,key:"".concat(l,"_high"),value:O}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:S}),t.pushToMain({index:e,key:"".concat(l,"_close"),value:w}),t.pushToMain({index:e,key:"".concat(l,"_cross"),value:h.cross}),!0},relativeVolume:function(t,e,r,n){var o=n.lag,i="relative_volume_".concat(r),a=t.instances,u=t.verticalOhlcv;if(0===e){var l=t.len;a[i]={instance:new Q(r),prevRelativeVolumeSma:NaN},u[i]=new Float64Array(l).fill(NaN),o>0&&t.lag([i],o)}var c=u.volume[e],s=a[i].instance;s.update(c);var f=NaN;try{f=s.getResult()}catch(t){}var h=a[i].prevRelativeVolumeSma,y=NaN;return Number.isNaN(f)||Number.isNaN(h)||(y=c/h),t.pushToMain({index:e,key:i,value:y}),a[i].prevRelativeVolumeSma=f,!0},donchianChannels:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.inputParams,c=t.lag,s=t.priceBased,f=o.height,h=o.range,y="".concat(r,"_").concat(n);if(0===e){var p=l.filter((function(t){return"donchianChannels"===t.key})).length,v="donchian_channel",m=p>1?"".concat(v,"_").concat(y):v,d=["upper","basis","lower"].map((function(t){return"".concat(m,"_").concat(t)}));f&&d.push("".concat(m,"_height"));var b,g=_e(h);try{for(g.s();!(b=g.n()).done;){var w=b.value;if(!(w in i))throw new Error('Invalid range key "'.concat(w,'".'));d.push("".concat(m,"_range_").concat(w))}}catch(t){g.e(t)}finally{g.f()}var O,S=_e(d);try{for(S.s();!(O=S.n()).done;){var j=O.value;s.add(j)}}catch(t){S.e(t)}finally{S.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:p,settings:{}}),a.donchian_channel.numberOfIndicators=p,a.donchian_channel.settings[y]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(d.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),c>0&&t.lag(d,c)}var N=a.donchian_channel,P=N.numberOfIndicators,_=N.settings,A=P>1?"donchian_channel_".concat(y):"donchian_channel",k=_[y],T=k.maxDeque,x=k.minDeque,E=e-n,M=E-r+1,I=["upper","basis","lower"].map((function(t){return"".concat(A,"_").concat(t)}));f&&I.push("".concat(A,"_height"));var D=h.map((function(t){return"".concat(A,"_range_").concat(t)}));if(M<0||E+1>u)return[].concat(Pe(I),Pe(D)).forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var R=i.high,C=i.low,F=function(t,e,r){for(;t.length&&t[0]<M;)t.shift();for(;t.length&&r(e[t.at(-1)],e[E]);)t.pop();t.push(E)};F(T,R,(function(t,e){return t<=e})),F(x,C,(function(t,e){return t>=e}));var B=T.length&&x.length,U=B?R[T[0]]:NaN,V=B?C[x[0]]:NaN,H=B?(U+V)/2:NaN;if(t.pushToMain({index:e,key:"".concat(A,"_upper"),value:U}),t.pushToMain({index:e,key:"".concat(A,"_basis"),value:H}),t.pushToMain({index:e,key:"".concat(A,"_lower"),value:V}),f){var q=B&&V?(U-V)/V:NaN;t.pushToMain({index:e,key:"".concat(A,"_height"),value:q})}for(var L=B?U-V:NaN,$=0;$<h.length;$++){var K=i[h[$]][e],z=B&&K==K&&L?(K-V)/L:NaN;t.pushToMain({index:e,key:D[$],value:z})}return!0},bollingerBands:function(t,e,r,n,o){var i,a,u,l,c,s,f=o.height,h=o.range,y=void 0===h?[]:h,p=o.target,v=o.lag,m=t.verticalOhlcv,d=t.instances,b="".concat(r,"_").concat(n),g="bollinger_bands";if(0===e){var w=t.inputParams,O=t.verticalOhlcv,S=t.len,j=t.priceBased;if(!(p in O))throw new Error('bollingerBands could not find target "'.concat(p,'"'));var N,P=0,_=Me(w);try{for(_.s();!(N=_.n()).done;)"bollingerBands"===N.value.key&&P++}catch(t){_.e(t)}finally{_.f()}d.bollinger_bands||(d.bollinger_bands={numberOfIndicators:P,settings:{}}),d.bollinger_bands.settings[b]=new Et(r,n);var A="";P>1&&(A+="_".concat(b)),p!==De&&(A+="_".concat(p));var k=["".concat(g,"_upper"),"".concat(g,"_middle"),"".concat(g,"_lower")].map((function(t){return"".concat(t).concat(A)}));f&&k.push("".concat(g,"_height").concat(A));var T,x=Me(y);try{for(x.s();!(T=x.n()).done;){var E=T.value;if(!(E in O))throw new Error('Invalid range item value "'.concat(E,'" property for bollingerBands.'));k.push("".concat(g,"_range_").concat(E).concat(A))}}catch(t){x.e(t)}finally{x.f()}if(j.has(p)){var M,I=Me(k);try{for(I.s();!(M=I.n()).done;){var D=M.value;j.add(D)}}catch(t){I.e(t)}finally{I.f()}}var R=Object.fromEntries(k.map((function(t){return[t,new Float64Array(S).fill(NaN)]})));Object.assign(O,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?xe(Object(r),!0).forEach((function(e){Ee(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},R)),v>0&&t.lag(k,v)}var C="";d.bollinger_bands.numberOfIndicators>1&&(C+="_".concat(b)),p!==De&&(C+="_".concat(p));var F=d.bollinger_bands.settings[b],B=m[p][e];F.update(B);var U={};try{U=F.getResult()}catch(t){}var V=null!==(i=null===(a=U)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,H=null!==(u=null===(l=U)||void 0===l?void 0:l.middle)&&void 0!==u?u:NaN,q=null!==(c=null===(s=U)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:e,key:"".concat(g,"_upper").concat(C),value:V}),t.pushToMain({index:e,key:"".concat(g,"_middle").concat(C),value:H}),t.pushToMain({index:e,key:"".concat(g,"_lower").concat(C),value:q}),f){var L=NaN;Number.isNaN(q)||Number.isNaN(V)||(L=(V-q)/q),t.pushToMain({index:e,key:"".concat(g,"_height").concat(C),value:L})}var $,K=Me(y);try{for(K.s();!($=K.n()).done;){var z=$.value,G=NaN,Y=m[z][e];Number.isNaN(Y)||Number.isNaN(q)||Number.isNaN(V)||(G=(Y-q)/(V-q)),t.pushToMain({index:e,key:"".concat(g,"_range_").concat(z).concat(C),value:G})}}catch(t){K.e(t)}finally{K.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a,u,l=o.lag,c=t.verticalOhlcv,s=t.instances,f=c.volume[e],h="volume_oscillator_".concat(r,"_").concat(n);if(0===e){var y=t.len;Object.assign(s,(i={},a=h,u={fastEMA:new Vt(r),slowEMA:new Vt(n)},(a=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+""}(a))in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,i)),c[h]=new Float64Array(y).fill(NaN),l>0&&t.lag([h],l)}var p=s[h],v=p.fastEMA,m=p.slowEMA;v.update(f),m.update(f);var d=NaN,b=NaN;try{d=v.getResult()}catch(t){}try{b=m.getResult()}catch(t){}var g=NaN;return Number.isNaN(d)||Number.isNaN(b)||(g=100*(d-b)/b),t.pushToMain({index:e,key:h,value:g}),!0},mapCols:function(t,e,r,n,o){var i=o.lag,a=o.isPriceBased,u=t.verticalOhlcv,l=t.len,c=t.priceBased,s=t.precision;if(0===e){var f,h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=jr(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}}}}(r);try{for(h.s();!(f=h.n()).done;){var y=f.value;if(u.hasOwnProperty(y))throw new Error('New property "'.concat(y,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'));u[y]=new Array(l).fill(0),s&&a&&c.add(y)}}catch(t){h.e(t)}finally{h.f()}i>0&&t.lag(r,i)}var p,v,m=n({index:e,main:t});if(null==m)return!0;for(var d=0,b=Object.entries(m);d<b.length;d++){var g=(p=b[d],v=2,function(t){if(Array.isArray(t))return t}(p)||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}}(p,v)||jr(p,v)||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.")}()),w=g[0],O=g[1];t.pushToMain({index:e,key:w,value:O})}},scaler:function(t,e,r,n,o){var i=o.type,a=o.minMaxRange,u=o.lookback,l=o.weights,c=o.euclideanWeights,s=o.byFeatureRange,f=t.verticalOhlcv,h=t.instances,y="".concat(i,"_").concat(r);if(0===e){var p=t.len;if(t.isAlreadyComputed.has(y))throw new Error('In scaler method can not repeat params "size" and "options.type" together between indicators.');h.hasOwnProperty("scaler")||(h.scaler={}),h.scaler.hasOwnProperty(y)||(h.scaler[y]={extectedFeatures:0===u?n.length:n.length+u*n.length});var v,m=[],d=gr(n);try{var b=function(){var e=v.value;if(!f.hasOwnProperty(e))throw new Error('Target property "'.concat(e,'" not found in verticalOhlcv'));var r,n="".concat(y,"_").concat(e);if(f[n]=new Float64Array(p).fill(NaN),t.scaledGroups[y]||(t.scaledGroups[y]=[]),t.scaledGroups[y].push(n),u>0){var o,i,a=Array.from({length:u}).map((function(t,e){return"".concat(n,"_lag_").concat(e+1)})),l=gr(a);try{for(l.s();!(i=l.n()).done;){var c=i.value;f[c]=new Float64Array(p).fill(NaN)}}catch(t){l.e(t)}finally{l.f()}(o=t.scaledGroups[y]).push.apply(o,function(t){if(Array.isArray(t))return Or(t)}(r=a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||wr(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.")}()),m.push(n)}};for(d.s();!(v=d.n()).done;)b()}catch(t){d.e(t)}finally{d.f()}for(var g=0,w=Object.keys(l);g<w.length;g++){var O=w[g];if(!f.hasOwnProperty(O))throw new Error('Target property "'.concat(O,'" not found in verticalOhlcv'))}}for(var S=h.scaler[y].extectedFeatures,j=!1,N={},P=[],_=0,A=0;A<n.length;A++){var k,T,x=n[A],E=f[x],M=null!==(k=null==l||null===(T=l[x])||void 0===T?void 0:T[0])&&void 0!==k?k:1,I=E[e];if(Sr(I)){j=!0;break}if(N[x]={val:I,weight:c?Math.sqrt(M):M},P.push(I),_++,u>0){for(var D=1;D<=u;D++){var R,C,F=null!==(R=null==l||null===(C=l[x])||void 0===C?void 0:C[D])&&void 0!==R?R:1,B=E[e-D];if(Sr(B)){j=!0;break}N["".concat(x,"_lag_").concat(D)]={val:B,weight:c?Math.sqrt(F):F},P.push(B),_++}if(j)break}}if(!j&&_===S){if("minmax"===i)for(var U=Math.min.apply(Math,P),V=Math.max.apply(Math,P),H=0,q=Object.entries(N);H<q.length;H++){var L=br(q[H],2),$=L[0],K=L[1],z=K.val,G=K.weight,Y=rr(z,U,V,a),J=0===Y?0:Y*G;t.pushToMain({index:e,key:"".concat(y,"_").concat($),value:J})}if("zscore"===i)for(var W=P.length,Z=P.reduce((function(t,e){return t+e}),0)/W,Q=P.reduce((function(t,e){return t+Math.pow(e-Z,2)}),0)/W,X=Math.sqrt(Q),tt=0,et=Object.entries(N);tt<et.length;tt++){var rt=br(et[tt],2),nt=rt[0],ot=rt[1],it=ot.val,at=ot.weight,ut=nr(it,Z,X),lt=0===ut?0:ut*at;t.pushToMain({index:e,key:"".concat(y,"_").concat(nt),value:lt})}if("byfeature"===i)for(var ct=br(s,2),st=ct[0],ft=ct[1],ht=0,yt=Object.entries(N);ht<yt.length;ht++){var pt=br(yt[ht],2),vt=pt[0],mt=pt[1],dt=mt.val,bt=mt.weight,gt=rr(dt,st,ft,a),wt=0===gt?0:gt*bt;t.pushToMain({index:e,key:"".concat(y,"_").concat(vt),value:wt})}}},crossPairs:function(t,e,r,n){var o,i=n.oneHot,a=n.limit,u=t.verticalOhlcv,l=t.verticalOhlcvTempCols,c=t.instances,s=t.len,f=t.precision,h=t.precisionMultiplier,y=t.priceBased,p=function(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 or(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)?or(t,e):void 0}}(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}}}}(r);try{for(p.s();!(o=p.n()).done;){var v=o.value,m=v.fast,d=v.slow,b="".concat(m,"_x_").concat(d);if(0===e){if("number"==typeof d){var g=d.toString();l.add(g);var w=f&&("price"===m||y.has(m)),O=w?Ue(g,h):d,S=d>=-125&&d<=125&&!1===w?"Int8Array":"Float64Array";u[g]=We(S,s,O)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new sr,min:1/0,max:-1/0};var j=null!==a&&a<=125?"Int8Array":"Float64Array";u[b]=We(j,s,0),i&&(u["one_hot_".concat(b)]=We("Array",s,null))}else if(e+1===s){if("price"!==m&&!u.hasOwnProperty(m))throw new Error('crossPairs invalid param: fast "'.concat(m,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))));if(!u.hasOwnProperty(d))throw new Error('crossPairs invalid param: slow "'.concat(d,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))))}if("price"!==m&&!u.hasOwnProperty(m))return;if(!u.hasOwnProperty(d))return;var N=c.crossPairs[b].run;if("price"===m){var P=u.close[e],_=u[d][e];N.update(e,{fast:P,slow:_,high:u.high[e],low:u.low[e]})}else{var A=u[m][e],k=u[d][e];N.update(e,{fast:A,slow:k})}var T=N.getResult(),x=null!==a?Math.min(Math.max(T,-a),a):T;if(t.pushToMain({index:e,key:b,value:x}),i){var E=x+a,M=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(b),value:er(E,M)})}}}catch(t){p.e(t)}finally{p.f()}return!0},lag:function(t,e,r,n){var o=t.verticalOhlcv,i=t.len,a=t.priceBased;if(0===e){var u,l=Qe(r);try{for(l.s();!(u=l.n()).done;){var c=u.value;if(!o.hasOwnProperty(c))throw new Error('Lag processing invoked by col "'.concat(c,'" was not found in "verticalOhlcv".'));for(var s=a.has(c),f=1;f<=n;f++){var h="".concat(c,"_lag_").concat(f);s&&a.add(h);var y=Ze(c,o[c]);o[h]=We(y,i)}}}catch(t){l.e(t)}finally{l.f()}}var p,v=Qe(r);try{for(v.s();!(p=v.n()).done;)for(var m=p.value,d=o[m],b=1;b<=n;b++){var g="".concat(m,"_lag_").concat(b),w=e-b,O=w<0||void 0===d[w]?null:d[w];t.pushToMain({index:e,key:g,value:O})}}catch(t){v.e(t)}finally{v.f()}return!0}};function Cr(t,e){if(t){if("string"==typeof t)return Fr(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)?Fr(t,e):void 0}}function Fr(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 Br=function(t){var e=t.main,r=t.skipNull,n=void 0!==r&&r,o=t.startIndex,i=void 0===o?0:o,a=t.dateFormat,u=e.verticalOhlcv,l=e.invalidValueIndex,c=e.len,s=e.verticalOhlcvKeyNames,f=e.verticalOhlcvTempCols,h=e.priceBased,y=e.precision,p=e.precisionMultiplier;if(0===s.length)return[];var v,m,d,b=n&&l>=0?l+1:0,g=Math.max(b,i),w=c-g,O=Array.from({length:w},(function(){return{}})),S={},j=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Cr(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}}}}(s);try{for(j.s();!(v=j.n()).done;){var N=v.value;y&&h.has(N)?S[N]=function(t,e){return function(t,e){if("number"!=typeof t||!Number.isFinite(t))throw new Error("revertPrecisionAsNumber expects a finite number");var r=t<0,n=Math.abs(t);n=Math.trunc(n);var o=1===e?0:String(e).length-1;if(0===o)return r?-n:n;var i=Math.trunc(n/e),a=String(n%e).padStart(o,"0"),u=0===(a=a.replace(/0+$/,"")).length?String(i):"".concat(i,".").concat(a);return Number(r?"-".concat(u):u)}(t,e)}:S[N]=function(t){return t}}}catch(t){j.e(t)}finally{j.f()}for(var P=0,_=Object.entries(u);P<_.length;P++){var A=(m=_[P],d=2,function(t){if(Array.isArray(t))return t}(m)||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}}(m,d)||Cr(m,d)||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.")}()),k=A[0],T=A[1];if(!f.has(k))for(var x=g;x<c;x++)O[x-g][k]="date"===k?$e[a](T[x]):S[k](T[x],p)}return O};function Ur(t){return Ur="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},Ur(t)}function Vr(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)||qr(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 Hr(t,e,r){return(e=Kr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qr(t,e){if(t){if("string"==typeof t)return Lr(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)?Lr(t,e):void 0}}function Lr(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 $r(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,Kr(n.key),n)}}function Kr(t){var e=function(t,e){if("object"!=Ur(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ur(e)?e:e+""}var zr=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,i=void 0===o?null:o,u=e.inputParams,c=void 0===u?null:u,s=e.chunkProcess,y=void 0===s?2e3:s,p=e.precision,v=void 0!==p&&p;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l(n,"input",null!==i?"contructor ".concat(i):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+i);h(y,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),f(v,"precision","contructor"),this.chunkProcess=y,this.input=function(t){return function(t){if(Array.isArray(t))return Lr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||qr(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.")}()}(n),this.len=this.input.length,this.firstRow=this.input[0],this.precision=v;var m=["open","high","low","close"];this.initialPriceBased=new Set(m),this.priceBased=new Set(m),this.precisionMultiplier=function(t){var e=t.precision,r=t.firstRow,n=t.initialPriceBased;if(!1===e)return 1;for(var o=1,i=0,a=Object.entries(r);i<a.length;i++){var u=Fe(a[i],2),l=u[0],c=u[1];if(n.has(l)){if("string"!=typeof c||!/^\d+(\.\d+)?$/.test(c))throw new Error('If "precision" is set to true all the "open", "high", "low" and "close" values must be numeric strings like "123.45" with no commas or currency symbols. Property "'.concat(l,'" had the value "').concat(c,'" type ').concat(Ce(c),"."));var s=Fe(c.split("."),2),f=s[0],h=s[1],y=void 0===h?"":h,p=Number(f),v=4;if(0===Math.abs(p)){var m=y.length,d=Math.max(4,m),b=y.search(/[1-9]/);if(-1===b)v=d;else{var g=b+1+5;v=Math.max(d,g)}}var w=Math.pow(10,v);w>o&&(o=w)}}return o}(this);var d=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=0,u=Object.entries(e);a<u.length;a++){var l=Ye(u[a],2),c=l[0],s=l[1];if("date"===c)o[c]=ze(s),i[c]="Array";else if("volume"===c)o[c]=qe(s,!0),i[c]="Int32Array";else if(n.has(c))o[c]=qe(s,!0,r),i[c]="Float64Array";else{var f=qe(s,!1,r);o[c]=f,i[c]="number"===f?"Float64Array":"Array"}}return{inputTypes:o,arrayTypes:i}}(this),b=d.inputTypes,g=d.arrayTypes;if(this.inputTypes=b,this.arrayTypes=g,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(i));return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.instances={},this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set,this.pushToMain=function(t){var e=t.index,n=t.key,o=t.value;return function(t){var e=t.index,r=t.key,n=t.value;return t.main.verticalOhlcv[r][e]=n,!0}({main:r,index:e,key:n,value:o})},null!==c?(a(c,this.len),this.inputParams=c.sort((function(t,e){return t.order-e.order})),this.compute()):this.inputParams=[],this},e=[{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.skipNull,r=void 0===e||e,n=t.dateFormat,o=void 0===n?"milliseconds":n;return s(Object.keys($e),o,"dateFormat","getData"),c(t,"options","getData"),Br({main:this,skipNull:r,startIndex:0,dateFormat:o})}},{key:"getLastValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.dateFormat,r=void 0===e?"milliseconds":e;return s(Object.keys($e),r,"dateFormat","getData"),Br({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:r})[0]}},{key:"compute",value:function(){return this.isComputed||(this.inputParams=this.inputParams.sort((function(t,e){return t.order-e.order})),this.isComputed=!1,this.len>0&&(function(t,e){var n=e.len,o=e.arrayTypes,i=e.verticalOhlcv,u=e.verticalOhlcvKeyNames,l=e.inputTypes,c=e.chunkProcess,s=e.precisionMultiplier,f=e.inputParams;a(f,n);for(var h=0,y=Object.keys(l);h<y.length;h++){var p=y[h];i[p]=We(o[p],n)}for(var v=0;v<n;v+=c)for(var m=Math.min(v+c,n),d=v;d<m;d++){for(var b=t[d],g=0,w=Object.entries(l);g<w.length;g++){var O=Mr(w[g],2),S=O[0],j=O[1],N=b[S];if(He.hasOwnProperty(j)){void 0===N&&console.log({index:d,formaterKey:j,key:S});var P=He[j](N,s);e.pushToMain({index:d,key:S,value:P})}else Ke.hasOwnProperty(j)?e.pushToMain({index:d,key:S,value:Ke[j](N)}):e.pushToMain({index:d,key:S,value:N})}var _,A=Er(f);try{for(A.s();!(_=A.n()).done;){var k=_.value,T=k.key,x=k.params;Rr[T].apply(Rr,[e,d].concat(xr(x)))}}catch(t){A.e(t)}finally{A.f()}t[d]=null;var E=Object.keys(i);r(e,d,E)||(e.invalidValueIndex=d)}u.push.apply(u,xr(Object.keys(i)))}(this.input,this),this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[])),this}},{key:"crossPairs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="crossPairs";u(this),l(t,"arr",r),c(e,"options",r);var n=e.limit,o=void 0===n?null:n,i=e.oneHot,a=void 0!==i&&i;null!==o&&h(o,{min:2,max:this.len},"options.limit",r),f(a,"options.oneHot",r);var s,y=[],p=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qr(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}}}}(t);try{for(p.s();!(s=p.n()).done;){var v=s.value,m=v.fast,d=void 0===m?"":m,b=v.slow,g=void 0===b?"":b;if(""===d||""===g)throw new Error("Invalid crossPairs[".concat(d,"_").concat(g,"]: Object property “fast” must be a non-null column name and “slow” must be a non-null column name or integer."));y.push(d.toString(),g.toString())}}catch(t){p.e(t)}finally{p.f()}if(this.isAlreadyComputed.has(r))throw new Error('You can only call the "'.concat(r,'" method once.'));return this.isAlreadyComputed.add(r),this.inputParams.push({key:r,params:[t,{limit:o,oneHot:a}]}),this}},{key:"lag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r="lag";return u(this),l(t,"colKeys",r),h(e,{min:1,max:this.len,allowDecimals:!1},"lookback",r),this.inputParams.push({key:r,params:[t,e]}),this}},{key:"relativeVolume",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n;return h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o}]}),this}},{key:"volumeDelta",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="volumeDelta";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeDelta" is called the input ohlcv must contain valid volume properties.');u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r;return h(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this.inputParams.push({key:e,order:0,params:[{lag:n}]}),this}},{key:"atr",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="atr";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.percentage,a=void 0!==i&&i,l=e.upper,s=void 0===l?null:l,y=e.lower,p=void 0===y?null:y;return h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.percentage","atr"),null!==s&&h(s,{min:.001,max:100,allowDecimals:!0},"options.upper","atr"),null!==p&&h(p,{min:.001,max:100,allowDecimals:!0},"options.lower","atr"),this.inputParams.push({key:r,order:0,params:[t,{lag:o,percentage:a,upper:s,lower:p}]}),this}},{key:"ema",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="ema";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return p(o,"options.target",r),h(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"sma",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="sma";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return p(o,"options.target",r),h(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"heikenAshi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="heikenAshi";u(this);var o=null===t&&null===e;!1===o&&(h(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),h(e,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),c(r,"options",n);var i=r.lag,a=void 0===i?0:i;return h(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:a,bothNull:o}]}),this}},{key:"vidya",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="vidya";u(this),h(t,{min:2,max:this.len,allowDecimals:!1},"size",n),h(e,{min:1,max:this.len,allowDecimals:!1},"momentum",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.lag,l=void 0===a?0:a,s=r.atrLength,f=void 0===s?200:s,y=r.bandDistance,v=void 0===y?2:y,m=r.liquidityLookback,d=void 0===m?20:m;return p(i,"options.target",n),h(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),h(v,{min:.01,max:10,allowDecimals:!0},"options.bandDistance",n),h(f,{min:2,max:this.len,allowDecimals:!1},"options.atrLength",n),h(d,{min:1,max:this.len,allowDecimals:!1},"options.liquidityLookback",n),this.inputParams.push({key:n,params:[t,e,{target:i,lag:l}]}),this}},{key:"stochastic",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="stochastic",i=this.len;h(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),h(e,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),h(r,{min:1,max:i,allowDecimals:!1},"dPeriod",o),c(n,"options",o);var a=n.lag,u=void 0===a?0:a;return h(u,{min:0,max:i,allowDecimals:!1},"options.lag",o),this.inputParams.push({key:o,order:0,params:[t,e,r,{lag:u}]}),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]:{},o="macd";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),h(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),h(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),c(n,"options",o);var i=n.target,a=void 0===i?"close":i,l=n.lag,s=void 0===l?0:l;p(a,"options.target",o),h(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var f={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===a?"":"_".concat(a))};return this.inputParams.push({key:o,params:[t,e,r,{target:a,lag:s,precomputed:f}]}),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]:{},n="bollingerBands";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",n),h(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.height,s=void 0!==a&&a,y=r.range,v=void 0===y?[]:y,m=r.lag,d=void 0===m?0:m;return p(i,"options.target",n),l(v,"options.range",n),h(d,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"options.height",n),this.inputParams.push({key:n,params:[t,e,{target:i,height:s,range:v,lag:d}]}),this}},{key:"rsi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="rsi";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return p(o,"options.target",r),h(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[t,{target:o,lag:a}]}),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]:{},n="donchianChannels";u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"size",n),h(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),c(r,"options",n);var o=r.height,i=void 0!==o&&o,a=r.range,s=void 0===a?[]:a,y=r.lag,p=void 0===y?0:y;return l(s,"options.range",n),h(p,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),this.inputParams.push({key:n,order:0,params:[t,e,{height:i,range:s,lag:p}]}),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]:{},n="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');u(this),h(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),h(e,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),c(r,"options",n);var o=r.lag,i=void 0===o?0:o;return h(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:i}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="dateTime";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.oneHot,i=void 0!==o&&o;h(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),f(i,"options.oneHot",e);var a=i?"one_hot_":"",l=Hr(Hr(Hr(Hr(Hr({},"".concat(a,"month"),12),"".concat(a,"day_of_the_month"),31),"".concat(a,"day_of_the_week"),7),"".concat(a,"hour"),24),"".concat(a,"minute"),60),s={prefix:a,colKeySizes:l,colKeys:Object.keys(l)};return this.inputParams.push({key:e,order:0,params:[{lag:n,oneHot:i,precompute:s}]}),this}},{key:"priceFeatures",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="priceFeatures";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.colKeys,i=void 0===o?[]:o;return h(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),l(i,"options.colKeys",e),this.inputParams.push({key:e,params:[{lag:n,colKeys:i}]}),this}},{key:"scaler",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zscore",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="scaler";u(this),s(["minmax","zscore","byfeature"],t,"options.type",n),h(e,{min:1,max:this.len,allowDecimals:!1},"size",n);var o="".concat(n,"(").concat(t,", ").concat(e,", options = {})");c(r,"options",o);var i=r.minMaxRange,a=void 0===i?null:i,p=r.lag,v=void 0!==p&&p,m=r.colKeys,d=void 0===m?[]:m,b=r.weights,g=void 0===b?{}:b,w=r.euclideanWeights,O=void 0!==w&&w,S=r.byFeatureRange,j=void 0===S?null:S;r.deltaSplit,l(d,"options.colKeys",o),f(v,"options.lag",o),c(g,"options.weights",o);var N=v?e-1:0;if(0===d.length)throw new Error('The property "options.colKeys" must be an array with target keys in '.concat(o,"."));for(var P=0,_=Object.entries(g);P<_.length;P++){var A=Vr(_[P],2),k=A[0],T=A[1];if(l(T,"options.weights.".concat(k)),!v&&T.size>0)throw new Error('If "options.lag" is set to false "options.weights.'.concat(k,'" can only contain 1 item (float) in ').concat(o,"."));if(T.length>e)throw new Error('The length of the property "options.weights.'.concat(k,'" can not be longer than "size" in ').concat(o,"."));for(var x=0;x<T.length;x++){var E=T[x];h(E,{min:.01,max:10,allowDecimals:!0},"options.weights.".concat(k,"[").concat(x,"]"),o)}}if("byfeature"!==t){if(null==!j)throw new Error('"options.byFeatureRange" is only valid when "type" is "byfeature".')}else y(j,"options.byFeatureRange",o);return["minmax","byfeature"].includes(t)&&y(a,"options.minMaxRange",o),this.inputParams.push({key:n,params:[e,d,{type:t,minMaxRange:a,lookback:N,weights:g,euclideanWeights:O,byFeatureRange:j}]}),this}},{key:"mapCols",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["change"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this);var n="mapCols";null==e&&(e=Pr),c(r,"options",n);var o=r.lag,i=void 0===o?0:o,a=r.isPriceBased,s=void 0!==a&&a;if(l(t,"newCols",n),h(i,{min:0,allowDecimals:!1},"options.lag",n),f(s,"isPriceBased","mapCols"),!1===this.precision&&s)throw new Error('Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.');return this.inputParams.push({key:n,params:[t,e,{lag:i,isPriceBased:s}]}),this}}],e&&$r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
|
package/index.js
CHANGED
|
@@ -92,7 +92,7 @@ export default class OHLCV_INDICATORS {
|
|
|
92
92
|
//getData method returns the last object (row) of the new OHLCV with indicators: {open, high, low, close, rsi_14, bollinger_bands_upper}
|
|
93
93
|
this.compute()
|
|
94
94
|
|
|
95
|
-
const {skipNull = true, dateFormat = '
|
|
95
|
+
const {skipNull = true, dateFormat = 'milliseconds'} = options
|
|
96
96
|
|
|
97
97
|
validateArrayOptions(Object.keys(dateOutputFormaters), dateFormat, 'dateFormat', 'getData')
|
|
98
98
|
validateObject(options, 'options', 'getData')
|
|
@@ -110,7 +110,7 @@ export default class OHLCV_INDICATORS {
|
|
|
110
110
|
|
|
111
111
|
this.compute()
|
|
112
112
|
|
|
113
|
-
const {dateFormat = '
|
|
113
|
+
const {dateFormat = 'milliseconds'} = options
|
|
114
114
|
|
|
115
115
|
validateArrayOptions(Object.keys(dateOutputFormaters), dateFormat, 'dateFormat', 'getData')
|
|
116
116
|
|
|
@@ -367,30 +367,11 @@ export default class OHLCV_INDICATORS {
|
|
|
367
367
|
validateNumber(dPeriod, {min: 1, max, allowDecimals: false}, 'dPeriod', methodName)
|
|
368
368
|
validateObject(options, 'options', methodName)
|
|
369
369
|
|
|
370
|
-
let parser = v => v
|
|
371
|
-
let prefix = ''
|
|
372
|
-
|
|
373
370
|
const {lag = 0} = options
|
|
374
371
|
|
|
375
372
|
validateNumber(lag, {min: 0, max, allowDecimals: false}, 'options.lag', methodName)
|
|
376
373
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if(Array.isArray(minmax) || (typeof minmax === 'boolean' && minmax === true))
|
|
380
|
-
{
|
|
381
|
-
if(Array.isArray(minmax)){
|
|
382
|
-
validateArrayOfRanges(minmax, 'options.minmax', methodName)
|
|
383
|
-
parser = value => (minmax !== null) ? normalizeMinMax(value, 0, 100, minmax) : value
|
|
384
|
-
} else
|
|
385
|
-
{
|
|
386
|
-
validateBoolean(minmax, 'options.minmax', methodName)
|
|
387
|
-
minmax = [0, 1]
|
|
388
|
-
parser = value => (minmax !== null) ? normalizeMinMax(value, 0, 100, minmax) : value
|
|
389
|
-
}
|
|
390
|
-
prefix = 'minmax_'
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
this.inputParams.push({key: methodName, order: 0, params: [kPeriod, kSlowingPeriod, dPeriod, {minmax, prefix, parser, lag}]})
|
|
374
|
+
this.inputParams.push({key: methodName, order: 0, params: [kPeriod, kSlowingPeriod, dPeriod, {lag}]})
|
|
394
375
|
|
|
395
376
|
return this
|
|
396
377
|
}
|
|
@@ -451,28 +432,11 @@ export default class OHLCV_INDICATORS {
|
|
|
451
432
|
validateObject(options, 'options', methodName)
|
|
452
433
|
|
|
453
434
|
const {target = 'close', lag = 0} = options
|
|
454
|
-
|
|
435
|
+
|
|
455
436
|
validateString(target, 'options.target', methodName)
|
|
456
437
|
validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
|
|
457
438
|
|
|
458
|
-
|
|
459
|
-
let prefix = ''
|
|
460
|
-
|
|
461
|
-
if(Array.isArray(minmax) || (typeof minmax === 'boolean' && minmax === true))
|
|
462
|
-
{
|
|
463
|
-
if(Array.isArray(minmax)){
|
|
464
|
-
validateArrayOfRanges(minmax, 'options.minmax', methodName)
|
|
465
|
-
parser = value => (minmax !== null) ? normalizeMinMax(value, 0, 100, minmax) : value
|
|
466
|
-
} else
|
|
467
|
-
{
|
|
468
|
-
validateBoolean(minmax, 'options.minmax', methodName)
|
|
469
|
-
minmax = [0, 1]
|
|
470
|
-
parser = value => (minmax !== null) ? normalizeMinMax(value, 0, 100, minmax) : value
|
|
471
|
-
}
|
|
472
|
-
prefix = 'minmax_'
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
this.inputParams.push({key: methodName, params: [size, {target, lag, parser, prefix, minmax}]})
|
|
439
|
+
this.inputParams.push({key: methodName, params: [size, {target, lag}]})
|
|
476
440
|
|
|
477
441
|
return this
|
|
478
442
|
}
|
|
@@ -585,7 +549,8 @@ export default class OHLCV_INDICATORS {
|
|
|
585
549
|
|
|
586
550
|
validateObject(options, 'options', longName)
|
|
587
551
|
|
|
588
|
-
const {minMaxRange = null, lag = false, colKeys = [], weights = {}, euclideanWeights = false, byFeatureRange = null} = options
|
|
552
|
+
const {minMaxRange = null, lag = false, colKeys = [], weights = {}, euclideanWeights = false, byFeatureRange = null, deltaSplit = false} = options
|
|
553
|
+
|
|
589
554
|
|
|
590
555
|
validateArray(colKeys, 'options.colKeys', longName)
|
|
591
556
|
validateBoolean(lag, 'options.lag', longName)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.63",
|
|
4
4
|
"description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]. This library is optimized for backtesting and trading bot development.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,12 +11,4 @@ export const normalizeMinMax = (value, min, max, [validMin, validMax]) => {
|
|
|
11
11
|
|
|
12
12
|
export const normalizeZScore = (value, mean, std) => {
|
|
13
13
|
return std === 0 ? 0 : (value - mean) / std
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const scaleByFeatureRange = (x, min, max) => {
|
|
17
|
-
const center = (min + max) / 2
|
|
18
|
-
const halfRange = (max - min) / 2
|
|
19
|
-
const scaled = ((x - center) / halfRange) * 2
|
|
20
|
-
|
|
21
|
-
return Math.max(-2, Math.min(2, scaled))
|
|
22
14
|
}
|
package/src/oscillators/rsi.js
CHANGED
|
@@ -2,15 +2,15 @@ import { FasterRSI } from 'trading-signals';
|
|
|
2
2
|
import { FasterSMA } from 'trading-signals';
|
|
3
3
|
|
|
4
4
|
const defaultTarget = 'close'
|
|
5
|
-
export const rsi = (main, index, size, { target, lag
|
|
5
|
+
export const rsi = (main, index, size, { target, lag }) => {
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
const { verticalOhlcv, instances } = main;
|
|
10
10
|
|
|
11
11
|
const suffix = target === defaultTarget ? '' : `_${target}`;
|
|
12
|
-
const rsiKey =
|
|
13
|
-
const rsiSmaKey =
|
|
12
|
+
const rsiKey = `rsi_${size}${suffix}`;
|
|
13
|
+
const rsiSmaKey = `rsi_sma_${size}${suffix}`;
|
|
14
14
|
|
|
15
15
|
// Initialization on the first index.
|
|
16
16
|
if (index === 0) {
|
|
@@ -37,18 +37,6 @@ export const rsi = (main, index, size, { target, lag, parser, prefix, minmax })
|
|
|
37
37
|
main.lag(baseKeys, lag);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//[key, key_lag_1, …, key_lag_n] for each key
|
|
41
|
-
const keyNames = lag > 0
|
|
42
|
-
? baseKeys.flatMap(key => [
|
|
43
|
-
key,
|
|
44
|
-
...Array.from({ length: lag }, (_, i) => `${key}_lag_${i + 1}`)
|
|
45
|
-
])
|
|
46
|
-
: baseKeys;
|
|
47
|
-
|
|
48
|
-
if (Array.isArray(minmax)) {
|
|
49
|
-
const group = main.scaledGroups.minmax_rsi ??= [];
|
|
50
|
-
group.push(...keyNames);
|
|
51
|
-
}
|
|
52
40
|
|
|
53
41
|
}
|
|
54
42
|
|
|
@@ -67,7 +55,7 @@ export const rsi = (main, index, size, { target, lag, parser, prefix, minmax })
|
|
|
67
55
|
|
|
68
56
|
|
|
69
57
|
// Always push the RSI value, using NaN as a fallback.
|
|
70
|
-
main.pushToMain({ index, key: rsiKey, value: (Number.isNaN(currentRsi)) ? NaN :
|
|
58
|
+
main.pushToMain({ index, key: rsiKey, value: (Number.isNaN(currentRsi)) ? NaN : currentRsi });
|
|
71
59
|
|
|
72
60
|
// Update the SMA indicator only if a valid RSI value is available.
|
|
73
61
|
if (!Number.isNaN(currentRsi)) {
|
|
@@ -81,5 +69,5 @@ export const rsi = (main, index, size, { target, lag, parser, prefix, minmax })
|
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
// Always push the smoothed RSI value.
|
|
84
|
-
main.pushToMain({ index, key: rsiSmaKey, value: (Number.isNaN(smoothedRsi)) ? NaN :
|
|
72
|
+
main.pushToMain({ index, key: rsiSmaKey, value: (Number.isNaN(smoothedRsi)) ? NaN : smoothedRsi });
|
|
85
73
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { FasterStochasticOscillator } from 'trading-signals';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {minmax, prefix, lag, parser}) => {
|
|
3
|
+
export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {lag}) => {
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
const { verticalOhlcv, instances } = main;
|
|
9
8
|
|
|
10
9
|
const paramsKey = (kPeriod === 14 && kSlowingPeriod === 3 && dPeriod === 3) ? '' : `${kPeriod}_${kSlowingPeriod}_${dPeriod}`
|
|
11
|
-
const stochD =
|
|
12
|
-
const stochK =
|
|
13
|
-
const instanceKey =
|
|
10
|
+
const stochD = `stoch_d${paramsKey}`;
|
|
11
|
+
const stochK = `stoch_k${paramsKey}`;
|
|
12
|
+
const instanceKey = paramsKey
|
|
14
13
|
|
|
15
14
|
// Initialization on the first index.
|
|
16
15
|
if (index === 0) {
|
|
@@ -32,18 +31,6 @@ export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {minma
|
|
|
32
31
|
main.lag(baseKeys, lag);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
//[key, key_lag_1, …, key_lag_n] for each key
|
|
36
|
-
const keyNames = lag > 0
|
|
37
|
-
? baseKeys.flatMap(key => [
|
|
38
|
-
key,
|
|
39
|
-
...Array.from({ length: lag }, (_, i) => `${key}_lag_${i + 1}`)
|
|
40
|
-
])
|
|
41
|
-
: baseKeys;
|
|
42
|
-
|
|
43
|
-
if (Array.isArray(minmax)) {
|
|
44
|
-
const group = main.scaledGroups.minmax_rsi ??= [];
|
|
45
|
-
group.push(...keyNames)
|
|
46
|
-
}
|
|
47
34
|
}
|
|
48
35
|
|
|
49
36
|
const close = verticalOhlcv['close'][index]
|
|
@@ -60,8 +47,8 @@ export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {minma
|
|
|
60
47
|
stockObj = null
|
|
61
48
|
}
|
|
62
49
|
|
|
63
|
-
const kVal = stockObj ?
|
|
64
|
-
const dVal = stockObj ?
|
|
50
|
+
const kVal = stockObj ? stockObj.stochK : NaN
|
|
51
|
+
const dVal = stockObj ? stockObj.stochD : NaN
|
|
65
52
|
|
|
66
53
|
main.pushToMain({ index, key: stochK, value: kVal })
|
|
67
54
|
main.pushToMain({ index, key: stochD, value: dVal })
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export const dateOutputFormaters = {
|
|
2
|
-
|
|
2
|
+
toString: d => d.toString(),
|
|
3
|
+
string: d => d.toString(), //fallback
|
|
4
|
+
toISOString: d => d.toISOString(),
|
|
5
|
+
iso: d => d.toISOString(), //fallback
|
|
6
|
+
toUTCString: d => d.toUTCString(),
|
|
3
7
|
milliseconds: d => d.getTime(),
|
|
4
8
|
seconds: d => d.getTime() / 1000,
|
|
5
9
|
object: d => d
|