# Send bybit-order-book to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "bybit-order-book",
    "name": "bybit-order-book",
    "source": "tencent",
    "type": "skill",
    "category": "数据分析",
    "sourceUrl": "https://clawhub.ai/davidm413/bybit-order-book",
    "canonicalUrl": "https://clawhub.ai/davidm413/bybit-order-book",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/bybit-order-book",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=bybit-order-book",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "backtest.py",
      "bybit_data_format.md",
      "download_orderbook.py",
      "process_orderbook.py",
      "SKILL.md",
      "strategies.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/bybit-order-book"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/bybit-order-book",
    "downloadUrl": "https://openagent3.xyz/downloads/bybit-order-book",
    "agentUrl": "https://openagent3.xyz/skills/bybit-order-book/agent",
    "manifestUrl": "https://openagent3.xyz/skills/bybit-order-book/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/bybit-order-book/agent.md"
  }
}
```
## Documentation

### ByBit Order Book Backtester

End-to-end pipeline: download → process → backtest → report.

### Dependencies

pip install undetected-chromedriver selenium pandas numpy pyarrow --break-system-packages

Chrome/Chromium must be installed for Selenium.

### Workflow

The pipeline has 3 stages. Run them sequentially, or skip to later stages if data is already available.

### Stage 1: Download Order Book Data

Prompt the user for:

Symbol (default: BTCUSDT)
Date range (default: last 30 days)

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:

Downloads from https://www.bybit.com/derivatives/en/history-data
Automatically chunks into 7-day windows (ByBit's limit)
Uses undetected-chromedriver for Cloudflare bypass
Outputs: ZIP files in ./data/raw/ named {date}_{symbol}_ob500.data.zip
For data format details: see references/bybit_data_format.md

If Selenium fails (Cloudflare blocks, UI changes): Instruct the user to manually download from the ByBit page and place ZIPs in ./data/raw/.

### Stage 2: Process & Filter to Depth 50

Run scripts/process_orderbook.py:

python scripts/process_orderbook.py \\
  --input ./data/raw \\
  --output ./data/processed \\
  --depth 50 \\
  --sample-interval 1s

What it does:

Reads JSONL from ZIPs (each line = full 500-level L2 snapshot)
Filters to top 50 bid/ask levels
Computes derived features: mid_price, spread, volume_imbalance, microprice
Optionally downsamples (e.g., 1s, 5s, 1min) — recommended for faster backtests
Outputs: Parquet files in ./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.

### Stage 3: Backtest Strategies

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 metrics

Report 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

### Customization

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:

Subclass Strategy in scripts/backtest.py
Implement on_snapshot(self, row, idx, df) with entry/exit logic
Register in STRATEGY_MAP

### Troubleshooting

Selenium 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.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: davidm413
- Version: 1.0.0
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-23T16:43:11.935Z
- Expires at: 2026-04-30T16:43:11.935Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/bybit-order-book)
- [Send to Agent page](https://openagent3.xyz/skills/bybit-order-book/agent)
- [JSON manifest](https://openagent3.xyz/skills/bybit-order-book/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/bybit-order-book/agent.md)
- [Download page](https://openagent3.xyz/downloads/bybit-order-book)