@d3fc/d3fc-technical-indicator
Advanced tools
Comparing version 7.0.65 to 7.1.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array'], factory) : | ||
(global = global || self, factory(global.fc = global.fc || {}, global.d3)); | ||
}(this, function (exports, d3Array) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('@d3fc/d3fc-rebind')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', '@d3fc/d3fc-rebind'], factory) : | ||
(global = global || self, factory(global.fc = global.fc || {}, global.d3, global.fc)); | ||
}(this, function (exports, d3Array, d3fcRebind) { 'use strict'; | ||
var createReboundMethod = ((target, source, name) => { | ||
const method = source[name]; | ||
if (typeof method !== 'function') { | ||
throw new Error(`Attempt to rebind ${name} which isn't a function on the source object`); | ||
} | ||
return (...args) => { | ||
var value = method.apply(source, args); | ||
return value === source ? target : value; | ||
}; | ||
}); | ||
var rebind = ((target, source, ...names) => { | ||
for (const name of names) { | ||
target[name] = createReboundMethod(target, source, name); | ||
} | ||
return target; | ||
}); | ||
const createTransform = transforms => name => transforms.reduce((name, fn) => name && fn(name), name); | ||
var rebindAll = ((target, source, ...transforms) => { | ||
const transform = createTransform(transforms); | ||
for (const name of Object.keys(source)) { | ||
const result = transform(name); | ||
if (result) { | ||
target[result] = createReboundMethod(target, source, name); | ||
} | ||
} | ||
return target; | ||
}); | ||
var includeMap = (mappings => name => mappings[name]); | ||
function identity(d) { | ||
@@ -156,3 +117,3 @@ return d; | ||
rebind(bollingerBands, slidingWindow, 'period', 'value'); | ||
d3fcRebind.rebind(bollingerBands, slidingWindow, 'period', 'value'); | ||
return bollingerBands; | ||
@@ -259,9 +220,9 @@ } | ||
rebindAll(macd, fastEMA, includeMap({ | ||
d3fcRebind.rebindAll(macd, fastEMA, d3fcRebind.includeMap({ | ||
'period': 'fastPeriod' | ||
})); | ||
rebindAll(macd, slowEMA, includeMap({ | ||
d3fcRebind.rebindAll(macd, slowEMA, d3fcRebind.includeMap({ | ||
'period': 'slowPeriod' | ||
})); | ||
rebindAll(macd, signalEMA, includeMap({ | ||
d3fcRebind.rebindAll(macd, signalEMA, d3fcRebind.includeMap({ | ||
'period': 'signalPeriod' | ||
@@ -389,3 +350,3 @@ })); | ||
rebind(rsi, slidingWindow, 'period', 'value'); | ||
d3fcRebind.rebind(rsi, slidingWindow, 'period', 'value'); | ||
return rsi; | ||
@@ -403,3 +364,3 @@ } | ||
rebind(movingAverage, slidingWindow, 'period', 'value'); | ||
d3fcRebind.rebind(movingAverage, slidingWindow, 'period', 'value'); | ||
return movingAverage; | ||
@@ -469,6 +430,6 @@ } | ||
rebindAll(stochastic, kWindow, includeMap({ | ||
d3fcRebind.rebindAll(stochastic, kWindow, d3fcRebind.includeMap({ | ||
'period': 'kPeriod' | ||
})); | ||
rebindAll(stochastic, dWindow, includeMap({ | ||
d3fcRebind.rebindAll(stochastic, dWindow, d3fcRebind.includeMap({ | ||
'period': 'dPeriod' | ||
@@ -519,3 +480,3 @@ })); | ||
rebind(force, emaComputer, 'period'); | ||
d3fcRebind.rebind(force, emaComputer, 'period'); | ||
return force; | ||
@@ -614,3 +575,3 @@ } | ||
rebind(elderRay, emaComputer, 'period'); | ||
d3fcRebind.rebind(elderRay, emaComputer, 'period'); | ||
return elderRay; | ||
@@ -617,0 +578,0 @@ } |
@@ -1,1 +0,1 @@ | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],b):(a=a||self,b(a.fc=a.fc||{},a.d3))})(this,function(a,b){'use strict';function c(a){return a}function d(){}function e(a){return"function"==typeof a?a:function(){return a}}function f(a){return"number"==typeof a&&isNaN(a)?void 0:a}function g(){var a=function(){return 10},b=d,f=c,g=function(a){return null!=a},h=function(c){var e=a.apply(this,arguments),h=c.slice(0,e).map(f);return c.map(function(a,c){return c>=e&&(h.shift(),h.push(f(a,c))),c<e-1||h.some(function(a){return!g(a)})?b(void 0,c):b(h,c)})};return h.period=function(){return arguments.length?(a=e(0>=arguments.length?void 0:arguments[0]),h):a},h.accumulator=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],h):b},h.defined=function(){return arguments.length?(g=0>=arguments.length?void 0:arguments[0],h):g},h.value=function(){return arguments.length?(f=0>=arguments.length?void 0:arguments[0],h):f},h}function h(){var a=2,c=g().accumulator(function(c){var d=c&&b.deviation(c),e=c&&b.mean(c);return{average:e,upper:f(e+a*d),lower:f(e-a*d)}}),d=function(a){return c(a)};return d.multiplier=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],d):a},w(d,c,"period","value"),d}function i(){var a=c,d=function(){return 9},g=function(a){var c=[];return function(d){var e;return c.length<a&&(null==d?c=[]:c.push(d)),c.length>=a&&(e=b.mean(c)),e}},h=function(b){var c,e=d.apply(this,arguments),h=2/(e+1),j=g(e);return b.map(function(b,d){var e=a(b,d);return c=void 0===c?j(e):e*h+(1-h)*c,f(c)})};return h.period=function(){return arguments.length?(d=e(0>=arguments.length?void 0:arguments[0]),h):d},h.value=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],h):a},h}function j(){var a=c,d=i().period(12),e=i().period(26),f=i().period(9),g=function(c){d.value(a),e.value(a);var g=b.zip(d(c),e(c)).map(function(a){return void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}),h=f(g);return b.zip(g,h).map(function(a){return{macd:a[0],signal:a[1],divergence:void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}})};return g.value=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],g):a},y(g,d,z({period:"fastPeriod"})),y(g,e,z({period:"slowPeriod"})),y(g,f,z({period:"signalPeriod"})),g}function k(a,b){return n(a)||p(a,b)||r()}function l(a){return m(a)||o(a)||q()}function m(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function n(a){if(Array.isArray(a))return a}function o(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function p(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function q(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function s(){var a=g().accumulator(function(a){return a&&b.mean(a)}),c=function(b){return a(b)};return w(c,a,"period","value"),c}function t(){var a=.1,b=c,d=function(c){return c.map(function(c){var d=f(b(c)*(1-a)),e=f(b(c)*(1+a));return{lower:d,upper:e}})};return d.factor=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],d):a},d.value=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],d):b},d}function u(){var a=function(a){return a.close},c=function(a){return a.high},e=function(a){return a.low},g=i().period(13),h=function(d){return g.value(a),b.zip(d,g(d)).map(function(a){var b=f(c(a[0])-a[1]),d=f(e(a[0])-a[1]);return{bullPower:b,bearPower:d}})};return h.closeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],h):a},h.highValue=function(){return arguments.length?(c=0>=arguments.length?void 0:arguments[0],h):c},h.lowValue=function(){return arguments.length?(e=0>=arguments.length?void 0:arguments[0],h):e},w(h,g,"period"),h}var v=(a,b,c)=>{const d=b[c];if("function"!=typeof d)throw new Error(`Attempt to rebind ${c} which isn't a function on the source object`);return(...c)=>{var e=d.apply(b,c);return e===b?a:e}},w=(a,b,...c)=>{for(const d of c)a[d]=v(a,b,d);return a};const x=a=>b=>a.reduce((a,b)=>a&&b(a),b);var y=(a,b,...c)=>{const d=x(c);for(const e of Object.keys(b)){const c=d(e);c&&(a[c]=v(a,b,e))}return a},z=a=>b=>a[b];a.indicatorBollingerBands=h,a.indicatorElderRay=u,a.indicatorEnvelope=t,a.indicatorExponentialMovingAverage=i,a.indicatorForceIndex=function(){var a=function(a){return a.volume},b=function(a){return a.close},c=i().period(13),d=g().period(2).defined(function(c){return null!=b(c)&&null!=a(c)}).accumulator(function(c){return c&&f((b(c[1])-b(c[0]))*a(c[1]))}),e=function(a){var b=d(a);return c(b)};return e.volumeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],e):a},e.closeValue=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],e):b},w(e,c,"period"),e},a.indicatorMacd=j,a.indicatorMovingAverage=s,a.indicatorRelativeStrengthIndex=function(){var a=g().period(14),c=function(a,b){return b+(a[a.length-1]-b)/a.length},d=function(a){var b=k(a,2),c=b[0],d=b[1];return c<d?0:c-d},e=function(a){var b=k(a,2),c=b[0],d=b[1];return c>d?0:d-c},h=function(a,d){return void 0===d?b.mean(a):c(a,d)},i=function(){var a,c,g;return function(i){if(!i)return void(void 0!==a&&(a=NaN));if(void 0===a)return void(a=i[0]);var j=b.pairs([a].concat(l(i)));c=h(j.map(d),c),g=h(j.map(e),g);var k=isNaN(a)?NaN:g/c;return f(100-100/(1+k))}},j=function(b){var c=i();return a.accumulator(c),a(b)};return w(j,a,"period","value"),j},a.indicatorStochasticOscillator=function(){var a=function(a){return a.close},c=function(a){return a.high},e=function(a){return a.low},h=g().period(5).defined(function(b){return null!=a(b)&&null!=c(b)&&null!=e(b)}).accumulator(function(d){var g=d&&b.max(d,c),h=d&&b.min(d,e),i=d&&100*(a(d[d.length-1])-h)/(g-h);return f(i)}),i=s().period(3),j=function(a){var b=h(a),c=i(b);return b.map(function(a,b){return{k:a,d:c[b]}})};return j.closeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],j):a},j.highValue=function(){return arguments.length?(c=0>=arguments.length?void 0:arguments[0],j):c},j.lowValue=function(){return arguments.length?(e=0>=arguments.length?void 0:arguments[0],j):e},y(j,h,z({period:"kPeriod"})),y(j,i,z({period:"dPeriod"})),j},Object.defineProperty(a,"__esModule",{value:!0})}); | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("d3-array"),require("@d3fc/d3fc-rebind")):"function"==typeof define&&define.amd?define(["exports","d3-array","@d3fc/d3fc-rebind"],b):(a=a||self,b(a.fc=a.fc||{},a.d3,a.fc))})(this,function(a,b,c){'use strict';function d(a){return a}function e(){}function f(a){return"function"==typeof a?a:function(){return a}}function g(a){return"number"==typeof a&&isNaN(a)?void 0:a}function h(){var a=function(){return 10},b=e,c=d,g=function(a){return null!=a},h=function(d){var e=a.apply(this,arguments),f=d.slice(0,e).map(c);return d.map(function(a,d){return d>=e&&(f.shift(),f.push(c(a,d))),d<e-1||f.some(function(a){return!g(a)})?b(void 0,d):b(f,d)})};return h.period=function(){return arguments.length?(a=f(0>=arguments.length?void 0:arguments[0]),h):a},h.accumulator=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],h):b},h.defined=function(){return arguments.length?(g=0>=arguments.length?void 0:arguments[0],h):g},h.value=function(){return arguments.length?(c=0>=arguments.length?void 0:arguments[0],h):c},h}function i(){var a=2,d=h().accumulator(function(c){var d=c&&b.deviation(c),e=c&&b.mean(c);return{average:e,upper:g(e+a*d),lower:g(e-a*d)}}),e=function(a){return d(a)};return e.multiplier=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],e):a},c.rebind(e,d,"period","value"),e}function j(){var a=d,c=function(){return 9},e=function(a){var c=[];return function(d){var e;return c.length<a&&(null==d?c=[]:c.push(d)),c.length>=a&&(e=b.mean(c)),e}},h=function(b){var f,h=c.apply(this,arguments),j=2/(h+1),k=e(h);return b.map(function(b,c){var d=a(b,c);return f=void 0===f?k(d):d*j+(1-j)*f,g(f)})};return h.period=function(){return arguments.length?(c=f(0>=arguments.length?void 0:arguments[0]),h):c},h.value=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],h):a},h}function k(){var a=d,e=j().period(12),f=j().period(26),g=j().period(9),h=function(c){e.value(a),f.value(a);var d=b.zip(e(c),f(c)).map(function(a){return void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}),h=g(d);return b.zip(d,h).map(function(a){return{macd:a[0],signal:a[1],divergence:void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}})};return h.value=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],h):a},c.rebindAll(h,e,c.includeMap({period:"fastPeriod"})),c.rebindAll(h,f,c.includeMap({period:"slowPeriod"})),c.rebindAll(h,g,c.includeMap({period:"signalPeriod"})),h}function l(a,b){return o(a)||q(a,b)||s()}function m(a){return n(a)||p(a)||r()}function n(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function o(a){if(Array.isArray(a))return a}function p(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function q(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function t(){var a=h().accumulator(function(a){return a&&b.mean(a)}),d=function(b){return a(b)};return c.rebind(d,a,"period","value"),d}function u(){var a=.1,b=d,c=function(c){return c.map(function(c){var d=g(b(c)*(1-a)),e=g(b(c)*(1+a));return{lower:d,upper:e}})};return c.factor=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],c):a},c.value=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],c):b},c}function v(){var a=function(a){return a.close},e=function(a){return a.high},f=function(a){return a.low},h=j().period(13),i=function(c){return h.value(a),b.zip(c,h(c)).map(function(a){var b=g(e(a[0])-a[1]),c=g(f(a[0])-a[1]);return{bullPower:b,bearPower:c}})};return i.closeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],i):a},i.highValue=function(){return arguments.length?(e=0>=arguments.length?void 0:arguments[0],i):e},i.lowValue=function(){return arguments.length?(f=0>=arguments.length?void 0:arguments[0],i):f},c.rebind(i,h,"period"),i}a.indicatorBollingerBands=i,a.indicatorElderRay=v,a.indicatorEnvelope=u,a.indicatorExponentialMovingAverage=j,a.indicatorForceIndex=function(){var a=function(a){return a.volume},b=function(a){return a.close},d=j().period(13),e=h().period(2).defined(function(c){return null!=b(c)&&null!=a(c)}).accumulator(function(c){return c&&g((b(c[1])-b(c[0]))*a(c[1]))}),f=function(a){var b=e(a);return d(b)};return f.volumeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],f):a},f.closeValue=function(){return arguments.length?(b=0>=arguments.length?void 0:arguments[0],f):b},c.rebind(f,d,"period"),f},a.indicatorMacd=k,a.indicatorMovingAverage=t,a.indicatorRelativeStrengthIndex=function(){var a=h().period(14),d=function(a,b){return b+(a[a.length-1]-b)/a.length},e=function(a){var b=l(a,2),c=b[0],d=b[1];return c<d?0:c-d},f=function(a){var b=l(a,2),c=b[0],d=b[1];return c>d?0:d-c},i=function(a,c){return void 0===c?b.mean(a):d(a,c)},j=function(){var a,c,d;return function(h){if(!h)return void(void 0!==a&&(a=NaN));if(void 0===a)return void(a=h[0]);var j=b.pairs([a].concat(m(h)));c=i(j.map(e),c),d=i(j.map(f),d);var k=isNaN(a)?NaN:d/c;return g(100-100/(1+k))}},k=function(b){var c=j();return a.accumulator(c),a(b)};return c.rebind(k,a,"period","value"),k},a.indicatorStochasticOscillator=function(){var a=function(a){return a.close},e=function(a){return a.high},f=function(a){return a.low},i=h().period(5).defined(function(b){return null!=a(b)&&null!=e(b)&&null!=f(b)}).accumulator(function(c){var d=c&&b.max(c,e),h=c&&b.min(c,f),i=c&&100*(a(c[c.length-1])-h)/(d-h);return g(i)}),j=t().period(3),k=function(a){var b=i(a),c=j(b);return b.map(function(a,b){return{k:a,d:c[b]}})};return k.closeValue=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],k):a},k.highValue=function(){return arguments.length?(e=0>=arguments.length?void 0:arguments[0],k):e},k.lowValue=function(){return arguments.length?(f=0>=arguments.length?void 0:arguments[0],k):f},c.rebindAll(k,i,c.includeMap({period:"kPeriod"})),c.rebindAll(k,j,c.includeMap({period:"dPeriod"})),k},Object.defineProperty(a,"__esModule",{value:!0})}); |
@@ -6,2 +6,13 @@ # Change Log | ||
# [7.1.0](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-technical-indicator@7.0.65...@d3fc/d3fc-technical-indicator@7.1.0) (2020-03-19) | ||
### Features | ||
* add fill to webgl boxplot ([7ea7859](https://github.com/d3fc/d3fc/commit/7ea7859)) | ||
## [7.0.65](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-technical-indicator@7.0.64...@d3fc/d3fc-technical-indicator@7.0.65) (2020-02-18) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@d3fc/d3fc-technical-indicator", | ||
"version": "7.0.65", | ||
"version": "7.1.0", | ||
"description": "Components for calculating technical indicators on data series", | ||
@@ -42,7 +42,7 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@d3fc/d3fc-annotation": "^2.4.42", | ||
"@d3fc/d3fc-extent": "^3.1.7", | ||
"@d3fc/d3fc-random-data": "^3.0.19", | ||
"@d3fc/d3fc-annotation": "^2.5.0", | ||
"@d3fc/d3fc-extent": "^3.2.0", | ||
"@d3fc/d3fc-random-data": "^3.1.0", | ||
"@d3fc/d3fc-rebind": "^5.0.8", | ||
"@d3fc/d3fc-series": "^4.4.17", | ||
"@d3fc/d3fc-series": "^4.5.0", | ||
"d3": "^4.2.5", | ||
@@ -58,3 +58,3 @@ "fs-promise": "^1.0.0" | ||
}, | ||
"gitHead": "6562a4dc0cea7adeb693f94c5844e5be081f53fc" | ||
"gitHead": "8a27597494353a1441a1a71ca06707d9e28c4381" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
602259
2796