ohlcv-indicators 3.5.79 → 3.5.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1 @@
1
- /*! For license information please see ohlcv-indicators.min.js.LICENSE.txt */
2
- 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:()=>cr});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 l=n[a][e];if(null==l||Number.isNaN(l)){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=function(t,e){if(t){if("string"==typeof t)return o(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)?o(t,e):void 0}}(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,l=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return l=t.done,t},e:function(t){u=!0,a=t},f:function(){try{l||null==r.return||r.return()}finally{if(u)throw a}}}}function o(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 i=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=r.value;if(!i||"string"!=typeof i.key||!Array.isArray(i.params))throw new TypeError("Each inputParams entry must have an indicator key and a params array.");if(void 0!==i.order&&!Number.isFinite(i.order))throw new TypeError("Indicator order must be a finite number when provided.");var a,l=n(i.params);try{for(l.s();!(a=l.n()).done;){var u=a.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){l.e(t)}finally{l.f()}}}catch(t){o.e(t)}finally{o.f()}},a=function(t){if(!0===t.isComputing)throw Error("You cannot add indicators while computation is in progress.");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},u=function(t,e,r){if(t instanceof Object==0)throw new Error('Param "'.concat(e,'" must be an object in "').concat(r,'".'));return!0},c=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},s=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},f=function(t,e,r,n){u(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,l=e.max,c=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an ').concat(c,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(c,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==l&&"number"!=typeof l)throw new Error('Param "max" must be a valid '.concat(c,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&void 0!==l&&a>=l)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(c," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==l&&t>l)throw new Error('Param "'.concat(r,'" must be an ').concat(c," ≤ ").concat(l,' in "').concat(n,'".'));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},y=function(t,e,r,n){if(0!==r)return!0;for(var o=[],i=0,a=Object.keys(t);i<a.length;i++){var l,u=a[i],c=null===(l=e[u])||void 0===l?void 0:l[r];("volume"===u?Number.isInteger(c)&&c>=0:Number.isFinite(c)&&c>0)||o.push(u)}if(o.length>0)throw new TypeError("Invalid or missing input value(s) [".concat(o.join(", "),"] ")+"at index ".concat(r,' in "').concat(n,'".'));return!0};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 v(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function m(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,b(n.key),n)}}function d(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function b(t){var e=function(t,e){if("object"!=p(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:e+""}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e,r){return e=P(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,j()?Reflect.construct(e,r||[],P(t).constructor):e.apply(t,r))}function S(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,e)}function O(t){var e="function"==typeof Map?new Map:void 0;return O=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(j())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&_(o,r.prototype),o}(t,arguments,P(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_(r,t)},O(t)}function j(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(j=function(){return!!t})()}function _(t,e){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_(t,e)}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},P(t)}var k=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return g(this,e),(t=w(this,e,[r])).name="NotEnoughDataError",t}return S(e,t),d(e)}(O(Error)),A=function(){return d((function t(){g(this,t),v(this,"result",void 0)}),[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(!this.isStable)throw new k;return this.result}}])}(),N=function(t){function e(){var t;g(this,e);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return v(t=w(this,e,[].concat(n)),"previousResult",void 0),v(t,"highest",void 0),v(t,"lowest",void 0),v(t,"previousHighest",void 0),v(t,"previousLowest",void 0),t}return S(e,t),d(e,[{key:"setResult",value:function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:(this.previousHighest=this.highest,t>this.highest&&(this.highest=t)),void 0===this.lowest?this.lowest=t:(this.previousLowest=this.lowest,t<this.lowest&&(this.lowest=t)),this.previousResult=this.result,this.result=t,t}},{key:"replace",value:function(t){return this.update(t,!0)}},{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}}])}(A);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 T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,C(n.key),n)}}function E(t,e,r){return e&&I(t.prototype,e),r&&I(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function C(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+""}function M(t,e,r){return e=R(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,D()?Reflect.construct(e,r||[],R(t).constructor):e.apply(t,r))}function D(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(D=function(){return!!t})()}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}function F(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&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var B=function(t){function e(t){var r;return T(this,e),(r=M(this,e)).interval=t,r.pricesCounter=0,r.weightFactor=2/(t+1),r}return F(e,t),E(e,[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&0!==this.pricesCounter||this.pricesCounter++;var r=e&&void 0!==this.previousResult?this.previousResult:void 0!==this.result?this.result:t;return this.setResult(t*this.weightFactor+r*(1-this.weightFactor),e)}},{key:"isStable",get:function(){return this.pricesCounter>=this.interval}}])}(N),U=function(t){function e(t){var r;return T(this,e),(r=M(this,e)).interval=t,r.prices=new Float64Array(t),r.count=0,r.head=0,r}return F(e,t),E(e,[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"number"==typeof t||Array.isArray(this.prices)||(this.prices=Array.from(this.prices));var r=this.interval,n=this.prices;if(e&&this.count){var o=this.head+this.count-1;o>=r&&(o-=r),n[o]=t}else this.count<r?n[this.count++]=t:(n[this.head]=t,++this.head===r&&(this.head=0));if(this.count===r){for(var i=0,a=this.head;a<r;a++)i+=n[a];for(var l=0;l<this.head;l++)i+=n[l];return this.setResult(i/r,e)}}}])}(N),H=function(t){function e(t){var r;return T(this,e),(r=M(this,e)).interval=t,r.indicator=new U(t),r.smoothingFactor=1/t,r}return F(e,t),E(e,[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===this.result){var r=this.indicator.update(t);if(void 0!==r)return this.indicator=void 0,this.setResult(r,e)}else{if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}}}}])}(N);function V(t){return V="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},V(t)}function $(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,K(n.key),n)}}function K(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:e+""}function z(t,e,r){return e=G(e),function(t,e){if(e&&("object"==V(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,Z()?Reflect.construct(e,r||[],G(t).constructor):e.apply(t,r))}function Z(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Z=function(){return!!t})()}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}var q=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=z(this,e)).interval=t,r.avgGain=new n(t),r.avgLoss=new n(t),r.maxValue=100,r.priceCount=0,r.previousPrice=void 0,r.currentPrice=void 0,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&&Y(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&0!==this.priceCount||(this.previousPrice=this.currentPrice,this.priceCount<2&&this.priceCount++),this.currentPrice=t,!(this.priceCount<2)){var r=this.previousPrice;if(t>r?(this.avgLoss.update(0,e),this.avgGain.update(t-r,e)):(this.avgLoss.update(r-t,e),this.avgGain.update(0,e)),this.avgGain.isStable){var n=this.avgLoss.getResult();if(0===n)return this.setResult(100,e);var o=this.avgGain.getResult()/n;return this.setResult(this.maxValue-this.maxValue/(o+1),e)}}}}],n&&$(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(N),J=function(t,e){if(0===t&&(t=.001),0===e&&(e=.001),Math.sign(t)!==Math.sign(e))throw new Error("[BUG] Params must have the same sign in mathLog a=".concat(t," b=").concat(e,"."));t<0&&(t=-t,e=-e);var r,n=Math.log(t/e);if(null==(r=n)||!Number.isFinite(r))throw new Error("[BUG] Invalid params passed to mathLog a=".concat(t," b=").concat(e,"."));return n};function W(t){return W="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},W(t)}function Q(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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return X(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)?X(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 X(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var tt=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=Q((r?t.slice(1):t).split("."),2),o=n[0],i=n[1],a=void 0===i?"":i,l=String(e),u=1===e?0:l.length-1,c=a.padEnd(u,"0").slice(0,u),s=parseInt(o+c||"0",10);return r&&(s=-s),s};function et(t){return et="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},et(t)}var rt={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return tt(t,e)}},nt=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"),l=0===(a=a.replace(/0+$/,"")).length?String(i):"".concat(i,".").concat(a);return Number(r?"-".concat(l):l)}(t,e)},ot=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 et(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return et(t)};function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}var at={toString:function(t){return t.toString()},string:function(t){return t.toString()},toISOString:function(t){return t.toISOString()},iso: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}},lt={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)}},ut=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(it(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===it(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 ct(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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||st(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 st(t,e){if(t){if("string"==typeof t)return ft(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)?ft(t,e):void 0}}function ft(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 ht=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,new o(e).fill(n)};function yt(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 pt=function(t,e){var r,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).lag,o=void 0===n?0:n,i=[],a=[],l=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 yt(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)?yt(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(e);try{for(l.s();!(r=l.n()).done;){var u=r.value,c=u.key,s=u.type,h=void 0===s?"Float64Array":s,y=u.fill,p=u.enabled,v=void 0===p||p,m=u.priceBased,d=void 0!==m&&m,b=u.includeInLag,g=void 0===b||b;if(v){if(Object.prototype.hasOwnProperty.call(t.verticalOhlcv,c))throw new Error('Output column "'.concat(c,'" already exists in verticalOhlcv.'));if(/^(?:Int|Uint)/.test(h)&&void 0===y)throw new Error('Integer output column "'.concat(c,'" requires an explicit fill value.'));t.verticalOhlcv[c]=ht(h,t.len,y),d&&t.priceBased.add(c),i.push(c),g&&a.push(c)}}}catch(t){l.e(t)}finally{l.f()}return o>0&&a.length>0&&(f(o,{min:1,max:t.len},"lag","initializeColumns"),t.executionParams.push({key:"lag",params:[a,o]})),i};function vt(t){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vt(t)}function mt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=vt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dt(t){return dt="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},dt(t)}function bt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,St(n.key),n)}}function wt(t,e,r){return e&&gt(t.prototype,e),r&&gt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function St(t){var e=function(t,e){if("object"!=dt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}function Ot(t,e,r){return e=_t(e),function(t,e){if(e&&("object"==dt(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||[],_t(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 _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(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&&kt(t,e)}function kt(t,e){return kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},kt(t,e)}var At=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return bt(this,e),(r=Ot(this,e)).interval=t,r.deviationMultiplier=n,r.prices=new Float64Array(t),r.count=0,r.head=0,r}return Pt(e,t),wt(e,[{key:"update",value:function(t){if("number"==typeof t||Array.isArray(this.prices)||(this.prices=Array.from(this.prices)),!(this.count<this.interval)){this.prices[this.head]=t,this.head=(this.head+1)%this.interval;for(var e=0,r=this.head,n=0;n<this.count;n++)e+=this.prices[r],++r===this.interval&&(r=0);var o=this.count?e/this.count:0,i=o;if(!i&&Array.isArray(this.prices)){e=0,r=this.head;for(var a=0;a<this.count;a++)e+=this.prices[r],++r===this.interval&&(r=0);i=this.count?e/this.count:0}var l=0;r=this.head;for(var u=0;u<this.count;u++){var c=this.prices[r]-i;l+=c*c,++r===this.interval&&(r=0)}var s=Math.sqrt(this.count?l/this.count:0);return this.result={lower:o-s*this.deviationMultiplier,middle:o,upper:o+s*this.deviationMultiplier}}this.prices[this.count++]=t}}])}(A),Nt=function(t){function e(t,r,n){var o;return bt(this,e),(o=Ot(this,e)).short=t,o.long=r,o.signal=n,o.pricesCounter=0,o}return Pt(e,t),wt(e,[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&0!==this.pricesCounter||this.pricesCounter++;var r=this.short.update(t,e),n=this.long.update(t,e);if(this.pricesCounter>this.long.interval&&this.pricesCounter--,this.pricesCounter===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}])}(A),xt=function(t){function e(t,r,n){var o;return bt(this,e),(o=Ot(this,e)).n=t,o.m=r,o.p=n,o.periodM=new U(r),o.periodP=new U(n),o.candles=new Array(t),o.count=0,o.head=0,o}return Pt(e,t),wt(e,[{key:"update",value:function(t){if(this.count<this.n?this.candles[this.count++]=t:(this.candles[this.head]=t,this.head=(this.head+1)%this.n),this.count===this.n){for(var e=-1/0,r=1/0,n=this.head,o=0;o<this.count;o++)e=Math.max(e,this.candles[n].high),++n===this.n&&(n=0);n=this.head;for(var i=0;i<this.count;i++)r=Math.min(r,this.candles[n].low),++n===this.n&&(n=0);var a=e-r,l=100*(t.close-r)/(0===a?1:a),u=this.periodM.update(l),c=u&&this.periodP.update(u);if(void 0!==u&&void 0!==c)return this.result={stochD:c,stochK:u}}}}])}(A);function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}function It(t){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(t)}var Et={ema:B,sma:U},Ct=function(t,e,r,n,o){var i,a,l,u=o.target,c=o.lag,s=t.verticalOhlcv,f=t.instances,h=t.priceBased,p="close"!==u?"_".concat(u):"",v="".concat(r,"_").concat(n).concat(p);if(0===e){if(y((i={},l=!0,(a=function(t){var e=function(t,e){if("object"!=It(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=It(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==It(e)?e:e+""}(a=u))in i?Object.defineProperty(i,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):i[a]=l,i),s,e,r),!s.hasOwnProperty(u))throw new Error("Target property ".concat(u," not found in verticalOhlcv for ").concat(r,"."));f[v]=new Et[r](n),pt(t,[{key:v,priceBased:h.has(u)}],{lag:c})}var m=s[u][e],d=f[v];d.update(m);var b=d.isStable?d.getResult():NaN;t.pushToMain({index:e,key:v,value:b})};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 Dt(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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||Ft(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 Rt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ft(t,e){if(t){if("string"==typeof t)return Lt(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)?Lt(t,e):void 0}}function Lt(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 Bt=function(t){return null==t||!Number.isFinite(t)};function Ut(t){return Ut="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},Ut(t)}function Ht(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 Vt="close";function $t(t){return $t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$t(t)}function Kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}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 Zt(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 Gt(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)?Gt(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function Gt(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 Yt=Symbol("lagColumns"),qt=function(t,e){var r=new Uint8Array(e);return r[t]=1,r};function Jt(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 Wt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Jt(Object(r),!0).forEach((function(e){Qt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Qt(t,e,r){return(e=re(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}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 ee(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,re(n.key),n)}}function re(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+""}var ne=function(t,e){return t>e},oe=function(t,e){return t<e},ie=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:ne(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&oe(i,o)&&ne(this.prevLow,this.prevSlow)?0:1:oe(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&ne(n,o)&&oe(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}}])&&ee(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ae(t){return ae="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},ae(t)}function le(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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||fe(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 ue(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 ce(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ue(Object(r),!0).forEach((function(e){se(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ue(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function se(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fe(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}}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 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,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ve(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,de(n.key),n)}}function me(t,e,r){return e&&ve(t.prototype,e),r&&ve(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function de(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+""}function be(t,e,r){return e=we(e),function(t,e){if(e&&("object"==ye(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,ge()?Reflect.construct(e,r||[],we(t).constructor):e.apply(t,r))}function ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ge=function(){return!!t})()}function we(t){return we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},we(t)}function Se(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&&Oe(t,e)}function Oe(t,e){return Oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oe(t,e)}var je=function(t){function e(){var t;return pe(this,e),(t=be(this,e)).previousCandle=void 0,t.twoPreviousCandle=void 0,t}return Se(e,t),me(e,[{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),_e=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;return pe(this,e),(r=be(this,e)).interval=t,r.tr=new je,r.smoothing=new n(t),r}return Se(e,t),me(e,[{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),Pe=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;return pe(this,e),(r=be(this,e)).interval=t,r.atr=new _e(t,n),r.movesDown=new n(t),r.movesUp=new n(t),r.previousCandle=void 0,r.mdi=void 0,r.pdi=void 0,r}return Se(e,t),me(e,[{key:"updateState",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.atr.update(t),this.movesUp.update(e),this.movesDown.update(r),this.previousCandle=t}},{key:"update",value:function(t){if(this.previousCandle){var e=t.high-this.previousCandle.high,r=this.previousCandle.low-t.low,n=e<0||e<r?0:e,o=r<0||r<e?0:r;if(this.updateState(t,n,o),this.movesUp.isStable){var i=this.atr.getResult();this.pdi=this.movesUp.getResult()/i,this.mdi=this.movesDown.getResult()/i;var a=Math.abs(this.pdi-this.mdi),l=this.pdi+this.mdi;return 0===l?this.setResult(0,!1):this.setResult(a/l*100,!1)}}else this.updateState(t)}}])}(N),ke=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;return pe(this,e),(r=be(this,e)).interval=t,r.adx=new n(t),r.dx=new Pe(t,n),r}return Se(e,t),me(e,[{key:"mdi",get:function(){return this.dx.mdi}},{key:"pdi",get:function(){return this.dx.pdi}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.dx.update(t);if(void 0!==r&&this.adx.update(r),this.adx.isStable)return this.setResult(this.adx.getResult(),e)}}])}(N);function Ae(t){return Ae="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},Ae(t)}function Ne(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}}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 Te=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 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 Ee(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=Me(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function Me(t,e){if(t){if("string"==typeof t)return De(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?De(t,e):void 0}}function De(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Re(t){return function(t){if(Array.isArray(t))return Ue(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Be(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 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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||Be(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 Le(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Be(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function Be(t,e){if(t){if("string"==typeof t)return Ue(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ue(t,e):void 0}}function Ue(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var He={candleFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=r.retLogs,a=t.verticalOhlcv,l=t.priceBased,u=t.scaledGroups,c=function(t,e){return i?Math.log(t/e):(t-e)/e},s=i?"ret_log_":"ret_";if(0===e){y({open:!0,high:!0,low:!0,close:!0},a,e,"candleFeatures");var f,h=["change","mid_price_change","upper_wick","lower_wick","gap","body","range"].map((function(t){return{key:"".concat(s).concat(t)}})),p=Ce(o);try{for(p.s();!(f=p.n()).done;){var v=f.value;if(y(Ee({},v,!0),a,e,"candleFeatures"),!a.hasOwnProperty(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in verticalOhlcv for "candleFeatures".'));if(!l.has(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in priceBased for "candleFeatures".'));h.push({key:"".concat(s).concat(v)})}}catch(t){p.e(t)}finally{p.f()}u.candleFeatures=pt(t,h,{lag:n})}var m,d,b=a.close[e-1],g=a.open[e-1];if(void 0!==b){var w,S,O=a.open[e],j=a.high[e],_=a.low[e],P=a.close[e],k=(b+g)/2,A=(O+P)/2,N=Math.max(O,P),x=Math.min(O,P),T=Ee(Ee(Ee(Ee(Ee(Ee(Ee({},"".concat(s,"change"),c(P,b)),"".concat(s,"mid_price_change"),c(A,k)),"".concat(s,"upper_wick"),c(j,N)),"".concat(s,"lower_wick"),c(x,_)),"".concat(s,"gap"),c(O,b)),"".concat(s,"body"),c(P,O)),"".concat(s,"range"),c(j,_)),I=!1,E=Ce(o);try{for(E.s();!(w=E.n()).done;){var C=w.value,M=a[C][e];if(null==(S=M)||!Number.isFinite(S)){I=!0;break}var D=c(P,M);T["".concat(s).concat(C)]=D}}catch(t){E.e(t)}finally{E.f()}if(!I)for(var R=0,F=Object.entries(T);R<F.length;R++){var L=(m=F[R],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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(m,d)||Me(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.")}()),B=L[0],U=L[1];t.pushToMain({index:e,key:B,value:U})}}},dateTime:function(t,e,r){var n,o=r.lag,i=r.oneHot,a=r.precompute,l=t.instances,u=t.verticalOhlcv,c=a.prefix;if(0===e){if(!t.dateType)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(l,{dateTime:{formatter:new Intl.DateTimeFormat("en-US-u-ca-gregory-nu-latn",{timeZone:t.timeZone,year:"numeric",month:"numeric",day:"numeric",weekday:"short",hour:"numeric",minute:"numeric",hourCycle:"h23"}),colKeys:[].concat((n=a.colKeys,function(t){if(Array.isArray(t))return he(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||fe(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")]).filter((function(t){return"one_hot_year"!==t})),colKeySizes:ce({},a.colKeySizes)}});var s=l.dateTime.colKeys;pt(t,s.map((function(t){return{key:t,type:i?"Array":"Int16Array",fill:i?null:0}})),{lag:o})}for(var f=l.dateTime,h=f.colKeySizes,y=f.formatter,p=function(t,e,r,n){var o=Object.fromEntries(n.formatToParts(t).map((function(t){return[t.type,t.value]}))),i=Number(o.year),a=Number(o.month)-1,l=Number(o.hour),u=Number(o.minute),c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(o.weekday),s=Number(o.day)-1;return e?{one_hot_month:qt(a,r.one_hot_month),one_hot_hour:qt(l,r.one_hot_hour),one_hot_minute:qt(u,r.one_hot_minute),one_hot_day_of_the_week:qt(c,r.one_hot_day_of_the_week),one_hot_day_of_the_month:qt(s,r.one_hot_day_of_the_month)}:{year:i,month:a+1,hour:l,minute:u,day_of_the_week:(c+6)%7+1,day_of_the_month:s+1}}(u.date[e],i,h,y),v=0,m=Object.entries(p);v<m.length;v++){var d=le(m[v],2),b=d[0],g=d[1];t.pushToMain({index:e,key:b,value:g})}},heikenAshi:function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i.lag,l=void 0===a?0:a,u=i.bothNull,c=void 0!==u&&u,s=i.retLogs,f=void 0===s||s,h=t.verticalOhlcv,p=t.instances,v=t.scaledGroups,m="".concat(r,"_").concat(n),d=["open","high","low","close"],b=function(t,e){return f?Math.log(t/e):(t-e)/e},g=f?"ret_log_":"ret_",w=c?"":"_".concat(m),S=function(t){return"".concat(g,"heiken_ashi_").concat(t).concat(w)},O=c?"heiken_ashi_cross":"heiken_ashi_cross_".concat(m),j=c?"heiken_ashi":"heiken_ashi_".concat(m);if(0===e){y({open:!0,high:!0,low:!0,close:!0},h,e,"heikenAshi"),p[j]={emaPre:c?null:Object.fromEntries(d.map((function(t){return[t,new B(r)]}))),emaPost:c?null:Object.fromEntries(d.map((function(t){return[t,new B(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,prevSmOpen:NaN,prevSmClose:NaN,isTrendUp:!1};var _=["body","upper_wick","lower_wick","range"].map(S);pt(t,[].concat((o=_,function(t){if(Array.isArray(t))return Lt(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||Ft(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.")}()),[O]).map((function(t){return{key:t}})),{lag:l}),v&&(v.heikenAshi=_)}var P=h.open[e],k=h.high[e],A=h.low[e],N=h.close[e],x=p[j];if(!(Bt(P)||Bt(k)||Bt(A)||Bt(N))){var T,I,E,C;if(c)T=P,I=k,E=A,C=N;else{if(x.emaPre.open.update(P),x.emaPre.high.update(k),x.emaPre.low.update(A),x.emaPre.close.update(N),!(x.emaPre.open.isStable&&x.emaPre.high.isStable&&x.emaPre.low.isStable&&x.emaPre.close.isStable))return;T=x.emaPre.open.getResult(),I=x.emaPre.high.getResult(),E=x.emaPre.low.getResult(),C=x.emaPre.close.getResult()}if(!(Bt(T)||Bt(I)||Bt(E)||Bt(C))){var M,D,R,F,L=(T+I+E+C)/4,U=Number.isNaN(x.prevHaOpen)||Number.isNaN(x.prevHaClose)?(T+C)/2:(x.prevHaOpen+x.prevHaClose)/2,H=Math.max(I,U,L),V=Math.min(E,U,L);if(x.prevHaOpen=U,x.prevHaClose=L,c)M=U,D=H,R=V,F=L;else{if(x.emaPost.open.update(U),x.emaPost.high.update(H),x.emaPost.low.update(V),x.emaPost.close.update(L),!(x.emaPost.open.isStable&&x.emaPost.high.isStable&&x.emaPost.low.isStable&&x.emaPost.close.isStable))return;M=x.emaPost.open.getResult(),D=x.emaPost.high.getResult(),R=x.emaPost.low.getResult(),F=x.emaPost.close.getResult()}if(!(Bt(M)||Bt(D)||Bt(R)||Bt(F)||M<=0||D<=0||R<=0||F<=0)){var $=e>0?h[O][e-1]:0,K=x.prevSmOpen,z=x.prevSmClose,Z=Number.isFinite(K)&&Number.isFinite(z)&&z<=K&&F>M,G=Number.isFinite(K)&&Number.isFinite(z)&&z>=K&&F<M;Z&&(x.isTrendUp=!0),G&&(x.isTrendUp=!1);var Y=0;e>0&&(Y=x.isTrendUp?$>0?$+1:1:$<0?$-1:-1),x.prevSmOpen=M,x.prevSmClose=F;for(var q=Math.max(M,F),J=Math.min(M,F),W=Rt(Rt(Rt(Rt({},S("body"),b(F,M)),S("upper_wick"),b(D,q)),S("lower_wick"),b(J,R)),S("range"),b(D,R)),Q=0,X=Object.entries(W);Q<X.length;Q++){var tt=Dt(X[Q],2),et=tt[0],rt=tt[1];Bt(rt)||t.pushToMain({index:e,key:et,value:rt})}t.pushToMain({index:e,key:O,value:Y})}}}},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=n.retLogs,l=t.verticalOhlcv,u=t.instances,c="close"===o?"":"_".concat(o),s=a?"ret_log_rsi_".concat(r).concat(c):"rsi_".concat(r).concat(c),f=a?"ret_log_rsi_sma_".concat(r).concat(c):"rsi_sma_".concat(r).concat(c);if(0===e){if(y(mt({},o,!0),l,e,"rsi"),!l.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(u,mt(mt({},s,new q(r)),f,new U(r))),pt(t,[{key:s},{key:f}],{lag:i})}var h=l[o][e];u[s].update(h);var p=u[s].isStable?u[s].getResult():NaN,v=Number.isNaN(p)?NaN:a?J(p,50):p;t.pushToMain({index:e,key:s,value:v}),Number.isNaN(p)||u[f].update(p);var m=u[f].isStable?u[f].getResult():NaN,d=Number.isNaN(m)?NaN:a?J(m,50):m;t.pushToMain({index:e,key:f,value:d})},stochastic:function(t,e,r,n,o,i){var a,l,u,c=i.lag,s=i.retLogs,f=t.verticalOhlcv,h=t.instances,p=t.useFullNames,v=14!==r||3!==n||3!==o||p?"_".concat(r,"_").concat(n,"_").concat(o):"",m=s?"ret_log_stochastic_d".concat(v):"stochastic_d".concat(v),d=s?"ret_log_stochastic_k".concat(v):"stochastic_k".concat(v),b=v;0===e&&(y({high:!0,low:!0,close:!0},f,e,"stochastic"),Object.assign(h,(a={},l=b,u=new xt(r,n,o),(l=function(t){var e=function(t,e){if("object"!=Tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tt(e)?e:e+""}(l))in a?Object.defineProperty(a,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[l]=u,a)),pt(t,[{key:m},{key:d}],{lag:c}));var g=f.close[e],w=f.low[e],S=f.high[e];h[b].update({close:g,low:w,high:S});var O=h[b].isStable?h[b].getResult():null,j=O?s?J(O.stochK,50):O.stochK:NaN,_=O?s?J(O.stochD,50):O.stochD:NaN;t.pushToMain({index:e,key:d,value:j}),t.pushToMain({index:e,key:m,value:_})},atr:function(t,e,r,n){var o=n.lag,i=n.retLogs,a=t.verticalOhlcv,l=t.instances,u=i?"ret_log_atr_".concat(r):"atr_".concat(r);if(0===e){var c=t.instances,s=t.verticalOhlcv;y({high:!0,low:!0,close:!0},s,e,"atr"),c[u]=new _e(r,H),pt(t,[{key:u,priceBased:!0}],{lag:o})}var f={high:a.high[e],low:a.low[e],close:a.close[e]},h=l[u];h.update(f);var p=h.isStable?h.getResult():NaN;t.pushToMain({index:e,key:u,value:Number.isNaN(p)?NaN:i?J(p,f.close):p})},adx:function(t,e,r,n){var o,i,a,l=n.lag,u=n.retLogs,c=t.verticalOhlcv,s=t.instances,f=(t.useFullNames,u?"ret_log_adx_".concat(r):"adx_".concat(r)),h="adx_".concat(r);if(0===e){if(y({high:!0,low:!0,close:!0},c,e,"adx"),!c.hasOwnProperty("high"))throw new Error("Property high not found in verticalOhlcv for adx.");if(!c.hasOwnProperty("low"))throw new Error("Property low not found in verticalOhlcv for adx.");if(!c.hasOwnProperty("close"))throw new Error("Property close not found in verticalOhlcv for adx.");Object.assign(s,(o={},i=h,a=new ke(r),(i=function(t){var e=function(t,e){if("object"!=Ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ae(e)?e:e+""}(i))in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,o)),pt(t,[{key:f}],{lag:l})}var p=c.high[e],v=c.low[e],m=c.close[e];s[h].update({high:p,low:v,close:m});var d=s[h].isStable?s[h].getResult():NaN,b=Number.isNaN(d)?NaN:u?J(d,20):d;t.pushToMain({index:e,key:f,value:b})},ema:Ct,sma:Ct,macd:function(t,e,r,n,o,i){var a,l,u,c=i.target,s=i.lag,f=i.precomputed,h=t.verticalOhlcv,p=t.instances,v=t.useFullNames,m=f.instanceKey;if(0===e){y((a={},u=!0,(l=function(t){var e=function(t,e){if("object"!=Ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ut(e)?e:e+""}(l=c))in a?Object.defineProperty(a,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[l]=u,a),h,e,"macd");var d=t.inputParams;if(!h.hasOwnProperty(c))throw new Error("Target property ".concat(c," not found in verticalOhlcv for macd."));var b,g=0,w=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 Ht(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)?Ht(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(d);try{for(w.s();!(b=w.n()).done;)"macd"===b.value.key&&g++}catch(t){w.e(t)}finally{w.f()}var S=g>1||v,O="".concat(r,"_").concat(n,"_").concat(o),j=function(t){return c===Vt?S?"macd_".concat(t,"_").concat(O):"macd_".concat(t):S?"macd_".concat(t,"_").concat(c,"_").concat(O):"macd_".concat(t,"_").concat(c)},_=j("diff"),P=j("dea"),k=j("histogram");p.hasOwnProperty("macd")||(p.macd={numberOfIndicators:g,settings:{}}),p.macd.settings[m]=new Nt(new B(r),new B(n),new B(o)),pt(t,[_,P,k].map((function(t){return{key:t,priceBased:!0}})),{lag:s})}var A=p.macd,N=A.numberOfIndicators,x=A.settings,T=N>1||v,I="".concat(r,"_").concat(n,"_").concat(o),E=function(t){return c===Vt?T?"macd_".concat(t,"_").concat(I):"macd_".concat(t):T?"macd_".concat(t,"_").concat(c,"_").concat(I):"macd_".concat(t,"_").concat(c)},C=E("diff"),M=E("dea"),D=E("histogram"),R=x[m],F=h[c][e];R.update(F);var L=R.isStable?R.getResult():null;t.pushToMain({index:e,key:C,value:L?L.macd:NaN}),t.pushToMain({index:e,key:M,value:L?L.signal:NaN}),t.pushToMain({index:e,key:D,value:L?L.histogram:NaN})},volumeDelta:function(t,e,r){var n=r.lag,o=void 0===n?0:n,i=t.verticalOhlcv,a=t.instances,l="volume_delta";if(0===e){y({open:!0,close:!0,volume:!0},i,e,"volumeDelta"),a[l]||(a[l]={isBuyVolume:!0,cross:0});var u=["".concat(l,"_high"),"".concat(l,"_low"),"".concat(l,"_close"),"".concat(l,"_cross")];pt(t,u.map((function(t){return{key:t}})),{lag:o})}var c=a[l],s=(c.hasInvalidInputValue,i.volume[e]);if(0!==s){var f=i.open[e],h=i.close[e],p=e>0?i.close[e-1]:NaN,v=c.isBuyVolume;h>f?v=!0:h<f?v=!1:h>p?v=!0:h<p&&(v=!1),c.isBuyVolume=v,e<1?c.cross=v?1:-1:v?c.cross>0?c.cross=c.cross+1:c.cross=1:c.cross>0?c.cross=-1:c.cross=c.cross-1;var m=v?s:-s,d=m,b=Math.max(m,0),g=Math.min(m,0);t.pushToMain({index:e,key:"".concat(l,"_high"),value:b}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:g}),t.pushToMain({index:e,key:"".concat(l,"_close"),value:d}),t.pushToMain({index:e,key:"".concat(l,"_cross"),value:c.cross})}},relativeVolume:function(t,e,r,n){var o=n.lag,i="relative_volume_".concat(r),a=t.instances,l=t.verticalOhlcv;0===e&&(y({volume:!0},l,e,"relativeVolume"),a[i]={instance:new U(r),prevRelativeVolumeSma:NaN},pt(t,[{key:i}],{lag:o}));var u=l.volume[e];if(0!==u){var c=a[i].instance;c.update(u);var s=c.isStable?c.getResult():NaN,f=a[i].prevRelativeVolumeSma;if(a[i].prevRelativeVolumeSma=s,!Number.isNaN(s)&&!Number.isNaN(f)){var h=u/f;t.pushToMain({index:e,key:i,value:h}),a[i].prevRelativeVolumeSma=s}}},donchianChannels:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,l=t.len,u=t.inputParams,c=t.useFullNames,s=o.lag,f=void 0===s?0:s,h="".concat(r,"_").concat(n);if(0===e){y({high:!0,low:!0},i,e,"donchianChannels");var p=u.filter((function(t){return"donchianChannels"===t.key})).length,v=p>1||c,m=["upper","basis","lower"].map((function(t){return v?"donchian_channel_".concat(t,"_").concat(h):"donchian_channel_".concat(t)}));a.donchian_channel||(a.donchian_channel={numberOfIndicators:p,settings:{}}),a.donchian_channel.numberOfIndicators=p,a.donchian_channel.settings[h]={maxDeque:{indices:[],head:0,length:0},minDeque:{indices:[],head:0,length:0}},pt(t,m.map((function(t){return{key:t,priceBased:!0}})),{lag:f})}var d=a.donchian_channel,b=d.numberOfIndicators,g=d.settings,w=b>1||c,S=function(t){return w?"donchian_channel_".concat(t,"_").concat(h):"donchian_channel_".concat(t)},O=g[h],j=O.maxDeque,_=O.minDeque,P=e-n,k=P-r+1;if(!(P<0||P>=l)){var A=i.high,N=i.low,x=function(t,e,n){for(var o=t.indices;t.length&&o[t.head]<k;)t.head=(t.head+1)%r,t.length--;for(;t.length&&n(e[o[(t.head+t.length-1)%r]],e[P]);)t.length--;o[(t.head+t.length)%r]=P,t.length++};if(x(j,A,(function(t,e){return t<=e})),x(_,N,(function(t,e){return t>=e})),!(k<0)){var T=j.length&&_.length,I=T?A[j.indices[j.head]]:NaN,E=T?N[_.indices[_.head]]:NaN,C=T?(I+E)/2:NaN;t.pushToMain({index:e,key:S("upper"),value:I}),t.pushToMain({index:e,key:S("basis"),value:C}),t.pushToMain({index:e,key:S("lower"),value:E})}}},bollingerBands:function(t,e,r,n){var o,i,a,l,u,c,s=(arguments.length>4&&void 0!==arguments[4]?arguments[4]:{}).lag,f=t.verticalOhlcv,h=t.instances,p=t.useFullNames,v="".concat(r,"_").concat(n),m="bollinger_bands",d="close";if(0===e){var b=t.inputParams,g=t.verticalOhlcv,w=t.priceBased;if(y((l={},c=!0,(u=function(t){var e=function(t,e){if("object"!=$t(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$t(e)?e:e+""}(u=d))in l?Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):l[u]=c,l),g,e,"bollingerBands"),!(d in g))throw new Error('bollingerBands could not find target "'.concat(d,'"'));var S,O=0,j=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 Kt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Kt(t,e):void 0}}(t))||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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(b);try{for(j.s();!(S=j.n()).done;)"bollingerBands"===S.value.key&&O++}catch(t){j.e(t)}finally{j.f()}h.bollinger_bands||(h.bollinger_bands={numberOfIndicators:O,settings:{}}),h.bollinger_bands.settings[v]=new At(r,n);var _=O>1||p?"_".concat(v):"",P=["".concat(m,"_upper").concat(_),"".concat(m,"_middle").concat(_),"".concat(m,"_lower").concat(_)];pt(t,P.map((function(t){return{key:t,priceBased:w.has(d)}})),{lag:s})}var k=h.bollinger_bands.numberOfIndicators>1||p?"_".concat(v):"",A=h.bollinger_bands.settings[v],N=f[d][e];A.update(N);var x=A.isStable?A.getResult():null,T=null!==(o=null==x?void 0:x.upper)&&void 0!==o?o:NaN,I=null!==(i=null==x?void 0:x.middle)&&void 0!==i?i:NaN,E=null!==(a=null==x?void 0:x.lower)&&void 0!==a?a:NaN;t.pushToMain({index:e,key:"".concat(m,"_upper").concat(k),value:T}),t.pushToMain({index:e,key:"".concat(m,"_middle").concat(k),value:I}),t.pushToMain({index:e,key:"".concat(m,"_lower").concat(k),value:E})},volumeOscillator:function(t,e,r,n,o){var i,a,l,u=o.lag,c=o.retLogs,s=t.verticalOhlcv,f=t.instances,h="volume_oscillator_".concat(r,"_").concat(n);0===e&&(y({volume:!0},s,e,"volumeOscillator"),Object.assign(f,(i={},a=h,l={fastEMA:new B(r),slowEMA:new B(n)},(a=function(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+""}(a))in i?Object.defineProperty(i,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):i[a]=l,i)),pt(t,[{key:h},{key:"ret_log_".concat(h),enabled:c}],{lag:u}));var p=f[h],v=p.fastEMA,m=p.slowEMA,d=s.volume[e];if(0!==d){v.update(d),m.update(d);var b,g=v.isStable?v.getResult():NaN,w=m.isStable?m.getResult():NaN,S=NaN;Number.isNaN(g)||Number.isNaN(w)||(b=100*(g-w)/w,c&&(S=J(g,w),t.pushToMain({index:e,key:"ret_log_".concat(h),value:S})),t.pushToMain({index:e,key:h,value:b}))}},mapCols:function(t,e,r,n,o){var i=o.lag,a=o.isPriceBased,l=o.callbackParams,u=void 0===l?{}:l,c=t.verticalOhlcv,s=t.precision;if(0===e){n===Te&&y({open:!0,close:!0},c,e,"mapCols");var f,h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ne(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(r);try{for(h.s();!(f=h.n()).done;){var p=f.value;if(c.hasOwnProperty(p))throw new Error('New property "'.concat(p,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'))}}catch(t){h.e(t)}finally{h.f()}pt(t,r.map((function(t){return{key:t,type:"Array",priceBased:s&&a}})),{lag:i})}var v,m,d=n({index:e,main:t,params:u});if(null!=d)for(var b=0,g=Object.entries(d);b<g.length;b++){var w=(v=g[b],m=2,function(t){if(Array.isArray(t))return t}(v)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(v,m)||Ne(v,m)||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.")}()),S=w[0],O=w[1];t.pushToMain({index:e,key:S,value:O})}},crossPairs:function(t,e,r,n){var o,i=n.oneHot,a=n.limit,l=t.verticalOhlcv,u=t.verticalOhlcvTempCols,c=t.instances,s=t.len,f=t.precision,h=t.precisionMultiplier,p=t.priceBased,v=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 Xt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xt(t,e):void 0}}(t))||e&&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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(r);try{for(v.s();!(o=v.n()).done;){var m=o.value,d=m.fast,b=m.slow,g="".concat(d,"_x_").concat(b);if(0===e){if(y(Wt(Wt({},"price"===d?{high:!0,low:!0,close:!0}:Qt({},d,!0)),"number"==typeof b?{}:Qt({},b,!0)),l,e,"crossPairs"),"number"==typeof b){var w=b.toString();u.add(w);var S=f&&("price"===d||p.has(d)),O=S?tt(w,h):b,j=b>=-125&&b<=125&&!1===S?"Int8Array":"Float64Array";l[w]=ht(j,s,O)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[g]={run:new ie,min:1/0,max:-1/0},pt(t,[{key:g,type:null!==a&&a<=125?"Int8Array":"Float64Array",fill:0},{key:"one_hot_".concat(g),type:"Array",enabled:i}])}else if(e+1===s){if("price"!==d&&!l.hasOwnProperty(d))throw new Error('crossPairs invalid param: fast "'.concat(d,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))));if(!l.hasOwnProperty(b))throw new Error('crossPairs invalid param: slow "'.concat(b,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))))}if("price"!==d&&!l.hasOwnProperty(d))return;if(!l.hasOwnProperty(b))return;var _=c.crossPairs[g].run;if("price"===d){var P=l.close[e],k=l[b][e];_.update(e,{fast:P,slow:k,high:l.high[e],low:l.low[e]})}else{var A=l[d][e],N=l[b][e];_.update(e,{fast:A,slow:N})}var x=_.getResult(),T=null!==a?Math.min(Math.max(x,-a),a):x;if(t.pushToMain({index:e,key:g,value:T}),i){var I=T+a,E=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(g),value:qt(I,E)})}}}catch(t){v.e(t)}finally{v.f()}},lag:function(t,e,r,n){var o,i=t.verticalOhlcv,a=t.priceBased,l=t.instances;if(0===e){var u,c=new Map,s=Zt(r);try{for(s.s();!(u=s.n()).done;){var f=u.value;if(!i.hasOwnProperty(f))throw new Error('Lag processing invoked by col "'.concat(f,'" was not found in "verticalOhlcv".'));for(var h=a.has(f),y=Array.isArray(i[f])?"Array":"Float64Array",p=[],v=[],m=1;m<=n;m++){var d="".concat(f,"_lag_").concat(m);p.push({key:d,type:y,priceBased:h,includeInLag:!1}),v.push(d)}pt(t,p),c.set(f,v)}}catch(t){s.e(t)}finally{s.f()}l[Yt]||(l[Yt]=new WeakMap),l[Yt].set(r,c)}var b,g=null===(o=l[Yt])||void 0===o?void 0:o.get(r),w=Zt(r);try{for(w.s();!(b=w.n()).done;)for(var S=b.value,O=null==g?void 0:g.get(S),j=i[S],_=Array.isArray(j)?null:NaN,P=1;P<=n;P++){var k,A=null!==(k=null==O?void 0:O[P-1])&&void 0!==k?k:"".concat(S,"_lag_").concat(P),N=e-P,x=N<0||null==j[N]?_:j[N];t.pushToMain({index:e,key:A,value:x})}}catch(t){w.e(t)}finally{w.f()}}};function Ve(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var $e=function(t){var e,r,n=t.main,o=t.skipNull,i=void 0!==o&&o,a=t.startIndex,l=void 0===a?0:a,u=t.dateFormat,c=n.verticalOhlcv,s=n.invalidValueIndex,f=n.len,h=n.verticalOhlcvKeyNames,y=n.verticalOhlcvTempCols,p=n.priceBased,v=n.precision,m=n.precisionMultiplier;if(0===h.length)return[];for(var d=i&&s>=0?s+1:0,b=Math.max(d,l),g=f-b,w=Array.from({length:g},(function(){return{}})),S=0,O=Object.entries(c);S<O.length;S++){var j=(e=O[S],r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return Ve(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ve(t,e):void 0}}(e,r)||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.")}()),_=j[0],P=j[1];if(!y.has(_))if("date"===_)for(var k=at[u],A=b;A<f;A++)w[A-b][_]=k(P[A]);else if(v&&p.has(_))for(var N=nt,x=b;x<f;x++){var T=P[x];w[x-b][_]=null==T||Number.isNaN(T)?T:N(T,m)}else for(var I=b;I<f;I++)w[I-b][_]=P[I]}return w};function Ke(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,l=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,e)||ze(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ze(t,e){if(t){if("string"==typeof t)return Ze(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)?Ze(t,e):void 0}}function Ze(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 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=new Map([["default",Te]]),qe=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(null===t||"string"==typeof t||"boolean"==typeof t)return t;if("number"==typeof t&&Number.isFinite(t))return t;if("function"==typeof t&&e)return t;if("object"!==Ge(t)||null===t)throw new TypeError("Configuration values must be JSON-safe: no undefined, non-finite numbers, or unregistered functions.");if(r.has(t))throw new TypeError("Configuration must not contain circular references.");var n=Object.getPrototypeOf(t);if(!Array.isArray(t)&&n!==Object.prototype&&null!==n)throw new TypeError("Configuration must contain only plain objects and arrays.");if(Object.getOwnPropertySymbols(t).length)throw new TypeError("Configuration must not contain symbol keys.");r.add(t);var o=Array.isArray(t)?Array.from(t,(function(t){return qe(t,e,r)})):Object.fromEntries(Object.entries(t).map((function(t){var n=Ke(t,2),o=n[0],i=n[1];return[o,qe(i,e,r)]})));return r.delete(t),o},Je=function(t){if(null!==t&&"object"===Ge(t)){for(var e=0,r=Object.values(t);e<r.length;e++){var n=r[e];Je(n)}Object.freeze(t)}return t},We=function(t){if("function"==typeof t)return t;if("string"==typeof t&&Ye.has(t))return Ye.get(t);throw new Error('Unknown mapCols callback "'.concat(t,'". Register it before loading the configuration.'))},Qe=function(t){var e,r=qe(t,!0),n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ze(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(r);try{var o=function(){var t=e.value;if("mapCols"!==t.key||"function"!=typeof t.params[1])return 1;var r,n=(r=Ye,function(t){if(Array.isArray(t))return Ze(t)}(r)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||ze(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.")}()).find((function(e){return Ke(e,2)[1]===t.params[1]}));if(!n)throw new Error("Cannot export an unregistered mapCols callback. Register it with OHLCV_INDICATORS.registerMapCallback(name, callback).");t.params[1]=n[0]};for(n.s();!(e=n.n()).done;)o()}catch(t){n.e(t)}finally{n.f()}return qe(r)};function Xe(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=or(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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function tr(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 er(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?tr(Object(r),!0).forEach((function(e){rr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function rr(t,e,r){return(e=ur(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nr(t){return function(t){if(Array.isArray(t))return ir(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||or(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 or(t,e){if(t){if("string"==typeof t)return ir(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)?ir(t,e):void 0}}function ir(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 ar(t){return ar="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},ar(t)}function lr(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"!=ar(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ar(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ar(e)?e:e+""}var cr=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,a=void 0===o?null:o,u=e.chunkProcess,y=void 0===u?2e3:u,p=e.config,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),null===v||Array.isArray(v)||"object"!==ar(v))throw new TypeError('Constructor "config" must be a plain object.');for(var m=qe(v),d=["schemaVersion","precision","useFullNames","inputParams","dateFormat","skipNull","timeZone"],b=0,g=Object.keys(m);b<g.length;b++){var w=g[b];if(!d.includes(w))throw new Error('Unknown configuration option "'.concat(w,'".'))}var S=m.schemaVersion,O=void 0===S?1:S,j=m.precision,_=void 0!==j&&j,P=m.useFullNames,k=void 0!==P&&P,A=m.inputParams,N=void 0===A?null:A,x=m.dateFormat,T=void 0===x?"milliseconds":x,I=m.skipNull,E=void 0===I||I,C=m.timeZone,M=void 0===C?Intl.DateTimeFormat().resolvedOptions().timeZone:C;if(1!==O)throw new Error("Unsupported configuration schemaVersion: ".concat(O,"."));s(E,"config.skipNull","constructor"),h(T,"config.dateFormat","constructor"),c(Object.keys(at),T,"config.dateFormat","constructor"),h(M,"config.timeZone","constructor");var D=new Intl.DateTimeFormat("en-US",{timeZone:M}).resolvedOptions().timeZone;if(this.config=Object.freeze({schemaVersion:O,precision:_,useFullNames:k,dateFormat:T,skipNull:E,timeZone:D}),this.timeZone=D,l(n,"input",null!==a?"contructor ".concat(a):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+a);f(y,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),s(_,"precision","contructor"),s(k,"config.useFullNames","constructor"),this.chunkProcess=y,this.input=nr(n),this.len=this.input.length,this.firstRow=this.input[0],this.precision=_,this.useFullNames=k;var R=["open","high","low","close","mid_price"];this.initialPriceBased=new Set(R),this.priceBased=new Set(R),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 l=Q(a[i],2),u=l[0],c=l[1];if(n.has(u)){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(u,'" had the value "').concat(c,'" type ').concat(W(c),"."));var s=Q(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 F=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=new Map,l=0,u=Object.entries(e);l<u.length;l++){var c=ct(u[l],2),s=c[0],f=c[1];if("date"===s)o[s]=ut(f),i[s]="Array";else if("volume"===s)o[s]=ot(f,!0),i[s]="Int32Array";else if(n.has(s))o[s]=ot(f,!0,r),i[s]="Float64Array",a.set(s,o[s]);else{var h=ot(f,!1,r);o[s]=h,i[s]="number"===h?"Float64Array":"Array"}}if(new Set(a.values()).size>1){var y=function(t){return function(t){if(Array.isArray(t))return ft(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||st(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.")}()}(a.entries()).map((function(t){var e=ct(t,2),r=e[0],n=e[1];return"".concat(r,': "').concat(n,'"')})).join(", ");throw new Error("Inconsistent types among price-based columns — ".concat(y,". ")+"All initialPriceBased columns must share the same numeric type.")}return i.hasOwnProperty("open")&&i.hasOwnProperty("close")&&(i.mid_price=i.open,o.mid_price=o.open),{inputTypes:o,arrayTypes:i}}(this),L=F.inputTypes,B=F.arrayTypes;if(this.inputTypes=L,this.arrayTypes=B,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(a));return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.isComputing=!1,this.executionParams=[],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;r.verticalOhlcv[n][e]=o},null!==N?(i(N,this.len),this.inputParams=Je(qe(N)),this.compute()):this.inputParams=Object.freeze([]),this},e=[{key:"exportConfig",value:function(){return er(er({},this.config),{},{inputParams:Qe(this.inputParams)})}},{key:"_registerIndicator",value:function(t){return a(this),this.inputParams=Object.freeze([].concat(nr(this.inputParams),[Je(qe(t,!0))])),this}},{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?this.config.skipNull:e,n=t.dateFormat,o=void 0===n?this.config.dateFormat:n;return c(Object.keys(at),o,"dateFormat","getData"),u(t,"options","getData"),$e({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?this.config.dateFormat:e;return c(Object.keys(at),r,"dateFormat","getData"),$e({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:r})[0]}},{key:"compute",value:function(){if(this.isComputed)return this;if(this.isComputing)throw new Error("Computation is already in progress.");this.executionParams=qe(this.inputParams,!0).sort((function(t,e){var r,n;return(null!==(r=t.order)&&void 0!==r?r:0)-(null!==(n=e.order)&&void 0!==n?n:0)}));var t,e=Xe(this.executionParams);try{for(e.s();!(t=e.n()).done;){var n=t.value;"mapCols"===n.key&&(n.params[1]=We(n.params[1]))}}catch(t){e.e(t)}finally{e.f()}if(this.isComputed=!1,this.len>0){this.isComputing=!0;try{!function(t,e){var n=e.len,o=e.arrayTypes,a=e.verticalOhlcv,l=e.verticalOhlcvKeyNames,u=e.inputTypes,c=e.chunkProcess,s=e.precisionMultiplier,f=e.executionParams;i(f,n);var h,y=Le(f);try{for(y.s();!(h=y.n()).done;){var p=h.value.key;if(!Object.prototype.hasOwnProperty.call(He,p))throw new Error('Unknown indicator "'.concat(p,'" in configuration.'))}}catch(t){y.e(t)}finally{y.f()}for(var v=0,m=Object.keys(u);v<m.length;v++){var d=m[v];a[d]=ht(o[d],n)}for(var b=f.some((function(t){return"mapCols"===t.key}))?null:Object.entries(u).map((function(t){var e=Fe(t,2),r=e[0],n=e[1],o=rt.hasOwnProperty(n);return{key:r,formatter:o?rt[n]:lt.hasOwnProperty(n)?lt[n]:null,numeric:o}})),g=0;g<n;g+=c)for(var w=Math.min(g+c,n),S=g;S<w;S++){var O=t[S];if(null!==b){var j,_=Le(b);try{for(_.s();!(j=_.n()).done;){var P=j.value,k=P.key,A=P.formatter,N=P.numeric,x=O[k];if(void 0!==x){var T=null===A?x:N?A(x,s):A(x);e.pushToMain({index:S,key:k,value:T})}}}catch(t){_.e(t)}finally{_.f()}}else for(var I=0,E=Object.entries(u);I<E.length;I++){var C=Fe(E[I],2),M=C[0],D=C[1],R=O[M];if(void 0!==R)if(rt.hasOwnProperty(D)){var F=rt[D](R,s);e.pushToMain({index:S,key:M,value:F})}else lt.hasOwnProperty(D)?e.pushToMain({index:S,key:M,value:lt[D](R)}):e.pushToMain({index:S,key:M,value:R})}var L=(a.open[S]+a.close[S])/2;e.pushToMain({index:S,key:"mid_price",value:L});var B,U=Le(f);try{for(U.s();!(B=U.n()).done;){var H=B.value,V=H.key,$=H.params;He[V].apply(He,[e,S].concat(Re($)))}}catch(t){U.e(t)}finally{U.f()}t[S]=null;var K=Object.keys(a);r(e,S,K)||(e.invalidValueIndex=S)}l.push.apply(l,Re(Object.keys(a)))}(this.input,this)}finally{this.isComputing=!1}this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[]}return 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";a(this),l(t,"arr",r),u(e,"options",r);var n=e.limit,o=void 0===n?null:n,i=e.oneHot,c=void 0!==i&&i;null!==o&&f(o,{min:2,max:this.len},"options.limit",r),s(c,"options.oneHot",r);var h,y=[],p=Xe(t);try{for(p.s();!(h=p.n()).done;){var v=h.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._registerIndicator({key:r,params:[t,{limit:o,oneHot:c}]}),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 a(this),l(t,"colKeys",r),f(e,{min:1,max:this.len,allowDecimals:!1},"lookback",r),this._registerIndicator({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.');a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.lag,o=void 0===n?0:n;return f(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this._registerIndicator({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.');a(this),u(t,"options",e);var r=t.lag,n=void 0===r?0:r;return f(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this._registerIndicator({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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.retLogs,l=void 0!==i&&i;return f(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(l,"options.retLogs",r),this._registerIndicator({key:r,order:0,params:[t,{lag:o,retLogs:l}]}),this}},{key:"adx",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="adx";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.retLogs,l=void 0!==i&&i;return f(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(l,"options.retLogs",r),this._registerIndicator({key:r,order:0,params:[t,{lag:o,retLogs:l}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,l=void 0===i?0:i;return h(o,"options.target",r),f(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this._registerIndicator({key:r,params:[r,t,{target:o,lag:l}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,l=void 0===i?0:i;return h(o,"options.target",r),f(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this._registerIndicator({key:r,params:[r,t,{target:o,lag:l}]}),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";a(this);var o=null===t&&null===e;!1===o&&(f(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),f(e,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),u(r,"options",n);var i=r.lag,l=void 0===i?0:i,c=r.retLogs,h=void 0!==c&&c;return f(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),s(h,"option.retLogs",n),this._registerIndicator({key:n,order:0,params:[t,e,{lag:l,bothNull:o,retLogs:h}]}),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";a(this);var i=this.len;f(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),f(e,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),f(r,{min:1,max:i,allowDecimals:!1},"dPeriod",o),u(n,"options",o);var l=n.lag,c=void 0===l?0:l,h=n.retLogs;return f(c,{min:0,max:i,allowDecimals:!1},"options.lag",o),s(h,"retLogs",o),this._registerIndicator({key:o,params:[t,e,r,{lag:c,retLogs:h}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),f(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),f(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),u(n,"options",o);var i=n.target,l=void 0===i?"close":i,c=n.lag,s=void 0===c?0:c;h(l,"options.target",o),f(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var y={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===l?"":"_".concat(l))};return this._registerIndicator({key:o,params:[t,e,r,{target:l,lag:s,precomputed:y}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",n),f(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),u(r,"options",n);var o=r.lag,i=void 0===o?0:o;return f(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this._registerIndicator({key:n,params:[t,e,{lag:i}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),u(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,l=void 0===i?0:i,c=e.retLogs,y=void 0!==c&&c;return h(o,"options.target",r),f(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(y,"retLogs",r),this._registerIndicator({key:r,params:[t,{target:o,lag:l,retLogs:y}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",n),f(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),u(r,"options",n);var o=r.lag,i=void 0===o?0:o;return f(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this._registerIndicator({key:n,order:0,params:[t,e,{lag:i}]}),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.');a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),f(e,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),u(r,"options",n);var o=r.lag,i=void 0===o?0:o,l=r.retLogs,c=void 0!==l&&l;return f(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),s(c,"retLogs",n),this._registerIndicator({key:n,order:0,params:[t,e,{lag:i,retLogs:c}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="dateTime";a(this),u(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.oneHot,i=void 0!==o&&o;f(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),s(i,"options.oneHot",e);var l=i?"one_hot_":"",c=rr(rr(rr(rr(rr({},"".concat(l,"month"),12),"".concat(l,"day_of_the_month"),31),"".concat(l,"day_of_the_week"),7),"".concat(l,"hour"),24),"".concat(l,"minute"),60),h={prefix:l,colKeySizes:c,colKeys:Object.keys(c)};return this._registerIndicator({key:e,order:0,params:[{lag:n,oneHot:i,precompute:h}]}),this}},{key:"candleFeatures",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="candleFeatures";a(this),u(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.colKeys,i=void 0===o?[]:o,c=t.retLogs,h=void 0!==c&&c;return f(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),l(i,"options.colKeys",e),s(h,"retLogs",e),this._registerIndicator({key:e,params:[{lag:n,colKeys:i,retLogs:h}]}),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]:{};a(this);var n="mapCols";null==e&&(e="default"),u(r,"options",n);var o=r.lag,i=void 0===o?0:o,c=r.isPriceBased,h=void 0!==c&&c,y=r.callbackParams,p=void 0===y?{}:y;We(e);var v=qe(p);if(l(t,"newCols",n),f(i,{min:0,allowDecimals:!1},"options.lag",n),s(h,"isPriceBased","mapCols"),!1===this.precision&&h)throw new Error('Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.');return this._registerIndicator({key:n,params:[t,e,{lag:i,isPriceBased:h,callbackParams:v}]}),this}}],n=[{key:"registerMapCallback",value:function(t,e){return function(t,e){if("string"!=typeof t||!t||"function"!=typeof e)throw new TypeError("registerMapCallback requires a nonempty name and a function.");if(Ye.has(t)&&Ye.get(t)!==e)throw new Error('mapCols callback "'.concat(t,'" is already registered. Use a new versioned name.'));Ye.set(t,e)}(t,e),this}}],e&&lr(t.prototype,e),n&&lr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}()})(),OHLCV_INDICATORS=e})();
1
+ var OHLCV_INDICATORS;(()=>{"use strict";const e={d:(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};(()=>{e.d(t,{default:()=>ee});const s=(e,t)=>{if(0===e.length)return!1;for(let s=0;s<e.length;s++){const i=e[s][t];if(null==i||Number.isNaN(i))return!1}return!0},i=(e,t)=>{if(!Array.isArray(e))throw new Error('Property "inputParams" must be an "Array" or "Set".');for(const s of e){if(!s||"string"!=typeof s.key||!Array.isArray(s.params))throw new TypeError("Each inputParams entry must have an indicator key and a params array.");if(void 0!==s.order&&!Number.isFinite(s.order))throw new TypeError("Indicator order must be a finite number when provided.");const{params:e}=s;for(const s of e)if("number"==typeof s&&s>t)throw console.log(s,t),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.")}},r=e=>{if(!0===e.isComputing)throw Error("You cannot add indicators while computation is in progress.");if(!0===e.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},o=(e,t,s)=>{if(!Array.isArray(e))throw new Error(`Param "${t}" must be an array in "${s}".`);return!0},n=(e,t,s)=>{if(e instanceof Object==0)throw new Error(`Param "${t}" must be an object in "${s}".`);return!0},a=(e,t,s,i)=>{if(o(e,"arrayOptions",`${i}.${s}.validateArrayOptions`),!e.includes(t.toString()))throw new Error(`Param "${s}" must be any of the following values [${e.join(", ")}] in "${i}".`);return!0},l=(e,t,s)=>{if("boolean"!=typeof e)throw new Error(`Param "${t}" must be an boolean in "${s}".`);return!0},h=(e,t,s,i)=>{n(t,"options",`${i}.${s}.validateNumber`);const{allowDecimals:r=!1,min:o,max:a}=t,l=r?"number":"integer";if("number"!=typeof e||!1===r&&!Number.isInteger(e))throw new Error(`Param "${s}" must be an ${l} in "${i}".`);if(void 0!==o&&"number"!=typeof o)throw new Error(`Param "min" must be a valid ${l} (if provided) in "${i}.${s}.validateNumber".`);if(void 0!==a&&"number"!=typeof a)throw new Error(`Param "max" must be a valid ${l} (if provided) in "${i}.${s}.validateNumber".`);if(void 0!==o&&void 0!==a&&o>=a)throw new Error(`Param "min" must be less than "max" in "${i}.${s}.validateNumber".`);if(void 0!==o&&e<o)throw new Error(`Param "${s}" must be an ${l} ≥ ${o} in "${i}".`);if(void 0!==a&&e>a)throw new Error(`Param "${s}" must be an ${l} ≤ ${a} in "${i}".`);return!0},c=(e,t,s)=>{if("string"!=typeof e||!e.length)throw new Error(`Invalid "${t}" property in "${s}". Only strings are accepted.`);return!0},u=(e,t,s,i)=>{if(0!==s)return!0;const r=[];for(const i of Object.keys(e)){const e=t[i]?.[s];("volume"===i?Number.isFinite(e)&&e>=0:Number.isFinite(e)&&e>0)||r.push(i)}if(r.length>0)throw new TypeError(`Invalid or missing input value(s) [${r.join(", ")}] at index ${s} in "${i}".`);return!0};class p extends Error{constructor(e="Not enough data"){super(e),this.name="NotEnoughDataError"}}class d{constructor(){this.result=void 0}get isStable(){return void 0!==this.result}getResult(){if(!this.isStable)throw new p;return this.result}}class m extends d{constructor(){super(),this.previousResult=void 0,this.highest=void 0,this.lowest=void 0,this.previousHighest=void 0,this.previousLowest=void 0}setResult(e,t=!1){return t&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=e:(this.previousHighest=this.highest,e>this.highest&&(this.highest=e)),void 0===this.lowest?this.lowest=e:(this.previousLowest=this.lowest,e<this.lowest&&(this.lowest=e)),this.previousResult=this.result,this.result=e,e}replace(e){return this.update(e,!0)}updates(e){return e.forEach(e=>this.update(e)),this.result}}class g extends m{constructor(e){super(),this.interval=e,this.pricesCounter=0,this.weightFactor=2/(e+1)}update(e,t=!1){t&&0!==this.pricesCounter||this.pricesCounter++;const s=t&&void 0!==this.previousResult?this.previousResult:void 0!==this.result?this.result:e;return this.setResult(e*this.weightFactor+s*(1-this.weightFactor),t)}get isStable(){return this.pricesCounter>=this.interval}}class f extends m{constructor(e){super(),this.interval=e,this.prices=new Float64Array(e),this.count=0,this.head=0}update(e,t=!1){"number"==typeof e||Array.isArray(this.prices)||(this.prices=Array.from(this.prices));const{interval:s,prices:i}=this;if(t&&this.count){let t=this.head+this.count-1;t>=s&&(t-=s),i[t]=e}else this.count<s?i[this.count++]=e:(i[this.head]=e,++this.head===s&&(this.head=0));if(this.count===s){let e=0;for(let t=this.head;t<s;t++)e+=i[t];for(let t=0;t<this.head;t++)e+=i[t];return this.setResult(e/s,t)}}}class v extends m{constructor(e){super(),this.interval=e,this.indicator=new f(e),this.smoothingFactor=1/e}update(e,t=!1){if(void 0===this.result){const s=this.indicator.update(e);if(void 0!==s)return this.indicator=void 0,this.setResult(s,t)}else{if(t&&void 0!==this.previousResult){const s=(e-this.previousResult)*this.smoothingFactor;return this.setResult(s+this.previousResult,t)}if(!t){const s=(e-this.result)*this.smoothingFactor;return this.setResult(s+this.result,t)}}}}class y extends m{constructor(e,t=v){super(),this.interval=e,this.avgGain=new t(e),this.avgLoss=new t(e),this.maxValue=100,this.priceCount=0,this.previousPrice=void 0,this.currentPrice=void 0}update(e,t=!1){if(t&&0!==this.priceCount||(this.previousPrice=this.currentPrice,this.priceCount<2&&this.priceCount++),this.currentPrice=e,this.priceCount<2)return;const s=this.previousPrice;if(e>s?(this.avgLoss.update(0,t),this.avgGain.update(e-s,t)):(this.avgLoss.update(s-e,t),this.avgGain.update(0,t)),this.avgGain.isStable){const e=this.avgLoss.getResult();if(0===e)return this.setResult(100,t);const s=this.avgGain.getResult()/e;return this.setResult(this.maxValue-this.maxValue/(s+1),t)}}}class w extends m{constructor(){super(),this.previousCandle=void 0,this.twoPreviousCandle=void 0}update(e,t=!1){const{high:s,low:i}=e,r=s-i;if(this.previousCandle&&t&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){const o=Math.abs(s-this.previousCandle.close),n=Math.abs(i-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=e,this.setResult(Math.max(r,o,n),t)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=e,this.setResult(r,t)}}class b extends m{constructor(e,t=v){super(),this.interval=e,this.tr=new w,this.smoothing=new t(e)}update(e,t=!1){const s=this.tr.update(e,t);if(this.smoothing.update(s,t),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),t)}}class _ extends m{constructor(e,t=v){super(),this.interval=e,this.atr=new b(e,t),this.movesDown=new t(e),this.movesUp=new t(e),this.previousCandle=void 0,this.mdi=void 0,this.pdi=void 0}updateState(e,t=0,s=0){this.atr.update(e),this.movesUp.update(t),this.movesDown.update(s),this.previousCandle=e}update(e){if(!this.previousCandle)return void this.updateState(e);const t=e.high-this.previousCandle.high,s=this.previousCandle.low-e.low,i=t<0||t<s?0:t,r=s<0||s<t?0:s;if(this.updateState(e,i,r),this.movesUp.isStable){const e=this.atr.getResult();this.pdi=this.movesUp.getResult()/e,this.mdi=this.movesDown.getResult()/e;const t=Math.abs(this.pdi-this.mdi),s=this.pdi+this.mdi;return 0===s?this.setResult(0,!1):this.setResult(t/s*100,!1)}}}class $ extends m{constructor(e,t=v){super(),this.interval=e,this.adx=new t(e),this.dx=new _(e,t)}get mdi(){return this.dx.mdi}get pdi(){return this.dx.pdi}update(e,t=!1){const s=this.dx.update(e);if(void 0!==s&&this.adx.update(s),this.adx.isStable)return this.setResult(this.adx.getResult(),t)}}class N extends d{constructor(e,t=2){super(),this.interval=e,this.deviationMultiplier=t,this.prices=new Float64Array(e),this.count=0,this.head=0}update(e){if("number"==typeof e||Array.isArray(this.prices)||(this.prices=Array.from(this.prices)),this.count<this.interval)return void(this.prices[this.count++]=e);this.prices[this.head]=e,this.head=(this.head+1)%this.interval;let t=0,s=this.head;for(let e=0;e<this.count;e++)t+=this.prices[s],++s===this.interval&&(s=0);const i=this.count?t/this.count:0;let r=i;if(!r&&Array.isArray(this.prices)){t=0,s=this.head;for(let e=0;e<this.count;e++)t+=this.prices[s],++s===this.interval&&(s=0);r=this.count?t/this.count:0}let o=0;s=this.head;for(let e=0;e<this.count;e++){const e=this.prices[s]-r;o+=e*e,++s===this.interval&&(s=0)}const n=Math.sqrt(this.count?o/this.count:0);return this.result={lower:i-n*this.deviationMultiplier,middle:i,upper:i+n*this.deviationMultiplier}}}class k extends d{constructor(e,t,s){super(),this.short=e,this.long=t,this.signal=s,this.pricesCounter=0}update(e,t=!1){t&&0!==this.pricesCounter||this.pricesCounter++;const s=this.short.update(e,t),i=this.long.update(e,t);if(this.pricesCounter>this.long.interval&&this.pricesCounter--,this.pricesCounter===this.long.interval){const e=s-i,r=this.signal.update(e,t);return this.result={histogram:e-r,macd:e,signal:r}}}}class x extends d{constructor(e,t,s){super(),this.n=e,this.m=t,this.p=s,this.periodM=new f(t),this.periodP=new f(s),this.candles=new Array(e),this.count=0,this.head=0}update(e){if(this.count<this.n?this.candles[this.count++]=e:(this.candles[this.head]=e,this.head=(this.head+1)%this.n),this.count===this.n){let t=-1/0,s=1/0,i=this.head;for(let e=0;e<this.count;e++)t=Math.max(t,this.candles[i].high),++i===this.n&&(i=0);i=this.head;for(let e=0;e<this.count;e++)s=Math.min(s,this.candles[i].low),++i===this.n&&(i=0);const r=t-s,o=100*(e.close-s)/(0===r?1:r),n=this.periodM.update(o),a=n&&this.periodP.update(n);if(void 0!==n&&void 0!==a)return this.result={stochD:a,stochK:n}}}}const O=(e,t)=>{if(0===e&&(e=.001),0===t&&(t=.001),Math.sign(e)!==Math.sign(t))throw new Error(`[BUG] Params must have the same sign in mathLog a=${e} b=${t}.`);e<0&&(e=-e,t=-t);const s=Math.log(e/t);if(null==(i=s)||!Number.isFinite(i))throw new Error(`[BUG] Invalid params passed to mathLog a=${e} b=${t}.`);var i;return s},T=e=>{const t=String(e);return 1===e?0:t.length-1},M=(e,t,s)=>{if("string"!=typeof e)throw new Error("addPrecisionExact expects a string when precision=true");const i="-"===e.charAt(0),r=i?e.slice(1):e,[o,n=""]=r.split("."),a=void 0===s?T(t):s,l=n.padEnd(a,"0").slice(0,a);let h=parseInt(o+l||"0",10);return i&&(h=-h),h},S={number:e=>e,numberCleanString:e=>Number(e),precisionNumberCleanString:(e,t,s)=>M(e,t,s)},P=(e,t,s)=>((e,t,s)=>{if("number"!=typeof e||!Number.isFinite(e))throw new Error("revertPrecisionAsNumber expects a finite number");const i=e<0;let r=Math.abs(e);r=Math.trunc(r);const o=void 0===s?T(t):s;if(0===o)return i?-r:r;const n=Math.trunc(r/t);let a=String(r%t).padStart(o,"0");a=a.replace(/0+$/,"");const l=0===a.length?String(n):`${n}.${a}`;return Number(i?`-${l}`:l)})(e,t,s),C=(e,t=!1,s=!1)=>{const i="number"==typeof e&&!Number.isNaN(e),r="string"==typeof e&&/^-?\d+(\.\d+)?$/.test(e);if(!0===s){if(r)return"precisionNumberCleanString";if(t)throw new Error("Invalid number forma");return typeof e}if(i)return"number";if(r)return"numberCleanString";if(t)throw new TypeError("Invalid input: expected a number or numeric string");return typeof e},A={toString:e=>e.toString(),string:e=>e.toString(),toISOString:e=>e.toISOString(),iso:e=>e.toISOString(),toUTCString:e=>e.toUTCString(),milliseconds:e=>e.getTime(),seconds:e=>e.getTime()/1e3,object:e=>e},F={dateObject:e=>e,dateMilliseconds:e=>new Date(e),dateSeconds:e=>new Date(1e3*e),dateIncompleteDayString:e=>new Date(`${e} 00:00:00`),dateCompleteDateString:e=>new Date(e)},D=e=>{const t=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i,s=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/,i=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/,r=/^\d{4}-\d{2}-\d{2}$/,o=/^\d{4}\/\d{2}\/\d{2}$/,n=["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"],a=()=>{throw new Error(`Invalid "${typeof e}" date value passed in selectDateFormatter. Supported formats: \n-${n.join("\n- ")}`)};if("object"==typeof e){if(e instanceof Date&&!isNaN(e.valueOf()))return"dateObject";a()}else{if("number"==typeof e)return Math.abs(e)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof e){if(t.test(e)||s.test(e)||i.test(e)&&e.length>10||o.test(e))return"dateCompleteDateString";if(r.test(e))return"dateIncompleteDayString";a()}else a()}},L=(e,t,s)=>{const i={Array,Float64Array,Float32Array,Int32Array,Uint8Array,Int8Array,Int16Array}[e];if(!i||"function"!=typeof i.from)throw new Error(`Unsupported array type: ${e}`);let r;return r=void 0!==s?s:"Array"===e?null:NaN,new i(t).fill(r)},I=(e,t,{lag:s=0}={})=>{const i=[],r=[];for(const{key:s,type:o="Float64Array",fill:n,enabled:a=!0,priceBased:l=!1,includeInLag:h=!0}of t)if(a){if(Object.prototype.hasOwnProperty.call(e.verticalOhlcv,s))throw new Error(`Output column "${s}" already exists in verticalOhlcv.`);if(/^(?:Int|Uint)/.test(o)&&void 0===n)throw new Error(`Integer output column "${s}" requires an explicit fill value.`);e.verticalOhlcv[s]=L(o,e.len,n),l&&e.priceBased.add(s),i.push(s),h&&r.push(s)}return s>0&&r.length>0&&(h(s,{min:1,max:e.len},"lag","initializeColumns"),e.executionParams.push({key:"lag",params:[r,s]})),i},E=e=>null==e||!Number.isFinite(e),R={ema:g,sma:f},j=(e,t,s,i,{target:r,lag:o,retLogs:n=!1})=>{const{verticalOhlcv:a,instances:l,priceBased:h}=e,c=`${n?"ret_log_":""}${s}_${i}${"close"!==r?`_${r}`:""}`;if(0===t){if(u({[r]:!0},a,t,s),!a.hasOwnProperty(r))throw new Error(`Target property ${r} not found in verticalOhlcv for ${s}.`);l[c]=new R[s](i),I(e,n?[{key:`${c}_distance`,priceBased:!1},{key:`${c}_change`,priceBased:!1}]:[{key:c,priceBased:h.has(r)}],{lag:o})}const p=a[r][t];if(E(p))return;const d=l[c],m=d.isStable?d.getResult():NaN;d.update(p);const g=d.isStable?d.getResult():NaN;if(!E(g))if(n){const s=O(p,g);if(e.pushToMain({index:t,key:`${c}_distance`,value:s}),E(m))return;const i=O(g,m);e.pushToMain({index:t,key:`${c}_change`,value:i})}else e.pushToMain({index:t,key:c,value:g})},H=e=>null==e||!Number.isFinite(e),B=(e,t)=>(e-t)/t,V="close",K=Symbol("lagColumns"),U=(e,t)=>{const s=new Uint8Array(t);return s[e]=1,s},z=(e,t)=>e>t,Z=(e,t)=>e<t;class G{constructor(){Object.assign(this,{interval:0,prevState:.5,prevFast:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1})}update(e,{fast:t,high:s,slow:i,low:r}){let o=this.prevState;this.areHighAndLowUndefined||void 0!==s&&void 0!==r||(this.areHighAndLowUndefined=!0),Number.isNaN(t)||Number.isNaN(i)||((e,t)=>e===t)(t,i)?o=.5:z(t,i)?o=this.areHighAndLowUndefined?1:[r,i,this.prevLow,this.prevSlow].every(e=>!Number.isNaN(e))&&Z(r,i)&&z(this.prevLow,this.prevSlow)?0:1:Z(t,i)&&(o=this.areHighAndLowUndefined?0:[s,i,this.prevHigh,this.prevSlow].every(e=>!Number.isNaN(e))&&z(s,i)&&Z(this.prevHigh,this.prevSlow)?1:0),.5===o?this.interval=0:1===o?this.prevState<=.5?this.interval=1:this.interval++:0===o&&(this.prevState>=.5?this.interval=-1:this.interval--),Object.assign(this,{prevState:o,prevFast:t,prevSlow:i,prevHigh:s,prevLow:r})}getResult(){return this.interval}}const Y=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],q=e=>null==e||!Number.isFinite(e),J={candleFeatures:(e,t,{lag:s,colKeys:i,retLogs:r})=>{const{verticalOhlcv:o,priceBased:n,scaledGroups:a}=e,l=(e,t)=>r?Math.log(e/t):(e-t)/t,h=r?"ret_log_":"ret_";if(0===t){u({open:!0,high:!0,low:!0,close:!0},o,t,"candleFeatures");const r=["change","mid_price_change","upper_wick","lower_wick","gap","body","range"].map(e=>({key:`${h}${e}`}));for(const e of i){if(u({[e]:!0},o,t,"candleFeatures"),!o.hasOwnProperty(e))throw new Error(`Target property in "options.colKey" array "${e}" not found in verticalOhlcv for "candleFeatures".`);if(!n.has(e))throw new Error(`Target property in "options.colKey" array "${e}" not found in priceBased for "candleFeatures".`);r.push({key:`${h}${e}`})}a.candleFeatures=I(e,r,{lag:s})}const c=o.close[t-1],p=o.open[t-1];if(void 0===c)return;const d=o.open[t],m=o.high[t],g=o.low[t],f=o.close[t],v=(c+p)/2,y=(d+f)/2,w=Math.max(d,f),b=Math.min(d,f),_=l(f,c),$=l(y,v),N=l(m,w),k=l(b,g),x=l(d,c),O=l(f,d),T=l(m,g);if(0===i.length)return e.pushToMain({index:t,key:`${h}change`,value:_}),e.pushToMain({index:t,key:`${h}mid_price_change`,value:$}),e.pushToMain({index:t,key:`${h}upper_wick`,value:N}),e.pushToMain({index:t,key:`${h}lower_wick`,value:k}),e.pushToMain({index:t,key:`${h}gap`,value:x}),e.pushToMain({index:t,key:`${h}body`,value:O}),void e.pushToMain({index:t,key:`${h}range`,value:T});const M={[`${h}change`]:_,[`${h}mid_price_change`]:$,[`${h}upper_wick`]:N,[`${h}lower_wick`]:k,[`${h}gap`]:x,[`${h}body`]:O,[`${h}range`]:T};let S=!1;for(const e of i){const s=o[e][t];if(q(s)){S=!0;break}const i=l(f,s);M[`${h}${e}`]=i}if(!S)for(const[s,i]of Object.entries(M))e.pushToMain({index:t,key:s,value:i})},dateTime:(e,t,{lag:s,oneHot:i,precompute:r})=>{const{instances:o,verticalOhlcv:n}=e,{prefix:a}=r;if(0===t){const{dateType:t}=e;if(!t)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(o,{dateTime:{formatter:new Intl.DateTimeFormat("en-US-u-ca-gregory-nu-latn",{timeZone:e.timeZone,year:"numeric",month:"numeric",day:"numeric",weekday:"short",hour:"numeric",minute:"numeric",hourCycle:"h23"}),colKeys:[...r.colKeys,`${a}year`].filter(e=>"one_hot_year"!==e),colKeySizes:{...r.colKeySizes}}});const{colKeys:n}=o.dateTime;I(e,n.map(e=>({key:e,type:i?"Array":"Int16Array",fill:i?null:0})),{lag:s})}const{colKeySizes:l,formatter:h}=o.dateTime,c=n.date[t];let u,p,d,m,g,f;for(const e of h.formatToParts(c))switch(e.type){case"year":u=e.value;break;case"month":p=e.value;break;case"hour":d=e.value;break;case"minute":m=e.value;break;case"weekday":g=e.value;break;case"day":f=e.value}const v=Number(u),y=Number(p)-1,w=Number(d),b=Number(m),_=Y.indexOf(g),$=Number(f)-1;if(!i)return e.pushToMain({index:t,key:"year",value:v}),e.pushToMain({index:t,key:"month",value:y+1}),e.pushToMain({index:t,key:"hour",value:w}),e.pushToMain({index:t,key:"minute",value:b}),e.pushToMain({index:t,key:"day_of_the_week",value:(_+6)%7+1}),void e.pushToMain({index:t,key:"day_of_the_month",value:$+1});const N=U(y,l.one_hot_month),k=U(w,l.one_hot_hour),x=U(b,l.one_hot_minute),O=U(_,l.one_hot_day_of_the_week),T=U($,l.one_hot_day_of_the_month);e.pushToMain({index:t,key:"one_hot_month",value:N}),e.pushToMain({index:t,key:"one_hot_hour",value:k}),e.pushToMain({index:t,key:"one_hot_minute",value:x}),e.pushToMain({index:t,key:"one_hot_day_of_the_week",value:O}),e.pushToMain({index:t,key:"one_hot_day_of_the_month",value:T})},heikenAshi:(e,t,s,i,{lag:r=0,noSmoothing:o=!1,retLogs:n=!1}={})=>{const{verticalOhlcv:a,instances:l,scaledGroups:h}=e,c=o?"heiken_ashi":`heiken_ashi_${s}_${i}`;if(0===t){u({open:!0,high:!0,low:!0,close:!0},a,t,"heikenAshi");const p=["open","high","low","close"],d=["body","upper_wick","lower_wick","range"],m=o?"":`_${s}_${i}`,f=n?"ret_log_":"ret_",v=Object.fromEntries(d.map(e=>[e,`${f}heiken_ashi_${e}${m}`])),y=`heiken_ashi_cross${m}`,w=Object.values(v);l[c]={emaPre:o?null:Object.fromEntries(p.map(e=>[e,new g(s)])),emaPost:o?null:Object.fromEntries(p.map(e=>[e,new g(i)])),prevHaOpen:NaN,prevHaClose:NaN,prevSmOpen:NaN,prevSmClose:NaN,trendDirection:0,getRet:n?O:B,outputKeys:v,crossKey:y},I(e,[...w,y].map(e=>({key:e})),{lag:r}),h&&(h.heikenAshi=w)}const p=a.open[t],d=a.high[t],m=a.low[t],f=a.close[t],v=l[c],{crossKey:y,emaPre:w,emaPost:b,getRet:_,outputKeys:$}=v;if(H(p)||H(d)||H(m)||H(f))return;let N,k,x,T;if(null!==w){if(w.open.update(p),w.high.update(d),w.low.update(m),w.close.update(f),!(w.open.isStable&&w.high.isStable&&w.low.isStable&&w.close.isStable))return;N=w.open.getResult(),k=w.high.getResult(),x=w.low.getResult(),T=w.close.getResult()}else N=p,k=d,x=m,T=f;if(H(N)||H(k)||H(x)||H(T))return;const M=(N+k+x+T)/4,S=Number.isNaN(v.prevHaOpen)||Number.isNaN(v.prevHaClose)?(N+T)/2:(v.prevHaOpen+v.prevHaClose)/2,P=Math.max(k,S,M),C=Math.min(x,S,M);let A,F,D,L;if(v.prevHaOpen=S,v.prevHaClose=M,null!==b){if(b.open.update(S),b.high.update(P),b.low.update(C),b.close.update(M),!(b.open.isStable&&b.high.isStable&&b.low.isStable&&b.close.isStable))return;A=b.open.getResult(),F=b.high.getResult(),D=b.low.getResult(),L=b.close.getResult()}else A=S,F=P,D=C,L=M;if(H(A)||H(F)||H(D)||H(L)||A<=0||F<=0||D<=0||L<=0)return;const E=Number.isFinite(v.prevSmOpen)&&Number.isFinite(v.prevSmClose),R=t>0?a[y][t-1]:NaN,j=L>A?1:L<A?-1:v.trendDirection;let V=0;E&&0!==j&&(V=Number.isFinite(R)&&Math.sign(R)===j?R+j:j),v.trendDirection=j,v.prevSmOpen=A,v.prevSmClose=L;const K=Math.max(A,L),U=Math.min(A,L),z=_(L,A),Z=_(F,K),G=_(U,D),Y=_(F,D);H(z)||e.pushToMain({index:t,key:$.body,value:z}),H(Z)||e.pushToMain({index:t,key:$.upper_wick,value:Z}),H(G)||e.pushToMain({index:t,key:$.lower_wick,value:G}),H(Y)||e.pushToMain({index:t,key:$.range,value:Y}),e.pushToMain({index:t,key:y,value:V})},rsi:(e,t,s,{target:i,lag:r,retLogs:o})=>{const{verticalOhlcv:n,instances:a}=e,l="close"===i?"":`_${i}`,h=o?`ret_log_rsi_${s}${l}`:`rsi_${s}${l}`,c=o?`ret_log_rsi_sma_${s}${l}`:`rsi_sma_${s}${l}`;if(0===t){if(u({[i]:!0},n,t,"rsi"),!n.hasOwnProperty(i))throw new Error(`Target property ${i} not found in verticalOhlcv for rsi.`);Object.assign(a,{[h]:new y(s),[c]:new f(s)}),I(e,[{key:h},{key:c}],{lag:r})}const p=n[i][t];a[h].update(p);const d=a[h].isStable?a[h].getResult():NaN,m=Number.isNaN(d)?NaN:o?O(d,50):d;e.pushToMain({index:t,key:h,value:m}),Number.isNaN(d)||a[c].update(d);const g=a[c].isStable?a[c].getResult():NaN,v=Number.isNaN(g)?NaN:o?O(g,50):g;e.pushToMain({index:t,key:c,value:v})},mfi:(e,t,s,{lag:i,retLogs:r})=>{const{verticalOhlcv:o,instances:n}=e,a=`${r?"ret_log_":""}mfi_${s}`;0===t&&(u({high:!0,low:!0,close:!0,volume:!0},o,t,"mfi"),I(e,[{key:a}],{lag:i}),n[a]={flows:new Float64Array(s),next:0,count:0,previousTypical:NaN});const l=n[a],h=(o.high[t]+o.low[t]+o.close[t])/3,c=h-l.previousTypical;if(l.previousTypical=h,0===t)return;const p=h*o.volume[t];if(l.flows[l.next]=Number.isFinite(c)&&Number.isFinite(p)&&p>=0?Math.sign(c)*p:NaN,l.next=(l.next+1)%s,l.count<s&&l.count++,l.count<s)return;let d=0,m=0,g=l.next;for(let e=0;e<s;e++){const e=l.flows[g];if(Number.isNaN(e))return;e>0?d+=e:e<0&&(m-=e),++g===s&&(g=0)}if(!Number.isFinite(d)||!Number.isFinite(m))return;const f=0===d&&0===m?NaN:100-100/(1+d/m);e.pushToMain({index:t,key:a,value:Number.isNaN(f)?NaN:r?O(f,50):f})},stochastic:(e,t,s,i,r,{lag:o,retLogs:n})=>{const{verticalOhlcv:a,instances:l,useFullNames:h}=e,c=14!==s||3!==i||3!==r||h?`_${s}_${i}_${r}`:"",p=n?`ret_log_stochastic_d${c}`:`stochastic_d${c}`,d=n?`ret_log_stochastic_k${c}`:`stochastic_k${c}`,m=c;0===t&&(u({high:!0,low:!0,close:!0},a,t,"stochastic"),Object.assign(l,{[m]:new x(s,i,r)}),I(e,[{key:p},{key:d}],{lag:o}));const g=a.close[t],f=a.low[t],v=a.high[t];l[m].update({close:g,low:f,high:v});const y=l[m].isStable?l[m].getResult():null,w=y?n?O(y.stochK,50):y.stochK:NaN,b=y?n?O(y.stochD,50):y.stochD:NaN;e.pushToMain({index:t,key:d,value:w}),e.pushToMain({index:t,key:p,value:b})},atr:(e,t,s,{lag:i,retLogs:r})=>{const{verticalOhlcv:o,instances:n}=e,a=r?`ret_log_atr_${s}`:`atr_${s}`;if(0===t){const{instances:o,verticalOhlcv:n}=e;u({high:!0,low:!0,close:!0},n,t,"atr"),o[a]=new b(s,v),I(e,[{key:a,priceBased:!r}],{lag:i})}const l={high:o.high[t],low:o.low[t],close:o.close[t]},h=n[a];h.update(l);const c=h.isStable?h.getResult():NaN;e.pushToMain({index:t,key:a,value:Number.isNaN(c)?NaN:r?O(c,l.close):c})},adx:(e,t,s,{lag:i,retLogs:r})=>{const{verticalOhlcv:o,instances:n,useFullNames:a}=e,l=r?`ret_log_adx_${s}`:`adx_${s}`,h=`adx_${s}`;if(0===t){if(u({high:!0,low:!0,close:!0},o,t,"adx"),!o.hasOwnProperty("high"))throw new Error("Property high not found in verticalOhlcv for adx.");if(!o.hasOwnProperty("low"))throw new Error("Property low not found in verticalOhlcv for adx.");if(!o.hasOwnProperty("close"))throw new Error("Property close not found in verticalOhlcv for adx.");Object.assign(n,{[h]:new $(s)}),I(e,[{key:l}],{lag:i})}const c=o.high[t],p=o.low[t],d=o.close[t];n[h].update({high:c,low:p,close:d});const m=n[h].isStable?n[h].getResult():NaN,g=Number.isNaN(m)?NaN:r?O(m,20):m;e.pushToMain({index:t,key:l,value:g})},ema:j,sma:j,macd:(e,t,s,i,r,{target:o,lag:n,precomputed:a})=>{const{verticalOhlcv:l,instances:h,useFullNames:c}=e,{instanceKey:p}=a;if(0===t){u({[o]:!0},l,t,"macd");const{inputParams:a}=e;if(!l.hasOwnProperty(o))throw new Error(`Target property ${o} not found in verticalOhlcv for macd.`);let d=0;for(const e of a)"macd"===e.key&&d++;const m=d>1||c,f=`${s}_${i}_${r}`,v=e=>o===V?m?`macd_${e}_${f}`:`macd_${e}`:m?`macd_${e}_${o}_${f}`:`macd_${e}_${o}`,y=v("diff"),w=v("dea"),b=v("histogram");h.hasOwnProperty("macd")||(h.macd={numberOfIndicators:d,settings:{}}),h.macd.settings[p]=new k(new g(s),new g(i),new g(r)),I(e,[y,w,b].map(e=>({key:e,priceBased:!0})),{lag:n})}const{numberOfIndicators:d,settings:m}=h.macd,f=d>1||c,v=`${s}_${i}_${r}`,y=e=>o===V?f?`macd_${e}_${v}`:`macd_${e}`:f?`macd_${e}_${o}_${v}`:`macd_${e}_${o}`,w=y("diff"),b=y("dea"),_=y("histogram"),$=m[p],N=l[o][t];$.update(N);const x=$.isStable?$.getResult():null;e.pushToMain({index:t,key:w,value:x?x.macd:NaN}),e.pushToMain({index:t,key:b,value:x?x.signal:NaN}),e.pushToMain({index:t,key:_,value:x?x.histogram:NaN})},volumeDelta:(e,t,{lag:s=0})=>{const{verticalOhlcv:i,instances:r}=e,o="volume_delta";0===t&&(u({open:!0,close:!0,volume:!0},i,t,"volumeDelta"),r[o]||(r[o]={isBuyVolume:!0,cross:0}),I(e,[`${o}_high`,`${o}_low`,`${o}_close`,`${o}_cross`].map(e=>({key:e})),{lag:s}));const n=r[o],{hasInvalidInputValue:a}=n,l=i.volume[t];if(0===l)return;const h=i.open[t],c=i.close[t],p=t>0?i.close[t-1]:NaN;let d=n.isBuyVolume;c>h?d=!0:c<h?d=!1:c>p?d=!0:c<p&&(d=!1),n.isBuyVolume=d,t<1?n.cross=d?1:-1:d?n.cross>0?n.cross=n.cross+1:n.cross=1:n.cross>0?n.cross=-1:n.cross=n.cross-1;const m=d?l:-l,g=m,f=Math.max(m,0),v=Math.min(m,0);e.pushToMain({index:t,key:`${o}_high`,value:f}),e.pushToMain({index:t,key:`${o}_low`,value:v}),e.pushToMain({index:t,key:`${o}_close`,value:g}),e.pushToMain({index:t,key:`${o}_cross`,value:n.cross})},relativeVolume:(e,t,s,{lag:i,retLogs:r=!1})=>{const o=`${r?"ret_log_":""}relative_volume_${s}`,{instances:n,verticalOhlcv:a}=e;0===t&&(u({volume:!0},a,t,"relativeVolume"),n[o]={instance:new f(s),prevRelativeVolumeSma:NaN},I(e,[{key:o}],{lag:i}));const l=a.volume[t];if(0===l)return;const h=n[o].instance;h.update(l);const c=h.isStable?h.getResult():NaN,p=n[o].prevRelativeVolumeSma;if(n[o].prevRelativeVolumeSma=c,Number.isNaN(c)||Number.isNaN(p))return;const d=l/p,m=r?l>0&&p>0&&d>0&&Number.isFinite(d)?O(d,1):NaN:d;e.pushToMain({index:t,key:o,value:m})},donchianChannels:(e,t,s,i,r)=>{const{verticalOhlcv:o,instances:n,len:a,inputParams:l,useFullNames:h}=e,{lag:c=0,retLogs:p=!1}=r,d=`${s}_${i}`,m=`${p?"ret_log_":""}${d}`,g=(p?"ret_log_":"")+"donchian_channel";if(0===t){u({high:!0,low:!0},o,t,"donchianChannels"),p&&u({close:!0},o,t,"donchianChannels");const s=l.filter(e=>"donchianChannels"===e.key).length,i=s>1||h,r=(p?["width","position"]:["upper","basis","lower"]).map(e=>i?`${g}_${e}_${d}`:`${g}_${e}`);n.donchian_channel||(n.donchian_channel={numberOfIndicators:s,settings:{}}),n.donchian_channel.numberOfIndicators=s,n.donchian_channel.settings[m]={maxDeque:{indices:[],head:0,length:0},minDeque:{indices:[],head:0,length:0}},I(e,r.map(e=>({key:e,priceBased:!p})),{lag:c})}const{numberOfIndicators:f,settings:v}=n.donchian_channel,y=f>1||h,w=e=>y?`${g}_${e}_${d}`:`${g}_${e}`,{maxDeque:b,minDeque:_}=v[m],$=t-i,N=$-s+1;if($<0||$>=a)return;const{high:k,low:x}=o,T=(e,t,i)=>{const{indices:r}=e;for(;e.length&&r[e.head]<N;)e.head=(e.head+1)%s,e.length--;for(;e.length&&i(t[r[(e.head+e.length-1)%s]],t[$]);)e.length--;r[(e.head+e.length)%s]=$,e.length++};if(T(b,k,(e,t)=>e<=t),T(_,x,(e,t)=>e>=t),N<0)return;const M=b.length&&_.length,S=M?k[b.indices[b.head]]:NaN,P=M?x[_.indices[_.head]]:NaN;if(p){let s=NaN,i=NaN;const r=S/P;if(P>0&&S>=P&&Number.isFinite(S)&&Number.isFinite(r)){const e=O(r,1);s=e/2;const n=o.close[t],a=n/P;if(e>0&&n>0&&a>0&&Number.isFinite(a)){const t=2*O(a,1)/e-1;Number.isFinite(t)&&(i=t)}}return e.pushToMain({index:t,key:w("width"),value:s}),void e.pushToMain({index:t,key:w("position"),value:i})}const C=M?(S+P)/2:NaN;e.pushToMain({index:t,key:w("upper"),value:S}),e.pushToMain({index:t,key:w("basis"),value:C}),e.pushToMain({index:t,key:w("lower"),value:P})},bollingerBands:(e,t,s,i,{lag:r,retLogs:o=!1}={})=>{const{verticalOhlcv:n,instances:a,useFullNames:l}=e,h=`${s}_${i}`,c=`${o?"ret_log_":""}${h}`,p=(o?"ret_log_":"")+"bollinger_bands",d="close";if(0===t){const{inputParams:n,verticalOhlcv:m,priceBased:g}=e;if(u({[d]:!0},m,t,"bollingerBands"),!(d in m))throw new Error(`bollingerBands could not find target "${d}"`);let f=0;for(const e of n)"bollingerBands"===e.key&&f++;a.bollinger_bands||(a.bollinger_bands={numberOfIndicators:f,settings:{}}),a.bollinger_bands.settings[c]=new N(s,i);const v=f>1||l?`_${h}`:"";I(e,(o?[`${p}_width${v}`,`${p}_position${v}`]:[`${p}_upper${v}`,`${p}_middle${v}`,`${p}_lower${v}`]).map(e=>({key:e,priceBased:!o&&g.has(d)})),{lag:r})}const{numberOfIndicators:m}=a.bollinger_bands,g=m>1||l?`_${h}`:"",f=a.bollinger_bands.settings[c],v=n[d][t];f.update(v);const y=f.isStable?f.getResult():null,w=y?.upper??NaN,b=y?.middle??NaN,_=y?.lower??NaN;if(o){let s=NaN,i=NaN;const r=w/_;if(_>0&&w>=_&&Number.isFinite(w)&&Number.isFinite(r)){const e=O(r,1);s=e/2;const t=v/_;if(e>0&&v>0&&t>0&&Number.isFinite(t)){const s=2*O(t,1)/e-1;Number.isFinite(s)&&(i=s)}}return e.pushToMain({index:t,key:`${p}_width${g}`,value:s}),void e.pushToMain({index:t,key:`${p}_position${g}`,value:i})}e.pushToMain({index:t,key:`${p}_upper${g}`,value:w}),e.pushToMain({index:t,key:`${p}_middle${g}`,value:b}),e.pushToMain({index:t,key:`${p}_lower${g}`,value:_})},volumeOscillator:(e,t,s,i,{lag:r,retLogs:o})=>{const{verticalOhlcv:n,instances:a}=e,l=o?`ret_log_volume_oscillator_${s}_${i}`:`volume_oscillator_${s}_${i}`;0===t&&(u({volume:!0},n,t,"volumeOscillator"),Object.assign(a,{[l]:{fastEMA:new g(s),slowEMA:new g(i)}}),I(e,[{key:l}],{lag:r}));const{fastEMA:h,slowEMA:c}=a[l],p=n.volume[t];if(0===p)return;h.update(p),c.update(p);const d=h.isStable?h.getResult():NaN,m=c.isStable?c.getResult():NaN;let f=NaN;Number.isNaN(d)||Number.isNaN(m)||(f=o?O(d,m):100*(d-m)/m,e.pushToMain({index:t,key:l,value:f}))},crossPairs:(e,t,s,{oneHot:i,limit:r})=>{const{verticalOhlcv:o,verticalOhlcvTempCols:n,instances:a,len:l,precision:h,precisionMultiplier:c,priceBased:p}=e;for(const{fast:d,slow:m}of s){const s=`${d}_x_${m}`;if(0===t){if(u({..."price"===d?{high:!0,low:!0,close:!0}:{[d]:!0},..."number"==typeof m?{}:{[m]:!0}},o,t,"crossPairs"),"number"==typeof m){const e=m.toString();n.add(e);const t=h&&("price"===d||p.has(d)),s=t?M(e,c):m,i=m>=-125&&m<=125&&!1===t?"Int8Array":"Float64Array";o[e]=L(i,l,s)}a.hasOwnProperty("crossPairs")||(a.crossPairs={}),a.crossPairs[s]={run:new G,min:1/0,max:-1/0},I(e,[{key:s,type:null!==r&&r<=125?"Int8Array":"Float64Array",fill:0},{key:`one_hot_${s}`,type:"Array",enabled:i}])}else if(t+1===l){if("price"!==d&&!o.hasOwnProperty(d))throw new Error(`crossPairs invalid param: fast "${d}" not found in "verticalOhlcv": ${JSON.stringify(Object.keys(o))}`);if(!o.hasOwnProperty(m))throw new Error(`crossPairs invalid param: slow "${m}" not found in "verticalOhlcv": ${JSON.stringify(Object.keys(o))}`)}if("price"!==d&&!o.hasOwnProperty(d))return;if(!o.hasOwnProperty(m))return;const{run:g}=a.crossPairs[s];if("price"===d){const e=o.close[t],s=o[m][t];g.update(t,{fast:e,slow:s,high:o.high[t],low:o.low[t]})}else{const e=o[d][t],s=o[m][t];g.update(t,{fast:e,slow:s})}const f=g.getResult(),v=null!==r?Math.min(Math.max(f,-r),r):f;if(e.pushToMain({index:t,key:s,value:v}),i){const i=v+r,o=2*r+1;e.pushToMain({index:t,key:`one_hot_${s}`,value:U(i,o)})}}},lag:(e,t,s,i)=>{const{verticalOhlcv:r,priceBased:o,instances:n}=e;if(0===t){const t=new Map;for(const n of s){if(!r.hasOwnProperty(n))throw new Error(`Lag processing invoked by col "${n}" was not found in "verticalOhlcv".`);const s=o.has(n),a=Array.isArray(r[n])?"Array":"Float64Array",l=[],h=[];for(let e=1;e<=i;e++){const t=`${n}_lag_${e}`;l.push({key:t,type:a,priceBased:s,includeInLag:!1}),h.push(t)}I(e,l),t.set(n,h)}n[K]||(n[K]=new WeakMap),n[K].set(s,t)}const a=n[K]?.get(s);for(const o of s){const s=a?.get(o),n=r[o],l=Array.isArray(n)?null:NaN;for(let r=1;r<=i;r++){const i=s?.[r-1]??`${o}_lag_${r}`,a=t-r,h=a<0||null==n[a]?l:n[a];e.pushToMain({index:t,key:i,value:h})}}}},W=({main:e,skipNull:t=!1,startIndex:s=0,dateFormat:i})=>{const{verticalOhlcv:r,invalidValueIndex:o,len:n,verticalOhlcvKeyNames:a,verticalOhlcvTempCols:l,priceBased:h,precision:c,precisionMultiplier:u}=e;if(0===a.length)return[];const p=c&&"number"==typeof u?T(u):void 0,d=t&&o>=0?o+1:0,m=Math.max(d,s),g=n-m,f=Array.from({length:g},()=>({}));for(const[e,t]of Object.entries(r))if(!l.has(e))if("date"===e){const s=A[i];for(let i=m;i<n;i++)f[i-m][e]=s(t[i])}else if(c&&h.has(e)){const s=P;for(let i=m;i<n;i++){const r=t[i];f[i-m][e]=null==r||Number.isNaN(r)?r:s(r,u,p)}}else for(let s=m;s<n;s++)f[s-m][e]=t[s];return f},Q=(e,t=new Set)=>{if(null===e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e&&Number.isFinite(e))return e;if("object"!=typeof e||null===e)throw new TypeError("Configuration values must be JSON-safe: no undefined, non-finite numbers, or functions.");if(t.has(e))throw new TypeError("Configuration must not contain circular references.");const s=Object.getPrototypeOf(e);if(!Array.isArray(e)&&s!==Object.prototype&&null!==s)throw new TypeError("Configuration must contain only plain objects and arrays.");if(Object.getOwnPropertySymbols(e).length)throw new TypeError("Configuration must not contain symbol keys.");t.add(e);const i=Array.isArray(e)?Array.from(e,e=>Q(e,t)):Object.fromEntries(Object.entries(e).map(([e,s])=>[e,Q(s,t)]));return t.delete(e),i},X=e=>{if(null!==e&&"object"==typeof e){for(const t of Object.values(e))X(t);Object.freeze(e)}return e};class ee{constructor({input:e,ticker:t=null,chunkProcess:s=2e3,config:r={}}){if(null===r||Array.isArray(r)||"object"!=typeof r)throw new TypeError('Constructor "config" must be a plain object.');const n=Q(r),u=["schemaVersion","precision","useFullNames","inputParams","dateFormat","skipNull","timeZone"];for(const e of Object.keys(n))if(!u.includes(e))throw new Error(`Unknown configuration option "${e}".`);const{schemaVersion:p=1,precision:d=!1,useFullNames:m=!1,inputParams:g=null,dateFormat:f="milliseconds",skipNull:v=!0,timeZone:y=Intl.DateTimeFormat().resolvedOptions().timeZone}=n;if(1!==p)throw new Error(`Unsupported configuration schemaVersion: ${p}.`);l(v,"config.skipNull","constructor"),c(f,"config.dateFormat","constructor"),a(Object.keys(A),f,"config.dateFormat","constructor"),c(y,"config.timeZone","constructor");const w=new Intl.DateTimeFormat("en-US",{timeZone:y}).resolvedOptions().timeZone;if(this.config=Object.freeze({schemaVersion:p,precision:d,useFullNames:m,dateFormat:f,skipNull:v,timeZone:w}),this.timeZone=w,o(e,"input",null!==t?`contructor ${t}`:"constuctor"),0===e.length)throw Error("input OHLCV must not be empty: "+t);h(s,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),l(d,"precision","contructor"),l(m,"config.useFullNames","constructor"),this.chunkProcess=s,this.input=[...e],this.len=this.input.length,this.firstRow=this.input[0],this.precision=d,this.useFullNames=m;const b=["open","high","low","close","mid_price"];this.initialPriceBased=new Set(b),this.priceBased=new Set(b),this.precisionMultiplier=(e=>{const{precision:t,firstRow:s,initialPriceBased:i}=e;if(!1===t)return 1;let r=1;for(const[e,t]of Object.entries(s)){if(!i.has(e))continue;if("string"!=typeof t||!/^\d+(\.\d+)?$/.test(t))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 "${e}" had the value "${t}" type ${typeof t}.`);const[s,o=""]=t.split("."),n=Number(s);let a=4;if(0===Math.abs(n)){const e=o.length,t=Math.max(4,e),s=o.search(/[1-9]/);if(-1===s)a=t;else{const e=s+1+5;a=Math.max(t,e)}}const l=10**a;l>r&&(r=l)}return r})(this);const{inputTypes:_,arrayTypes:$}=(e=>{const{firstRow:t,precision:s,initialPriceBased:i}=e,r={},o={},n=new Map;for(const[e,a]of Object.entries(t))if("date"===e)r[e]=D(a),o[e]="Array";else if("volume"===e)r[e]=C(a,!0),o[e]="Float64Array";else if(i.has(e))r[e]=C(a,!0,s),o[e]="Float64Array",n.set(e,r[e]);else{const t=C(a,!1,s);r[e]=t,o[e]="number"===t?"Float64Array":"Array"}if(new Set(n.values()).size>1){const e=[...n.entries()].map(([e,t])=>`${e}: "${t}"`).join(", ");throw new Error(`Inconsistent types among price-based columns — ${e}. All initialPriceBased columns must share the same numeric type.`)}return o.hasOwnProperty("open")&&o.hasOwnProperty("close")&&(o.mid_price=o.open,r.mid_price=r.open),{inputTypes:r,arrayTypes:o}})(this);if(this.inputTypes=_,this.arrayTypes=$,!this.firstRow.hasOwnProperty("close"))throw Error(`input OHLCV array objects require at least "close" property: ${t}`);return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.isComputing=!1,this.executionParams=[],this.instances={},this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set,this.pushToMain=({index:e,key:t,value:s})=>{this.verticalOhlcv[t][e]=s},null!==g?(i(g,this.len),this.inputParams=X(Q(g)),this.compute()):this.inputParams=Object.freeze([]),this}exportConfig(){return{...this.config,inputParams:Q(this.inputParams)}}_registerIndicator(e){return r(this),this.inputParams=Object.freeze([...this.inputParams,X(Q(e))]),this}getData(e={}){this.compute();const{skipNull:t=this.config.skipNull,dateFormat:s=this.config.dateFormat}=e;return a(Object.keys(A),s,"dateFormat","getData"),n(e,"options","getData"),W({main:this,skipNull:t,startIndex:0,dateFormat:s})}getLastValues(e={}){this.compute();const{dateFormat:t=this.config.dateFormat}=e;return a(Object.keys(A),t,"dateFormat","getData"),W({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:t})[0]}compute(){if(this.isComputed)return this;if(this.isComputing)throw new Error("Computation is already in progress.");if(this.executionParams=Q(this.inputParams).sort((e,t)=>(e.order??0)-(t.order??0)),this.isComputed=!1,this.len>0){this.isComputing=!0;try{((e,t)=>{const{len:r,arrayTypes:o,verticalOhlcv:n,verticalOhlcvKeyNames:a,inputTypes:l,chunkProcess:h,precisionMultiplier:c,executionParams:u}=t;i(u,r);for(const{key:e}of u)if(!Object.prototype.hasOwnProperty.call(J,e))throw new Error(`Unknown indicator "${e}" in configuration.`);for(const e of Object.keys(l))n[e]=L(o[e],r);const p=Object.entries(l).map(([e,t])=>{const s=S.hasOwnProperty(t);return{key:e,formatter:s?S[t]:F.hasOwnProperty(t)?F[t]:null,numeric:s}}),d="number"==typeof c?T(c):void 0;let m=null;for(let i=0;i<r;i+=h){const o=Math.min(i+h,r);for(let r=i;r<o;r++){const i=e[r];for(const{key:e,formatter:s,numeric:o}of p){const n=i[e];if(void 0===n)continue;const a=null===s?n:o?s(n,c,d):s(n);t.pushToMain({index:r,key:e,value:a})}const o=(n.open[r]+n.close[r])/2;t.pushToMain({index:r,key:"mid_price",value:o});for(const{key:e,params:s}of u)J[e](t,r,...s);e[r]=null,null===m&&(m=Object.values(n)),s(m,r)||(t.invalidValueIndex=r)}}a.push(...Object.keys(n))})(this.input,this)}finally{this.isComputing=!1}this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[]}return this}crossPairs(e=[],t={}){const s="crossPairs";r(this),o(e,"arr",s),n(t,"options",s);const{limit:i=null,oneHot:a=!1}=t;null!==i&&h(i,{min:2,max:this.len},"options.limit",s),l(a,"options.oneHot",s);const c=[];for(const{fast:t="",slow:s=""}of e){if(""===t||""===s)throw new Error(`Invalid crossPairs[${t}_${s}]: Object property “fast” must be a non-null column name and “slow” must be a non-null column name or integer.`);c.push(t.toString(),s.toString())}if(this.isAlreadyComputed.has(s))throw new Error(`You can only call the "${s}" method once.`);return this.isAlreadyComputed.add(s),this._registerIndicator({key:s,params:[e,{limit:i,oneHot:a}]}),this}lag(e=["close"],t=1){const s="lag";r(this),o(e,"colKeys",s);const i=e.find(e=>"string"!=typeof e||""===e);if(void 0!==i)throw new Error(`Invalid item "${i}" (column name) in "colKeys" array param of "${s}()".`);return h(t,{min:1,max:this.len,allowDecimals:!1},"lookback",s),this._registerIndicator({key:s,params:[e,t]}),this}relativeVolume(e=10,t={}){const s="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{lag:i=0,retLogs:o=!1}=t;return h(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(o,"options.retLogs",s),this._registerIndicator({key:s,order:0,params:[e,{lag:i,retLogs:o}]}),this}volumeDelta(e={}){const t="volumeDelta";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeDelta" is called the input ohlcv must contain valid volume properties.');r(this),n(e,"options",t);const{lag:s=0}=e;return h(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",t),this._registerIndicator({key:t,order:0,params:[{lag:s}]}),this}atr(e=14,t={}){const s="atr";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{lag:i=0,retLogs:o=!1}=t;return h(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(o,"options.retLogs",s),this._registerIndicator({key:s,order:0,params:[e,{lag:i,retLogs:o}]}),this}adx(e=14,t={}){const s="adx";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{lag:i=0,retLogs:o=!1}=t;return h(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(o,"options.retLogs",s),this._registerIndicator({key:s,order:0,params:[e,{lag:i,retLogs:o}]}),this}ema(e=5,t={}){const s="ema";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{target:i="close",lag:o=0,retLogs:a=!1}=t;return c(i,"options.target",s),h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(a,"options.retLogs",s),this._registerIndicator({key:s,params:[s,e,{target:i,lag:o,retLogs:a}]}),this}sma(e=5,t={}){const s="sma";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{target:i="close",lag:o=0,retLogs:a=!1}=t;return c(i,"options.target",s),h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(a,"options.retLogs",s),this._registerIndicator({key:s,params:[s,e,{target:i,lag:o,retLogs:a}]}),this}heikenAshi(e=null,t=null,s={}){const i="heikenAshi";r(this);const o=null===e&&null===t;!1===o&&(h(e,{min:1,max:this.len,allowDecimals:!1},"smoothLength",i),h(t,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",i)),n(s,"options",i);const{lag:a=0,retLogs:c=!1}=s;return h(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",i),l(c,"option.retLogs",i),this._registerIndicator({key:i,order:0,params:[e,t,{lag:a,noSmoothing:o,retLogs:c}]}),this}stochastic(e=14,t=3,s=3,i={}){const o="stochastic";r(this);const{len:a}=this;h(e,{min:1,max:a,allowDecimals:!1},"kPeriod",o),h(t,{min:1,max:a,allowDecimals:!1},"kSlowingPeriod",o),h(s,{min:1,max:a,allowDecimals:!1},"dPeriod",o),n(i,"options",o);const{lag:c=0,retLogs:u}=i;return h(c,{min:0,max:a,allowDecimals:!1},"options.lag",o),l(u,"retLogs",o),this._registerIndicator({key:o,params:[e,t,s,{lag:c,retLogs:u}]}),this}macd(e=12,t=26,s=9,i={}){const o="macd";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"fast",o),h(t,{min:1,max:this.len,allowDecimals:!1},"slow",o),h(s,{min:1,max:this.len,allowDecimals:!1},"signal",o),n(i,"options",o);const{target:a="close",lag:l=0}=i;c(a,"options.target",o),h(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);const u={instanceKey:`${e}_${t}_${s}${"close"===a?"":`_${a}`}`};return this._registerIndicator({key:o,params:[e,t,s,{target:a,lag:l,precomputed:u}]}),this}bollingerBands(e=20,t=2,s={}){const i="bollingerBands";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",i),h(t,{min:.01,max:50,allowDecimals:!0},"stdDev",i),n(s,"options",i);const{lag:o=0,retLogs:a=!1}=s;return h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",i),l(a,"options.retLogs",i),this._registerIndicator({key:i,params:[e,t,{lag:o,retLogs:a}]}),this}rsi(e=14,t={}){const s="rsi";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{target:i="close",lag:o=0,retLogs:a=!1}=t;return c(i,"options.target",s),h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(a,"retLogs",s),this._registerIndicator({key:s,params:[e,{target:i,lag:o,retLogs:a}]}),this}mfi(e=14,t={}){const s="mfi";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",s),n(t,"options",s);const{lag:i=0,retLogs:o=!1}=t;return h(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",s),l(o,"options.retLogs",s),this._registerIndicator({key:s,params:[e,{lag:i,retLogs:o}]}),this}donchianChannels(e=20,t=0,s={}){const i="donchianChannels";r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"size",i),h(t,{min:0,max:this.len,allowDecimals:!1},"offset",i),n(s,"options",i);const{lag:o=0,retLogs:a=!1}=s;return h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",i),l(a,"options.retLogs",i),this._registerIndicator({key:i,order:0,params:[e,t,{lag:o,retLogs:a}]}),this}volumeOscillator(e=5,t=10,s={}){const i="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');r(this),h(e,{min:1,max:this.len,allowDecimals:!1},"fastsize",i),h(t,{min:e,max:this.len,allowDecimals:!1},"slowsize",i),n(s,"options",i);const{lag:o=0,retLogs:a=!1}=s;return h(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",i),l(a,"retLogs",i),this._registerIndicator({key:i,order:0,params:[e,t,{lag:o,retLogs:a}]}),this}dateTime(e={}){const t="dateTime";r(this),n(e,"options",t);const{lag:s=0,oneHot:i=!1}=e;h(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",t),l(i,"options.oneHot",t);const o=i?"one_hot_":"",a={[`${o}month`]:12,[`${o}day_of_the_month`]:31,[`${o}day_of_the_week`]:7,[`${o}hour`]:24,[`${o}minute`]:60},c={prefix:o,colKeySizes:a,colKeys:Object.keys(a)};return this._registerIndicator({key:t,order:0,params:[{lag:s,oneHot:i,precompute:c}]}),this}candleFeatures(e={}){let t="candleFeatures";r(this),n(e,"options",t);const{lag:s=0,colKeys:i=[],retLogs:a=!1}=e;return h(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",t),o(i,"options.colKeys",t),l(a,"retLogs",t),this._registerIndicator({key:t,params:[{lag:s,colKeys:i,retLogs:a}]}),this}}})(),OHLCV_INDICATORS=t.default})();
package/index.js CHANGED
@@ -13,7 +13,7 @@ import { verticalToHorizontal } from './src/utilities/verticalToHorizontal.js'
13
13
  import { assignTypes } from './src/utilities/assignTypes.js'
14
14
  import { dateOutputFormaters } from './src/utilities/dateUtilities.js'
15
15
  import { calcPrecisionMultiplier } from './src/utilities/precisionMultiplier.js'
16
- import { CONFIG_VERSION, copyConfig, freezeConfig, registerMapCallback, resolveMapCallback, exportInputParams } from './src/utilities/config.js'
16
+ import { CONFIG_VERSION, copyConfig, freezeConfig } from './src/utilities/config.js'
17
17
 
18
18
  /**
19
19
  * Class OHLCV_INDICATORS
@@ -116,18 +116,13 @@ export default class OHLCV_INDICATORS {
116
116
  }
117
117
 
118
118
 
119
- static registerMapCallback(name, callback) {
120
- registerMapCallback(name, callback)
121
- return this
122
- }
123
-
124
119
  exportConfig() {
125
- return { ...this.config, inputParams: exportInputParams(this.inputParams) }
120
+ return { ...this.config, inputParams: copyConfig(this.inputParams) }
126
121
  }
127
122
 
128
123
  _registerIndicator(job) {
129
124
  isAlreadyComputed(this)
130
- this.inputParams = Object.freeze([...this.inputParams, freezeConfig(copyConfig(job, true))])
125
+ this.inputParams = Object.freeze([...this.inputParams, freezeConfig(copyConfig(job))])
131
126
  return this
132
127
  }
133
128
 
@@ -175,11 +170,8 @@ export default class OHLCV_INDICATORS {
175
170
 
176
171
  if (this.isComputing) throw new Error('Computation is already in progress.')
177
172
 
178
- this.executionParams = copyConfig(this.inputParams, true)
173
+ this.executionParams = copyConfig(this.inputParams)
179
174
  .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
180
- for (const job of this.executionParams) {
181
- if (job.key === 'mapCols') job.params[1] = resolveMapCallback(job.params[1])
182
- }
183
175
 
184
176
  // Mark as “in progress”
185
177
  this.isComputed = false;
@@ -255,6 +247,13 @@ export default class OHLCV_INDICATORS {
255
247
 
256
248
  isAlreadyComputed(this)
257
249
  validateArray(colKeys, 'colKeys', methodName)
250
+
251
+ const invalidItem = colKeys.find(v => typeof v !== 'string' || v === '')
252
+
253
+ if(invalidItem !== undefined) {
254
+ throw new Error(`Invalid item "${invalidItem}" (column name) in "colKeys" array param of "${methodName}()".`)
255
+ }
256
+
258
257
  validateNumber(lookback, {min:1, max: this.len, allowDecimals: false}, 'lookback', methodName)
259
258
 
260
259
  this._registerIndicator({key: methodName, params: [colKeys, lookback]})
@@ -275,11 +274,12 @@ export default class OHLCV_INDICATORS {
275
274
  validateNumber(size, {min:1, max: this.len, allowDecimals: false}, 'size', methodName)
276
275
  validateObject(options, 'options', methodName)
277
276
 
278
- const { lag = 0} = options;
277
+ const { lag = 0, retLogs = false } = options;
279
278
 
280
279
  validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
280
+ validateBoolean(retLogs, 'options.retLogs', methodName)
281
281
 
282
- this._registerIndicator({key: methodName, order: 0, params: [size, {lag}]})
282
+ this._registerIndicator({key: methodName, order: 0, params: [size, {lag, retLogs}]})
283
283
 
284
284
  return this
285
285
  }
@@ -354,12 +354,13 @@ export default class OHLCV_INDICATORS {
354
354
  validateNumber(size, {min: 1, max: this.len, allowDecimals: false}, 'size', methodName)
355
355
  validateObject(options, 'options', methodName)
356
356
 
357
- const {target = 'close', lag = 0} = options
357
+ const {target = 'close', lag = 0, retLogs = false} = options
358
358
 
359
359
  validateString(target, 'options.target', methodName)
360
360
  validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
361
+ validateBoolean(retLogs, 'options.retLogs', methodName)
361
362
 
362
- this._registerIndicator({key: methodName, params: [methodName, size, {target, lag}]})
363
+ this._registerIndicator({key: methodName, params: [methodName, size, {target, lag, retLogs}]})
363
364
 
364
365
  return this
365
366
  }
@@ -372,12 +373,13 @@ export default class OHLCV_INDICATORS {
372
373
  validateNumber(size, {min: 1, max: this.len, allowDecimals: false}, 'size', methodName)
373
374
  validateObject(options, 'options', methodName)
374
375
 
375
- const {target = 'close', lag = 0} = options
376
+ const {target = 'close', lag = 0, retLogs = false} = options
376
377
 
377
378
  validateString(target, 'options.target', methodName)
378
379
  validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
380
+ validateBoolean(retLogs, 'options.retLogs', methodName)
379
381
 
380
- this._registerIndicator({key: methodName, params: [methodName, size, {target, lag}]})
382
+ this._registerIndicator({key: methodName, params: [methodName, size, {target, lag, retLogs}]})
381
383
 
382
384
  return this
383
385
  }
@@ -387,9 +389,9 @@ export default class OHLCV_INDICATORS {
387
389
 
388
390
  isAlreadyComputed(this)
389
391
 
390
- const bothNull = smoothLength === null && afterSmoothLength === null;
392
+ const noSmoothing = smoothLength === null && afterSmoothLength === null;
391
393
 
392
- if(bothNull === false) {
394
+ if(noSmoothing === false) {
393
395
  validateNumber(smoothLength, {min: 1, max: this.len, allowDecimals: false}, 'smoothLength', methodName)
394
396
  validateNumber(afterSmoothLength, {min: 1, max: this.len, allowDecimals: false}, 'afterSmoothLength', methodName)
395
397
  }
@@ -403,7 +405,7 @@ export default class OHLCV_INDICATORS {
403
405
 
404
406
  const order = 0
405
407
 
406
- this._registerIndicator({key: methodName, order, params: [smoothLength, afterSmoothLength, {lag, bothNull, retLogs}]})
408
+ this._registerIndicator({key: methodName, order, params: [smoothLength, afterSmoothLength, {lag, noSmoothing, retLogs}]})
407
409
 
408
410
  return this
409
411
  }
@@ -464,11 +466,12 @@ export default class OHLCV_INDICATORS {
464
466
  validateNumber(stdDev, {min: 0.01, max: 50, allowDecimals: true}, 'stdDev', methodName)
465
467
  validateObject(options, 'options', methodName)
466
468
 
467
- const { lag = 0} = options
469
+ const { lag = 0, retLogs = false } = options
468
470
 
469
471
  validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
472
+ validateBoolean(retLogs, 'options.retLogs', methodName)
470
473
 
471
- this._registerIndicator({key: methodName, params: [size, stdDev, {lag}]});
474
+ this._registerIndicator({key: methodName, params: [size, stdDev, {lag, retLogs}]});
472
475
 
473
476
  return this;
474
477
  }
@@ -492,6 +495,21 @@ export default class OHLCV_INDICATORS {
492
495
 
493
496
  return this
494
497
  }
498
+ mfi(size = 14, options = {}) {
499
+ const methodName = 'mfi'
500
+
501
+ isAlreadyComputed(this)
502
+ validateNumber(size, {min: 1, max: this.len, allowDecimals: false}, 'size', methodName)
503
+ validateObject(options, 'options', methodName)
504
+
505
+ const {lag = 0, retLogs = false} = options
506
+ validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
507
+ validateBoolean(retLogs, 'options.retLogs', methodName)
508
+
509
+ this._registerIndicator({key: methodName, params: [size, {lag, retLogs}]})
510
+ return this
511
+ }
512
+
495
513
  donchianChannels(size = 20, offset = 0, options = {}) {
496
514
 
497
515
  const methodName = 'donchianChannels'
@@ -502,11 +520,12 @@ export default class OHLCV_INDICATORS {
502
520
  validateNumber(offset, {min: 0, max: this.len, allowDecimals: false}, 'offset', methodName)
503
521
 
504
522
  validateObject(options, 'options', methodName)
505
- const { lag = 0} = options;
523
+ const { lag = 0, retLogs = false } = options;
506
524
 
507
525
  validateNumber(lag, {min: 0, max: this.len, allowDecimals: false}, 'options.lag', methodName)
526
+ validateBoolean(retLogs, 'options.retLogs', methodName)
508
527
 
509
- this._registerIndicator({ key: methodName, order: 0, params: [size, offset, {lag}] });
528
+ this._registerIndicator({ key: methodName, order: 0, params: [size, offset, {lag, retLogs}] });
510
529
 
511
530
  return this;
512
531
  }
@@ -588,33 +607,4 @@ export default class OHLCV_INDICATORS {
588
607
  return this
589
608
  }
590
609
 
591
- mapCols(newCols = ['change'], callback = null, options = {}) {
592
-
593
- isAlreadyComputed(this)
594
-
595
- const methodName = 'mapCols'
596
-
597
- if(typeof callback === 'undefined' || callback === null)
598
- {
599
- callback = 'default'
600
- }
601
-
602
- validateObject(options, 'options', methodName)
603
-
604
- const {lag = 0, isPriceBased = false, callbackParams = {}} = options
605
- resolveMapCallback(callback)
606
- const savedCallbackParams = copyConfig(callbackParams)
607
-
608
- validateArray(newCols, 'newCols', methodName)
609
- validateNumber(lag, {min: 0, allowDecimals: false}, 'options.lag', methodName)
610
- validateBoolean(isPriceBased, 'isPriceBased', 'mapCols')
611
-
612
- if(this.precision === false && isPriceBased) {
613
- throw new Error(`Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.`)
614
- }
615
-
616
- this._registerIndicator({key: methodName, params: [newCols, callback, {lag, isPriceBased, callbackParams: savedCallbackParams}]})
617
-
618
- return this
619
- }
620
610
  }