{"id":23824668,"url":"https://github.com/dzakarias/orderbook-replayer","last_synced_at":"2026-04-30T22:32:28.262Z","repository":{"id":270608624,"uuid":"910802798","full_name":"dzakarias/orderbook-replayer","owner":"dzakarias","description":"Replay/analyse historical orderbook data","archived":false,"fork":false,"pushed_at":"2025-01-14T21:30:44.000Z","size":5305,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T10:34:51.283Z","etag":null,"topics":["cryptocurrency","docker","fastapi","orderbook","poetry","python","vuejs"],"latest_commit_sha":null,"homepage":"https://orderbook-replayer.onrender.com/","language":"Python","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/dzakarias.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-01T13:29:58.000Z","updated_at":"2025-01-16T21:23:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"3762eb3b-8798-4cc7-b945-2fadeb5dd3b0","html_url":"https://github.com/dzakarias/orderbook-replayer","commit_stats":null,"previous_names":["dzakarias/orderbook-replayer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dzakarias/orderbook-replayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzakarias%2Forderbook-replayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzakarias%2Forderbook-replayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzakarias%2Forderbook-replayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzakarias%2Forderbook-replayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzakarias","download_url":"https://codeload.github.com/dzakarias/orderbook-replayer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzakarias%2Forderbook-replayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32479448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["cryptocurrency","docker","fastapi","orderbook","poetry","python","vuejs"],"created_at":"2025-01-02T11:15:01.458Z","updated_at":"2026-04-30T22:32:23.246Z","avatar_url":"https://github.com/dzakarias.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Orderbook Replayer\n\nA small fullstack app: a Python FastAPI backend maintaining state of an archive central limit order book (CLOB), and a Vue.js frontend visualizing said state, and providing controls for replay.\n\n\n\n\n## Screenshots\n\n![App Screenshot](./screenshot/screen1.png)\n\n\n## Orderbooks\n\nThe app works on historical orderbook data. Bybit (a major cryptocurrency exchange) provides 500-depth orderbook history for free download. The problem with this is size: a typical day of BTCUSDT trading is well over a gigabyte in the format they provide. So the backend includes a utility class (OrderBookProcessor) that takes such a Bybit history file as input, and outputs a new file with configurable depth. For an example, the repo includes a 20-depth book for February 3, 2024 for BNBUSDT. 20 levels are enough for most practical purposes and they require 3-10x less space than a full, depth-500 one.\n\n## More technical details on orderbooks\n\nBybit's files include a snapshot at start, i.e. all the 500 price levels and quantities for both the Bid and the Ask side. After this snapshot, a set of deltas are provided: they represent changed quantities for a given price level: 0 means no more offers on that price. \n\nTranslating a depth 500 file to a depth 20 one means the deltas have to be processed, and for each set of deltas (one set contains all the deltas carrying the same timestamp) internal state is updated, and a - potentially different - set of deltas is computed. For example deltas more than 20 levels beneath best price need not be propagated at this point: but it may become necessary to include them later if they enter top-20 (if no other delta for its price level appears in the meantime).\n\nSome (most) deltas never become relevant, so will never make it to the output file - that's how space can be saved. \n\nThe internal orderbook implementation uses sorted lists of tuples and the [bisect](https://docs.python.org/3/library/bisect.html) module for quick (O(log n)) lookups essential for processing performance: enabling conversion speed of around 10K delta-sets per second on big pairs (like BTCUSDT) for a 500-\u003e20 conversion.\n\n## Run Locally\n\nClone the project:\n\n```bash\n  git clone https://github.com/dzakarias/orderbook-replayer.git\n```\n\nGo to the project directory:\n\n```bash\n  cd orderbook-replayer\n```\n\nThe backend targets Python 3.11 and uses Poetry for dependencies. When you have these installed, you install dependencies with:\n\n```bash\npoetry install\n```\n\nStart the backend:\n\n```bash\npoetry run uvicorn src.backend.ob_replayer_backend:app --host 0.0.0.0 --port 8000 --reload\n```\n\nRun the frontend by opening http://localhost:8000 in your browser. It isn't necessary to build the frontend, so you don't need Node.js, Webpack, etc. at all.\nStill a package.json is provided in the frontend directory, so you can run `npm install` and `npm run build` if you insist.\n\n## Deploy online\n\nThe project includes a Dockerfile you can use to deploy it in a containerized manner. Here's it deployed to Render: https://orderbook-replayer.onrender.com/\nIt might take a minute to load as it's on a free account: so uses a Spot instance on AWS which take some time to fire up.\n\n## Usage\n\nWhen the app loads, select a date. A list of markets for which orderbook histories are available at the backend will be populated. Choose one to load the initial snapshot of that orderbook.\nThe repo includes only one orderbook file, so you'll need to select 02-03-2024 as date, and the BNBUSDT book history will be loaded.\n\n## How can I create my own orderbook files?\n\nGoto [Bybit's historical data download page](https://www.bybit.com/derivatives/en/history-data), download the orderbook(s) you need, then extract them. Do not modify the filename. Run orderbook processor (/src/backend/orderbook_processor.py) like this:\n\n\n```bash\npython -m orderbook_processor --file \u003cbybit orderbook filename\u003e [--depth \u003cdesired depth\u003e]\n```\n\nThe output file will be created in the same directory, and the same filename-structure will be maintained: the \"ob500\" part will be modified only to reflect the output depth.\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n\n## Author\n\n[@dzakarias](https://www.github.com/dzakarias) David Zakarias. Contact me at [LinkedIn](https://www.linkedin.com/in/david-zakarias-9720a24/) or email me at david (dot) zakarias (at) gmail (dot) com.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzakarias%2Forderbook-replayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzakarias%2Forderbook-replayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzakarias%2Forderbook-replayer/lists"}