{"id":15993681,"url":"https://github.com/azuobs/event-sourcer","last_synced_at":"2025-04-05T00:15:03.160Z","repository":{"id":143238977,"uuid":"143787906","full_name":"AzuObs/event-sourcer","owner":"AzuObs","description":"Financial algorithm that sources market events and transforms them into an order book","archived":false,"fork":false,"pushed_at":"2018-08-06T22:16:40.000Z","size":4817,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T08:29:45.674Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/AzuObs.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":"2018-08-06T22:00:32.000Z","updated_at":"2018-08-06T22:16:41.000Z","dependencies_parsed_at":"2023-04-17T11:38:30.879Z","dependency_job_id":null,"html_url":"https://github.com/AzuObs/event-sourcer","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"5746877f9b569e346b0f1e54de1aa6f9f3f6a3cc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzuObs%2Fevent-sourcer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzuObs%2Fevent-sourcer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzuObs%2Fevent-sourcer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzuObs%2Fevent-sourcer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AzuObs","download_url":"https://codeload.github.com/AzuObs/event-sourcer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266566,"owners_count":20910836,"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":"2024-10-08T07:01:52.777Z","updated_at":"2025-04-05T00:15:03.143Z","avatar_url":"https://github.com/AzuObs.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Run the dev app\n\n```bash\nsbt \"run src/main/resources/sample-updates.txt 2 10.0\"\n```\n\n## Run the compiled app\n\n```bash\njava -jar pre-assembled-prog.jar src/main/resources/sample-updates.txt 2 10.0\n```\n\n## Compile the app and run it\n\n```bash\nsbt assembly\njava -jar target/scala-2.12/prog.jar src/main/resources/sample-updates.txt 2 10.0\n```\n\n## Architecture Decision Record\n### Assumptions\n- Although this is specified in the spec for Update events, Delete event will also not be given for a price level index which hasn't already been provided using a New event.\n- Missing price level indexes, if they exist, will still be outputted as 0 bids, 0 asks.\n- Delete instructions still contain ticks and quantity. And they are formatted the same way `U` and `N` instructions are. (eg `D A 1 0 0`)\n\n### Data Structures used\nWe decided to use Array to store the market events, but List was considered too. Writing to an Array of which a\nsize is known ahead of time is O(1), and reading from an Array is also O(1). Writing to a List is O(1) if we keep\ntrack of the last element of the list, and reading from a list sequentially is also O(1) for each element read.\nThere is however a slight optimisation advantage when using an Array because it is sequentially in memory, meaning\nthat the CPU can prefetch and cache the array. Where as a linked list will be stored all over memory and cannot be\npre-fetched.\n\nWe decided to use a HashMap to store the order book as it was being sourced from the market event. The \nHashMap uses the price level indexes as its keys. It is an efficient data structure because inserts are O(1),\nand reads are also O(1). Reads were important because the order book needs to be read in order to be printed on\nthe screen. \n\nOverall the execution of the program is O(n), where n is the number of lines in the `updates.txt` file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuobs%2Fevent-sourcer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuobs%2Fevent-sourcer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuobs%2Fevent-sourcer/lists"}