ohlcv-indicators 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var OHLCV_INDICATORS;(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{e.r(t),e.d(t,{default:()=>P});var r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",l=1e14,u=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],a=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function g(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(t=e[n++]+"",r=u-t.length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function m(e,t){var r,n,i=e.c,s=t.c,o=e.s,l=t.s,u=e.e,c=t.e;if(!o||!l)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-l:o;if(o!=l)return o;if(r=o<0,n=u==c,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(l=(u=i.length)<(c=s.length)?u:c,o=0;o<l;o++)if(i[o]!=s[o])return i[o]>s[o]^r?1:-1;return u==c?0:u>c^r?1:-1}function d(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function y(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}const b=function e(t){var b,N,O,B,E,_,A,T,C,D,S=F.prototype={constructor:F,toString:null,valueOf:null},L=new F(1),P=20,R=4,$=-7,I=21,M=-1e7,x=1e7,U=!1,G=1,V=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function F(e,t){var n,s,l,f,a,h,p,g,m=this;if(!(m instanceof F))return new F(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>x?m.c=m.e=null:e.e<M?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(f=0,a=e;a>=10;a/=10,f++);return void(f>x?m.c=m.e=null:(m.e=f,m.c=[e]))}g=String(e)}else{if(!r.test(g=String(e)))return O(m,g,h);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(f=g.indexOf("."))>-1&&(g=g.replace(".","")),(a=g.search(/e/i))>0?(f<0&&(f=a),f+=+g.slice(a+1),g=g.substring(0,a)):f<0&&(f=g.length)}else{if(d(t,2,k.length,"Base"),10==t&&q)return X(m=new F(e),P+m.e+1,R);if(g=String(e),h="number"==typeof e){if(0*e!=0)return O(m,g,h,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,F.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=k.slice(0,t),f=a=0,p=g.length;a<p;a++)if(n.indexOf(s=g.charAt(a))<0){if("."==s){if(a>f){f=p;continue}}else if(!l&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){l=!0,a=-1,f=0;continue}return O(m,String(e),h,t)}h=!1,(f=(g=N(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):f=g.length}for(a=0;48===g.charCodeAt(a);a++);for(p=g.length;48===g.charCodeAt(--p););if(g=g.slice(a,++p)){if(p-=a,h&&F.DEBUG&&p>15&&(e>c||e!==i(e)))throw Error(o+m.s*e);if((f=f-a-1)>x)m.c=m.e=null;else if(f<M)m.c=[m.e=0];else{if(m.e=f,m.c=[],a=(f+1)%u,f<0&&(a+=u),a<p){for(a&&m.c.push(+g.slice(0,a)),p-=u;a<p;)m.c.push(+g.slice(a,a+=u));a=u-(g=g.slice(a)).length}else a-=p;for(;a--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function H(e,t,r,n){var i,s,o,l,u;if(null==r?r=R:d(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=g(e.c),u=1==n||2==n&&(o<=$||o>=I)?v(u,o):y(u,o,"0");else if(s=(e=X(new F(e),t,r)).e,l=(u=g(e.c)).length,1==n||2==n&&(t<=s||s<=$)){for(;l<t;u+="0",l++);u=v(u,s)}else if(t-=o,u=y(u,s,"0"),s+1>l){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-l)>0)for(s+1==l&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n,i=1,s=new F(e[0]);i<e.length;i++)(!(n=new F(e[i])).s||(r=m(s,n))===t||0===r&&s.s===t)&&(s=n);return s}function W(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*u-1)>x?e.c=e.e=null:r<M?e.c=[e.e=0]:(e.e=r,e.c=t),e}function X(e,t,r,s){var o,c,a,h,p,g,m,d=e.c,w=f;if(d){e:{for(o=1,h=d[0];h>=10;h/=10,o++);if((c=t-o)<0)c+=u,a=t,p=d[g=0],m=i(p/w[o-a-1]%10);else if((g=n((c+1)/u))>=d.length){if(!s)break e;for(;d.length<=g;d.push(0));p=m=0,o=1,a=(c%=u)-u+1}else{for(p=h=d[g],o=1;h>=10;h/=10,o++);m=(a=(c%=u)-u+o)<0?0:i(p/w[o-a-1]%10)}if(s=s||t<0||null!=d[g+1]||(a<0?p:p%w[o-a-1]),s=r<4?(m||s)&&(0==r||r==(e.s<0?3:2)):m>5||5==m&&(4==r||s||6==r&&(c>0?a>0?p/w[o-a]:0:d[g-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,s?(t-=e.e+1,d[0]=w[(u-t%u)%u],e.e=-t||0):d[0]=e.e=0,e;if(0==c?(d.length=g,h=1,g--):(d.length=g+1,h=w[u-c],d[g]=a>0?i(p/w[o-a]%w[a])*h:0),s)for(;;){if(0==g){for(c=1,a=d[0];a>=10;a/=10,c++);for(a=d[0]+=h,h=1;a>=10;a/=10,h++);c!=h&&(e.e++,d[0]==l&&(d[0]=1));break}if(d[g]+=h,d[g]!=l)break;d[g--]=0,h=1}for(c=d.length;0===d[--c];d.pop());}e.e>x?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=g(e.c),t=r<=$||r>=I?v(t,r):y(t,r,"0"),e.s<0?"-"+t:t)}return F.clone=e,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(d(r=e[t],0,h,t),P=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(d(r=e[t],0,8,t),R=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(d(r[0],-h,0,t),d(r[1],0,h,t),$=r[0],I=r[1]):(d(r,-h,h,t),$=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)d(r[0],-h,-1,t),d(r[1],1,h,t),M=r[0],x=r[1];else{if(d(r,-h,h,t),!r)throw Error(s+t+" cannot be zero: "+r);M=-(x=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(s+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(d(r=e[t],0,9,t),G=r),e.hasOwnProperty(t="POW_PRECISION")&&(d(r=e[t],0,h,t),V=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);j=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);q="0123456789"==r.slice(0,10),k=r}}return{DECIMAL_PLACES:P,ROUNDING_MODE:R,EXPONENTIAL_AT:[$,I],RANGE:[M,x],CRYPTO:U,MODULO_MODE:G,POW_PRECISION:V,FORMAT:j,ALPHABET:k}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,n=e.c,o=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===c||-1===c)&&o>=-h&&o<=h&&o===i(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((t=(o+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=l||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===o&&(null===c||1===c||-1===c))return!0;throw Error(s+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return z(arguments,-1)},F.minimum=F.min=function(){return z(arguments,1)},F.random=(B=9007199254740992,E=Math.random()*B&2097151?function(){return i(Math.random()*B)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,o,l,c,a=0,p=[],g=new F(L);if(null==e?e=P:d(e,0,h),l=n(e/u),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(l*=2));a<l;)(c=131072*t[a]+(t[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(p.push(c%1e14),a+=2);a=l/2}else{if(!crypto.randomBytes)throw U=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(l*=7);a<l;)(c=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])>=9e15?crypto.randomBytes(7).copy(t,a):(p.push(c%1e14),a+=7);a=l/7}if(!U)for(;a<l;)(c=E())<9e15&&(p[a++]=c%1e14);for(l=p[--a],e%=u,l&&e&&(c=f[u-e],p[a]=i(l/c)*c);0===p[a];p.pop(),a--);if(a<0)p=[o=0];else{for(o=-1;0===p[0];p.splice(0,1),o-=u);for(a=1,c=p[0];c>=10;c/=10,a++);a<u&&(o-=u-a)}return g.e=o,g.c=p,g}),F.sum=function(){for(var e=1,t=arguments,r=new F(t[0]);e<t.length;)r=r.plus(t[e++]);return r},N=function(){var e="0123456789";function t(e,t,r,n){for(var i,s,o=[0],l=0,u=e.length;l<u;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(l++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(r,n,i,s,o){var l,u,c,f,a,h,p,m,d=r.indexOf("."),w=P,v=R;for(d>=0&&(f=V,V=0,r=r.replace(".",""),h=(m=new F(n)).pow(r.length-d),V=f,m.c=t(y(g(h.c),h.e,"0"),10,i,e),m.e=m.c.length),c=f=(p=t(r,n,i,o?(l=k,e):(l=e,k))).length;0==p[--f];p.pop());if(!p[0])return l.charAt(0);if(d<0?--c:(h.c=p,h.e=c,h.s=s,p=(h=b(h,m,w,v,i)).c,a=h.r,c=h.e),d=p[u=c+w+1],f=i/2,a=a||u<0||null!=p[u+1],a=v<4?(null!=d||a)&&(0==v||v==(h.s<0?3:2)):d>f||d==f&&(4==v||a||6==v&&1&p[u-1]||v==(h.s<0?8:7)),u<1||!p[0])r=a?y(l.charAt(1),-w,l.charAt(0)):l.charAt(0);else{if(p.length=u,a)for(--i;++p[--u]>i;)p[u]=0,u||(++c,p=[1].concat(p));for(f=p.length;!p[--f];);for(d=0,r="";d<=f;r+=l.charAt(p[d++]));r=y(r,c,l.charAt(0))}return r}}(),b=function(){function e(e,t,r){var n,i,s,o,l=0,u=e.length,c=t%a,f=t/a|0;for(e=e.slice();u--;)l=((i=c*(s=e[u]%a)+(n=f*s+(o=e[u]/a|0)*c)%a*a+l)/r|0)+(n/a|0)+f*o,e[u]=i%r;return l&&(e=[l].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,s,o,c,f){var a,h,g,m,d,w,v,y,b,N,O,B,E,_,A,T,C,D=n.s==s.s?1:-1,S=n.c,L=s.c;if(!(S&&S[0]&&L&&L[0]))return new F(n.s&&s.s&&(S?!L||S[0]!=L[0]:L)?S&&0==S[0]||!L?0*D:D/0:NaN);for(b=(y=new F(D)).c=[],D=o+(h=n.e-s.e)+1,f||(f=l,h=p(n.e/u)-p(s.e/u),D=D/u|0),g=0;L[g]==(S[g]||0);g++);if(L[g]>(S[g]||0)&&h--,D<0)b.push(1),m=!0;else{for(_=S.length,T=L.length,g=0,D+=2,(d=i(f/(L[0]+1)))>1&&(L=e(L,d,f),S=e(S,d,f),T=L.length,_=S.length),E=T,O=(N=S.slice(0,T)).length;O<T;N[O++]=0);C=L.slice(),C=[0].concat(C),A=L[0],L[1]>=f/2&&A++;do{if(d=0,(a=t(L,N,T,O))<0){if(B=N[0],T!=O&&(B=B*f+(N[1]||0)),(d=i(B/A))>1)for(d>=f&&(d=f-1),v=(w=e(L,d,f)).length,O=N.length;1==t(w,N,v,O);)d--,r(w,T<v?C:L,v,f),v=w.length,a=1;else 0==d&&(a=d=1),v=(w=L.slice()).length;if(v<O&&(w=[0].concat(w)),r(N,w,O,f),O=N.length,-1==a)for(;t(L,N,T,O)<1;)d++,r(N,T<O?C:L,O,f),O=N.length}else 0===a&&(d++,N=[0]);b[g++]=d,N[0]?N[O++]=S[E]||0:(N=[S[E]],O=1)}while((E++<_||null!=N[0])&&D--);m=null!=N[0],b[0]||b.splice(0,1)}if(f==l){for(g=1,D=b[0];D>=10;D/=10,g++);X(y,o+(y.e=g+h*u-1)+1,c,m)}else y.e=h,y.r=+m;return y}}(),_=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,T=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,D=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(e,t,r,n){var i,o=r?t:t.replace(D,"");if(C.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(_,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(A,"$1").replace(T,"0.$1")),t!=o))return new F(o,i);if(F.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return m(this,new F(e,t))},S.decimalPlaces=S.dp=function(e,t){var r,n,i,s=this;if(null!=e)return d(e,0,h),null==t?t=R:d(t,0,8),X(new F(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=((i=r.length-1)-p(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},S.dividedBy=S.div=function(e,t){return b(this,new F(e,t),P,R)},S.dividedToIntegerBy=S.idiv=function(e,t){return b(this,new F(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var r,o,l,c,f,a,h,p,g=this;if((e=new F(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new F(t)),f=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return p=new F(Math.pow(+Y(g),f?e.s*(2-w(e)):+Y(e))),t?p.mod(t):p;if(a=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(o=!a&&g.isInteger()&&t.isInteger())&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||f&&g.c[1]>=24e7:g.c[0]<8e13||f&&g.c[0]<=9999975e7)))return c=g.s<0&&w(e)?-0:0,g.e>-1&&(c=1/c),new F(a?1/c:c);V&&(c=n(V/u+2))}for(f?(r=new F(.5),a&&(e.s=1),h=w(e)):h=(l=Math.abs(+Y(e)))%2,p=new F(L);;){if(h){if(!(p=p.times(g)).c)break;c?p.c.length>c&&(p.c.length=c):o&&(p=p.mod(t))}if(l){if(0===(l=i(l/2)))break;h=l%2}else if(X(e=e.times(r),e.e+1,1),e.e>14)h=w(e);else{if(0==(l=+Y(e)))break;h=l%2}g=g.times(g),c?g.c&&g.c.length>c&&(g.c.length=c):o&&(g=g.mod(t))}return o?p:(a&&(p=L.div(p)),t?p.mod(t):c?X(p,V,R,void 0):p)},S.integerValue=function(e){var t=new F(this);return null==e?e=R:d(e,0,8),X(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return 0===m(this,new F(e,t))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return m(this,new F(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return 1===(t=m(this,new F(e,t)))||0===t},S.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return m(this,new F(e,t))<0},S.isLessThanOrEqualTo=S.lte=function(e,t){return-1===(t=m(this,new F(e,t)))||0===t},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,t){var r,n,i,s,o=this,c=o.s;if(t=(e=new F(e,t)).s,!c||!t)return new F(NaN);if(c!=t)return e.s=-t,o.plus(e);var f=o.e/u,a=e.e/u,h=o.c,g=e.c;if(!f||!a){if(!h||!g)return h?(e.s=-t,e):new F(g?o:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-t,e):new F(h[0]?o:3==R?-0:0)}if(f=p(f),a=p(a),h=h.slice(),c=f-a){for((s=c<0)?(c=-c,i=h):(a=f,i=g),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(n=(s=(c=h.length)<(t=g.length))?c:t,c=t=0;t<n;t++)if(h[t]!=g[t]){s=h[t]<g[t];break}if(s&&(i=h,h=g,g=i,e.s=-e.s),(t=(n=g.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=l-1;n>c;){if(h[--n]<g[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=l}h[n]-=g[n]}for(;0==h[0];h.splice(0,1),--a);return h[0]?W(e,h,a):(e.s=3==R?-1:1,e.c=[e.e=0],e)},S.modulo=S.mod=function(e,t){var r,n,i=this;return e=new F(e,t),!i.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||i.c&&!i.c[0]?new F(i):(9==G?(n=e.s,e.s=1,r=b(i,e,0,3),e.s=n,r.s*=n):r=b(i,e,0,G),(e=i.minus(r.times(e))).c[0]||1!=G||(e.s=i.s),e)},S.multipliedBy=S.times=function(e,t){var r,n,i,s,o,c,f,h,g,m,d,w,v,y,b,N=this,O=N.c,B=(e=new F(e,t)).c;if(!(O&&B&&O[0]&&B[0]))return!N.s||!e.s||O&&!O[0]&&!B||B&&!B[0]&&!O?e.c=e.e=e.s=null:(e.s*=N.s,O&&B?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(N.e/u)+p(e.e/u),e.s*=N.s,(f=O.length)<(m=B.length)&&(v=O,O=B,B=v,i=f,f=m,m=i),i=f+m,v=[];i--;v.push(0));for(y=l,b=a,i=m;--i>=0;){for(r=0,d=B[i]%b,w=B[i]/b|0,s=i+(o=f);s>i;)r=((h=d*(h=O[--o]%b)+(c=w*h+(g=O[o]/b|0)*d)%b*b+v[s]+r)/y|0)+(c/b|0)+w*g,v[s--]=h%y;v[s]=r}return r?++n:v.splice(0,1),W(e,v,n)},S.negated=function(){var e=new F(this);return e.s=-e.s||null,e},S.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new F(e,t)).s,!i||!t)return new F(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/u,o=e.e/u,c=n.c,f=e.c;if(!s||!o){if(!c||!f)return new F(i/0);if(!c[0]||!f[0])return f[0]?e:new F(c[0]?n:0*i)}if(s=p(s),o=p(o),c=c.slice(),i=s-o){for(i>0?(o=s,r=f):(i=-i,r=c),r.reverse();i--;r.push(0));r.reverse()}for((i=c.length)-(t=f.length)<0&&(r=f,f=c,c=r,t=i),i=0;t;)i=(c[--t]=c[t]+f[t]+i)/l|0,c[t]=l===c[t]?0:c[t]%l;return i&&(c=[i].concat(c),++o),W(e,c,o)},S.precision=S.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return d(e,1,h),null==t?t=R:d(t,0,8),X(new F(s),e,t);if(!(r=s.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},S.shiftedBy=function(e){return d(e,-9007199254740991,c),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,t,r,n,i,s=this,o=s.c,l=s.s,u=s.e,c=P+4,f=new F("0.5");if(1!==l||!o||!o[0])return new F(!l||l<0&&(!o||o[0])?NaN:o?s:1/0);if(0==(l=Math.sqrt(+Y(s)))||l==1/0?(((t=g(o)).length+u)%2==0&&(t+="0"),l=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),r=new F(t=l==1/0?"5e"+u:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new F(l+""),r.c[0])for((l=(u=r.e)+c)<3&&(l=0);;)if(i=r,r=f.times(i.plus(b(s,i,c,1))),g(i.c).slice(0,l)===(t=g(r.c)).slice(0,l)){if(r.e<u&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(X(r,r.e+P+2,1),e=!r.times(r).eq(s));break}if(!n&&(X(i,i.e+P+2,0),i.times(i).eq(s))){r=i;break}c+=4,l+=4,n=1}return X(r,r.e+P+1,R,e)},S.toExponential=function(e,t){return null!=e&&(d(e,0,h),e++),H(this,e,t,1)},S.toFixed=function(e,t){return null!=e&&(d(e,0,h),e=e+this.e+1),H(this,e,t)},S.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=j;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,l=n.split("."),u=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",a=l[0],h=l[1],p=i.s<0,g=p?a.slice(1):a,m=g.length;if(c&&(o=u,u=c,c=o,m-=o),u>0&&m>0){for(o=m%u||u,a=g.substr(0,o);o<m;o+=u)a+=f+g.substr(o,u);c>0&&(a+=f+g.slice(o)),p&&(a="-"+a)}n=h?a+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):a}return(r.prefix||"")+n+(r.suffix||"")},S.toFraction=function(e){var t,r,n,i,o,l,c,a,h,p,m,d,w=this,v=w.c;if(null!=e&&(!(c=new F(e)).isInteger()&&(c.c||1!==c.s)||c.lt(L)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new F(w);for(t=new F(L),h=r=new F(L),n=a=new F(L),d=g(v),o=t.e=d.length-w.e-1,t.c[0]=f[(l=o%u)<0?u+l:l],e=!e||c.comparedTo(t)>0?o>0?t:h:c,l=x,x=1/0,c=new F(d),a.c[0]=0;p=b(c,t,0,1),1!=(i=r.plus(p.times(n))).comparedTo(e);)r=n,n=i,h=a.plus(p.times(i=h)),a=i,t=c.minus(p.times(i=t)),c=i;return i=b(e.minus(r),n,0,1),a=a.plus(i.times(h)),r=r.plus(i.times(n)),a.s=h.s=w.s,m=b(h,n,o*=2,R).minus(w).abs().comparedTo(b(a,r,o,R).minus(w).abs())<1?[h,n]:[a,r],x=l,m},S.toNumber=function(){return+Y(this)},S.toPrecision=function(e,t){return null!=e&&d(e,1,h),H(this,e,t,2)},S.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=$||i>=I?v(g(r.c),i):y(g(r.c),i,"0"):10===e&&q?t=y(g((r=X(new F(r),P+i+1,R)).c),r.e,"0"):(d(e,2,k.length,"Base"),t=N(y(g(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},S.valueOf=S.toJSON=function(){return Y(this)},S._isBigNumber=!0,S[Symbol.toStringTag]="BigNumber",S[Symbol.for("nodejs.util.inspect.custom")]=S.valueOf,null!=t&&F.set(t),F}(),N=(e,t,r)=>{const n=e(2/(r+1)),i=t.length,s=[];if(n.isGreaterThan(1))return Array(i);if(n.isEqualTo(1))return[...t];let o=0,l=0;for(;l<i;l++){const e=t[l];if("object"==typeof e){s[l]=e,o=e,l++;break}}if(Array.isArray(n))for(;l<i;l++){const e=t[l];"object"==typeof e&&"object"==typeof n[l]?o=s[l]=n[l].multipliedBy(e).plus(n[l].minus(1).multipliedBy(o)):s[l]=s[l-1]}else{const r=e(1).minus(n);for(;l<i;l++){const e=t[l];o="object"==typeof e?n.multipliedBy(e).plus(r.multipliedBy(o)):s[l-1],s[l]=o}}return s},O=(e,t,r)=>{let n=[],i=e(0),s=[];for(let e=0;e<t.length;e++)s.push(t[e]),i=i.plus(t[e]),s.length>r&&(i=i.minus(s.shift())),e>=r-1?n.push(i.dividedBy(r)):n.push(i.dividedBy(s.length));return n},B=(e,t,r)=>{let n=new Array(t.length).fill(0),i=0;const s=new e(t[0]),o=new e(r[0]);s.isGreaterThan(o)?(i=1,n[0]=1):s.isLessThan(o)?(i=-1,n[0]=-1):(i=0,n[0]=0);for(let s=1;s<t.length;s++){const o=new e(t[s]),l=new e(r[s]),u=new e(t[s-1]),c=new e(r[s-1]);o.isGreaterThan(l)&&u.isLessThanOrEqualTo(c)?(i=1,n[s]=1):o.isLessThan(l)&&u.isGreaterThanOrEqualTo(c)?(i=-1,n[s]=-1):n[s]=1===i?n[s-1]+1:-1===i?n[s-1]-1:0}return n.map((t=>e(t)))},E=(e,t,r)=>{const n=new e(0),i=t.length,s=O(e,t,r),o=new Array(i).fill(n);for(let e=r-1;e<i;e++){let i=n;for(let n=e-r+1;n<=e;n++)i=i.plus(t[n].minus(s[e]).pow(2));o[e]=i.dividedBy(r).sqrt()}return o},_=(e,t)=>{let{upper:r,lower:n}=t;const i=r.map(((e,t)=>e.minus(n[t])));return e.map(((e,t)=>e.minus(n[t]).dividedBy(i[t]).times(100)))},A=(e,t,r,n)=>t.slice(n).map(((i,s)=>{const o=t.slice(s,s+n),l=r.slice(s,s+n);return e.maximum(...o).plus(e.minimum(...l)).dividedBy(2)})),T=(e,t,r,n)=>{const i=e.slice(r).map(((e,r)=>r<t.length?e.plus(t[r]).dividedBy(2):null)).filter((e=>null!==e));return i.slice(0,i.length-n+1)},C=(e,t,r,n,i)=>{let s=t.slice(n).map(((i,s)=>{const o=t.slice(s,s+n),l=r.slice(s,s+n);return e.maximum(...o).plus(e.minimum(...l)).dividedBy(2)}));return s.slice(0,s.length-i+1)},D=(e,t)=>e.slice(0,e.length-t),S={getSMA:O,getEMA:N},L=(e,t,r=10)=>{const{open:n,high:i,low:s,close:o,volume:l}=t,u=e.min(...s),c=e.max(...i).minus(u).dividedBy(r),f=Array.from({length:r},((t,r)=>({price:u.plus(c.multipliedBy(r)),upVolume:new e(0),downVolume:new e(0)}))),a=new e(1).dividedBy(c),h=o.length;for(let t=0;t<h;t++){const c=n[t],h=i[t],p=s[t],g=o[t],m=l[t],d=g.isGreaterThanOrEqualTo(c)?m:new e(0),w=g.isLessThan(c)?m:new e(0),v=p.minus(u).multipliedBy(a).integerValue(e.ROUND_FLOOR).toNumber(),y=h.minus(u).multipliedBy(a).integerValue(e.ROUND_CEIL).toNumber();for(let e=Math.max(v,0);e<Math.min(y,r);e++)f[e].upVolume=f[e].upVolume.plus(d),f[e].downVolume=f[e].downVolume.plus(w)}return f};class P{constructor(){this.BigNumber=b,this.VolumeProfile=L}init(e){const{BigNumber:t}=this,r=e.map((({open:e,high:r,low:n,close:i,volume:s,...o})=>({open:t(e),high:t(r),low:t(n),close:t(i),volume:t(s),...o})));return this.ohlcv=r.reduce(((e,{open:t,high:r,low:n,close:i,volume:s,...o})=>(e.open.push(t),e.high.push(r),e.low.push(n),e.close.push(i),e.volume.push(s),Object.keys(o).forEach((t=>{e[t]||(e[t]=[]),e[t].push(o[t])})),e)),{open:[],high:[],low:[],close:[],volume:[]}),this}getHeaders(){return Object.keys(this.getData())}getData(){return this.ohlcv}getLastValues(){const e={};for(let t in this.ohlcv){const r=this.ohlcv[t];e[t]=r[r.length-1]}return e}addColumn(e,t){const r=this.ohlcv.open.length;if(t.length>r)throw new Error("Invalid column data: The length of the new column exceeds the length of the OHLCV data");for(;t.length<r;)t.unshift(NaN);this.ohlcv[e]=t.map((e=>isNaN(e)?e:e.toNumber()))}crossPairs(e){const t=this.getData();let r=[];e.forEach((e=>{const{fast:n,slow:i}=e;if(n&&i)if([n,i].forEach(((e,n)=>{if(t.hasOwnProperty(e)||"string"!=typeof e)"number"==typeof e&&1===n&&(r=t.close.map((e=>30)));else{const t=e.split("_");if(t.length>0){const e=t[0].toUpperCase(),r=t.slice(1);"function"==typeof this[e]&&r.length>0&&this[e](...r)}}})),t.hasOwnProperty(n)&&t.hasOwnProperty(i)){const e=B(this.BigNumber,t[n],t[i]);this.addColumn(`${n}_x_${i}`,e)}else if(t.hasOwnProperty(n)&&r.length>0){const e=B(this.BigNumber,t[n],r);this.addColumn(`${n}_x_${i}`,e)}else console.error(`Missing ohlcv properties for ${n} or ${i}`)}))}EMA(e){return((e,t)=>{const r=e.getData().close,n=N(e.BigNumber,r,t);e.addColumn(`ema_${t}`,n)})(this,e),this}SMA(e){return((e,t)=>{const r=e.getData().close,n=O(e.BigNumber,r,t);e.addColumn(`sma_${t}`,n)})(this,e),this}MACD(e,t,r){return((e,t=12,r=26,n=9)=>{const i=e.getData().close,s=((e,t,r=12,n=26,i=9)=>{const s=N(e,t,r),o=N(e,t,n),l=s.map(((e,t)=>e.minus(o[t]))),u=N(e,l,i),c=l.map(((e,t)=>e.minus(u[t]))),f=B(e,l,u);return{diff:l,dea:u,histogram:c,crosses:f}})(e.BigNumber,i,t,r,n);for(let t in s)e.addColumn(`macd_${t}`,s[t])})(this,e,t,r),this}BollingerBands(e,t,r){return((e,t,r)=>{const n=e.getData().close,i=((e,t,r=20,n=2)=>{n=new e(n);const i=O(e,t,r),s=E(e,t,r).map((e=>e.times(n)));let o=i.map(((e,t)=>e.plus(s[t]))),l=i,u=i.map(((e,t)=>e.minus(s[t])));return{upper:o,mid:l,lower:u,range:_(t,{upper:o,lower:u})}})(e.BigNumber,n,t,r);for(let t in i)e.addColumn(`bollinger_bands_${t}`,i[t])})(this,e,t),this}IchimokuCloud(e,t,r){return((e,t,r,n)=>{const i=e.getData(),s=((e,t,r=9,n=26,i=52)=>{const s=r,o=n,l=o-s,u=i,{high:c,low:f,close:a}=t,h=A(e,c,f,s),p=A(e,c,f,o);return{conversion_line:h,base_line:p,leading_span_a:T(h,p,l,o),leading_span_b:C(e,c,f,u,o),lagging_span:D(a,o)}})(e.BigNumber,i,t,r,n);for(let t in s)console.log(`${t} [length ${s[t].length}] [lastValue ${s[t][s[t].length-1]}]`),e.addColumn(`ichimoku_${t}`,s[t])})(this,e,t,r),this}RSI(e,t,r){return((e,t,r,n)=>{const i=e.getData().close,s=((e,t,r=14,n="SMA",i=14)=>{if(t.length<r)return[];const s=new e(0),o=new e(100),l=new e(1);let u=[],c=s,f=s;for(let n=1;n<=r;n++){const r=new e(t[n]),i=new e(t[n-1]),o=r.minus(i);o.isLessThan(s)?f=f.plus(o.abs()):c=c.plus(o)}let a=c.dividedBy(r),h=f.dividedBy(r),p=h.isEqualTo(s)?s:a.dividedBy(h);u.push(o.minus(o.dividedBy(l.plus(p))));for(let n=r+1;n<t.length;n++){const i=new e(t[n]),g=new e(t[n-1]),m=i.minus(g);m.isLessThan(s)?(f=m.abs(),c=s):(c=m,f=s),a=a.times(r-1).plus(c).dividedBy(r),h=h.times(r-1).plus(f).dividedBy(r),p=h.isEqualTo(s)?s:a.dividedBy(h),u.push(o.minus(o.dividedBy(l.plus(p))))}let g={rsi:u};if("string"==typeof n&&"number"==typeof i&&S.hasOwnProperty(`get${n}`)){const t=S[`get${n}`](e,u,i);g[`rsi_${n}`]=t,g[`rsi_x_rsi_${n}`]=B(e,u,t)}return g})(e.BigNumber,i,t,r,n),o=`${t}`;for(let t in s)e.addColumn(`${t}_${o}`.toLowerCase(),s[t])})(this,e,t,r),this}MFI(e){return((e,t=14)=>{const r=e.getData(),n=((e,t,r=14)=>{const{high:n,low:i,close:s,volume:o}=t,l=e(0),u=e(100),c=e(1),f=[],a=[],h=[],p=[],g=[],m=[];for(let e=0;e<s.length;e++){const t=n[e].plus(i[e]).plus(s[e]).dividedBy(3),r=t.times(o[e]);f.push(t),a.push(r)}for(let e=1;e<f.length;e++)f[e].isGreaterThan(f[e-1])?(h.push(a[e]),p.push(l)):f[e].isLessThan(f[e-1])?(h.push(l),p.push(a[e])):(h.push(l),p.push(l));for(let e=r;e<=h.length;e++){const t=h.slice(e-r,e),n=p.slice(e-r,e),i=t.reduce(((e,t)=>e.plus(t)),l),s=n.reduce(((e,t)=>e.plus(t)),l),o=i.dividedBy(s);g.push(o)}for(let e=0;e<g.length;e++){const t=u.minus(u.dividedBy(c.plus(g[e])));m.push(t)}return m})(e.BigNumber,r,t);e.addColumn(`mfi_${t}`,n)})(this,e),this}RelativeVolume(e){return((e,t)=>{const r=e.getData().volume,n=((e,t,r=10)=>{const n=O(e,t,r);return t.map(((e,t)=>0!==t&&n[t-2]?n[t-2].isZero()?NaN:e.dividedBy(n[t-2]):NaN)).filter((e=>!Number.isNaN(e)))})(e.BigNumber,r,t);e.addColumn(`relative_volume_${t}`,n)})(this,e),this}}})(),OHLCV_INDICATORS=t})();
1
+ var OHLCV_INDICATORS;(()=>{"use strict";var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{e.r(r),e.d(r,{default:()=>P});var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",l=1e14,u=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],a=1e7,h=1e9;function p(e){var r=0|e;return e>0||e===r?r:r-1}function m(e){for(var r,t,n=1,i=e.length,s=e[0]+"";n<i;){for(r=e[n++]+"",t=u-r.length;t--;r="0"+r);s+=r}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function g(e,r){var t,n,i=e.c,s=r.c,o=e.s,l=r.s,u=e.e,c=r.e;if(!o||!l)return null;if(t=i&&!i[0],n=s&&!s[0],t||n)return t?n?0:-l:o;if(o!=l)return o;if(t=o<0,n=u==c,!i||!s)return n?0:!i^t?1:-1;if(!n)return u>c^t?1:-1;for(l=(u=i.length)<(c=s.length)?u:c,o=0;o<l;o++)if(i[o]!=s[o])return i[o]>s[o]^t?1:-1;return u==c?0:u>c^t?1:-1}function d(e,r,t,n){if(e<r||e>t||e!==i(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var r=e.c.length-1;return p(e.e/u)==r&&e.c[r]%2!=0}function v(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function y(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}const b=function e(r){var b,N,O,B,E,_,A,T,C,D,S=F.prototype={constructor:F,toString:null,valueOf:null},V=new F(1),L=20,P=4,R=-7,x=21,I=-1e7,M=1e7,$=!1,U=1,G=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function F(e,r){var n,s,l,f,a,h,p,m,g=this;if(!(g instanceof F))return new F(e,r);if(null==r){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>M?g.c=g.e=null:e.e<I?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(f=0,a=e;a>=10;a/=10,f++);return void(f>M?g.c=g.e=null:(g.e=f,g.c=[e]))}m=String(e)}else{if(!t.test(m=String(e)))return O(g,m,h);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(f=m.indexOf("."))>-1&&(m=m.replace(".","")),(a=m.search(/e/i))>0?(f<0&&(f=a),f+=+m.slice(a+1),m=m.substring(0,a)):f<0&&(f=m.length)}else{if(d(r,2,k.length,"Base"),10==r&&q)return X(g=new F(e),L+g.e+1,P);if(m=String(e),h="number"==typeof e){if(0*e!=0)return O(g,m,h,r);if(g.s=1/e<0?(m=m.slice(1),-1):1,F.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=k.slice(0,r),f=a=0,p=m.length;a<p;a++)if(n.indexOf(s=m.charAt(a))<0){if("."==s){if(a>f){f=p;continue}}else if(!l&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){l=!0,a=-1,f=0;continue}return O(g,String(e),h,r)}h=!1,(f=(m=N(m,r,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):f=m.length}for(a=0;48===m.charCodeAt(a);a++);for(p=m.length;48===m.charCodeAt(--p););if(m=m.slice(a,++p)){if(p-=a,h&&F.DEBUG&&p>15&&(e>c||e!==i(e)))throw Error(o+g.s*e);if((f=f-a-1)>M)g.c=g.e=null;else if(f<I)g.c=[g.e=0];else{if(g.e=f,g.c=[],a=(f+1)%u,f<0&&(a+=u),a<p){for(a&&g.c.push(+m.slice(0,a)),p-=u;a<p;)g.c.push(+m.slice(a,a+=u));a=u-(m=m.slice(a)).length}else a-=p;for(;a--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function H(e,r,t,n){var i,s,o,l,u;if(null==t?t=P:d(t,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==r)u=m(e.c),u=1==n||2==n&&(o<=R||o>=x)?v(u,o):y(u,o,"0");else if(s=(e=X(new F(e),r,t)).e,l=(u=m(e.c)).length,1==n||2==n&&(r<=s||s<=R)){for(;l<r;u+="0",l++);u=v(u,s)}else if(r-=o,u=y(u,s,"0"),s+1>l){if(--r>0)for(u+=".";r--;u+="0");}else if((r+=s-l)>0)for(s+1==l&&(u+=".");r--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,r){for(var t,n,i=1,s=new F(e[0]);i<e.length;i++)(!(n=new F(e[i])).s||(t=g(s,n))===r||0===t&&s.s===r)&&(s=n);return s}function W(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*u-1)>M?e.c=e.e=null:t<I?e.c=[e.e=0]:(e.e=t,e.c=r),e}function X(e,r,t,s){var o,c,a,h,p,m,g,d=e.c,w=f;if(d){e:{for(o=1,h=d[0];h>=10;h/=10,o++);if((c=r-o)<0)c+=u,a=r,p=d[m=0],g=i(p/w[o-a-1]%10);else if((m=n((c+1)/u))>=d.length){if(!s)break e;for(;d.length<=m;d.push(0));p=g=0,o=1,a=(c%=u)-u+1}else{for(p=h=d[m],o=1;h>=10;h/=10,o++);g=(a=(c%=u)-u+o)<0?0:i(p/w[o-a-1]%10)}if(s=s||r<0||null!=d[m+1]||(a<0?p:p%w[o-a-1]),s=t<4?(g||s)&&(0==t||t==(e.s<0?3:2)):g>5||5==g&&(4==t||s||6==t&&(c>0?a>0?p/w[o-a]:0:d[m-1])%10&1||t==(e.s<0?8:7)),r<1||!d[0])return d.length=0,s?(r-=e.e+1,d[0]=w[(u-r%u)%u],e.e=-r||0):d[0]=e.e=0,e;if(0==c?(d.length=m,h=1,m--):(d.length=m+1,h=w[u-c],d[m]=a>0?i(p/w[o-a]%w[a])*h:0),s)for(;;){if(0==m){for(c=1,a=d[0];a>=10;a/=10,c++);for(a=d[0]+=h,h=1;a>=10;a/=10,h++);c!=h&&(e.e++,d[0]==l&&(d[0]=1));break}if(d[m]+=h,d[m]!=l)break;d[m--]=0,h=1}for(c=d.length;0===d[--c];d.pop());}e.e>M?e.c=e.e=null:e.e<I&&(e.c=[e.e=0])}return e}function Y(e){var r,t=e.e;return null===t?e.toString():(r=m(e.c),r=t<=R||t>=x?v(r,t):y(r,t,"0"),e.s<0?"-"+r:r)}return F.clone=e,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var r,t;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(d(t=e[r],0,h,r),L=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(d(t=e[r],0,8,r),P=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(d(t[0],-h,0,r),d(t[1],0,h,r),R=t[0],x=t[1]):(d(t,-h,h,r),R=-(x=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)d(t[0],-h,-1,r),d(t[1],1,h,r),I=t[0],M=t[1];else{if(d(t,-h,h,r),!t)throw Error(s+r+" cannot be zero: "+t);I=-(M=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(s+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw $=!t,Error(s+"crypto unavailable");$=t}else $=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(d(t=e[r],0,9,r),U=t),e.hasOwnProperty(r="POW_PRECISION")&&(d(t=e[r],0,h,r),G=t),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(t=e[r]))throw Error(s+r+" not an object: "+t);j=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(s+r+" invalid: "+t);q="0123456789"==t.slice(0,10),k=t}}return{DECIMAL_PLACES:L,ROUNDING_MODE:P,EXPONENTIAL_AT:[R,x],RANGE:[I,M],CRYPTO:$,MODULO_MODE:U,POW_PRECISION:G,FORMAT:j,ALPHABET:k}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var r,t,n=e.c,o=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===c||-1===c)&&o>=-h&&o<=h&&o===i(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((r=(o+1)%u)<1&&(r+=u),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=l||t!==i(t))break e;if(0!==t)return!0}}}else if(null===n&&null===o&&(null===c||1===c||-1===c))return!0;throw Error(s+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return z(arguments,-1)},F.minimum=F.min=function(){return z(arguments,1)},F.random=(B=9007199254740992,E=Math.random()*B&2097151?function(){return i(Math.random()*B)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,o,l,c,a=0,p=[],m=new F(V);if(null==e?e=L:d(e,0,h),l=n(e/u),$)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(l*=2));a<l;)(c=131072*r[a]+(r[a+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[a]=t[0],r[a+1]=t[1]):(p.push(c%1e14),a+=2);a=l/2}else{if(!crypto.randomBytes)throw $=!1,Error(s+"crypto unavailable");for(r=crypto.randomBytes(l*=7);a<l;)(c=281474976710656*(31&r[a])+1099511627776*r[a+1]+4294967296*r[a+2]+16777216*r[a+3]+(r[a+4]<<16)+(r[a+5]<<8)+r[a+6])>=9e15?crypto.randomBytes(7).copy(r,a):(p.push(c%1e14),a+=7);a=l/7}if(!$)for(;a<l;)(c=E())<9e15&&(p[a++]=c%1e14);for(l=p[--a],e%=u,l&&e&&(c=f[u-e],p[a]=i(l/c)*c);0===p[a];p.pop(),a--);if(a<0)p=[o=0];else{for(o=-1;0===p[0];p.splice(0,1),o-=u);for(a=1,c=p[0];c>=10;c/=10,a++);a<u&&(o-=u-a)}return m.e=o,m.c=p,m}),F.sum=function(){for(var e=1,r=arguments,t=new F(r[0]);e<r.length;)t=t.plus(r[e++]);return t},N=function(){var e="0123456789";function r(e,r,t,n){for(var i,s,o=[0],l=0,u=e.length;l<u;){for(s=o.length;s--;o[s]*=r);for(o[0]+=n.indexOf(e.charAt(l++)),i=0;i<o.length;i++)o[i]>t-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/t|0,o[i]%=t)}return o.reverse()}return function(t,n,i,s,o){var l,u,c,f,a,h,p,g,d=t.indexOf("."),w=L,v=P;for(d>=0&&(f=G,G=0,t=t.replace(".",""),h=(g=new F(n)).pow(t.length-d),G=f,g.c=r(y(m(h.c),h.e,"0"),10,i,e),g.e=g.c.length),c=f=(p=r(t,n,i,o?(l=k,e):(l=e,k))).length;0==p[--f];p.pop());if(!p[0])return l.charAt(0);if(d<0?--c:(h.c=p,h.e=c,h.s=s,p=(h=b(h,g,w,v,i)).c,a=h.r,c=h.e),d=p[u=c+w+1],f=i/2,a=a||u<0||null!=p[u+1],a=v<4?(null!=d||a)&&(0==v||v==(h.s<0?3:2)):d>f||d==f&&(4==v||a||6==v&&1&p[u-1]||v==(h.s<0?8:7)),u<1||!p[0])t=a?y(l.charAt(1),-w,l.charAt(0)):l.charAt(0);else{if(p.length=u,a)for(--i;++p[--u]>i;)p[u]=0,u||(++c,p=[1].concat(p));for(f=p.length;!p[--f];);for(d=0,t="";d<=f;t+=l.charAt(p[d++]));t=y(t,c,l.charAt(0))}return t}}(),b=function(){function e(e,r,t){var n,i,s,o,l=0,u=e.length,c=r%a,f=r/a|0;for(e=e.slice();u--;)l=((i=c*(s=e[u]%a)+(n=f*s+(o=e[u]/a|0)*c)%a*a+l)/t|0)+(n/a|0)+f*o,e[u]=i%t;return l&&(e=[l].concat(e)),e}function r(e,r,t,n){var i,s;if(t!=n)s=t>n?1:-1;else for(i=s=0;i<t;i++)if(e[i]!=r[i]){s=e[i]>r[i]?1:-1;break}return s}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,s,o,c,f){var a,h,m,g,d,w,v,y,b,N,O,B,E,_,A,T,C,D=n.s==s.s?1:-1,S=n.c,V=s.c;if(!(S&&S[0]&&V&&V[0]))return new F(n.s&&s.s&&(S?!V||S[0]!=V[0]:V)?S&&0==S[0]||!V?0*D:D/0:NaN);for(b=(y=new F(D)).c=[],D=o+(h=n.e-s.e)+1,f||(f=l,h=p(n.e/u)-p(s.e/u),D=D/u|0),m=0;V[m]==(S[m]||0);m++);if(V[m]>(S[m]||0)&&h--,D<0)b.push(1),g=!0;else{for(_=S.length,T=V.length,m=0,D+=2,(d=i(f/(V[0]+1)))>1&&(V=e(V,d,f),S=e(S,d,f),T=V.length,_=S.length),E=T,O=(N=S.slice(0,T)).length;O<T;N[O++]=0);C=V.slice(),C=[0].concat(C),A=V[0],V[1]>=f/2&&A++;do{if(d=0,(a=r(V,N,T,O))<0){if(B=N[0],T!=O&&(B=B*f+(N[1]||0)),(d=i(B/A))>1)for(d>=f&&(d=f-1),v=(w=e(V,d,f)).length,O=N.length;1==r(w,N,v,O);)d--,t(w,T<v?C:V,v,f),v=w.length,a=1;else 0==d&&(a=d=1),v=(w=V.slice()).length;if(v<O&&(w=[0].concat(w)),t(N,w,O,f),O=N.length,-1==a)for(;r(V,N,T,O)<1;)d++,t(N,T<O?C:V,O,f),O=N.length}else 0===a&&(d++,N=[0]);b[m++]=d,N[0]?N[O++]=S[E]||0:(N=[S[E]],O=1)}while((E++<_||null!=N[0])&&D--);g=null!=N[0],b[0]||b.splice(0,1)}if(f==l){for(m=1,D=b[0];D>=10;D/=10,m++);X(y,o+(y.e=m+h*u-1)+1,c,g)}else y.e=h,y.r=+g;return y}}(),_=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,T=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,D=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(e,r,t,n){var i,o=t?r:r.replace(D,"");if(C.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(_,(function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r})),n&&(i=n,o=o.replace(A,"$1").replace(T,"0.$1")),r!=o))return new F(o,i);if(F.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,r){return g(this,new F(e,r))},S.decimalPlaces=S.dp=function(e,r){var t,n,i,s=this;if(null!=e)return d(e,0,h),null==r?r=P:d(r,0,8),X(new F(s),e+s.e+1,r);if(!(t=s.c))return null;if(n=((i=t.length-1)-p(this.e/u))*u,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},S.dividedBy=S.div=function(e,r){return b(this,new F(e,r),L,P)},S.dividedToIntegerBy=S.idiv=function(e,r){return b(this,new F(e,r),0,1)},S.exponentiatedBy=S.pow=function(e,r){var t,o,l,c,f,a,h,p,m=this;if((e=new F(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+Y(e));if(null!=r&&(r=new F(r)),f=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return p=new F(Math.pow(+Y(m),f?e.s*(2-w(e)):+Y(e))),r?p.mod(r):p;if(a=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new F(NaN);(o=!a&&m.isInteger()&&r.isInteger())&&(m=m.mod(r))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||f&&m.c[1]>=24e7:m.c[0]<8e13||f&&m.c[0]<=9999975e7)))return c=m.s<0&&w(e)?-0:0,m.e>-1&&(c=1/c),new F(a?1/c:c);G&&(c=n(G/u+2))}for(f?(t=new F(.5),a&&(e.s=1),h=w(e)):h=(l=Math.abs(+Y(e)))%2,p=new F(V);;){if(h){if(!(p=p.times(m)).c)break;c?p.c.length>c&&(p.c.length=c):o&&(p=p.mod(r))}if(l){if(0===(l=i(l/2)))break;h=l%2}else if(X(e=e.times(t),e.e+1,1),e.e>14)h=w(e);else{if(0==(l=+Y(e)))break;h=l%2}m=m.times(m),c?m.c&&m.c.length>c&&(m.c.length=c):o&&(m=m.mod(r))}return o?p:(a&&(p=V.div(p)),r?p.mod(r):c?X(p,G,P,void 0):p)},S.integerValue=function(e){var r=new F(this);return null==e?e=P:d(e,0,8),X(r,r.e+1,e)},S.isEqualTo=S.eq=function(e,r){return 0===g(this,new F(e,r))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,r){return g(this,new F(e,r))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,r){return 1===(r=g(this,new F(e,r)))||0===r},S.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},S.isLessThan=S.lt=function(e,r){return g(this,new F(e,r))<0},S.isLessThanOrEqualTo=S.lte=function(e,r){return-1===(r=g(this,new F(e,r)))||0===r},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,r){var t,n,i,s,o=this,c=o.s;if(r=(e=new F(e,r)).s,!c||!r)return new F(NaN);if(c!=r)return e.s=-r,o.plus(e);var f=o.e/u,a=e.e/u,h=o.c,m=e.c;if(!f||!a){if(!h||!m)return h?(e.s=-r,e):new F(m?o:NaN);if(!h[0]||!m[0])return m[0]?(e.s=-r,e):new F(h[0]?o:3==P?-0:0)}if(f=p(f),a=p(a),h=h.slice(),c=f-a){for((s=c<0)?(c=-c,i=h):(a=f,i=m),i.reverse(),r=c;r--;i.push(0));i.reverse()}else for(n=(s=(c=h.length)<(r=m.length))?c:r,c=r=0;r<n;r++)if(h[r]!=m[r]){s=h[r]<m[r];break}if(s&&(i=h,h=m,m=i,e.s=-e.s),(r=(n=m.length)-(t=h.length))>0)for(;r--;h[t++]=0);for(r=l-1;n>c;){if(h[--n]<m[n]){for(t=n;t&&!h[--t];h[t]=r);--h[t],h[n]+=l}h[n]-=m[n]}for(;0==h[0];h.splice(0,1),--a);return h[0]?W(e,h,a):(e.s=3==P?-1:1,e.c=[e.e=0],e)},S.modulo=S.mod=function(e,r){var t,n,i=this;return e=new F(e,r),!i.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||i.c&&!i.c[0]?new F(i):(9==U?(n=e.s,e.s=1,t=b(i,e,0,3),e.s=n,t.s*=n):t=b(i,e,0,U),(e=i.minus(t.times(e))).c[0]||1!=U||(e.s=i.s),e)},S.multipliedBy=S.times=function(e,r){var t,n,i,s,o,c,f,h,m,g,d,w,v,y,b,N=this,O=N.c,B=(e=new F(e,r)).c;if(!(O&&B&&O[0]&&B[0]))return!N.s||!e.s||O&&!O[0]&&!B||B&&!B[0]&&!O?e.c=e.e=e.s=null:(e.s*=N.s,O&&B?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(N.e/u)+p(e.e/u),e.s*=N.s,(f=O.length)<(g=B.length)&&(v=O,O=B,B=v,i=f,f=g,g=i),i=f+g,v=[];i--;v.push(0));for(y=l,b=a,i=g;--i>=0;){for(t=0,d=B[i]%b,w=B[i]/b|0,s=i+(o=f);s>i;)t=((h=d*(h=O[--o]%b)+(c=w*h+(m=O[o]/b|0)*d)%b*b+v[s]+t)/y|0)+(c/b|0)+w*m,v[s--]=h%y;v[s]=t}return t?++n:v.splice(0,1),W(e,v,n)},S.negated=function(){var e=new F(this);return e.s=-e.s||null,e},S.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new F(e,r)).s,!i||!r)return new F(NaN);if(i!=r)return e.s=-r,n.minus(e);var s=n.e/u,o=e.e/u,c=n.c,f=e.c;if(!s||!o){if(!c||!f)return new F(i/0);if(!c[0]||!f[0])return f[0]?e:new F(c[0]?n:0*i)}if(s=p(s),o=p(o),c=c.slice(),i=s-o){for(i>0?(o=s,t=f):(i=-i,t=c),t.reverse();i--;t.push(0));t.reverse()}for((i=c.length)-(r=f.length)<0&&(t=f,f=c,c=t,r=i),i=0;r;)i=(c[--r]=c[r]+f[r]+i)/l|0,c[r]=l===c[r]?0:c[r]%l;return i&&(c=[i].concat(c),++o),W(e,c,o)},S.precision=S.sd=function(e,r){var t,n,i,s=this;if(null!=e&&e!==!!e)return d(e,1,h),null==r?r=P:d(r,0,8),X(new F(s),e,r);if(!(t=s.c))return null;if(n=(i=t.length-1)*u+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},S.shiftedBy=function(e){return d(e,-9007199254740991,c),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,r,t,n,i,s=this,o=s.c,l=s.s,u=s.e,c=L+4,f=new F("0.5");if(1!==l||!o||!o[0])return new F(!l||l<0&&(!o||o[0])?NaN:o?s:1/0);if(0==(l=Math.sqrt(+Y(s)))||l==1/0?(((r=m(o)).length+u)%2==0&&(r+="0"),l=Math.sqrt(+r),u=p((u+1)/2)-(u<0||u%2),t=new F(r=l==1/0?"5e"+u:(r=l.toExponential()).slice(0,r.indexOf("e")+1)+u)):t=new F(l+""),t.c[0])for((l=(u=t.e)+c)<3&&(l=0);;)if(i=t,t=f.times(i.plus(b(s,i,c,1))),m(i.c).slice(0,l)===(r=m(t.c)).slice(0,l)){if(t.e<u&&--l,"9999"!=(r=r.slice(l-3,l+1))&&(n||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(X(t,t.e+L+2,1),e=!t.times(t).eq(s));break}if(!n&&(X(i,i.e+L+2,0),i.times(i).eq(s))){t=i;break}c+=4,l+=4,n=1}return X(t,t.e+L+1,P,e)},S.toExponential=function(e,r){return null!=e&&(d(e,0,h),e++),H(this,e,r,1)},S.toFixed=function(e,r){return null!=e&&(d(e,0,h),e=e+this.e+1),H(this,e,r)},S.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==typeof r?(t=r,r=null):e&&"object"==typeof e?(t=e,e=r=null):t=j;else if("object"!=typeof t)throw Error(s+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,l=n.split("."),u=+t.groupSize,c=+t.secondaryGroupSize,f=t.groupSeparator||"",a=l[0],h=l[1],p=i.s<0,m=p?a.slice(1):a,g=m.length;if(c&&(o=u,u=c,c=o,g-=o),u>0&&g>0){for(o=g%u||u,a=m.substr(0,o);o<g;o+=u)a+=f+m.substr(o,u);c>0&&(a+=f+m.slice(o)),p&&(a="-"+a)}n=h?a+(t.decimalSeparator||"")+((c=+t.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):h):a}return(t.prefix||"")+n+(t.suffix||"")},S.toFraction=function(e){var r,t,n,i,o,l,c,a,h,p,g,d,w=this,v=w.c;if(null!=e&&(!(c=new F(e)).isInteger()&&(c.c||1!==c.s)||c.lt(V)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new F(w);for(r=new F(V),h=t=new F(V),n=a=new F(V),d=m(v),o=r.e=d.length-w.e-1,r.c[0]=f[(l=o%u)<0?u+l:l],e=!e||c.comparedTo(r)>0?o>0?r:h:c,l=M,M=1/0,c=new F(d),a.c[0]=0;p=b(c,r,0,1),1!=(i=t.plus(p.times(n))).comparedTo(e);)t=n,n=i,h=a.plus(p.times(i=h)),a=i,r=c.minus(p.times(i=r)),c=i;return i=b(e.minus(t),n,0,1),a=a.plus(i.times(h)),t=t.plus(i.times(n)),a.s=h.s=w.s,g=b(h,n,o*=2,P).minus(w).abs().comparedTo(b(a,t,o,P).minus(w).abs())<1?[h,n]:[a,t],M=l,g},S.toNumber=function(){return+Y(this)},S.toPrecision=function(e,r){return null!=e&&d(e,1,h),H(this,e,r,2)},S.toString=function(e){var r,t=this,n=t.s,i=t.e;return null===i?n?(r="Infinity",n<0&&(r="-"+r)):r="NaN":(null==e?r=i<=R||i>=x?v(m(t.c),i):y(m(t.c),i,"0"):10===e&&q?r=y(m((t=X(new F(t),L+i+1,P)).c),t.e,"0"):(d(e,2,k.length,"Base"),r=N(y(m(t.c),i,"0"),10,e,n,!0)),n<0&&t.c[0]&&(r="-"+r)),r},S.valueOf=S.toJSON=function(){return Y(this)},S._isBigNumber=!0,S[Symbol.toStringTag]="BigNumber",S[Symbol.for("nodejs.util.inspect.custom")]=S.valueOf,null!=r&&F.set(r),F}(),N=(e,r,t)=>{const n=e(2/(t+1)),i=r.length,s=[];if(n.isGreaterThan(1))return Array(i);if(n.isEqualTo(1))return[...r];let o=0,l=0;for(;l<i;l++){const e=r[l];if("object"==typeof e){s[l]=e,o=e,l++;break}}if(Array.isArray(n))for(;l<i;l++){const e=r[l];"object"==typeof e&&"object"==typeof n[l]?o=s[l]=n[l].multipliedBy(e).plus(n[l].minus(1).multipliedBy(o)):s[l]=s[l-1]}else{const t=e(1).minus(n);for(;l<i;l++){const e=r[l];o="object"==typeof e?n.multipliedBy(e).plus(t.multipliedBy(o)):s[l-1],s[l]=o}}return s},O=(e,r,t)=>{let n=[],i=e(0),s=[];for(let e=0;e<r.length;e++)s.push(r[e]),i=i.plus(r[e]),s.length>t&&(i=i.minus(s.shift())),e>=t-1?n.push(i.dividedBy(t)):n.push(i.dividedBy(s.length));return n},B=(e,r,t)=>{let n=new Array(r.length).fill(0),i=0;const s=new e(r[0]),o=new e(t[0]);s.isGreaterThan(o)?(i=1,n[0]=1):s.isLessThan(o)?(i=-1,n[0]=-1):(i=0,n[0]=0);for(let s=1;s<r.length;s++){const o=new e(r[s]),l=new e(t[s]),u=new e(r[s-1]),c=new e(t[s-1]);o.isGreaterThan(l)&&u.isLessThanOrEqualTo(c)?(i=1,n[s]=1):o.isLessThan(l)&&u.isGreaterThanOrEqualTo(c)?(i=-1,n[s]=-1):n[s]=1===i?n[s-1]+1:-1===i?n[s-1]-1:0}return n.map((r=>e(r)))},E=(e,r,t)=>{const n=new e(0),i=r.length,s=O(e,r,t),o=new Array(i).fill(n);for(let e=t-1;e<i;e++){let i=n;for(let n=e-t+1;n<=e;n++)i=i.plus(r[n].minus(s[e]).pow(2));o[e]=i.dividedBy(t).sqrt()}return o},_=(e,r)=>{let{upper:t,lower:n}=r;const i=t.map(((e,r)=>e.minus(n[r])));return e.map(((e,r)=>e.minus(n[r]).dividedBy(i[r]).times(100)))},A=(e,r,t,n)=>r.slice(0,r.length-n+1).map(((i,s)=>{const o=r.slice(s,s+n),l=t.slice(s,s+n);return e.maximum(...o).plus(e.minimum(...l)).dividedBy(2)})),T=(e,r,t,n)=>{const i=e.slice(t).map(((e,t)=>t<r.length?e.plus(r[t]).dividedBy(2):null)).filter((e=>null!==e));return i.slice(0,i.length-n+1)},C=(e,r,t,n,i)=>{let s=r.slice(n).map(((i,s)=>{const o=r.slice(s,s+n),l=t.slice(s,s+n);return e.maximum(...o).plus(e.minimum(...l)).dividedBy(2)}));return s.slice(0,s.length-i+2)},D=(e,r)=>e.slice(0,e.length-r+1),S={getSMA:O,getEMA:N},V=(e,r,t=10,n)=>{const{open:i,high:s,low:o,close:l,volume:u}=r,c=e.min(...o),f=e.max(...s).minus(c).dividedBy(t),a=e(0),h={upVolume:a,downVolume:a,grossVolume:a},p=Array.from({length:t},((e,r)=>({price:c.plus(f.multipliedBy(r)),upVolume:a,downVolume:a,grossVolume:a}))),m=e(1).dividedBy(f);for(let r=0;r<l.length;r++){const n=l[r],f=i[r],h=s[r],g=o[r],d=u[r],w=n.isGreaterThanOrEqualTo(f)?d:a,v=n.isLessThan(f)?d:a,y=Math.max(0,g.minus(c).multipliedBy(m).integerValue(e.ROUND_FLOOR).toNumber()),b=Math.min(t,h.minus(c).multipliedBy(m).integerValue(e.ROUND_CEIL).toNumber());for(let e=y;e<b;e++)p[e].upVolume=p[e].upVolume.plus(w),p[e].downVolume=p[e].downVolume.plus(v),p[e].grossVolume=p[e].grossVolume.plus(w.plus(v))}for(const{upVolume:e,downVolume:r,grossVolume:t}of p)h.upVolume=h.upVolume.plus(e),h.downVolume=h.downVolume.plus(r),h.grossVolume=h.grossVolume.plus(t);return{bins:p,nodes:L(p)}},L=e=>{if(!e||0===e.length)throw new Error("Bins array is empty or not provided");let r=e[0],t=e[0];return e.forEach((e=>{e.grossVolume.isGreaterThan(r.grossVolume)&&(r=e),e.grossVolume.isLessThan(t.grossVolume)&&(t=e)})),{highestVolumeNode:r,lowestVolumeNode:t}};class P{constructor(){this.BigNumber=b,this.VolumeProfile=V}init(e){const{BigNumber:r}=this;return this.ohlcv=e.reduce(((e,{open:t,high:n,low:i,close:s,volume:o,...l})=>(e.open.push(r(t)),e.high.push(r(n)),e.low.push(r(i)),e.close.push(r(s)),e.volume.push(r(o)),Object.keys(l).forEach((r=>{e[r]||(e[r]=[]),e[r].push(l[r])})),e)),{open:[],high:[],low:[],close:[],volume:[]}),this}getHeaders(){return Object.keys(this.getData())}getData(){return this.ohlcv}getLastValues(){const e={};for(const[r,t]of Object.entries(this.ohlcv)){let n=t[t.length-1];e[r]=b.isBigNumber(n)?n.toNumber():n}return e}addColumn(e,r){const t=this.ohlcv.open.length;if(r.length>t)throw new Error("Invalid column data: The length of the new column exceeds the length of the OHLCV data");r=new Array(t-r.length).fill(NaN).concat(r),this.ohlcv[e]=r.map((e=>isNaN(e)?e:e.toNumber()))}crossPairs(e){const r=this.getData(),t={},n=e=>{if(!r.hasOwnProperty(e)&&"string"==typeof e){const[r,...t]=e.split("_");this[r.toUpperCase()]&&t.length>0&&this[r.toUpperCase()](...t)}};for(const{fast:i,slow:s}of e)if(i&&s)if(n(i),n(s),"number"!=typeof s||t[s]||(t[s]=r.close.map((()=>s))),r[i]&&r[s]){const e=B(this.BigNumber,r[i],r[s]);this.addColumn(`${i}_x_${s}`,e)}else if(r[i]&&t[s]){const e=B(this.BigNumber,r[i],t[s]);this.addColumn(`${i}_x_${s}`,e)}else console.error(`Missing ohlcv properties for ${i} or ${s}`)}EMA(e){return((e,r)=>{const t=e.getData().close,n=N(e.BigNumber,t,r);e.addColumn(`ema_${r}`,n)})(this,e),this}SMA(e){return((e,r)=>{const t=e.getData().close,n=O(e.BigNumber,t,r);e.addColumn(`sma_${r}`,n)})(this,e),this}MACD(e,r,t){return((e,r=12,t=26,n=9)=>{const i=e.getData().close,s=((e,r,t=12,n=26,i=9)=>{const s=N(e,r,t),o=N(e,r,n),l=s.map(((e,r)=>e.minus(o[r]))),u=N(e,l,i),c=l.map(((e,r)=>e.minus(u[r]))),f=B(e,l,u);return{diff:l,dea:u,histogram:c,x:f}})(e.BigNumber,i,r,t,n);for(let r in s)e.addColumn(`macd_${r}`,s[r])})(this,e,r,t),this}BollingerBands(e,r,t){return((e,r,t)=>{const n=e.getData().close,i=((e,r,t=20,n=2)=>{n=new e(n);const i=O(e,r,t),s=E(e,r,t).map((e=>e.times(n)));let o=i.map(((e,r)=>e.plus(s[r]))),l=i,u=i.map(((e,r)=>e.minus(s[r])));return{upper:o,mid:l,lower:u,range:_(r,{upper:o,lower:u})}})(e.BigNumber,n,r,t);for(let r in i)e.addColumn(`bollinger_bands_${r}`,i[r])})(this,e,r),this}IchimokuCloud(e,r,t){return((e,r,t,n)=>{const i=e.getData(),s=((e,r,t=9,n=26,i=52)=>{const s=t,o=n,l=o-s,u=i,{high:c,low:f,close:a}=r,h=A(e,c,f,s),p=A(e,c,f,o);return{conversion_line:h,base_line:p,leading_span_a:T(h,p,l,o),leading_span_b:C(e,c,f,u,o),lagging_span:D(a,o)}})(e.BigNumber,i,r,t,n);for(let r in s)e.addColumn(`ichimoku_${r}`,s[r])})(this,e,r,t),this}RSI(e,r,t){return((e,r,t,n)=>{const i=e.getData().close,s=((e,r,t=14,n="SMA",i=14)=>{if(r.length<t)return[];const s=new e(0),o=new e(100),l=new e(1);let u=[],c=s,f=s;for(let n=1;n<=t;n++){const t=new e(r[n]),i=new e(r[n-1]),o=t.minus(i);o.isLessThan(s)?f=f.plus(o.abs()):c=c.plus(o)}let a=c.dividedBy(t),h=f.dividedBy(t),p=h.isEqualTo(s)?s:a.dividedBy(h);u.push(o.minus(o.dividedBy(l.plus(p))));for(let n=t+1;n<r.length;n++){const i=new e(r[n]),m=new e(r[n-1]),g=i.minus(m);g.isLessThan(s)?(f=g.abs(),c=s):(c=g,f=s),a=a.times(t-1).plus(c).dividedBy(t),h=h.times(t-1).plus(f).dividedBy(t),p=h.isEqualTo(s)?s:a.dividedBy(h),u.push(o.minus(o.dividedBy(l.plus(p))))}let m={[`rsi_${t}`]:u};if("string"==typeof n&&"number"==typeof i&&S.hasOwnProperty(`get${n}`)){const r=S[`get${n}`](e,u,i);m[`rsi_${n}_${i}`]=r,m[`rsi_${t}_x_rsi_${n}_${i}`]=B(e,u,r)}return m})(e.BigNumber,i,r,t,n);for(let r in s)e.addColumn(`${r}`.toLowerCase(),s[r])})(this,e,r,t),this}MFI(e){return((e,r=14)=>{const t=e.getData(),n=((e,r,t=14)=>{const{high:n,low:i,close:s,volume:o}=r,l=e(0),u=e(100),c=e(1),f=[],a=[],h=[],p=[],m=[],g=[];for(let e=0;e<s.length;e++){const r=n[e].plus(i[e]).plus(s[e]).dividedBy(3),t=r.times(o[e]);f.push(r),a.push(t)}for(let e=1;e<f.length;e++)f[e].isGreaterThan(f[e-1])?(h.push(a[e]),p.push(l)):f[e].isLessThan(f[e-1])?(h.push(l),p.push(a[e])):(h.push(l),p.push(l));for(let e=t;e<=h.length;e++){const r=h.slice(e-t,e),n=p.slice(e-t,e),i=r.reduce(((e,r)=>e.plus(r)),l),s=n.reduce(((e,r)=>e.plus(r)),l),o=i.dividedBy(s);m.push(o)}for(let e=0;e<m.length;e++){const r=u.minus(u.dividedBy(c.plus(m[e])));g.push(r)}return g})(e.BigNumber,t,r);e.addColumn(`mfi_${r}`,n)})(this,e),this}RelativeVolume(e){return((e,r)=>{const t=e.getData().volume,n=((e,r,t=10)=>{const n=O(e,r,t);return r.map(((e,r)=>0!==r&&n[r-2]?n[r-2].isZero()?NaN:e.dividedBy(n[r-2]):NaN)).filter((e=>!Number.isNaN(e)))})(e.BigNumber,t,r);e.addColumn(`relative_volume_${r}`,n)})(this,e),this}}})(),OHLCV_INDICATORS=r})();
package/index.js CHANGED
@@ -19,27 +19,18 @@ export default class OHLCV_INDICATORS {
19
19
  init(ohlcv) {
20
20
  const { BigNumber } = this
21
21
 
22
- const ohlcvObj = ohlcv.map(({ open, high, low, close, volume, ...rest }) => ({
23
- open: BigNumber(open),
24
- high: BigNumber(high),
25
- low: BigNumber(low),
26
- close: BigNumber(close),
27
- volume: BigNumber(volume),
28
- ...rest
29
- }));
30
-
31
- this.ohlcv = ohlcvObj.reduce((acc, { open, high, low, close, volume, ...rest }) => {
32
- acc.open.push(open);
33
- acc.high.push(high);
34
- acc.low.push(low);
35
- acc.close.push(close);
36
- acc.volume.push(volume);
37
- Object.keys(rest).forEach(key => {
22
+ this.ohlcv = ohlcv.reduce((acc, { open, high, low, close, volume, ...rest }) => {
23
+ acc.open.push(BigNumber(open))
24
+ acc.high.push(BigNumber(high))
25
+ acc.low.push(BigNumber(low))
26
+ acc.close.push(BigNumber(close))
27
+ acc.volume.push(BigNumber(volume))
28
+ for (const key of Object.keys(rest)) {
38
29
  if (!acc[key]) acc[key] = [];
39
30
  acc[key].push(rest[key]);
40
- });
31
+ }
41
32
  return acc;
42
- }, { open: [], high: [], low: [], close: [], volume: [] });
33
+ }, { open: [], high: [], low: [], close: [], volume: [] })
43
34
 
44
35
 
45
36
  return this
@@ -55,85 +46,68 @@ export default class OHLCV_INDICATORS {
55
46
  getLastValues(){
56
47
  const output = {}
57
48
 
58
- for(let k in this.ohlcv)
59
- {
60
- const arr = this.ohlcv[k]
61
- let value = arr[arr.length - 1]
62
- output[k] = (BigNumber.isBigNumber(value)) ? value.toNumber() : value
49
+ for (const [k, arr] of Object.entries(this.ohlcv)) {
50
+ let value = arr[arr.length - 1];
51
+ output[k] = (BigNumber.isBigNumber(value)) ? value.toNumber() : value;
63
52
  }
64
53
 
65
54
  return output
66
55
  }
67
56
 
68
57
  addColumn(key, arr) {
69
- const ohlcvLength = this.ohlcv.open.length
58
+ const ohlcvLength = this.ohlcv.open.length;
70
59
 
71
60
  if (arr.length > ohlcvLength) {
72
- throw new Error(`Invalid column data: The length of the new column exceeds the length of the OHLCV data`)
73
- }
74
-
75
- //fulls arr with NaN until it has the same lenght as ohlcvLength
76
-
77
- while (arr.length < ohlcvLength) {
78
- arr.unshift(NaN)
61
+ throw new Error(`Invalid column data: The length of the new column exceeds the length of the OHLCV data`);
79
62
  }
63
+
64
+ // Use Array.prototype.unshift to add NaN elements efficiently
65
+ const nanArray = new Array(ohlcvLength - arr.length).fill(NaN)
66
+ arr = [...nanArray, ...arr]
80
67
 
81
- this.ohlcv[key] = arr.map(o => isNaN(o) ? o : o.toNumber())
68
+ this.ohlcv[key] = arr
82
69
  }
83
70
 
84
71
  crossPairs(arr)
85
72
  {
86
-
87
- //crossing single column pairs
88
- const ohlcv = this.getData()
89
- let slowNumArr = []
90
-
91
- //each parameter [{fast, slow}, {fast, slow}]
92
-
93
- arr.forEach(o => {
94
- const {fast, slow} = o
95
-
96
- //validates both are destructured correctly
97
- if(!fast || !slow)
98
- {
99
- return
100
- }
101
-
102
- //if the column does not exist, will try to create a new one
103
- //this code can only add single column output indicators such as SMA and EMA
104
- [fast, slow].forEach((v, i) => {
105
- if (!ohlcv.hasOwnProperty(v) && typeof v === 'string') {
106
- const arr = v.split('_')
107
- if (arr.length > 0) {
108
- const funcName = arr[0].toUpperCase()
109
- const params = arr.slice(1)
110
-
111
- if (typeof this[funcName] === 'function' && params.length > 0) {
112
- this[funcName](...params)
113
- }
114
- }
115
- }
116
- else if(typeof v === 'number' && i === 1)
117
- {
118
- slowNumArr = ohlcv.close.map(o => 30)
119
- }
120
- })
73
+ const ohlcv = this.getData();
74
+ const slowNumArrCache = {};
121
75
 
122
- //finds the cross and adds is to the columns
123
- if (ohlcv.hasOwnProperty(fast) && ohlcv.hasOwnProperty(slow)) {
124
- const cross = findCrosses(this.BigNumber, ohlcv[fast], ohlcv[slow])
125
- this.addColumn(`${fast}_x_${slow}`, cross)
126
- }
127
- else if(ohlcv.hasOwnProperty(fast) && slowNumArr.length > 0)
128
- {
129
- const cross = findCrosses(this.BigNumber, ohlcv[fast], slowNumArr)
130
- this.addColumn(`${fast}_x_${slow}`, cross)
76
+ // Helper function to create column if it doesn't exist
77
+ const createColumnIfNeeded = (v) => {
78
+ if (!ohlcv.hasOwnProperty(v) && typeof v === 'string') {
79
+ const [funcName, ...params] = v.split('_');
80
+ if (this[funcName.toUpperCase()] && params.length > 0) {
81
+ this[funcName.toUpperCase()](...params);
82
+ }
131
83
  }
132
- else {
133
- console.error(`Missing ohlcv properties for ${fast} or ${slow}`)
84
+ };
85
+
86
+ for (const { fast, slow } of arr) {
87
+ // Validate parameters
88
+ if (!fast || !slow) continue;
89
+
90
+ // Create columns if needed
91
+ createColumnIfNeeded(fast);
92
+ createColumnIfNeeded(slow);
93
+
94
+ // Prepare slowNumArr if 'slow' is a number
95
+ if (typeof slow === 'number' && !slowNumArrCache[slow]) {
96
+ slowNumArrCache[slow] = ohlcv.close.map(() => slow);
134
97
  }
135
- })
136
98
 
99
+ // Find and add crosses
100
+ if (ohlcv[fast] && ohlcv[slow]) {
101
+ const cross = findCrosses(this.BigNumber, ohlcv[fast], ohlcv[slow]);
102
+ this.addColumn(`${fast}_x_${slow}`, cross);
103
+ } else if (ohlcv[fast] && slowNumArrCache[slow]) {
104
+ const cross = findCrosses(this.BigNumber, ohlcv[fast], slowNumArrCache[slow]);
105
+ this.addColumn(`${fast}_x_${slow}`, cross);
106
+ } else {
107
+ console.error(`Missing ohlcv properties for ${fast} or ${slow}`);
108
+ }
109
+ }
110
+
137
111
  }
138
112
 
139
113
  EMA(size) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ohlcv-indicators",
3
- "version": "1.1.2",
4
- "description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}], utilizing BigNumber precision for enhanced accuracy.",
3
+ "version": "1.1.4",
4
+ "description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}], utilizing BigNumber precision for enhanced accuracy. This library is optimized for backtesting and trading bot development.",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -5,7 +5,7 @@ export const IchimokuCloud = (main, tenkan, kijun, senkou) => {
5
5
 
6
6
  for(let k in ichi)
7
7
  {
8
- console.log(`${k} [length ${ichi[k].length}] [lastValue ${ichi[k][ichi[k].length -1]}]`)
8
+ //console.log(`${k} [length ${ichi[k].length}] [lastValue ${ichi[k][ichi[k].length -1]}]`)
9
9
  main.addColumn(`ichimoku_${k}`, ichi[k])
10
10
  }
11
11
  }
package/src/utilities.js CHANGED
@@ -43,5 +43,5 @@ export const findCrosses = (BigNumber, fast, slow) => {
43
43
  }
44
44
  }
45
45
 
46
- return crosses.map(o => BigNumber(o))
46
+ return crosses
47
47
  }
@@ -22,7 +22,9 @@ const getOneDayOHLCV = async (symbol, limit) => {
22
22
  high: convertCurrencyToFloat(z.high),
23
23
  low: convertCurrencyToFloat(z.low),
24
24
  close: convertCurrencyToFloat(z.close),
25
- volume: convertCurrencyToFloat(z.volume)
25
+ volume: convertCurrencyToFloat(z.volume),
26
+ timestamp: x,
27
+ date: new Date(x).toDateString().slice(0, 10)
26
28
  }))
27
29
 
28
30
  return ohlcv
@@ -34,15 +36,16 @@ export const getLatestOHLCV = async (symbol) => {
34
36
  const data = await response.json()
35
37
  const {chart, lastSalePrice, volume} = data.data
36
38
  const allValues = chart.map(o => convertCurrencyToFloat(o.z.value))
37
-
38
- console.log(new Date(chart[chart.length -1].x).toDateString().slice(0, 10))
39
+ const timestamp = chart[chart.length -1].x
39
40
 
40
41
  return [{
41
42
  open: allValues[0],
42
43
  high: Math.max(...allValues),
43
44
  low: Math.min(...allValues),
44
45
  close: convertCurrencyToFloat(lastSalePrice),
45
- volume: convertCurrencyToFloat(volume)
46
+ volume: convertCurrencyToFloat(volume),
47
+ timestamp,
48
+ date: new Date(chart[chart.length -1].x).toDateString().slice(0, 10)
46
49
  }]
47
50
  }
48
51
 
package/test/test.js CHANGED
@@ -1,28 +1,30 @@
1
1
  import OHLCV_INDICATORS from '../index.js'
2
2
  import { getOHLCV } from './fetchLiveData.js'
3
3
 
4
- const indicators = new OHLCV_INDICATORS();
4
+ const indicators = new OHLCV_INDICATORS()
5
+ const {BigNumber, VolumeProfile} = indicators
5
6
 
6
7
  const TEST = async () => {
7
8
 
8
- const ohlcv = await getOHLCV('ADMA', 200)
9
+ const unparsedOHLCV = await getOHLCV('ADMA', 200)
9
10
 
10
11
  indicators
11
- .init(ohlcv)
12
- //.EMA(21)
13
- //.EMA(9, 'ema21')
14
- //.SMA(200)
15
- //.SMA(100, 'sma_200')
16
- //.MACD(12, 26, 9)
17
- //.BollingerBands(20, 2)
12
+ .init(unparsedOHLCV)
13
+ .EMA(21)
14
+ .EMA(9, 'ema21')
15
+ .SMA(200)
16
+ .SMA(100, 'sma_200')
17
+ .MACD(12, 26, 9)
18
+ .BollingerBands(20, 2)
18
19
  .IchimokuCloud(9, 26, 52)
19
- //.RSI(14)
20
- //.MFI(14)
21
- //.RelativeVolume(10)
22
- //.RelativeVolume(20)
23
- //.crossPairs([{fast: 'ema_9', slow: 'ema_21'}, {fast: 'close', slow: 'sma_200'}, {fast: 'rsi_14', slow: 30}])
20
+ .RSI(14)
21
+ .MFI(14)
22
+ .RelativeVolume(10)
23
+ .RelativeVolume(20)
24
+ .crossPairs([{fast: 'ema_9', slow: 'ema_21'}, {fast: 'close', slow: 'sma_200'}, {fast: 'rsi_14', slow: 70}])
24
25
 
25
26
  console.log(indicators.getLastValues())
27
+ console.log(VolumeProfile(BigNumber, indicators.getData(), 5))
26
28
  }
27
29
 
28
30
  TEST()