Skip to content

Commit eb9f15e

Browse files
Quentin-Mclaude
andcommitted
feat: rename recipe-* skills and auto-install to agent dirs
Rename all 20 recipe-* skill directories to bitmex-recipe-* so every skill has the bitmex- prefix. Makes all bitmex skills easy to find and remove (rm ~/.claude/commands/bitmex-*.md) without touching unrelated skills from other tools. Extend install.sh to copy skills to detected agent directories after binary install: OpenClaw (~/.openclaw/skills/), Claude Code (~/.claude/commands/ as flat .md files), Hermes (~/.hermes/skills/). Skills install is non-fatal — a download failure warns and continues. Also corrects ~80 command bugs across 29 SKILL.md files verified against the live BitMEX API. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2f8765d commit eb9f15e

43 files changed

Lines changed: 309 additions & 302 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

skills/INDEX.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,43 +88,43 @@ Multi-step workflows combining multiple skills.
8888

8989
| Skill | Description |
9090
|-------|-------------|
91-
| [recipe-start-dca-bot](./recipe-start-dca-bot/SKILL.md) | Set up and run a DCA bot from testnet validation to live. |
92-
| [recipe-launch-grid-bot](./recipe-launch-grid-bot/SKILL.md) | Deploy a grid trading bot with testnet validation. |
93-
| [recipe-trailing-stop-runner](./recipe-trailing-stop-runner/SKILL.md) | Ride a trend with a trailing stop that locks in profits on reversal. |
94-
| [recipe-basis-trade-entry](./recipe-basis-trade-entry/SKILL.md) | Enter a perp-futures basis trade when premium exceeds threshold. |
95-
| [recipe-futures-hedge-spot](./recipe-futures-hedge-spot/SKILL.md) | Hedge a long position with a short perpetual. |
96-
| [recipe-funding-rate-scan](./recipe-funding-rate-scan/SKILL.md) | Scan perpetual contracts for funding rate carry opportunities. |
97-
| [recipe-testnet-strategy-backtest](./recipe-testnet-strategy-backtest/SKILL.md) | Validate a strategy across multiple testnet sessions before going live. |
91+
| [bitmex-recipe-start-dca-bot](./bitmex-recipe-start-dca-bot/SKILL.md) | Set up and run a DCA bot from testnet validation to live. |
92+
| [bitmex-recipe-launch-grid-bot](./bitmex-recipe-launch-grid-bot/SKILL.md) | Deploy a grid trading bot with testnet validation. |
93+
| [bitmex-recipe-trailing-stop-runner](./bitmex-recipe-trailing-stop-runner/SKILL.md) | Ride a trend with a trailing stop that locks in profits on reversal. |
94+
| [bitmex-recipe-basis-trade-entry](./bitmex-recipe-basis-trade-entry/SKILL.md) | Enter a perp-futures basis trade when premium exceeds threshold. |
95+
| [bitmex-recipe-futures-hedge-spot](./bitmex-recipe-futures-hedge-spot/SKILL.md) | Hedge a long position with a short perpetual. |
96+
| [bitmex-recipe-funding-rate-scan](./bitmex-recipe-funding-rate-scan/SKILL.md) | Scan perpetual contracts for funding rate carry opportunities. |
97+
| [bitmex-recipe-testnet-strategy-backtest](./bitmex-recipe-testnet-strategy-backtest/SKILL.md) | Validate a strategy across multiple testnet sessions before going live. |
9898

9999
### Portfolio Recipes
100100

101101
| Skill | Description |
102102
|-------|-------------|
103-
| [recipe-weekly-rebalance](./recipe-weekly-rebalance/SKILL.md) | Weekly rebalance to maintain target position allocations. |
104-
| [recipe-daily-pnl-report](./recipe-daily-pnl-report/SKILL.md) | Daily realised P&L summary from trades and wallet history. |
105-
| [recipe-portfolio-snapshot-csv](./recipe-portfolio-snapshot-csv/SKILL.md) | Export portfolio snapshot with balances and positions to CSV. |
106-
| [recipe-subaccount-capital-rotation](./recipe-subaccount-capital-rotation/SKILL.md) | Rotate capital between subaccounts based on strategy performance. |
107-
| [recipe-fee-tier-progress](./recipe-fee-tier-progress/SKILL.md) | Track trading volume and commission rates. |
103+
| [bitmex-recipe-weekly-rebalance](./bitmex-recipe-weekly-rebalance/SKILL.md) | Weekly rebalance to maintain target position allocations. |
104+
| [bitmex-recipe-daily-pnl-report](./bitmex-recipe-daily-pnl-report/SKILL.md) | Daily realised P&L summary from trades and wallet history. |
105+
| [bitmex-recipe-portfolio-snapshot-csv](./bitmex-recipe-portfolio-snapshot-csv/SKILL.md) | Export portfolio snapshot with balances and positions to CSV. |
106+
| [bitmex-recipe-subaccount-capital-rotation](./bitmex-recipe-subaccount-capital-rotation/SKILL.md) | Rotate capital between subaccounts based on strategy performance. |
107+
| [bitmex-recipe-fee-tier-progress](./bitmex-recipe-fee-tier-progress/SKILL.md) | Track trading volume and commission rates. |
108108

