From f8db09681ae2b6958f6036361e4b121491a2fd8c Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Mon, 3 Jun 2019 13:19:42 +0200 Subject: [PATCH 1/8] removed ; doublon --- lib/directionalmovement/ADX.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/directionalmovement/ADX.js b/lib/directionalmovement/ADX.js index a4e8ee8..6929f59 100644 --- a/lib/directionalmovement/ADX.js +++ b/lib/directionalmovement/ADX.js @@ -83,7 +83,6 @@ export class ADX extends Indicator { }); } ; - ; nextValue(price) { let result = this.generator.next(price).value; if (result != undefined && result.adx != undefined) { From 109557ae2784d6c0ef8b95b14d3f50dc57174965 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Mon, 3 Jun 2019 13:22:39 +0200 Subject: [PATCH 2/8] Update ForceIndex.js --- lib/volume/ForceIndex.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/volume/ForceIndex.js b/lib/volume/ForceIndex.js index abac138..f5b67b1 100644 --- a/lib/volume/ForceIndex.js +++ b/lib/volume/ForceIndex.js @@ -40,7 +40,6 @@ export class ForceIndex extends Indicator { }); } ; - ; nextValue(price) { let result = this.generator.next(price).value; if (result != undefined) { From e1cc4a4e1e30fbc6b161a56667798ab1dc6f2020 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Mon, 3 Jun 2019 13:25:19 +0200 Subject: [PATCH 3/8] Update CCI.js --- lib/oscillators/CCI.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/oscillators/CCI.js b/lib/oscillators/CCI.js index 8182efc..ee8c00b 100644 --- a/lib/oscillators/CCI.js +++ b/lib/oscillators/CCI.js @@ -56,7 +56,6 @@ export class CCI extends Indicator { }); } ; - ; nextValue(price) { let result = this.generator.next(price).value; if (result != undefined) { From 3aa55f9a1f53e4eba27557de48ef8bfb9c9a7eb2 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Mon, 3 Jun 2019 13:26:34 +0200 Subject: [PATCH 4/8] Update VWAP.js --- lib/volume/VWAP.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/volume/VWAP.js b/lib/volume/VWAP.js index 18a3c01..1111eb1 100644 --- a/lib/volume/VWAP.js +++ b/lib/volume/VWAP.js @@ -41,7 +41,6 @@ export class VWAP extends Indicator { }); } ; - ; nextValue(price) { let result = this.generator.next(price).value; if (result != undefined) { From 30842089917e348899769238b37a77ef17b1e9e9 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Wed, 21 Aug 2019 17:21:53 -0600 Subject: [PATCH 5/8] pkg upd --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cf24cb5..70bb5ce 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,8 @@ "typescript": "^2.9.2" }, "dependencies": { - "@tensorflow/tfjs": "^0.13.0", - "@tensorflow/tfjs-node": "^0.1.17", + "@tensorflow/tfjs": "^1.2.7", + "@tensorflow/tfjs-node": "^1.2.7", "@types/node": "^6.0.96" } } From 1aef5b55cbd69d465d422df6b81136a9ae0f6109 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Thu, 22 Aug 2019 08:43:42 -0600 Subject: [PATCH 6/8] rem pattern detection --- declarations/index.d.ts | 16 +- index.js | 2 +- lib/index.js | 16 +- lib/patterndetection/patterndetection.js | 165 ------------------- lib/patterndetection/patterndetection.js.map | 1 - package.json | 2 - src/index.ts | 16 +- 7 files changed, 25 insertions(+), 193 deletions(-) delete mode 100644 lib/patterndetection/patterndetection.js delete mode 100644 lib/patterndetection/patterndetection.js.map diff --git a/declarations/index.d.ts b/declarations/index.d.ts index 2cd9f0a..d6cb507 100644 --- a/declarations/index.d.ts +++ b/declarations/index.d.ts @@ -72,14 +72,14 @@ export { shootingstarunconfirmed } from './candlestick/ShootingStarUnconfirmed'; export { tweezertop } from './candlestick/TweezerTop'; export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement } from './drawingtools/fibonacci'; -export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -export { AvailablePatterns } from './patterndetection/patterndetection'; -export { hasDoubleBottom } from './patterndetection/patterndetection'; -export { hasDoubleTop } from './patterndetection/patterndetection'; -export { hasHeadAndShoulder } from './patterndetection/patterndetection'; -export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -export { isTrendingUp } from './patterndetection/patterndetection'; -export { isTrendingDown } from './patterndetection/patterndetection'; +//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +//export { AvailablePatterns } from './patterndetection/patterndetection'; +//export { hasDoubleBottom } from './patterndetection/patterndetection'; +//export { hasDoubleTop } from './patterndetection/patterndetection'; +//export { hasHeadAndShoulder } from './patterndetection/patterndetection'; +//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +//export { isTrendingUp } from './patterndetection/patterndetection'; +//export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; export { keltnerchannels, KeltnerChannels, KeltnerChannelsInput, KeltnerChannelsOutput } from './volatility/KeltnerChannels'; export { chandelierexit, ChandelierExit, ChandelierExitInput, ChandelierExitOutput } from './volatility/ChandelierExit'; diff --git a/index.js b/index.js index 4947eef..68d9a1a 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,7 @@ export function getAvailableIndicators () { AvailableIndicators.push('tweezertop'); AvailableIndicators.push('tweezerbottom'); - AvailableIndicators.push('predictPattern'); + //AvailableIndicators.push('predictPattern'); AvailableIndicators.push('hasDoubleBottom'); AvailableIndicators.push('hasDoubleTop'); AvailableIndicators.push('hasHeadAndShoulder'); diff --git a/lib/index.js b/lib/index.js index 2cd9f0a..d6cb507 100644 --- a/lib/index.js +++ b/lib/index.js @@ -72,14 +72,14 @@ export { shootingstarunconfirmed } from './candlestick/ShootingStarUnconfirmed'; export { tweezertop } from './candlestick/TweezerTop'; export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement } from './drawingtools/fibonacci'; -export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -export { AvailablePatterns } from './patterndetection/patterndetection'; -export { hasDoubleBottom } from './patterndetection/patterndetection'; -export { hasDoubleTop } from './patterndetection/patterndetection'; -export { hasHeadAndShoulder } from './patterndetection/patterndetection'; -export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -export { isTrendingUp } from './patterndetection/patterndetection'; -export { isTrendingDown } from './patterndetection/patterndetection'; +//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +//export { AvailablePatterns } from './patterndetection/patterndetection'; +//export { hasDoubleBottom } from './patterndetection/patterndetection'; +//export { hasDoubleTop } from './patterndetection/patterndetection'; +//export { hasHeadAndShoulder } from './patterndetection/patterndetection'; +//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +//export { isTrendingUp } from './patterndetection/patterndetection'; +//export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; export { keltnerchannels, KeltnerChannels, KeltnerChannelsInput, KeltnerChannelsOutput } from './volatility/KeltnerChannels'; export { chandelierexit, ChandelierExit, ChandelierExitInput, ChandelierExitOutput } from './volatility/ChandelierExit'; diff --git a/lib/patterndetection/patterndetection.js b/lib/patterndetection/patterndetection.js deleted file mode 100644 index 0de4e69..0000000 --- a/lib/patterndetection/patterndetection.js +++ /dev/null @@ -1,165 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { Indicator, IndicatorInput } from '../indicator/indicator'; -// import * as tf from '@tensorflow/tfjs'; -var isNodeEnvironment = false; -var model; -var oneHotMap = ['IHS', 'TU', 'DB', 'HS', 'TD', 'DT']; -var tf; -try { - isNodeEnvironment = Object.prototype.toString.call(global.process) === '[object process]'; -} -catch (e) { } -export class PatternDetectorInput extends IndicatorInput { - constructor(values) { - super(); - this.values = values; - } -} -export var AvailablePatterns; -(function (AvailablePatterns) { - AvailablePatterns[AvailablePatterns["IHS"] = 0] = "IHS"; - AvailablePatterns[AvailablePatterns["TU"] = 1] = "TU"; - AvailablePatterns[AvailablePatterns["DB"] = 2] = "DB"; - AvailablePatterns[AvailablePatterns["HS"] = 3] = "HS"; - AvailablePatterns[AvailablePatterns["TD"] = 4] = "TD"; - AvailablePatterns[AvailablePatterns["DT"] = 5] = "DT"; -})(AvailablePatterns || (AvailablePatterns = {})); -function interpolateArray(data, fitCount) { - var linearInterpolate = function (before, after, atPoint) { - return before + (after - before) * atPoint; - }; - var newData = new Array(); - var springFactor = new Number((data.length - 1) / (fitCount - 1)); - newData[0] = data[0]; // for new allocation - for (var i = 1; i < fitCount - 1; i++) { - var tmp = i * springFactor; - var before = new Number(Math.floor(tmp)).toFixed(); - var after = new Number(Math.ceil(tmp)).toFixed(); - var atPoint = tmp - before; - newData[i] = linearInterpolate(data[before], data[after], atPoint); - } - newData[fitCount - 1] = data[data.length - 1]; // for new allocation - return newData; -} -; -function l2Normalize(arr) { - var sum = arr.reduce((cum, value) => { return cum + (value * value); }, 0); - var norm = Math.sqrt(sum); - return arr.map((v) => v / norm); -} -export class PatternDetectorOutput { -} -var modelLoaded = false; -var laodingModel = false; -var loadingPromise; -function loadModel() { - return __awaiter(this, void 0, void 0, function* () { - if (modelLoaded) - return Promise.resolve(true); - if (laodingModel) - return loadingPromise; - laodingModel = true; - loadingPromise = new Promise(function (resolve, reject) { - return __awaiter(this, void 0, void 0, function* () { - if (isNodeEnvironment) { - tf = require('@tensorflow/tfjs'); - console.log('Nodejs Environment detected '); - var tfnode = require('@tensorflow/tfjs-node'); - var modelPath = require('path').resolve(__dirname, '../tf_model/model.json'); - model = yield tf.loadModel(tfnode.io.fileSystem(modelPath)); - } - else { - if (typeof window.tf == "undefined") { - modelLoaded = false; - laodingModel = false; - console.log('Tensorflow js not imported, pattern detection may not work'); - resolve(); - return; - } - tf = window.tf; - console.log('Browser Environment detected ', tf); - console.log('Loading model ....'); - model = yield tf.loadModel('/tf_model/model.json'); - modelLoaded = true; - laodingModel = false; - setTimeout(resolve, 1000); - console.log('Loaded model'); - return; - } - modelLoaded = true; - laodingModel = false; - resolve(); - return; - }); - }); - yield loadingPromise; - return; - }); -} -loadModel(); -export function predictPattern(input) { - return __awaiter(this, void 0, void 0, function* () { - yield loadModel(); - if (input.values.length < 300) { - console.warn('Pattern detector requires atleast 300 data points for a reliable prediction, received just ', input.values.length); - } - Indicator.reverseInputs(input); - var values = input.values; - var output = yield model.predict(tf.tensor2d([l2Normalize(interpolateArray(values, 400))])); - var index = tf.argMax(output, 1).get(0); - Indicator.reverseInputs(input); - return { patternId: index, pattern: oneHotMap[index], probability: output.get(0, 4) * 100 }; - }); -} -export function hasDoubleBottom(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.DB); - }); -} -export function hasDoubleTop(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.DT); - }); -} -export function hasHeadAndShoulder(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.HS); - }); -} -export function hasInverseHeadAndShoulder(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.IHS); - }); -} -export function isTrendingUp(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.TU); - }); -} -export function isTrendingDown(input) { - return __awaiter(this, void 0, void 0, function* () { - var result = yield predictPattern(input); - return (result.patternId === AvailablePatterns.TD); - }); -} -export class PatternDetector extends Indicator { -} -PatternDetector.predictPattern = predictPattern; -PatternDetector.hasDoubleBottom = hasDoubleBottom; -PatternDetector.hasDoubleTop = hasDoubleTop; -PatternDetector.hasHeadAndShoulder = hasHeadAndShoulder; -PatternDetector.hasInverseHeadAndShoulder = hasInverseHeadAndShoulder; -PatternDetector.isTrendingUp = isTrendingUp; -PatternDetector.isTrendingDown = isTrendingDown; diff --git a/lib/patterndetection/patterndetection.js.map b/lib/patterndetection/patterndetection.js.map deleted file mode 100644 index ab4a234..0000000 --- a/lib/patterndetection/patterndetection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patterndetection.js","sourceRoot":"","sources":["../../src/patterndetection/patterndetection.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAM9B,IAAI,CAAC;IACD,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAA;AAC5F,CAAC;AAAC,KAAK,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC;AAEd,IAAI,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC;AAE7D,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS;IAClE,GAAG,EAAE,KAAK;IACV,UAAU,EAAE,iBAAiB;CAChC,CAAC,CAAA;AAEF,MAAM,2BAA4B,SAAQ,cAAc;IACpD,YAAmB,MAAe;QAC9B,KAAK,EAAE,CAAC;QADO,WAAM,GAAN,MAAM,CAAS;IAElC,CAAC;CACJ;AAED,MAAM,CAAN,IAAY,iBAOX;AAPD,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AC,CAAC,MAAM,CAAC,SAAS,KAAK,iBAAiB,CAAC,EAAE,IAAI,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAED,MAAM,yBAA+B,KAA0B;;QAC3D,IAAI,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,CAAA;QACxC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,iBAAiB,CAAC,EAAE,IAAI,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAED,MAAM,sBAAuB,SAAQ,SAAS;;AACnC,8BAAc,GAAG,cAAc,CAAC;AAChC,+BAAe,GAAG,eAAe,CAAC;AAClC,4BAAY,GAAG,YAAY,CAAC;AAC5B,kCAAkB,GAAG,kBAAkB,CAAC;AACxC,yCAAyB,GAAG,yBAAyB,CAAC;AACtD,4BAAY,GAAG,YAAY,CAAC;AAC5B,8BAAc,GAAG,cAAc,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 70bb5ce..4d70642 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,6 @@ "typescript": "^2.9.2" }, "dependencies": { - "@tensorflow/tfjs": "^1.2.7", - "@tensorflow/tfjs-node": "^1.2.7", "@types/node": "^6.0.96" } } diff --git a/src/index.ts b/src/index.ts index 2cabaa1..bcaf5d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,14 +79,14 @@ export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement} from './drawingtools/fibonacci'; -export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -export { AvailablePatterns } from './patterndetection/patterndetection'; -export { hasDoubleBottom} from './patterndetection/patterndetection'; -export { hasDoubleTop } from './patterndetection/patterndetection'; -export { hasHeadAndShoulder} from './patterndetection/patterndetection'; -export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -export { isTrendingUp} from './patterndetection/patterndetection'; -export { isTrendingDown } from './patterndetection/patterndetection'; +//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +//export { AvailablePatterns } from './patterndetection/patterndetection'; +//export { hasDoubleBottom} from './patterndetection/patterndetection'; +//export { hasDoubleTop } from './patterndetection/patterndetection'; +//export { hasHeadAndShoulder} from './patterndetection/patterndetection'; +//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +//export { isTrendingUp} from './patterndetection/patterndetection'; +//export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; From dd3beb6ad01c2fc628ddab3c9527c8ce6e08bbc3 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Thu, 5 Sep 2019 08:34:26 -0600 Subject: [PATCH 7/8] Revert "rem pattern detection" This reverts commit 1aef5b55cbd69d465d422df6b81136a9ae0f6109. --- declarations/index.d.ts | 16 +- index.js | 2 +- lib/index.js | 16 +- lib/patterndetection/patterndetection.js | 165 +++++++++++++++++++ lib/patterndetection/patterndetection.js.map | 1 + package.json | 2 + src/index.ts | 16 +- 7 files changed, 193 insertions(+), 25 deletions(-) create mode 100644 lib/patterndetection/patterndetection.js create mode 100644 lib/patterndetection/patterndetection.js.map diff --git a/declarations/index.d.ts b/declarations/index.d.ts index d6cb507..2cd9f0a 100644 --- a/declarations/index.d.ts +++ b/declarations/index.d.ts @@ -72,14 +72,14 @@ export { shootingstarunconfirmed } from './candlestick/ShootingStarUnconfirmed'; export { tweezertop } from './candlestick/TweezerTop'; export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement } from './drawingtools/fibonacci'; -//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -//export { AvailablePatterns } from './patterndetection/patterndetection'; -//export { hasDoubleBottom } from './patterndetection/patterndetection'; -//export { hasDoubleTop } from './patterndetection/patterndetection'; -//export { hasHeadAndShoulder } from './patterndetection/patterndetection'; -//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -//export { isTrendingUp } from './patterndetection/patterndetection'; -//export { isTrendingDown } from './patterndetection/patterndetection'; +export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +export { AvailablePatterns } from './patterndetection/patterndetection'; +export { hasDoubleBottom } from './patterndetection/patterndetection'; +export { hasDoubleTop } from './patterndetection/patterndetection'; +export { hasHeadAndShoulder } from './patterndetection/patterndetection'; +export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +export { isTrendingUp } from './patterndetection/patterndetection'; +export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; export { keltnerchannels, KeltnerChannels, KeltnerChannelsInput, KeltnerChannelsOutput } from './volatility/KeltnerChannels'; export { chandelierexit, ChandelierExit, ChandelierExitInput, ChandelierExitOutput } from './volatility/ChandelierExit'; diff --git a/index.js b/index.js index 68d9a1a..4947eef 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,7 @@ export function getAvailableIndicators () { AvailableIndicators.push('tweezertop'); AvailableIndicators.push('tweezerbottom'); - //AvailableIndicators.push('predictPattern'); + AvailableIndicators.push('predictPattern'); AvailableIndicators.push('hasDoubleBottom'); AvailableIndicators.push('hasDoubleTop'); AvailableIndicators.push('hasHeadAndShoulder'); diff --git a/lib/index.js b/lib/index.js index d6cb507..2cd9f0a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -72,14 +72,14 @@ export { shootingstarunconfirmed } from './candlestick/ShootingStarUnconfirmed'; export { tweezertop } from './candlestick/TweezerTop'; export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement } from './drawingtools/fibonacci'; -//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -//export { AvailablePatterns } from './patterndetection/patterndetection'; -//export { hasDoubleBottom } from './patterndetection/patterndetection'; -//export { hasDoubleTop } from './patterndetection/patterndetection'; -//export { hasHeadAndShoulder } from './patterndetection/patterndetection'; -//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -//export { isTrendingUp } from './patterndetection/patterndetection'; -//export { isTrendingDown } from './patterndetection/patterndetection'; +export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +export { AvailablePatterns } from './patterndetection/patterndetection'; +export { hasDoubleBottom } from './patterndetection/patterndetection'; +export { hasDoubleTop } from './patterndetection/patterndetection'; +export { hasHeadAndShoulder } from './patterndetection/patterndetection'; +export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +export { isTrendingUp } from './patterndetection/patterndetection'; +export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; export { keltnerchannels, KeltnerChannels, KeltnerChannelsInput, KeltnerChannelsOutput } from './volatility/KeltnerChannels'; export { chandelierexit, ChandelierExit, ChandelierExitInput, ChandelierExitOutput } from './volatility/ChandelierExit'; diff --git a/lib/patterndetection/patterndetection.js b/lib/patterndetection/patterndetection.js new file mode 100644 index 0000000..0de4e69 --- /dev/null +++ b/lib/patterndetection/patterndetection.js @@ -0,0 +1,165 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { Indicator, IndicatorInput } from '../indicator/indicator'; +// import * as tf from '@tensorflow/tfjs'; +var isNodeEnvironment = false; +var model; +var oneHotMap = ['IHS', 'TU', 'DB', 'HS', 'TD', 'DT']; +var tf; +try { + isNodeEnvironment = Object.prototype.toString.call(global.process) === '[object process]'; +} +catch (e) { } +export class PatternDetectorInput extends IndicatorInput { + constructor(values) { + super(); + this.values = values; + } +} +export var AvailablePatterns; +(function (AvailablePatterns) { + AvailablePatterns[AvailablePatterns["IHS"] = 0] = "IHS"; + AvailablePatterns[AvailablePatterns["TU"] = 1] = "TU"; + AvailablePatterns[AvailablePatterns["DB"] = 2] = "DB"; + AvailablePatterns[AvailablePatterns["HS"] = 3] = "HS"; + AvailablePatterns[AvailablePatterns["TD"] = 4] = "TD"; + AvailablePatterns[AvailablePatterns["DT"] = 5] = "DT"; +})(AvailablePatterns || (AvailablePatterns = {})); +function interpolateArray(data, fitCount) { + var linearInterpolate = function (before, after, atPoint) { + return before + (after - before) * atPoint; + }; + var newData = new Array(); + var springFactor = new Number((data.length - 1) / (fitCount - 1)); + newData[0] = data[0]; // for new allocation + for (var i = 1; i < fitCount - 1; i++) { + var tmp = i * springFactor; + var before = new Number(Math.floor(tmp)).toFixed(); + var after = new Number(Math.ceil(tmp)).toFixed(); + var atPoint = tmp - before; + newData[i] = linearInterpolate(data[before], data[after], atPoint); + } + newData[fitCount - 1] = data[data.length - 1]; // for new allocation + return newData; +} +; +function l2Normalize(arr) { + var sum = arr.reduce((cum, value) => { return cum + (value * value); }, 0); + var norm = Math.sqrt(sum); + return arr.map((v) => v / norm); +} +export class PatternDetectorOutput { +} +var modelLoaded = false; +var laodingModel = false; +var loadingPromise; +function loadModel() { + return __awaiter(this, void 0, void 0, function* () { + if (modelLoaded) + return Promise.resolve(true); + if (laodingModel) + return loadingPromise; + laodingModel = true; + loadingPromise = new Promise(function (resolve, reject) { + return __awaiter(this, void 0, void 0, function* () { + if (isNodeEnvironment) { + tf = require('@tensorflow/tfjs'); + console.log('Nodejs Environment detected '); + var tfnode = require('@tensorflow/tfjs-node'); + var modelPath = require('path').resolve(__dirname, '../tf_model/model.json'); + model = yield tf.loadModel(tfnode.io.fileSystem(modelPath)); + } + else { + if (typeof window.tf == "undefined") { + modelLoaded = false; + laodingModel = false; + console.log('Tensorflow js not imported, pattern detection may not work'); + resolve(); + return; + } + tf = window.tf; + console.log('Browser Environment detected ', tf); + console.log('Loading model ....'); + model = yield tf.loadModel('/tf_model/model.json'); + modelLoaded = true; + laodingModel = false; + setTimeout(resolve, 1000); + console.log('Loaded model'); + return; + } + modelLoaded = true; + laodingModel = false; + resolve(); + return; + }); + }); + yield loadingPromise; + return; + }); +} +loadModel(); +export function predictPattern(input) { + return __awaiter(this, void 0, void 0, function* () { + yield loadModel(); + if (input.values.length < 300) { + console.warn('Pattern detector requires atleast 300 data points for a reliable prediction, received just ', input.values.length); + } + Indicator.reverseInputs(input); + var values = input.values; + var output = yield model.predict(tf.tensor2d([l2Normalize(interpolateArray(values, 400))])); + var index = tf.argMax(output, 1).get(0); + Indicator.reverseInputs(input); + return { patternId: index, pattern: oneHotMap[index], probability: output.get(0, 4) * 100 }; + }); +} +export function hasDoubleBottom(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.DB); + }); +} +export function hasDoubleTop(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.DT); + }); +} +export function hasHeadAndShoulder(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.HS); + }); +} +export function hasInverseHeadAndShoulder(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.IHS); + }); +} +export function isTrendingUp(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.TU); + }); +} +export function isTrendingDown(input) { + return __awaiter(this, void 0, void 0, function* () { + var result = yield predictPattern(input); + return (result.patternId === AvailablePatterns.TD); + }); +} +export class PatternDetector extends Indicator { +} +PatternDetector.predictPattern = predictPattern; +PatternDetector.hasDoubleBottom = hasDoubleBottom; +PatternDetector.hasDoubleTop = hasDoubleTop; +PatternDetector.hasHeadAndShoulder = hasHeadAndShoulder; +PatternDetector.hasInverseHeadAndShoulder = hasInverseHeadAndShoulder; +PatternDetector.isTrendingUp = isTrendingUp; +PatternDetector.isTrendingDown = isTrendingDown; diff --git a/lib/patterndetection/patterndetection.js.map b/lib/patterndetection/patterndetection.js.map new file mode 100644 index 0000000..ab4a234 --- /dev/null +++ b/lib/patterndetection/patterndetection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patterndetection.js","sourceRoot":"","sources":["../../src/patterndetection/patterndetection.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAM9B,IAAI,CAAC;IACD,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAA;AAC5F,CAAC;AAAC,KAAK,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC;AAEd,IAAI,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC;AAE7D,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS;IAClE,GAAG,EAAE,KAAK;IACV,UAAU,EAAE,iBAAiB;CAChC,CAAC,CAAA;AAEF,MAAM,2BAA4B,SAAQ,cAAc;IACpD,YAAmB,MAAe;QAC9B,KAAK,EAAE,CAAC;QADO,WAAM,GAAN,MAAM,CAAS;IAElC,CAAC;CACJ;AAED,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IACzB,qDAAI,CAAA;IACJ,uDAAK,CAAA;IACL,qDAAI,CAAA;IACJ,qDAAI,CAAA;IACJ,qDAAI,CAAA;IACJ,qDAAI,CAAA;AACR,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAED,0BAA0B,IAAQ,EAAE,QAAY;IAC5C,IAAI,iBAAiB,GAAG,UAAU,MAA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AAS,KAAK,iBAAiB,CAAC,EAAE,IAAI,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAED,MAAM,sBAAuB,SAAQ,SAAS;;AACnC,8BAAc,GAAG,cAAc,CAAC;AAChC,+BAAe,GAAG,eAAe,CAAC;AAClC,4BAAY,GAAG,YAAY,CAAC;AAC5B,kCAAkB,GAAG,kBAAkB,CAAC;AACxC,yCAAyB,GAAG,yBAAyB,CAAC;AACtD,4BAAY,GAAG,YAAY,CAAC;AAC5B,8BAAc,GAAG,cAAc,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 4d70642..70bb5ce 100644 --- a/package.json +++ b/package.json @@ -147,6 +147,8 @@ "typescript": "^2.9.2" }, "dependencies": { + "@tensorflow/tfjs": "^1.2.7", + "@tensorflow/tfjs-node": "^1.2.7", "@types/node": "^6.0.96" } } diff --git a/src/index.ts b/src/index.ts index bcaf5d0..2cabaa1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,14 +79,14 @@ export { tweezerbottom } from './candlestick/TweezerBottom'; export { fibonacciretracement} from './drawingtools/fibonacci'; -//export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; -//export { AvailablePatterns } from './patterndetection/patterndetection'; -//export { hasDoubleBottom} from './patterndetection/patterndetection'; -//export { hasDoubleTop } from './patterndetection/patterndetection'; -//export { hasHeadAndShoulder} from './patterndetection/patterndetection'; -//export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; -//export { isTrendingUp} from './patterndetection/patterndetection'; -//export { isTrendingDown } from './patterndetection/patterndetection'; +export { predictPattern, PatternDetector } from './patterndetection/patterndetection'; +export { AvailablePatterns } from './patterndetection/patterndetection'; +export { hasDoubleBottom} from './patterndetection/patterndetection'; +export { hasDoubleTop } from './patterndetection/patterndetection'; +export { hasHeadAndShoulder} from './patterndetection/patterndetection'; +export { hasInverseHeadAndShoulder } from './patterndetection/patterndetection'; +export { isTrendingUp} from './patterndetection/patterndetection'; +export { isTrendingDown } from './patterndetection/patterndetection'; export { ichimokucloud, IchimokuCloud } from './ichimoku/IchimokuCloud'; From c9b19f2c73c9a109fe3abe1e60ed21355e5d5524 Mon Sep 17 00:00:00 2001 From: "JSapp.me" Date: Thu, 5 Sep 2019 08:39:57 -0600 Subject: [PATCH 8/8] tfjs upd --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 70bb5ce..9d7d7f9 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,8 @@ "typescript": "^2.9.2" }, "dependencies": { - "@tensorflow/tfjs": "^1.2.7", - "@tensorflow/tfjs-node": "^1.2.7", + "@tensorflow/tfjs": "^1.2.8", + "@tensorflow/tfjs-node": "^1.2.8", "@types/node": "^6.0.96" } }