{"action":"created","comment":{"url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/comments/180234061","pull_request_review_id":110621039,"id":180234061,"diff_hunk":"@@ -0,0 +1,66 @@\n+// @flow\n+\n+import moment from \"moment\";\n+\n+export type BasisFrame = {\n+  date: moment,\n+  amount: number,\n+  cost: number,\n+};\n+\n+/** A cost basis calculator with LIFO (Last In, First Out) semantics.\n+ * Any time that a currency is being disposed of (e.g. sold or gifted),\n+ * it reports the effective cost basis for that amount of currency, by\n+ * returning the appropriate BasisFrames. Note that it may return several\n+ * BasisFrames, e.g. if you acquired 50 at one cost, 50 at another cost, and then\n+ * dispose of 75, you will get 2 frames (50 from the last frame, 25 from the first one).\n+ */\n+export class LIFOCostBasisCalculator {\n+  frames: BasisFrame[];\n+  ticker: string;\n+\n+  constructor(ticker: string) {\n+    this.frames = [];\n+    this.ticker = ticker;\n+  }\n+\n+  /** Record that a cryptocurrency was acquired at a certain cost */\n+  acquire(date: moment, amount: number, cost: number) {\n+    const frame = {amount, cost, date};","path":"src/tax/basis.js","position":29,"original_position":29,"commit_id":"f7145864a7372392ef488cd68f463c4a91ef4926","original_commit_id":"f7145864a7372392ef488cd68f463c4a91ef4926","user":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"body":"Switched to big.js","created_at":"2018-04-09T21:19:03Z","updated_at":"2018-04-09T21:19:03Z","html_url":"https://github.com/decentralion/cryptofolio/pull/1#discussion_r180234061","pull_request_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/comments/180234061"},"html":{"href":"https://github.com/decentralion/cryptofolio/pull/1#discussion_r180234061"},"pull_request":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1"}},"in_reply_to_id":180136309},"pull_request":{"url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1","id":180238470,"html_url":"https://github.com/decentralion/cryptofolio/pull/1","diff_url":"https://github.com/decentralion/cryptofolio/pull/1.diff","patch_url":"https://github.com/decentralion/cryptofolio/pull/1.patch","issue_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/1","number":1,"state":"open","locked":false,"title":"Add LIFOCostBasisCalculator and tests","user":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"body":"The LIFOCostBasisCalculator keeps track of a sequence of acquisitions\r\nand disposals for a given cryptocurrency. For each disposal, it reports\r\na sequence of `BasisFrames`; these BasisFrames have the cost basis\r\ninformation for that disposal (when the corresponding crypto was\r\nacquired, and at what cost).\r\n\r\nTest plan: Check out the new tests that have been added. They pass, as\r\ndoes `yarn flow`.","created_at":"2018-04-09T08:10:00Z","updated_at":"2018-04-09T21:19:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d916f66031c2cc9720e0a13ae048cb5ecf1f40ac","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1/commits","review_comments_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1/comments","review_comment_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/1/comments","statuses_url":"https://api.github.com/repos/decentralion/cryptofolio/statuses/f7145864a7372392ef488cd68f463c4a91ef4926","head":{"label":"decentralion:basis","ref":"basis","sha":"f7145864a7372392ef488cd68f463c4a91ef4926","user":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"repo":{"id":128724350,"name":"cryptofolio","full_name":"decentralion/cryptofolio","owner":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/decentralion/cryptofolio","description":"a cryptocurrency tracking app (under development)","fork":false,"url":"https://api.github.com/repos/decentralion/cryptofolio","forks_url":"https://api.github.com/repos/decentralion/cryptofolio/forks","keys_url":"https://api.github.com/repos/decentralion/cryptofolio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/decentralion/cryptofolio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/decentralion/cryptofolio/teams","hooks_url":"https://api.github.com/repos/decentralion/cryptofolio/hooks","issue_events_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/events{/number}","events_url":"https://api.github.com/repos/decentralion/cryptofolio/events","assignees_url":"https://api.github.com/repos/decentralion/cryptofolio/assignees{/user}","branches_url":"https://api.github.com/repos/decentralion/cryptofolio/branches{/branch}","tags_url":"https://api.github.com/repos/decentralion/cryptofolio/tags","blobs_url":"https://api.github.com/repos/decentralion/cryptofolio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/decentralion/cryptofolio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/decentralion/cryptofolio/git/refs{/sha}","trees_url":"https://api.github.com/repos/decentralion/cryptofolio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/decentralion/cryptofolio/statuses/{sha}","languages_url":"https://api.github.com/repos/decentralion/cryptofolio/languages","stargazers_url":"https://api.github.com/repos/decentralion/cryptofolio/stargazers","contributors_url":"https://api.github.com/repos/decentralion/cryptofolio/contributors","subscribers_url":"https://api.github.com/repos/decentralion/cryptofolio/subscribers","subscription_url":"https://api.github.com/repos/decentralion/cryptofolio/subscription","commits_url":"https://api.github.com/repos/decentralion/cryptofolio/commits{/sha}","git_commits_url":"https://api.github.com/repos/decentralion/cryptofolio/git/commits{/sha}","comments_url":"https://api.github.com/repos/decentralion/cryptofolio/comments{/number}","issue_comment_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/comments{/number}","contents_url":"https://api.github.com/repos/decentralion/cryptofolio/contents/{+path}","compare_url":"https://api.github.com/repos/decentralion/cryptofolio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/decentralion/cryptofolio/merges","archive_url":"https://api.github.com/repos/decentralion/cryptofolio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/decentralion/cryptofolio/downloads","issues_url":"https://api.github.com/repos/decentralion/cryptofolio/issues{/number}","pulls_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls{/number}","milestones_url":"https://api.github.com/repos/decentralion/cryptofolio/milestones{/number}","notifications_url":"https://api.github.com/repos/decentralion/cryptofolio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/decentralion/cryptofolio/labels{/name}","releases_url":"https://api.github.com/repos/decentralion/cryptofolio/releases{/id}","deployments_url":"https://api.github.com/repos/decentralion/cryptofolio/deployments","created_at":"2018-04-09T06:23:36Z","updated_at":"2018-04-09T21:06:58Z","pushed_at":"2018-04-09T21:07:15Z","git_url":"git://github.com/decentralion/cryptofolio.git","ssh_url":"git@github.com:decentralion/cryptofolio.git","clone_url":"https://github.com/decentralion/cryptofolio.git","svn_url":"https://github.com/decentralion/cryptofolio","homepage":null,"size":132,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"decentralion:master","ref":"master","sha":"063d35525d9a073e265c23ea68e4bb57381c5cbc","user":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"repo":{"id":128724350,"name":"cryptofolio","full_name":"decentralion/cryptofolio","owner":{"login":"decentralion","id":1400023,"avatar_url":"https://avatars2.githubusercontent.com/u/1400023?v=4","gravatar_id":"","url":"https://api.github.com/users/decentralion","html_url":"https://github.com/decentralion","followers_url":"https://api.github.com/users/decentralion/followers","following_url":"https://api.github.com/users/decentralion/following{/other_user}","gists_url":"https://api.github.com/users/decentralion/gists{/gist_id}","starred_url":"https://api.github.com/users/decentralion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decentralion/subscriptions","organizations_url":"https://api.github.com/users/decentralion/orgs","repos_url":"https://api.github.com/users/decentralion/repos","events_url":"https://api.github.com/users/decentralion/events{/privacy}","received_events_url":"https://api.github.com/users/decentralion/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/decentralion/cryptofolio","description":"a cryptocurrency tracking app (under development)","fork":false,"url":"https://api.github.com/repos/decentralion/cryptofolio","forks_url":"https://api.github.com/repos/decentralion/cryptofolio/forks","keys_url":"https://api.github.com/repos/decentralion/cryptofolio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/decentralion/cryptofolio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/decentralion/cryptofolio/teams","hooks_url":"https://api.github.com/repos/decentralion/cryptofolio/hooks","issue_events_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/events{/number}","events_url":"https://api.github.com/repos/decentralion/cryptofolio/events","assignees_url":"https://api.github.com/repos/decentralion/cryptofolio/assignees{/user}","branches_url":"https://api.github.com/repos/decentralion/cryptofolio/branches{/branch}","tags_url":"https://api.github.com/repos/decentralion/cryptofolio/tags","blobs_url":"https://api.github.com/repos/decentralion/cryptofolio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/decentralion/cryptofolio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/decentralion/cryptofolio/git/refs{/sha}","trees_url":"https://api.github.com/repos/decentralion/cryptofolio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/decentralion/cryptofolio/statuses/{sha}","languages_url":"https://api.github.com/repos/decentralion/cryptofolio/languages","stargazers_url":"https://api.github.com/repos/decentralion/cryptofolio/stargazers","contributors_url":"https://api.github.com/repos/decentralion/cryptofolio/contributors","subscribers_url":"https://api.github.com/repos/decentralion/cryptofolio/subscribers","subscription_url":"https://api.github.com/repos/decentralion/cryptofolio/subscription","commits_url":"https://api.github.com/repos/decentralion/cryptofolio/commits{/sha}","git_commits_url":"https://api.github.com/repos/decentralion/cryptofolio/git/commits{/sha}","comments_url":"https://api.github.com/repos/decentralion/cryptofolio/comments{/number}","issue_comment_url":"https://api.github.com/repos/decentralion/cryptofolio/issues/comments{/number}","contents_url":"https://api.github.com/repos/decentralion/cryptofolio/contents/{+path}","compare_url":"https://api.github.com/repos/decentralion/cryptofolio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/decentralion/cryptofolio/merges","archive_url":"https://api.github.com/repos/decentralion/cryptofolio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/decentralion/cryptofolio/downloads","issues_url":"https://api.github.com/repos/decentralion/cryptofolio/issues{/number}","pulls_url":"https://api.github.com/repos/decentralion/cryptofolio/pulls{/number}","milestones_url":"https://api.github.com/repos/decentralion/cryptofolio/milestones{/number}","notifications_url":"https://api.github.com/repos/decentralion/cryptofolio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/decentralion/cryptofolio/labels{/name}","releases_url":"https://api.github.com/repos/decentralion/cryptofolio/releases{/id}","deployments_url":"https://api.github.com/repos/decentralion/cryptofolio/deployments","created_at":"2018-04-09T06:23:36Z","updated_at":"2018-04-09T21:06:58Z","pushed_at":"2018-04-09T21:07:15Z","git_url":"git://github.com/decentralion/cryptofolio.git","ssh_url":"git@github.com:decentralion/cryptofolio.git","clone_url":"https://github.com/decentralion/cryptofolio.git","svn_url":"https://github.com/decentralion/cryptofolio","homepage":null,"size":132,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1"},"html":{"href":"https://github.com/decentralion/cryptofolio/pull/1"},"issue":{"href":"https://api.github.com/repos/decentralion/cryptofolio/issues/1"},"comments":{"href":"https://api.github.com/repos/decentralion/cryptofolio/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/decentralion/cryptofolio/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/decentralion/cryptofolio/statuses/f7145864a7372392ef488cd68f463c4a91ef4926"}},"author_association":"OWNER"}}
{"actor":{"display_login":"decentralion"}}