109109
### Market Data Recipes
110110

111111
| Skill | Description |
112112
|-------|-------------|
113-
| [recipe-morning-market-brief](./recipe-morning-market-brief/SKILL.md) | Morning summary: prices, funding, positions, and wallet. |
114-
| [recipe-multi-pair-breakout-watch](./recipe-multi-pair-breakout-watch/SKILL.md) | Monitor multiple symbols for price breakouts. |
115-
| [recipe-track-orderbook-depth](./recipe-track-orderbook-depth/SKILL.md) | Monitor order book depth and bid-ask imbalance for liquidity signals. |
116-
| [recipe-price-level-alerts](./recipe-price-level-alerts/SKILL.md) | Set up price level alerts for key levels. |
113+
| [bitmex-recipe-morning-market-brief](./bitmex-recipe-morning-market-brief/SKILL.md) | Morning summary: prices, funding, positions, and wallet. |
114+
| [bitmex-recipe-multi-pair-breakout-watch](./bitmex-recipe-multi-pair-breakout-watch/SKILL.md) | Monitor multiple symbols for price breakouts. |
115+
| [bitmex-recipe-track-orderbook-depth](./bitmex-recipe-track-orderbook-depth/SKILL.md) | Monitor order book depth and bid-ask imbalance for liquidity signals. |
116+
| [bitmex-recipe-price-level-alerts](./bitmex-recipe-price-level-alerts/SKILL.md) | Set up price level alerts for key levels. |
117117

118118
### Risk Recipes
119119

120120
| Skill | Description |
121121
|-------|-------------|
122-
| [recipe-emergency-flatten](./recipe-emergency-flatten/SKILL.md) | Cancel all orders and close all positions immediately. |
123-
| [recipe-drawdown-circuit-breaker](./recipe-drawdown-circuit-breaker/SKILL.md) | Halt trading when portfolio drawdown exceeds threshold. |
122+
| [bitmex-recipe-emergency-flatten](./bitmex-recipe-emergency-flatten/SKILL.md) | Cancel all orders and close all positions immediately. |
123+
| [bitmex-recipe-drawdown-circuit-breaker](./bitmex-recipe-drawdown-circuit-breaker/SKILL.md) | Halt trading when portfolio drawdown exceeds threshold. |
124124

125125
### Funding Recipes
126126

127127
| Skill | Description |
128128
|-------|-------------|
129-
| [recipe-withdrawal-to-cold-storage](./recipe-withdrawal-to-cold-storage/SKILL.md) | Safely withdraw funds to a pre-approved cold storage address. |
130-
| [recipe-staking-yield-compare](./recipe-staking-yield-compare/SKILL.md) | Compare staking yields across instruments to find the best rate. |
129+
| [bitmex-recipe-withdrawal-to-cold-storage](./bitmex-recipe-withdrawal-to-cold-storage/SKILL.md) | Safely withdraw funds to a pre-approved cold storage address. |
130+
| [bitmex-recipe-staking-yield-compare](./bitmex-recipe-staking-yield-compare/SKILL.md) | Compare staking yields across instruments to find the best rate. |

skills/bitmex-basis-trading/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ A positive basis (futures above perp) typically reflects cost-of-carry. The stra
2727
```bash
2828
# Perpetual
2929
PERP=$(bitmex market instrument --symbol XBTUSD -o json 2>/dev/null | \
30-
jq -r '.lastPrice')
30+
jq -r '.[0].lastPrice')
3131

3232
# Nearest quarterly future (example: XBTM25)
3333
FUT=$(bitmex market instrument --symbol XBTM25 -o json 2>/dev/null | \
34-
jq -r '.lastPrice')
34+
jq -r '.[0].lastPrice')
3535

3636
echo "Perp: $PERP | Future: $FUT"
3737
```
@@ -44,7 +44,7 @@ echo "Basis: ${BASIS}%"
4444

