{"action":"created","comment":{"url":"https://api.github.com/repos/ta4j/ta4j/pulls/comments/173326442","pull_request_review_id":102501131,"id":173326442,"diff_hunk":"@@ -34,21 +37,25 @@ this software and associated documentation files (the \"Software\"), to deal in\n public class NumberOfBarsCriterion extends AbstractAnalysisCriterion {\n \n     @Override\n-    public double calculate(TimeSeries series, TradingRecord tradingRecord) {\n-        int nBars = 0;\n+    public Num calculate(TimeSeries series, TradingRecord tradingRecord) {\n+        Num nBars = series.numOf(0);\n         for (Trade trade : tradingRecord.getTrades()) {\n-            nBars += calculate(series, trade);\n+            nBars = nBars.plus(calculate(series, trade));\n         }\n         return nBars;\n     }\n \n     @Override\n-    public double calculate(TimeSeries series, Trade trade) {\n-        return (1 + trade.getExit().getIndex()) - trade.getEntry().getIndex();\n+    public Num calculate(TimeSeries series, Trade trade) {\n+        Objects.requireNonNull(series, \"Series must be not null\");","path":"ta4j-core/src/main/java/org/ta4j/core/analysis/criteria/NumberOfBarsCriterion.java","position":29,"original_position":29,"commit_id":"5661fc3eae16f60d9e0025cbdfdf57b6140c8dba","original_commit_id":"7920ff5995b98c75fb1d8b02b28263bbb68fbe8c","user":{"login":"edlins","id":12804882,"avatar_url":"https://avatars2.githubusercontent.com/u/12804882?v=4","gravatar_id":"","url":"https://api.github.com/users/edlins","html_url":"https://github.com/edlins","followers_url":"https://api.github.com/users/edlins/followers","following_url":"https://api.github.com/users/edlins/following{/other_user}","gists_url":"https://api.github.com/users/edlins/gists{/gist_id}","starred_url":"https://api.github.com/users/edlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edlins/subscriptions","organizations_url":"https://api.github.com/users/edlins/orgs","repos_url":"https://api.github.com/users/edlins/repos","events_url":"https://api.github.com/users/edlins/events{/privacy}","received_events_url":"https://api.github.com/users/edlins/received_events","type":"User","site_admin":false},"body":"OOS, opened #216 .","created_at":"2018-03-08T23:36:28Z","updated_at":"2018-03-08T23:36:28Z","html_url":"https://github.com/ta4j/ta4j/pull/208#discussion_r173326442","pull_request_url":"https://api.github.com/repos/ta4j/ta4j/pulls/208","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/comments/173326442"},"html":{"href":"https://github.com/ta4j/ta4j/pull/208#discussion_r173326442"},"pull_request":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/208"}},"in_reply_to_id":173265837},"pull_request":{"url":"https://api.github.com/repos/ta4j/ta4j/pulls/208","id":172971843,"html_url":"https://github.com/ta4j/ta4j/pull/208","diff_url":"https://github.com/ta4j/ta4j/pull/208.diff","patch_url":"https://github.com/ta4j/ta4j/pull/208.patch","issue_url":"https://api.github.com/repos/ta4j/ta4j/issues/208","number":208,"state":"open","locked":false,"title":"Update AnalysisCriterion to Num","user":{"login":"MarijnKoesen","id":711208,"avatar_url":"https://avatars3.githubusercontent.com/u/711208?v=4","gravatar_id":"","url":"https://api.github.com/users/MarijnKoesen","html_url":"https://github.com/MarijnKoesen","followers_url":"https://api.github.com/users/MarijnKoesen/followers","following_url":"https://api.github.com/users/MarijnKoesen/following{/other_user}","gists_url":"https://api.github.com/users/MarijnKoesen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarijnKoesen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarijnKoesen/subscriptions","organizations_url":"https://api.github.com/users/MarijnKoesen/orgs","repos_url":"https://api.github.com/users/MarijnKoesen/repos","events_url":"https://api.github.com/users/MarijnKoesen/events{/privacy}","received_events_url":"https://api.github.com/users/MarijnKoesen/received_events","type":"User","site_admin":false},"body":"Fixes #186 .\r\n\r\nChanges proposed in this pull request:\r\n- Fixed requirements as mentioned in #186\r\n- Use Num in AnalysisCriterion\r\n- But keep Criterion parameters as primitives\r\n\r\n- [x] added an entry to the unreleased section of `CHANGES.md` \r\n\r\n\r\nNotes:\r\n* There was 1 test, namely NumberOfTradesTest::calculateWithOneTrade that passed the TimeSeries as null, but I changed this to some series, otherwise series.numOf() would give a null pointer exception,\r\n* LinearTransactionCostCriterionTest is giving different results, it's not consistent anymore with external data, nor the test data, it looks to me like a precision diff between double/Num. Please check it. I think we should change the xls/tests to reflect the new outcome. (Because of this the tests are currently failing)\r\n* Don't merge yet, until LinearTransactionCostCriterion(Test) is fixed :)","created_at":"2018-03-05T20:04:05Z","updated_at":"2018-03-08T23:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec14fd197c229aa0edf56dde3f5685b3c569eea3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ta4j/ta4j/pulls/208/commits","review_comments_url":"https://api.github.com/repos/ta4j/ta4j/pulls/208/comments","review_comment_url":"https://api.github.com/repos/ta4j/ta4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ta4j/ta4j/issues/208/comments","statuses_url":"https://api.github.com/repos/ta4j/ta4j/statuses/5661fc3eae16f60d9e0025cbdfdf57b6140c8dba","head":{"label":"MarijnKoesen:feature/use_num_in_analysis_criterion","ref":"feature/use_num_in_analysis_criterion","sha":"5661fc3eae16f60d9e0025cbdfdf57b6140c8dba","user":{"login":"MarijnKoesen","id":711208,"avatar_url":"https://avatars3.githubusercontent.com/u/711208?v=4","gravatar_id":"","url":"https://api.github.com/users/MarijnKoesen","html_url":"https://github.com/MarijnKoesen","followers_url":"https://api.github.com/users/MarijnKoesen/followers","following_url":"https://api.github.com/users/MarijnKoesen/following{/other_user}","gists_url":"https://api.github.com/users/MarijnKoesen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarijnKoesen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarijnKoesen/subscriptions","organizations_url":"https://api.github.com/users/MarijnKoesen/orgs","repos_url":"https://api.github.com/users/MarijnKoesen/repos","events_url":"https://api.github.com/users/MarijnKoesen/events{/privacy}","received_events_url":"https://api.github.com/users/MarijnKoesen/received_events","type":"User","site_admin":false},"repo":{"id":123676914,"name":"ta4j","full_name":"MarijnKoesen/ta4j","owner":{"login":"MarijnKoesen","id":711208,"avatar_url":"https://avatars3.githubusercontent.com/u/711208?v=4","gravatar_id":"","url":"https://api.github.com/users/MarijnKoesen","html_url":"https://github.com/MarijnKoesen","followers_url":"https://api.github.com/users/MarijnKoesen/followers","following_url":"https://api.github.com/users/MarijnKoesen/following{/other_user}","gists_url":"https://api.github.com/users/MarijnKoesen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarijnKoesen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarijnKoesen/subscriptions","organizations_url":"https://api.github.com/users/MarijnKoesen/orgs","repos_url":"https://api.github.com/users/MarijnKoesen/repos","events_url":"https://api.github.com/users/MarijnKoesen/events{/privacy}","received_events_url":"https://api.github.com/users/MarijnKoesen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MarijnKoesen/ta4j","description":"A Java library for technical analysis.","fork":true,"url":"https://api.github.com/repos/MarijnKoesen/ta4j","forks_url":"https://api.github.com/repos/MarijnKoesen/ta4j/forks","keys_url":"https://api.github.com/repos/MarijnKoesen/ta4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarijnKoesen/ta4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarijnKoesen/ta4j/teams","hooks_url":"https://api.github.com/repos/MarijnKoesen/ta4j/hooks","issue_events_url":"https://api.github.com/repos/MarijnKoesen/ta4j/issues/events{/number}","events_url":"https://api.github.com/repos/MarijnKoesen/ta4j/events","assignees_url":"https://api.github.com/repos/MarijnKoesen/ta4j/assignees{/user}","branches_url":"https://api.github.com/repos/MarijnKoesen/ta4j/branches{/branch}","tags_url":"https://api.github.com/repos/MarijnKoesen/ta4j/tags","blobs_url":"https://api.github.com/repos/MarijnKoesen/ta4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarijnKoesen/ta4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarijnKoesen/ta4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarijnKoesen/ta4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarijnKoesen/ta4j/statuses/{sha}","languages_url":"https://api.github.com/repos/MarijnKoesen/ta4j/languages","stargazers_url":"https://api.github.com/repos/MarijnKoesen/ta4j/stargazers","contributors_url":"https://api.github.com/repos/MarijnKoesen/ta4j/contributors","subscribers_url":"https://api.github.com/repos/MarijnKoesen/ta4j/subscribers","subscription_url":"https://api.github.com/repos/MarijnKoesen/ta4j/subscription","commits_url":"https://api.github.com/repos/MarijnKoesen/ta4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarijnKoesen/ta4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarijnKoesen/ta4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarijnKoesen/ta4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarijnKoesen/ta4j/contents/{+path}","compare_url":"https://api.github.com/repos/MarijnKoesen/ta4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarijnKoesen/ta4j/merges","archive_url":"https://api.github.com/repos/MarijnKoesen/ta4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarijnKoesen/ta4j/downloads","issues_url":"https://api.github.com/repos/MarijnKoesen/ta4j/issues{/number}","pulls_url":"https://api.github.com/repos/MarijnKoesen/ta4j/pulls{/number}","milestones_url":"https://api.github.com/repos/MarijnKoesen/ta4j/milestones{/number}","notifications_url":"https://api.github.com/repos/MarijnKoesen/ta4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarijnKoesen/ta4j/labels{/name}","releases_url":"https://api.github.com/repos/MarijnKoesen/ta4j/releases{/id}","deployments_url":"https://api.github.com/repos/MarijnKoesen/ta4j/deployments","created_at":"2018-03-03T09:15:45Z","updated_at":"2018-03-03T09:15:48Z","pushed_at":"2018-03-08T21:32:43Z","git_url":"git://github.com/MarijnKoesen/ta4j.git","ssh_url":"git@github.com:MarijnKoesen/ta4j.git","clone_url":"https://github.com/MarijnKoesen/ta4j.git","svn_url":"https://github.com/MarijnKoesen/ta4j","homepage":"https://ta4j.github.io/ta4j-wiki/","size":5036,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ta4j:develop","ref":"develop","sha":"3e0ac2998d098b5be3acd199920e4fce6ba81796","user":{"login":"ta4j","id":31952695,"avatar_url":"https://avatars2.githubusercontent.com/u/31952695?v=4","gravatar_id":"","url":"https://api.github.com/users/ta4j","html_url":"https://github.com/ta4j","followers_url":"https://api.github.com/users/ta4j/followers","following_url":"https://api.github.com/users/ta4j/following{/other_user}","gists_url":"https://api.github.com/users/ta4j/gists{/gist_id}","starred_url":"https://api.github.com/users/ta4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta4j/subscriptions","organizations_url":"https://api.github.com/users/ta4j/orgs","repos_url":"https://api.github.com/users/ta4j/repos","events_url":"https://api.github.com/users/ta4j/events{/privacy}","received_events_url":"https://api.github.com/users/ta4j/received_events","type":"Organization","site_admin":false},"repo":{"id":103560333,"name":"ta4j","full_name":"ta4j/ta4j","owner":{"login":"ta4j","id":31952695,"avatar_url":"https://avatars2.githubusercontent.com/u/31952695?v=4","gravatar_id":"","url":"https://api.github.com/users/ta4j","html_url":"https://github.com/ta4j","followers_url":"https://api.github.com/users/ta4j/followers","following_url":"https://api.github.com/users/ta4j/following{/other_user}","gists_url":"https://api.github.com/users/ta4j/gists{/gist_id}","starred_url":"https://api.github.com/users/ta4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta4j/subscriptions","organizations_url":"https://api.github.com/users/ta4j/orgs","repos_url":"https://api.github.com/users/ta4j/repos","events_url":"https://api.github.com/users/ta4j/events{/privacy}","received_events_url":"https://api.github.com/users/ta4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ta4j/ta4j","description":"A Java library for technical analysis.","fork":false,"url":"https://api.github.com/repos/ta4j/ta4j","forks_url":"https://api.github.com/repos/ta4j/ta4j/forks","keys_url":"https://api.github.com/repos/ta4j/ta4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ta4j/ta4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ta4j/ta4j/teams","hooks_url":"https://api.github.com/repos/ta4j/ta4j/hooks","issue_events_url":"https://api.github.com/repos/ta4j/ta4j/issues/events{/number}","events_url":"https://api.github.com/repos/ta4j/ta4j/events","assignees_url":"https://api.github.com/repos/ta4j/ta4j/assignees{/user}","branches_url":"https://api.github.com/repos/ta4j/ta4j/branches{/branch}","tags_url":"https://api.github.com/repos/ta4j/ta4j/tags","blobs_url":"https://api.github.com/repos/ta4j/ta4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ta4j/ta4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ta4j/ta4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/ta4j/ta4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ta4j/ta4j/statuses/{sha}","languages_url":"https://api.github.com/repos/ta4j/ta4j/languages","stargazers_url":"https://api.github.com/repos/ta4j/ta4j/stargazers","contributors_url":"https://api.github.com/repos/ta4j/ta4j/contributors","subscribers_url":"https://api.github.com/repos/ta4j/ta4j/subscribers","subscription_url":"https://api.github.com/repos/ta4j/ta4j/subscription","commits_url":"https://api.github.com/repos/ta4j/ta4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/ta4j/ta4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/ta4j/ta4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/ta4j/ta4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/ta4j/ta4j/contents/{+path}","compare_url":"https://api.github.com/repos/ta4j/ta4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ta4j/ta4j/merges","archive_url":"https://api.github.com/repos/ta4j/ta4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ta4j/ta4j/downloads","issues_url":"https://api.github.com/repos/ta4j/ta4j/issues{/number}","pulls_url":"https://api.github.com/repos/ta4j/ta4j/pulls{/number}","milestones_url":"https://api.github.com/repos/ta4j/ta4j/milestones{/number}","notifications_url":"https://api.github.com/repos/ta4j/ta4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ta4j/ta4j/labels{/name}","releases_url":"https://api.github.com/repos/ta4j/ta4j/releases{/id}","deployments_url":"https://api.github.com/repos/ta4j/ta4j/deployments","created_at":"2017-09-14T17:14:32Z","updated_at":"2018-03-08T08:10:53Z","pushed_at":"2018-03-08T21:33:26Z","git_url":"git://github.com/ta4j/ta4j.git","ssh_url":"git@github.com:ta4j/ta4j.git","clone_url":"https://github.com/ta4j/ta4j.git","svn_url":"https://github.com/ta4j/ta4j","homepage":"https://ta4j.github.io/ta4j-wiki/","size":4829,"stargazers_count":185,"watchers_count":185,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":74,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":74,"open_issues":30,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/208"},"html":{"href":"https://github.com/ta4j/ta4j/pull/208"},"issue":{"href":"https://api.github.com/repos/ta4j/ta4j/issues/208"},"comments":{"href":"https://api.github.com/repos/ta4j/ta4j/issues/208/comments"},"review_comments":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/208/comments"},"review_comment":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ta4j/ta4j/pulls/208/commits"},"statuses":{"href":"https://api.github.com/repos/ta4j/ta4j/statuses/5661fc3eae16f60d9e0025cbdfdf57b6140c8dba"}},"author_association":"NONE"}}
{"actor":{"display_login":"edlins"}}