원클릭으로
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 직업 분류 기준
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.
| 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}]'