4545
# Days to expiry for annualized estimate
4646
SETTLE=$(bitmex market instrument --symbol XBTM25 -o json 2>/dev/null | \
47-
jq -r '.settle')
47+
jq -r '.[0].settle')
4848
echo "Settlement: $SETTLE"
4949
```
5050

@@ -86,8 +86,8 @@ bitmex order sell XBTM25 $QTY --price "$FUT" \
8686

8787
```bash
8888
# Check current basis
89-
PERP_NOW=$(bitmex market instrument --symbol XBTUSD -o json 2>/dev/null | jq -r '.lastPrice')
90-
FUT_NOW=$(bitmex market instrument --symbol XBTM25 -o json 2>/dev/null | jq -r '.lastPrice')
89+
PERP_NOW=$(bitmex market instrument --symbol XBTUSD -o json 2>/dev/null | jq -r '.[0].lastPrice')
90+
FUT_NOW=$(bitmex market instrument --symbol XBTM25 -o json 2>/dev/null | jq -r '.[0].lastPrice')
9191
BASIS_NOW=$(echo "scale=6; ($FUT_NOW - $PERP_NOW) / $PERP_NOW * 100" | bc -l)
9292
echo "Current basis: ${BASIS_NOW}%"
9393

skills/bitmex-dca-strategy/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export BITMEX_API_SECRET="testnet-secret"
3535
# Run 3 testnet cycles to verify logic
3636
for i in 1 2 3; do
3737
PRICE=$(bitmex --testnet market orderbook XBTUSD --depth 1 -o json 2>/dev/null | \
38-
jq '.bids[0][0]')
38+
jq '[.[] | select(.side == "Buy")] | .[0].price')
3939
bitmex --testnet order buy XBTUSD 100 --price "$PRICE" \
4040
--order-type Limit --exec-inst ParticipateDoNotInitiate \
4141
-o json 2>/dev/null | jq '{orderID, price, ordStatus}'
@@ -72,7 +72,7 @@ while true; do
7272

7373
# 3. Place limit order at best bid
7474
BID=$(bitmex market orderbook $SYMBOL --depth 1 -o json 2>/dev/null | \
75-
jq '.bids[0][0]')
75+
jq '[.[] | select(.side == "Buy")] | .[0].price')
7676
echo "DCA buy $QTY $SYMBOL @ $BID"
7777
bitmex order buy $SYMBOL $QTY \
7878
--price "$BID" \

skills/bitmex-fee-optimization/SKILL.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ BitMEX charges taker fees and pays maker rebates. The difference is meaningful a
2121
| Maker | Rebate | You earn (negative fee) |
2222
| Taker | Fee | You pay |
2323

24-
Check your current fee schedule:
24+
Check your current fee schedule (returns a map of symbol → fees):
2525

2626
```bash
27+
# All symbols
28+
bitmex account commission -o json 2>/dev/null
29+
30+
# Single symbol
2731
bitmex account commission -o json 2>/dev/null | \
28-
jq '{makerFee, takerFee, settlementFee}'
32+
jq '.XBTUSD | {makerFee, takerFee, settlementFee}'
2933
```
3034

