{"id":20259415,"url":"https://github.com/letsila/vwap","last_synced_at":"2026-05-08T22:09:25.506Z","repository":{"id":57655499,"uuid":"434942944","full_name":"letsila/vwap","owner":"letsila","description":"Real time crypto VWAP calculator","archived":false,"fork":false,"pushed_at":"2021-12-06T17:12:32.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-03T11:58:17.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/letsila.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-04T15:49:24.000Z","updated_at":"2025-01-25T18:29:45.000Z","dependencies_parsed_at":"2022-09-01T01:40:37.564Z","dependency_job_id":null,"html_url":"https://github.com/letsila/vwap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/letsila/vwap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsila%2Fvwap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsila%2Fvwap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsila%2Fvwap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsila%2Fvwap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/letsila","download_url":"https://codeload.github.com/letsila/vwap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsila%2Fvwap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32799298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-11-14T11:14:36.295Z","updated_at":"2026-05-08T22:09:25.486Z","avatar_url":"https://github.com/letsila.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# VWAP calculator\nA realtime VWAP calculator of crypto currencies. It uses coinbase as its default provider for real time data over websocket.\n\n\u003cimg width=\"673\" alt=\"screenshot\" src=\"https://user-images.githubusercontent.com/4066051/144716693-2223bc33-e689-4135-8fc8-3000df29a617.png\"\u003e\n\n## Design\nThe service in `./internal/service.go` is composed of two main components:\n* A websocket client that pulls data off an exchange.\n  * The default choice is coinbase.\n  * Any exchange can be used as long as it implements the client interface defined in the websocket package.\n* A list of data points defined in the VWAP package.\n  * The VWAP calculation is performed each time a data point is pushed to the list and saved in a hash map for each trading pairs.\n  * We don't loop over the datapoints so the VWAP calculation is done in constant time, O(1).\n\n## Configuration\nThe following flags are available while running the project through CLI using the binary.\n* `trading-pairs`: a comma separated strings of crypto currencies pairs, default is set to `BTC-USD,ETH-USD,ETH-BTC`\n* `ws-url`: the URL of the websocket server to use, default is coinbase websocket URL.\n* `window-size`: the sliding window used for the VWAP calculation, default is set to **200**.\n\n## Decimal\nFor precision sake we used https://github.com/shopspring/decimal for all calculation.\n\n## Run it\nFirst, make sure that you have go version 0.17 installed on your machine. Then ...\n```\nmake run\n```\nor \n```\nmake build\n``` \nthen ...\n```\n./vwap -ws-url \"\u003ccoinbase_valid_ws_url\u003e\" -trading-pairs \"\u003ctrading_pairs\u003e\" -window-size \u003cwindow_size\u003e\n```\n\n## Tests\n* Runs all the tests.\n```\nmake test\n``` \n* Runs the unit tests.\n```\nmake test-unit\n```\n* Runs the integration test.\n```\nmake test-intergration\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsila%2Fvwap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletsila%2Fvwap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsila%2Fvwap/lists"}