一键导入
bitmex-recipe-weekly-rebalance
Weekly rebalance to maintain target position allocations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Weekly rebalance to maintain target position allocations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | bitmex-recipe-weekly-rebalance |
| description | Weekly rebalance to maintain target position allocations. |
Each week, compare your actual position sizes against target allocations and place orders to bring them back in line.
Always validate on testnet first: prefix commands with bitmex --testnet until the strategy behaves as expected.
BITMEX_API_KEY and BITMEX_API_SECRET set.jq and bc installed.bitmex position list -o json \
| jq '[.[] | {symbol, currentQty, markValue, unrealisedPnl}]'
WALLET=$(bitmex wallet balance -o json | jq '.amount')
echo "Total wallet: $WALLET satoshis"
Example: 60% XBTUSD, 25% ETHUSD, 15% SOLUSDT of total notional:
XBTUSD_MARK=$(bitmex market instrument --symbol XBTUSD -o json | jq '.[0].markPrice')
ETHUSD_MARK=$(bitmex market instrument --symbol ETHUSD -o json | jq '.[0].markPrice')
# Convert wallet from satoshis to USD equivalent
WALLET_USD=$(echo "scale=2; $WALLET / 100000000 * $XBTUSD_MARK" | bc)
TARGET_XBTUSD=$(echo "scale=0; $WALLET_USD * 0.60 / 1" | bc)
TARGET_ETHUSD=$(echo "scale=0; $WALLET_USD * 0.25 / 1" | bc)
CURRENT_XBTUSD=$(bitmex position list -o json \
| jq '[.[] | select(.symbol == "XBTUSD")] | .[0].currentQty // 0')
DELTA=$(echo "$TARGET_XBTUSD - $CURRENT_XBTUSD" | bc)
echo "XBTUSD drift: $DELTA contracts"
# If delta is positive, buy the difference; if negative, sell
if (( $(echo "$DELTA > 0" | bc -l) )); then
bitmex order buy XBTUSD $(echo "$DELTA" | xargs printf "%.0f") \
--order-type Limit --price $(echo "$XBTUSD_MARK * 1.0001" | bc | xargs printf "%.0f") \
--validate -o json
elif (( $(echo "$DELTA < 0" | bc -l) )); then
bitmex order sell XBTUSD $(echo "-1 * $DELTA" | bc | xargs printf "%.0f") \
--order-type Limit --price $(echo "$XBTUSD_MARK * 0.9999" | bc | xargs printf "%.0f") \
--validate -o json
fi
Replace --validate with --yes after reviewing the output.
bitmex position list -o json \
| jq '[.[] | {symbol, currentQty, markValue}]'
Price, funding, liquidation, and balance alerts using polling and WebSocket on bitmex-cli.
Autonomy progression for bitmex-cli agents: from read-only market data to autonomous fund management.
Delta-neutral basis trading between BitMEX perpetuals and fixed-date futures: entry, monitoring, and exit.
Dollar cost averaging on bitmex-cli: testnet-first, fixed qty per interval, limit orders, and position cap enforcement.
Error category handling, duplicate order prevention, retry logic, and partial fill management for bitmex-cli.
Minimize trading fees on bitmex-cli: maker vs taker, post-only orders, commission tiers, and fee audit.