Download, process, and backtest ByBit derivatives historical order book data. Use this skill when the user wants to: (1) download historical order book snapshots from ByBit's derivatives history-data page using Selenium automation, (2) process/unzip ob500 JSONL files and filter to depth 50, (3) run any of 10 order-book-based trading strategies (Order Book Imbalance, Breakout, False Breakout, Scalping, Momentum, Reversal, Spoofing Detection, Optimal Execution, Market Making, Latency Arbitrage) against the data, or (4) generate full backtest performance reports with PnL, Sharpe ratio, win rate, max drawdown, and strategy comparison. Triggers on: "bybit order book", "order book backtest", "download bybit data", "ob500", "order book imbalance", "spoofing detection strategy", "market making backtest", "crypto order book", "depth of book backtest", "bybit historical data".
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install bybit-order-book或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install bybit-order-book⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/bybit-order-book/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: bybit-orderbook-backtester description: > Download, process, and backtest ByBit derivatives historical order book data. Use this skill when the user wants to: (1) download historical order book snapshots from ByBit's derivatives history-data page using Selenium automation, (2) process/unzip ob500 JSONL files and filter to depth 50, (3) run any of 10 order-book-based trading strategies (Order Book Imbalance, Breakout, False Breakout, Scalping, Momentum, Reversal, Spoofing Detection, Optimal Execution, Market Making, Latency Arbitrage) against the data, or (4) generate full backtest performance reports with PnL, Sharpe ratio, win rate, max drawdown, and strategy comparison. Triggers on: "bybit order book", "order book backtest", "download bybit data", "ob500", "order book imbalance", "spoofing detection strategy", "market making backtest", "crypto order book", "depth of book backtest", "bybit historical data". ---
End-to-end pipeline: download → process → backtest → report.
pip install undetected-chromedriver selenium pandas numpy pyarrow --break-system-packages
Chrome/Chromium must be installed for Selenium.
The pipeline has 3 stages. Run them sequentially, or skip to later stages if data is already available.
Prompt the user for:
Run scripts/download_orderbook.py:
python scripts/download_orderbook.py \
--symbol BTCUSDT \
--start 2024-06-01 --end 2024-06-30 \
--output ./data/raw
Key details:
https://www.bybit.com/derivatives/en/history-dataundetected-chromedriver for Cloudflare bypass./data/raw/ named {date}_{symbol}_ob500.data.zipreferences/bybit_data_format.mdIf Selenium fails (Cloudflare blocks, UI changes): Instruct the user to manually download from the ByBit page and place ZIPs in ./data/raw/.
Run scripts/process_orderbook.py:
python scripts/process_orderbook.py \
--input ./data/raw \
--output ./data/processed \
--depth 50 \
--sample-interval 1s
What it does:
1s, 5s, 1min) — recommended for faster backtests./data/processed/Without downsampling: ~860K snapshots/day, ~300 MB Parquet per day per symbol. With 1s downsampling: ~86K snapshots/day, ~5 MB per day — much more practical.
Run scripts/backtest.py:
# Run all 10 strategies
python scripts/backtest.py \
--input ./data/processed/BTCUSDT_ob50.parquet \
--output ./reports
# Run specific strategies
python scripts/backtest.py \
--input ./data/processed/BTCUSDT_ob50.parquet \
--strategies imbalance,breakout,market_making \
--output ./reports
# Quick test with limited rows
python scripts/backtest.py \
--input ./data/processed/BTCUSDT_ob50.parquet \
--max-rows 100000 \
--output ./reports
Strategy keys: imbalance, breakout, false_breakout, scalping, momentum, reversal, spoofing, optimal_execution, market_making, latency_arb
Outputs in ./reports/:
{SYMBOL}_backtest_report.json — Full results with equity curves{SYMBOL}_backtest_report.md — Comparison table and detailed metricsReport metrics per strategy: total trades, winners/losers, win rate, cumulative PnL, Sharpe ratio, max drawdown (absolute and %), avg PnL per trade, avg hold time, profit factor, best/worst trade, equity curve.
For strategy logic and tunable parameters: see references/strategies.md
To modify strategy parameters, edit the __init__ method of any strategy class in scripts/backtest.py. Each strategy's self.params dict contains all tunables.
To add a new strategy:
Strategy in scripts/backtest.pyon_snapshot(self, row, idx, df) with entry/exit logicSTRATEGY_MAPSelenium can't load ByBit page: ByBit uses Cloudflare. Ensure undetected-chromedriver is up to date. Try --no-headless to debug visually. Fall back to manual download.
Out of memory on processing: Use --sample-interval 1s or larger. Process one day at a time.
No trades generated: Strategy thresholds may be too tight for the data period. Relax parameters (lower thresholds, shorter lookbacks) in references/strategies.md.
安装 bybit-order-book 后,可以对 AI 说这些话来触发它
Help me get started with bybit-order-book
Explains what bybit-order-book does, walks through the setup, and runs a quick demo based on your current project
Use bybit-order-book to download, process, and backtest ByBit derivatives historical order ...
Invokes bybit-order-book with the right parameters and returns the result directly in the conversation
What can I do with bybit-order-book in my finance & investment workflow?
Lists the top use cases for bybit-order-book, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/bybit-order-book/ 目录(个人级,所有项目可用),或 .claude/skills/bybit-order-book/(项目级)。重启 AI 客户端后,用 /bybit-order-book 主动调用,或让 AI 根据上下文自动发现并使用。
bybit-order-book 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
bybit-order-book 可免费安装使用。请查阅仓库了解许可证信息。
Download, process, and backtest ByBit derivatives historical order book data. Use this skill when the user wants to: (1) download historical order book snapshots from ByBit's derivatives history-data page using Selenium automation, (2) process/unzip ob500 JSONL files and filter to depth 50, (3) run any of 10 order-book-based trading strategies (Order Book Imbalance, Breakout, False Breakout, Scalping, Momentum, Reversal, Spoofing Detection, Optimal Execution, Market Making, Latency Arbitrage) against the data, or (4) generate full backtest performance reports with PnL, Sharpe ratio, win rate, max drawdown, and strategy comparison. Triggers on: "bybit order book", "order book backtest", "download bybit data", "ob500", "order book imbalance", "spoofing detection strategy", "market making backtest", "crypto order book", "depth of book backtest", "bybit historical data".
Automate my finance & investment tasks using bybit-order-book
Identifies repetitive steps in your workflow and sets up bybit-order-book to handle them automatically
bybit-order-book 属于「Finance & Investment」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。