{"action":"created","comment":{"url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/comments/150879142","pull_request_review_id":76493508,"id":150879142,"diff_hunk":"@@ -127,19 +143,121 @@ public void Stop()\n             {\n                 return;\n             }\n-            var orderBooks = from si in OrderBookSnapshot\n-                             group si by si.Symbol into g\n-                             let asks = g.Where(i => !i.IsBuy).Select(i => new VolumePrice(i.Price, i.Size)).ToArray()\n-                             let bids = g.Where(i => i.IsBuy).Select(i => new VolumePrice(i.Price, i.Size)).ToArray()\n-                             let assetPair = BitMexModelConverter.ConvertSymbolFromBitMexToLykke(g.Key, CurrencyMappingProvider).Name\n-                             select new OrderBook(ExchangeName, assetPair, asks, bids, DateTime.UtcNow);\n+            var orderBooks = OrderBookSnapshots.Values\n+                .Select(obs => new OrderBook(\n+                    ExchangeName,\n+                    ConvertSymbolFromExchangeToLykke(obs.AssetPair).Name,\n+                    obs.Asks.Values.Select(i => new VolumePrice(i.Price, i.Size)).ToArray(),\n+                    obs.Bids.Values.Select(i => new VolumePrice(i.Price, i.Size)).ToArray(),\n+                    DateTime.UtcNow));\n             _publishedToRabbit++;\n+            \n             foreach (var orderBook in orderBooks)\n             {\n                 await _newOrderBookHandler(orderBook);\n             }\n         }\n \n+        protected abstract Task MessageLoopImpl();\n+\n+        protected async Task<OrderBookSnapshot> GetOrderBookSnapshot(string pair)\n+        {\n+            if (!OrderBookSnapshots.TryGetValue(pair, out var orderBook))\n+            {\n+                var message = \"Trying to retrieve a non-existing pair order book snapshot \" +\n+                              $\"for exchange {ExchangeName} and pair {pair}\";\n+                await Log.WriteInfoAsync(nameof(MessageLoopImpl), nameof(MessageLoopImpl), message);\n+                throw new OrderBookInconsistencyException(message);\n+            }\n+\n+            return orderBook;\n+        }\n+\n+        protected async Task<ConcurrentDictionary<string, OrderBookItem>> GetOrdersList(string pair, bool isBuy)","path":"src/Lykke.Service.ExchangeConnector/Exchanges/Concrete/Shared/OrderBooksHarvesterBase.cs","position":149,"original_position":149,"commit_id":"c1a9b60dc3a507280e2486fbf6ce18f0c0acce69","original_commit_id":"c1a9b60dc3a507280e2486fbf6ce18f0c0acce69","user":{"login":"MikhailGerasimov","id":30234290,"avatar_url":"https://avatars3.githubusercontent.com/u/30234290?v=4","gravatar_id":"","url":"https://api.github.com/users/MikhailGerasimov","html_url":"https://github.com/MikhailGerasimov","followers_url":"https://api.github.com/users/MikhailGerasimov/followers","following_url":"https://api.github.com/users/MikhailGerasimov/following{/other_user}","gists_url":"https://api.github.com/users/MikhailGerasimov/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailGerasimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailGerasimov/subscriptions","organizations_url":"https://api.github.com/users/MikhailGerasimov/orgs","repos_url":"https://api.github.com/users/MikhailGerasimov/repos","events_url":"https://api.github.com/users/MikhailGerasimov/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailGerasimov/received_events","type":"User","site_admin":false},"body":"The method doesn't have callers","created_at":"2017-11-14T16:06:14Z","updated_at":"2017-11-14T16:29:42Z","html_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10#discussion_r150879142","pull_request_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/comments/150879142"},"html":{"href":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10#discussion_r150879142"},"pull_request":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10","id":152187357,"html_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10","diff_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10.diff","patch_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10.patch","issue_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/10","number":10,"state":"open","locked":false,"title":"Feature lwdev3757 - implement generic orderbook harvesting","user":{"login":"ivelin-ivanov-prime","id":32848216,"avatar_url":"https://avatars0.githubusercontent.com/u/32848216?v=4","gravatar_id":"","url":"https://api.github.com/users/ivelin-ivanov-prime","html_url":"https://github.com/ivelin-ivanov-prime","followers_url":"https://api.github.com/users/ivelin-ivanov-prime/followers","following_url":"https://api.github.com/users/ivelin-ivanov-prime/following{/other_user}","gists_url":"https://api.github.com/users/ivelin-ivanov-prime/gists{/gist_id}","starred_url":"https://api.github.com/users/ivelin-ivanov-prime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivelin-ivanov-prime/subscriptions","organizations_url":"https://api.github.com/users/ivelin-ivanov-prime/orgs","repos_url":"https://api.github.com/users/ivelin-ivanov-prime/repos","events_url":"https://api.github.com/users/ivelin-ivanov-prime/events{/privacy}","received_events_url":"https://api.github.com/users/ivelin-ivanov-prime/received_events","type":"User","site_admin":false},"body":"Created a base mechanism to handle and persist exchanges orderbook events and snapshots. Functionality to persist orderbooks into table and blobs.\r\nInitial Gdax, Bitfinex and Bitmex implementations.","created_at":"2017-11-13T09:24:34Z","updated_at":"2017-11-14T16:29:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58c445b1c3cd12be6c29f8c214bcdd8c3d0c4527","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10/commits","review_comments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10/comments","review_comment_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/10/comments","statuses_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/statuses/c1a9b60dc3a507280e2486fbf6ce18f0c0acce69","head":{"label":"LykkeCity:feature_LWDEV-3757-Implement-OrderBook","ref":"feature_LWDEV-3757-Implement-OrderBook","sha":"c1a9b60dc3a507280e2486fbf6ce18f0c0acce69","user":{"login":"LykkeCity","id":14153330,"avatar_url":"https://avatars0.githubusercontent.com/u/14153330?v=4","gravatar_id":"","url":"https://api.github.com/users/LykkeCity","html_url":"https://github.com/LykkeCity","followers_url":"https://api.github.com/users/LykkeCity/followers","following_url":"https://api.github.com/users/LykkeCity/following{/other_user}","gists_url":"https://api.github.com/users/LykkeCity/gists{/gist_id}","starred_url":"https://api.github.com/users/LykkeCity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LykkeCity/subscriptions","organizations_url":"https://api.github.com/users/LykkeCity/orgs","repos_url":"https://api.github.com/users/LykkeCity/repos","events_url":"https://api.github.com/users/LykkeCity/events{/privacy}","received_events_url":"https://api.github.com/users/LykkeCity/received_events","type":"Organization","site_admin":false},"repo":{"id":90874307,"name":"Lykke.Service.ExchangeConnector","full_name":"LykkeCity/Lykke.Service.ExchangeConnector","owner":{"login":"LykkeCity","id":14153330,"avatar_url":"https://avatars0.githubusercontent.com/u/14153330?v=4","gravatar_id":"","url":"https://api.github.com/users/LykkeCity","html_url":"https://github.com/LykkeCity","followers_url":"https://api.github.com/users/LykkeCity/followers","following_url":"https://api.github.com/users/LykkeCity/following{/other_user}","gists_url":"https://api.github.com/users/LykkeCity/gists{/gist_id}","starred_url":"https://api.github.com/users/LykkeCity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LykkeCity/subscriptions","organizations_url":"https://api.github.com/users/LykkeCity/orgs","repos_url":"https://api.github.com/users/LykkeCity/repos","events_url":"https://api.github.com/users/LykkeCity/events{/privacy}","received_events_url":"https://api.github.com/users/LykkeCity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector","description":null,"fork":false,"url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector","forks_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/forks","keys_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/teams","hooks_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/hooks","issue_events_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/events{/number}","events_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/events","assignees_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/assignees{/user}","branches_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/branches{/branch}","tags_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/tags","blobs_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/refs{/sha}","trees_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/statuses/{sha}","languages_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/languages","stargazers_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/stargazers","contributors_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/contributors","subscribers_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/subscribers","subscription_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/subscription","commits_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/commits{/sha}","git_commits_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/commits{/sha}","comments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/comments{/number}","issue_comment_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/comments{/number}","contents_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/contents/{+path}","compare_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/merges","archive_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/downloads","issues_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues{/number}","pulls_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls{/number}","milestones_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/milestones{/number}","notifications_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/labels{/name}","releases_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/releases{/id}","deployments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/deployments","created_at":"2017-05-10T14:35:30Z","updated_at":"2017-10-26T09:31:37Z","pushed_at":"2017-11-14T09:41:54Z","git_url":"git://github.com/LykkeCity/Lykke.Service.ExchangeConnector.git","ssh_url":"git@github.com:LykkeCity/Lykke.Service.ExchangeConnector.git","clone_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector.git","svn_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector","homepage":null,"size":2176,"stargazers_count":14,"watchers_count":14,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":14,"default_branch":"master"}},"base":{"label":"LykkeCity:develop","ref":"develop","sha":"be85533efc3afbcdf5fed8993eaf31542dfd005e","user":{"login":"LykkeCity","id":14153330,"avatar_url":"https://avatars0.githubusercontent.com/u/14153330?v=4","gravatar_id":"","url":"https://api.github.com/users/LykkeCity","html_url":"https://github.com/LykkeCity","followers_url":"https://api.github.com/users/LykkeCity/followers","following_url":"https://api.github.com/users/LykkeCity/following{/other_user}","gists_url":"https://api.github.com/users/LykkeCity/gists{/gist_id}","starred_url":"https://api.github.com/users/LykkeCity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LykkeCity/subscriptions","organizations_url":"https://api.github.com/users/LykkeCity/orgs","repos_url":"https://api.github.com/users/LykkeCity/repos","events_url":"https://api.github.com/users/LykkeCity/events{/privacy}","received_events_url":"https://api.github.com/users/LykkeCity/received_events","type":"Organization","site_admin":false},"repo":{"id":90874307,"name":"Lykke.Service.ExchangeConnector","full_name":"LykkeCity/Lykke.Service.ExchangeConnector","owner":{"login":"LykkeCity","id":14153330,"avatar_url":"https://avatars0.githubusercontent.com/u/14153330?v=4","gravatar_id":"","url":"https://api.github.com/users/LykkeCity","html_url":"https://github.com/LykkeCity","followers_url":"https://api.github.com/users/LykkeCity/followers","following_url":"https://api.github.com/users/LykkeCity/following{/other_user}","gists_url":"https://api.github.com/users/LykkeCity/gists{/gist_id}","starred_url":"https://api.github.com/users/LykkeCity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LykkeCity/subscriptions","organizations_url":"https://api.github.com/users/LykkeCity/orgs","repos_url":"https://api.github.com/users/LykkeCity/repos","events_url":"https://api.github.com/users/LykkeCity/events{/privacy}","received_events_url":"https://api.github.com/users/LykkeCity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector","description":null,"fork":false,"url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector","forks_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/forks","keys_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/teams","hooks_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/hooks","issue_events_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/events{/number}","events_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/events","assignees_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/assignees{/user}","branches_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/branches{/branch}","tags_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/tags","blobs_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/refs{/sha}","trees_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/statuses/{sha}","languages_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/languages","stargazers_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/stargazers","contributors_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/contributors","subscribers_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/subscribers","subscription_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/subscription","commits_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/commits{/sha}","git_commits_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/git/commits{/sha}","comments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/comments{/number}","issue_comment_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/comments{/number}","contents_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/contents/{+path}","compare_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/merges","archive_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/downloads","issues_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues{/number}","pulls_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls{/number}","milestones_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/milestones{/number}","notifications_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/labels{/name}","releases_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/releases{/id}","deployments_url":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/deployments","created_at":"2017-05-10T14:35:30Z","updated_at":"2017-10-26T09:31:37Z","pushed_at":"2017-11-14T09:41:54Z","git_url":"git://github.com/LykkeCity/Lykke.Service.ExchangeConnector.git","ssh_url":"git@github.com:LykkeCity/Lykke.Service.ExchangeConnector.git","clone_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector.git","svn_url":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector","homepage":null,"size":2176,"stargazers_count":14,"watchers_count":14,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10"},"html":{"href":"https://github.com/LykkeCity/Lykke.Service.ExchangeConnector/pull/10"},"issue":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/10"},"comments":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/LykkeCity/Lykke.Service.ExchangeConnector/statuses/c1a9b60dc3a507280e2486fbf6ce18f0c0acce69"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"MikhailGerasimov"}}