📊 Bybit Historical Data Puller (Playwright)
Bybit provides high-quality historical market data, including:
- Full trade history
- Deep L2 order books
- Spot & derivatives markets
The downside is that downloading this data manually is painful — lots of UI clicks, symbol/date selection, and repeating the same workflow over and over.
💡 What this project does
This tool automates the entire Bybit download flow using Playwright:
- handles all UI interaction for you
- selects symbols and date ranges
- downloads and saves data locally
The goal is to make historical data collection fast, repeatable, and hands-off.
⚠️ Project status
🚧 Fresh release — expect rough edges
Bybit UI changes and browser automation can be flaky. If something breaks:
- try running with
--no-headlessto see the browser - reduce
--chunk-daysif downloads fail
Bug reports and PRs are welcome.
🚀 Quick Start (Linux / WSL)
⚠️ Not for native Windows.
Use WSL (Ubuntu) or a Linux machine.
From the project root, run:
chmod +x setup.sh
./setup.sh
source .venv/bin/activate
export PYTHONPATH=$PWD/src
That’s it — no manual downloads, cookies, or browser setup required.
🖥️ CLI Usage
Entry point:
src/main.py
General syntax:
python -m src.main [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
Global options
| Flag | Description |
|---|---|
--browser |
firefox (default), chromium, webkit |
--headless / --no-headless |
Run browser headless (default: headless) |
✅ What you can do
1) List spot symbols
python -m src.main symbols spot
2) List contract symbols
python -m src.main symbols contract
3) Download historical data
Spot trades example
python -m src.main download spot trades \
--symbol BTCUSDT \
--start 2025-01-03 \
--end 2026-01-03 \
--out ./data \
--chunk-days 5
Contract L2 order book example
python -m src.main download contract l2book \
--symbol BTCUSDT \
--start 2025-01-03 \
--end 2026-01-03 \
--out ./data \
--chunk-days 5
Supported datasets
- trades
- l2book
⚠️ Chunking rule (important)
chunk-days MUST be < 6
This is a Bybit UI limitation.
The CLI will error if you exceed it.
🧠 Python API (library usage)
You can also use this directly in Python:
from src.client import BybitHistoryClient
import asyncio
async def run():
async with BybitHistoryClient() as c:
await c.download_data(
margin="Spot",
data_type="Trades",
symbol="BTCUSDT",
start_date="2026-01-01",
end_date="2026-01-03",
final_path="./data",
chunk_days=5,
)
asyncio.run(run())
⚠️ Disclaimer
This tool automates Bybit’s public web UI.
Use responsibly and at your own risk.
Metadata
Release files for bybit-history-downloader 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bybit_history_downloader-0.1.0.tar.gz | 483.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bybit_history_downloader-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 496.4 kB
Release files / bybit_history_downloader-0.1.0.tar.gz
| Download URL | bybit_history_downloader-0.1.0.tar.gz |
|---|---|
| Size | 483.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6aee0079113fb57ffeaf97d2658aefc783a8bcf8193ebde377343cee771546b3
|
|
BLAKE2b-256 checksum How to use checksums |
ee4f3fe95c78f3fb26b04236deb6d3695af2030905a29da873061b8daab3dc0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / bybit_history_downloader-0.1.0-py3-none-any.whl
| Download URL | bybit_history_downloader-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
986c19125866d8f6a4db7a11ee9829c7519b06c63ccd7c527fef7be3b7985c81
|
|
BLAKE2b-256 checksum How to use checksums |
9e09aa75ac386071813ac960bc10e91df871c13eec535534859bdab45897e762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|