{"action":"created","comment":{"url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/comments/41887804","id":41887804,"diff_hunk":"@@ -0,0 +1,68 @@\n+import d3 from 'd3';\n+import _slidingWindow from './slidingWindow';\n+import {rebind} from '../../../util/rebind';\n+\n+export default function() {\n+\n+    var closeValue = function(d, i) { return d.close; },\n+        highValue = function(d, i) { return d.high; },\n+        lowValue = function(d, i) { return d.low; };\n+\n+    var kWindow = _slidingWindow()\n+        .windowSize(5)\n+        .accumulator(function(values) {\n+            var maxHigh = d3.max(values, highValue);\n+            var minLow = d3.min(values, lowValue);\n+            return 100 * (closeValue(values[values.length - 1]) - minLow) / (maxHigh - minLow);\n+        });\n+\n+    var dWindow = _slidingWindow()\n+        .windowSize(3)\n+        .accumulator(function(values) {\n+            if (values[0] === undefined) {\n+                return undefined;\n+            }\n+            return d3.mean(values);\n+        });\n+\n+    var stochastic = function(data) {\n+        var kValues = kWindow(data);\n+        var dValues = dWindow(kValues);\n+        return kValues.map(function(k, i) {","path":"src/indicator/algorithm/calculator/stochasticOscillator.js","position":31,"original_position":31,"commit_id":"c5789aa052e1dc068ff2f8917a40619fc2c7e401","original_commit_id":"c5789aa052e1dc068ff2f8917a40619fc2c7e401","user":{"login":"jdunkerley","id":4699705,"avatar_url":"https://avatars.githubusercontent.com/u/4699705?v=3","gravatar_id":"","url":"https://api.github.com/users/jdunkerley","html_url":"https://github.com/jdunkerley","followers_url":"https://api.github.com/users/jdunkerley/followers","following_url":"https://api.github.com/users/jdunkerley/following{/other_user}","gists_url":"https://api.github.com/users/jdunkerley/gists{/gist_id}","starred_url":"https://api.github.com/users/jdunkerley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdunkerley/subscriptions","organizations_url":"https://api.github.com/users/jdunkerley/orgs","repos_url":"https://api.github.com/users/jdunkerley/repos","events_url":"https://api.github.com/users/jdunkerley/events{/privacy}","received_events_url":"https://api.github.com/users/jdunkerley/received_events","type":"User","site_admin":false},"body":"Yep d3 has implementation will change to that:\r\nhttps://github.com/mbostock/d3/wiki/Arrays#d3_zip","created_at":"2015-10-13T16:09:04Z","updated_at":"2015-10-13T16:09:04Z","html_url":"https://github.com/ScottLogic/d3fc/pull/611#discussion_r41887804","pull_request_url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611","_links":{"self":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/comments/41887804"},"html":{"href":"https://github.com/ScottLogic/d3fc/pull/611#discussion_r41887804"},"pull_request":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611"}}},"pull_request":{"url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611","id":47551084,"html_url":"https://github.com/ScottLogic/d3fc/pull/611","diff_url":"https://github.com/ScottLogic/d3fc/pull/611.diff","patch_url":"https://github.com/ScottLogic/d3fc/pull/611.patch","issue_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/611","number":611,"state":"open","locked":false,"title":"Implemenation of Stochastic Oscillator Indicator","user":{"login":"jdunkerley","id":4699705,"avatar_url":"https://avatars.githubusercontent.com/u/4699705?v=3","gravatar_id":"","url":"https://api.github.com/users/jdunkerley","html_url":"https://github.com/jdunkerley","followers_url":"https://api.github.com/users/jdunkerley/followers","following_url":"https://api.github.com/users/jdunkerley/following{/other_user}","gists_url":"https://api.github.com/users/jdunkerley/gists{/gist_id}","starred_url":"https://api.github.com/users/jdunkerley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdunkerley/subscriptions","organizations_url":"https://api.github.com/users/jdunkerley/orgs","repos_url":"https://api.github.com/users/jdunkerley/repos","events_url":"https://api.github.com/users/jdunkerley/events{/privacy}","received_events_url":"https://api.github.com/users/jdunkerley/received_events","type":"User","site_admin":false},"body":"A first go at a Stochastic Oscillator for d3fc","created_at":"2015-10-13T15:47:04Z","updated_at":"2015-10-13T16:09:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7be462733933190a17b05ed657316b85f9340c7e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611/commits","review_comments_url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611/comments","review_comment_url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/611/comments","statuses_url":"https://api.github.com/repos/ScottLogic/d3fc/statuses/c5789aa052e1dc068ff2f8917a40619fc2c7e401","head":{"label":"jdunkerley:stochastics","ref":"stochastics","sha":"c5789aa052e1dc068ff2f8917a40619fc2c7e401","user":{"login":"jdunkerley","id":4699705,"avatar_url":"https://avatars.githubusercontent.com/u/4699705?v=3","gravatar_id":"","url":"https://api.github.com/users/jdunkerley","html_url":"https://github.com/jdunkerley","followers_url":"https://api.github.com/users/jdunkerley/followers","following_url":"https://api.github.com/users/jdunkerley/following{/other_user}","gists_url":"https://api.github.com/users/jdunkerley/gists{/gist_id}","starred_url":"https://api.github.com/users/jdunkerley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdunkerley/subscriptions","organizations_url":"https://api.github.com/users/jdunkerley/orgs","repos_url":"https://api.github.com/users/jdunkerley/repos","events_url":"https://api.github.com/users/jdunkerley/events{/privacy}","received_events_url":"https://api.github.com/users/jdunkerley/received_events","type":"User","site_admin":false},"repo":{"id":43490371,"name":"d3fc","full_name":"jdunkerley/d3fc","owner":{"login":"jdunkerley","id":4699705,"avatar_url":"https://avatars.githubusercontent.com/u/4699705?v=3","gravatar_id":"","url":"https://api.github.com/users/jdunkerley","html_url":"https://github.com/jdunkerley","followers_url":"https://api.github.com/users/jdunkerley/followers","following_url":"https://api.github.com/users/jdunkerley/following{/other_user}","gists_url":"https://api.github.com/users/jdunkerley/gists{/gist_id}","starred_url":"https://api.github.com/users/jdunkerley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdunkerley/subscriptions","organizations_url":"https://api.github.com/users/jdunkerley/orgs","repos_url":"https://api.github.com/users/jdunkerley/repos","events_url":"https://api.github.com/users/jdunkerley/events{/privacy}","received_events_url":"https://api.github.com/users/jdunkerley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdunkerley/d3fc","description":"A collection of components that make it easy to build interactive charts with D3","fork":true,"url":"https://api.github.com/repos/jdunkerley/d3fc","forks_url":"https://api.github.com/repos/jdunkerley/d3fc/forks","keys_url":"https://api.github.com/repos/jdunkerley/d3fc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdunkerley/d3fc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdunkerley/d3fc/teams","hooks_url":"https://api.github.com/repos/jdunkerley/d3fc/hooks","issue_events_url":"https://api.github.com/repos/jdunkerley/d3fc/issues/events{/number}","events_url":"https://api.github.com/repos/jdunkerley/d3fc/events","assignees_url":"https://api.github.com/repos/jdunkerley/d3fc/assignees{/user}","branches_url":"https://api.github.com/repos/jdunkerley/d3fc/branches{/branch}","tags_url":"https://api.github.com/repos/jdunkerley/d3fc/tags","blobs_url":"https://api.github.com/repos/jdunkerley/d3fc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdunkerley/d3fc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdunkerley/d3fc/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdunkerley/d3fc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdunkerley/d3fc/statuses/{sha}","languages_url":"https://api.github.com/repos/jdunkerley/d3fc/languages","stargazers_url":"https://api.github.com/repos/jdunkerley/d3fc/stargazers","contributors_url":"https://api.github.com/repos/jdunkerley/d3fc/contributors","subscribers_url":"https://api.github.com/repos/jdunkerley/d3fc/subscribers","subscription_url":"https://api.github.com/repos/jdunkerley/d3fc/subscription","commits_url":"https://api.github.com/repos/jdunkerley/d3fc/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdunkerley/d3fc/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdunkerley/d3fc/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdunkerley/d3fc/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdunkerley/d3fc/contents/{+path}","compare_url":"https://api.github.com/repos/jdunkerley/d3fc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdunkerley/d3fc/merges","archive_url":"https://api.github.com/repos/jdunkerley/d3fc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdunkerley/d3fc/downloads","issues_url":"https://api.github.com/repos/jdunkerley/d3fc/issues{/number}","pulls_url":"https://api.github.com/repos/jdunkerley/d3fc/pulls{/number}","milestones_url":"https://api.github.com/repos/jdunkerley/d3fc/milestones{/number}","notifications_url":"https://api.github.com/repos/jdunkerley/d3fc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdunkerley/d3fc/labels{/name}","releases_url":"https://api.github.com/repos/jdunkerley/d3fc/releases{/id}","created_at":"2015-10-01T10:20:02Z","updated_at":"2015-10-01T10:20:03Z","pushed_at":"2015-10-13T15:48:58Z","git_url":"git://github.com/jdunkerley/d3fc.git","ssh_url":"git@github.com:jdunkerley/d3fc.git","clone_url":"https://github.com/jdunkerley/d3fc.git","svn_url":"https://github.com/jdunkerley/d3fc","homepage":"http://d3fc.io/","size":3896,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ScottLogic:master","ref":"master","sha":"619422132aa23ad61bc4584f11334332c3c40417","user":{"login":"ScottLogic","id":2046037,"avatar_url":"https://avatars.githubusercontent.com/u/2046037?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottLogic","html_url":"https://github.com/ScottLogic","followers_url":"https://api.github.com/users/ScottLogic/followers","following_url":"https://api.github.com/users/ScottLogic/following{/other_user}","gists_url":"https://api.github.com/users/ScottLogic/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottLogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottLogic/subscriptions","organizations_url":"https://api.github.com/users/ScottLogic/orgs","repos_url":"https://api.github.com/users/ScottLogic/repos","events_url":"https://api.github.com/users/ScottLogic/events{/privacy}","received_events_url":"https://api.github.com/users/ScottLogic/received_events","type":"Organization","site_admin":false},"repo":{"id":24850617,"name":"d3fc","full_name":"ScottLogic/d3fc","owner":{"login":"ScottLogic","id":2046037,"avatar_url":"https://avatars.githubusercontent.com/u/2046037?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottLogic","html_url":"https://github.com/ScottLogic","followers_url":"https://api.github.com/users/ScottLogic/followers","following_url":"https://api.github.com/users/ScottLogic/following{/other_user}","gists_url":"https://api.github.com/users/ScottLogic/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottLogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottLogic/subscriptions","organizations_url":"https://api.github.com/users/ScottLogic/orgs","repos_url":"https://api.github.com/users/ScottLogic/repos","events_url":"https://api.github.com/users/ScottLogic/events{/privacy}","received_events_url":"https://api.github.com/users/ScottLogic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ScottLogic/d3fc","description":"A collection of components that make it easy to build interactive charts with D3","fork":false,"url":"https://api.github.com/repos/ScottLogic/d3fc","forks_url":"https://api.github.com/repos/ScottLogic/d3fc/forks","keys_url":"https://api.github.com/repos/ScottLogic/d3fc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ScottLogic/d3fc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ScottLogic/d3fc/teams","hooks_url":"https://api.github.com/repos/ScottLogic/d3fc/hooks","issue_events_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/events{/number}","events_url":"https://api.github.com/repos/ScottLogic/d3fc/events","assignees_url":"https://api.github.com/repos/ScottLogic/d3fc/assignees{/user}","branches_url":"https://api.github.com/repos/ScottLogic/d3fc/branches{/branch}","tags_url":"https://api.github.com/repos/ScottLogic/d3fc/tags","blobs_url":"https://api.github.com/repos/ScottLogic/d3fc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ScottLogic/d3fc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ScottLogic/d3fc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ScottLogic/d3fc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ScottLogic/d3fc/statuses/{sha}","languages_url":"https://api.github.com/repos/ScottLogic/d3fc/languages","stargazers_url":"https://api.github.com/repos/ScottLogic/d3fc/stargazers","contributors_url":"https://api.github.com/repos/ScottLogic/d3fc/contributors","subscribers_url":"https://api.github.com/repos/ScottLogic/d3fc/subscribers","subscription_url":"https://api.github.com/repos/ScottLogic/d3fc/subscription","commits_url":"https://api.github.com/repos/ScottLogic/d3fc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ScottLogic/d3fc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ScottLogic/d3fc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ScottLogic/d3fc/contents/{+path}","compare_url":"https://api.github.com/repos/ScottLogic/d3fc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ScottLogic/d3fc/merges","archive_url":"https://api.github.com/repos/ScottLogic/d3fc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ScottLogic/d3fc/downloads","issues_url":"https://api.github.com/repos/ScottLogic/d3fc/issues{/number}","pulls_url":"https://api.github.com/repos/ScottLogic/d3fc/pulls{/number}","milestones_url":"https://api.github.com/repos/ScottLogic/d3fc/milestones{/number}","notifications_url":"https://api.github.com/repos/ScottLogic/d3fc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ScottLogic/d3fc/labels{/name}","releases_url":"https://api.github.com/repos/ScottLogic/d3fc/releases{/id}","created_at":"2014-10-06T15:03:11Z","updated_at":"2015-10-11T07:24:06Z","pushed_at":"2015-10-13T15:48:58Z","git_url":"git://github.com/ScottLogic/d3fc.git","ssh_url":"git@github.com:ScottLogic/d3fc.git","clone_url":"https://github.com/ScottLogic/d3fc.git","svn_url":"https://github.com/ScottLogic/d3fc","homepage":"http://d3fc.io/","size":7220,"stargazers_count":175,"watchers_count":175,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":28,"mirror_url":null,"open_issues_count":59,"forks":28,"open_issues":59,"watchers":175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611"},"html":{"href":"https://github.com/ScottLogic/d3fc/pull/611"},"issue":{"href":"https://api.github.com/repos/ScottLogic/d3fc/issues/611"},"comments":{"href":"https://api.github.com/repos/ScottLogic/d3fc/issues/611/comments"},"review_comments":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611/comments"},"review_comment":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ScottLogic/d3fc/pulls/611/commits"},"statuses":{"href":"https://api.github.com/repos/ScottLogic/d3fc/statuses/c5789aa052e1dc068ff2f8917a40619fc2c7e401"}}}}