3135
## Default: Post-Only Limit Orders
@@ -60,7 +64,7 @@ Market orders always pay taker fees. Use limit orders at aggressive prices (insi
6064

6165
```bash
6266
# Instead of market buy, use aggressive limit:
63-
ASK=$(bitmex market orderbook XBTUSD --depth 1 -o json 2>/dev/null | jq '.asks[0][0]')
67+
ASK=$(bitmex market orderbook XBTUSD --depth 1 -o json 2>/dev/null | jq '[.[] | select(.side=="Sell") | .price][0]')
6468
bitmex order buy XBTUSD 100 \
6569
--price "$ASK" \
6670
--order-type Limit \
@@ -85,12 +89,12 @@ bitmex order buy XBTUSD 100 \
8589
Higher 30-day trading volume unlocks lower fees:
8690

8791
```bash
88-
# Check your 30-day volume
92+
# Check your 30-day volume (returns array; first element has the totals)
8993
bitmex account volume -o json 2>/dev/null | \
90-
jq '{advUsd, advXBt}'
94+
jq '.[0] | {advUsd, advUsdContract, advUsdSpot}'
9195

92-
# Cross-reference with commission tiers
93-
bitmex account commission -o json 2>/dev/null
96+
# Cross-reference with commission tiers (returns map of symbol → fees)
97+
bitmex account commission -o json 2>/dev/null | jq '.XBTUSD'
9498
```
9599

96100
## Fee Audit from Trade History

skills/bitmex-funding-carry/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Only enter if the annualized yield exceeds transaction costs and risk premium. A
4444

4545
```bash
4646
# Annualized carry threshold check (e.g., > 10% annualized)
47-
RATE=$(bitmex market funding --symbol XBTUSD -o json 2>/dev/null | \
47+
RATE=$(bitmex market funding --symbol XBTUSD --count 1 --reverse -o json 2>/dev/null | \
4848
jq -r '.[0].fundingRate // 0')
4949
ANNUALIZED=$(echo "$RATE * 3 * 365 * 100" | bc -l)
5050
echo "Annualized funding yield: ${ANNUALIZED}%"
@@ -101,7 +101,7 @@ bitmex position list --symbol XBTUSD -o json 2>/dev/null | \
101101

102102
```bash
103103
# Check if rate has converged toward zero
104-
RATE=$(bitmex market funding --symbol XBTUSD -o json 2>/dev/null | \
104+
RATE=$(bitmex market funding --symbol XBTUSD --count 1 --reverse -o json 2>/dev/null | \
105105
jq -r '.[0].fundingRate // 0')
106106
EXIT_THRESHOLD=0.0001 # < 0.01% per 8h no longer worth holding
107107

skills/bitmex-grid-trading/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ FLAG="--testnet"
3636

3737
# Verify connectivity
3838
bitmex $FLAG market instrument --symbol XBTUSD -o json 2>/dev/null | \
39-
jq '{symbol, lastPrice}'
39+
jq '.[0] | {symbol, lastPrice}'
4040
```
4141

4242
## Calculate Grid Levels
@@ -61,7 +61,7 @@ done
6161
## Place Grid Orders
6262

6363
```bash
64-
CURRENT=$(bitmex market instrument --symbol $SYMBOL -o json 2>/dev/null | jq -r '.lastPrice')
64+
CURRENT=$(bitmex market instrument --symbol $SYMBOL -o json 2>/dev/null | jq -r '.[0].lastPrice')
6565

6666
for i in $(seq 0 $((GRID_COUNT - 1))); do
6767
LEVEL=$(echo "$GRID_LOW + $STEP * $i" | bc)

skills/bitmex-liquidation-guard/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bitmex account margin --currency XBt -o json 2>/dev/null | jq '
2121
{
2222
marginBalance,
2323
availableMargin,
24-
maintenanceMargin,
24+
maintMargin,
2525
health_pct: ((.availableMargin / .marginBalance * 100) | round / 100)
2626
}
2727
'

skills/bitmex-market-intel/SKILL.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Retrieve contract specifications, mark price, open interest, and 24h volume.
2121
```bash
2222
# Single instrument
2323
bitmex market instrument --symbol XBTUSD -o json 2>/dev/null | \
24-
jq '{symbol, lastPrice, markPrice, openInterest, volume24h: .volume}'
24+
jq '.[0] | {symbol, lastPrice, markPrice, openInterest, volume24h: .volume}'
2525

2626
# All active instruments
2727
bitmex market instrument --active -o json 2>/dev/null | \
@@ -35,16 +35,16 @@ bitmex market instrument --indices -o json 2>/dev/null | \
3535
## Order Book
3636

3737
```bash
38-
# Top 25 levels (default)
38+
# Top 25 levels (default) — response is a flat array of {side, price, size}
3939
bitmex market orderbook XBTUSD -o json 2>/dev/null | \
40-
jq '{bids: .bids[:5], asks: .asks[:5]}'
40+
jq '{bids: [.[] | select(.side=="Buy") | [.price,.size]][:5], asks: [.[] | select(.side=="Sell") | [.price,.size]][:5]}'
4141

4242
# Top 5 levels
4343
bitmex market orderbook XBTUSD --depth 5 -o json 2>/dev/null
4444

4545
# Mid price calculation
4646
bitmex market orderbook XBTUSD --depth 1 -o json 2>/dev/null | \
47-
jq '(.bids[0][0] + .asks[0][0]) / 2'
47+
jq '([.[] | select(.side=="Buy") | .price][0] + [.[] | select(.side=="Sell") | .price][0]) / 2'
4848
```
4949

5050
## Recent Trades
@@ -68,7 +68,7 @@ bitmex market trades --symbol XBTUSD --bucketed --bin-size 5m -o json 2>/dev/nul
6868
```bash
6969
# Current best bid/ask
7070
bitmex market quote --symbol XBTUSD -o json 2>/dev/null | \
71-
jq '{bidPrice, bidSize, askPrice, askSize}'
71+
jq '.[0] | {bidPrice, bidSize, askPrice, askSize}'
7272

7373
# Bucketed quote history
7474
bitmex market quote --symbol XBTUSD --bucketed --bin-size 1h -o json 2>/dev/null
@@ -81,7 +81,7 @@ Perpetual contracts pay or receive funding every 8 hours (00:00, 08:00, 16:00 UT
8181
```bash
8282
# Current funding rate
8383
bitmex market funding --symbol XBTUSD -o json 2>/dev/null | \
84-
jq '{symbol, fundingRate, fundingRateDaily: (.fundingRate * 3), nextFundingTime}'
84+
jq '.[0] | {symbol, fundingRate, fundingRateDaily: (.fundingRate * 3), timestamp}'
8585

8686
# Funding history (last 10 periods)
8787
bitmex market funding --symbol XBTUSD --count 10 --reverse -o json 2>/dev/null | \
@@ -101,7 +101,7 @@ bitmex market liquidation --symbol XBTUSD -o json 2>/dev/null | \
101101
```bash
102102
# Upcoming and past settlements
103103
bitmex market settlement --symbol XBTM25 -o json 2>/dev/null | \
104-
jq '{settlDate, settledPrice}'
104+
jq '.[0] | {timestamp, settledPrice}'
105105
```
106106

107107
## Insurance Fund
@@ -125,6 +125,6 @@ bitmex market stats -o json 2>/dev/null | \
125125
# Top traders by notional
126126
bitmex market leaderboard --method notional -o json 2>/dev/null | jq '.[0:5]'
127127

128-
# Top traders by ROE
129-
bitmex market leaderboard --method roe -o json 2>/dev/null | jq '.[0:5]'
128+
# Top traders by ROE (not supported on mainnet — omit or use --method notional)
129+
# bitmex market leaderboard --method roe -o json 2>/dev/null | jq '.[0:5]'
130130
```

skills/bitmex-mcp-integration/SKILL.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,18 @@ MCP tools follow the pattern `bitmex_<group>_<subcommand>`:
115115
## Verifying the MCP Server
116116

117117
```bash
118-
# List available tools
119-
bitmex mcp --list-tools 2>/dev/null
120-
121-
# Test a single tool call
122-
bitmex mcp --call bitmex_market_instrument '{"symbol":"XBTUSD"}' 2>/dev/null
118+
# Start the MCP server in stdio mode and confirm it launches without error
119+
bitmex mcp -s market,account 2>/dev/null &
120+
MCP_PID=$!
121+
sleep 1
122+
kill $MCP_PID 2>/dev/null
123+
124+
# To test a tool call, connect via an MCP client (e.g. Claude Desktop) or use the --port HTTP mode:
125+
# bitmex mcp --port 3000 --token mytoken -s market,account &
126+
# curl -s -H "Authorization: Bearer mytoken" \
127+
# -H "Content-Type: application/json" \
128+
# -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"bitmex_market_instrument","arguments":{"symbol":"XBTUSD"}}}' \
129+
# http://localhost:3000/mcp
123130
```
124131

125132
## System Prompt Guidance

skills/bitmex-multi-pair/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ When you need per-symbol data not available in bulk (e.g., order book):
7070
SYMBOLS=("XBTUSD" "ETHUSD" "SOLUSD")
7171
for SYM in "${SYMBOLS[@]}"; do
7272
DEPTH=$(bitmex market orderbook "$SYM" --depth 1 -o json 2>/dev/null | \
73-
jq '{symbol: .symbol, spread: (.asks[0][0] - .bids[0][0])}')
73+
jq '{symbol: .[0].symbol, spread: (([.[] | select(.side == "Sell")] | .[0].price) - ([.[] | select(.side == "Buy")] | .[0].price))}')
7474
echo "$DEPTH"
7575
sleep 1 # stay within 300 req/5min budget
7676
done

0 commit comments

Comments
 (0)