{"id":24517868,"url":"https://github.com/moattarwork/pricemonitoring","last_synced_at":"2025-07-05T18:11:59.249Z","repository":{"id":88929115,"uuid":"182776317","full_name":"moattarwork/PriceMonitoring","owner":"moattarwork","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-03T13:31:39.000Z","size":157,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T01:36:50.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moattarwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-22T12:01:04.000Z","updated_at":"2023-07-03T13:31:43.000Z","dependencies_parsed_at":"2025-01-22T01:35:51.894Z","dependency_job_id":"92559efe-6b2a-4566-9d58-60bc2a9b031c","html_url":"https://github.com/moattarwork/PriceMonitoring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moattarwork%2FPriceMonitoring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moattarwork%2FPriceMonitoring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moattarwork%2FPriceMonitoring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moattarwork%2FPriceMonitoring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moattarwork","download_url":"https://codeload.github.com/moattarwork/PriceMonitoring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243719398,"owners_count":20336607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T01:35:44.475Z","updated_at":"2025-03-15T11:11:25.784Z","avatar_url":"https://github.com/moattarwork.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PriceMonitoring\n\n## Frontend\n\nThe dashboard consists of 2 components:\n\n1. `favourites`: A table of up to 10 rows with prices for our \"favourite\"\n   securities.\n2. `all`: A table containing all securities for which a price has been received.\n\nIn particular:\n\n`favourites`:\n\n* A table of up to 10 securities.\n* Securities can be marked as favourite from the `all` table.\n* Securities can be unmarked as favourite from the `favourites` table.\n* Each row shows the security symbol and its live price.\n* Each row also shows the average price for that symbol in the last 3 minutes.\n  Note: This is a moving-window average.\n\n`all`:\n\n* A table showing all the securities for which we have received a price so far.\n* Each row contains the security symbol and its live price.\n* The user can select which securities to make their favourite from this table.\n\nThe live price of each security should not flash on the screen more than once\nevery second, even when data comes in more often than that for that security.\n\n## Backend\n\nBackend is a simple node.js server that delivers data through a web-socket on\nport 8043. Each data point is a JSON-stringified object of the following form:\n\n```js\n{\n  'symbol': 'AAPL',\n  'price': 178.92,\n}\n```\n\nPrices arrive through the web-socket at random intervals between 10 and 1500 ms.\nThe order in which price updates arrive is also random.\n\n## Quickstart\n\nInstall the npm packages:\n\n```bash\n$ npm install\n```\n\nIn one console, run the backend server:\n\n```bash\n$ npm run backend\n```\n\nYou can connect to the web-socket with:\n\n```js\nws = new WebSocket('ws://localhost:8043');\nws.onmessage = (msg) =\u003e {\n  console.log(msg);\n};\n```\n\nIn another console, run the frontend dev server:\n\n```bash\n$ ng serve\n```\n\nThe website is served live at \u003chttp://localhost:4200\u003e.\n\n\n## Components\n\n- Favorite and Securities components to display the ticker and price\n- security-store service that is listening to web-socket and pump the relevant data to the display components\n- socket-factory that facilitate the testing and mocking of the web-socket\n- card component which is for layout management.\n- slidingWindow operator (rxjs operator) to facilitate the sliding operation on observable.\n\n## Extensions Points\n\nThere are the following extension points to the code base:\n\n- Better error handling for web socket connection. Currently it get logged to the console\n- Implementing the solution using ngrx (redux like) which make the solution more extensible when the solution get bigger. It wasn't necessary at this stage and for small code bases\n- Providing a search box based on the list of symbols which make the filtering easier for the users.\n\n## External libraries\n\n- Bootstrap and ngx-bootstrap\n- ngx-toastr\n- ngx-config\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoattarwork%2Fpricemonitoring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoattarwork%2Fpricemonitoring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoattarwork%2Fpricemonitoring/lists"}