一键导入
bitmex-recipe-start-dca-bot
Set up and run a DCA bot from testnet validation to live.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Set up and run a DCA bot from testnet validation to live.
用 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-start-dca-bot |
| description | Set up and run a DCA bot from testnet validation to live. |
Dollar-cost average into a position by placing limit buy orders at a fixed discount to the current market price on a recurring schedule.
Always validate on testnet first: prefix commands with bitmex --testnet until the strategy behaves as expected.
BITMEX_API_KEY and BITMEX_API_SECRET set for live.jq and bc installed.SYMBOL, DCA_QTY, DISCOUNT_PCT, MAX_QTY, INTERVAL_SECONDS.# Get current mid price on testnet
MID=$(bitmex --testnet market instrument --symbol XBTUSD -o json \
| jq '.[0].lastPrice')
BID=$(echo "scale=0; $MID * (1 - 0.005) / 1" | bc)
bitmex --testnet order buy XBTUSD 10 --order-type Limit \
--price $BID --validate -o json
Run 3–5 test sessions on testnet. Confirm fills appear in:
bitmex --testnet execution trade-history --count 10 -o json
Start at 10% of intended quantity:
DCA_QTY=10 # full size would be 100
DISCOUNT_PCT=0.5
MAX_QTY=500
while true; do
# Check current position
CURRENT_QTY=$(bitmex position list -o json \
| jq '[.[] | select(.symbol == "XBTUSD")] | .[0].currentQty // 0')
if (( $(echo "$CURRENT_QTY >= $MAX_QTY" | bc -l) )); then
echo "Max position $MAX_QTY reached, pausing DCA"
sleep $INTERVAL_SECONDS
continue
fi
# Check available margin
MARGIN=$(bitmex account margin -o json | jq '.availableMargin')
if (( $(echo "$MARGIN < 1000000" | bc -l) )); then
echo "Low margin, halting DCA"
exit 1
fi
# Place limit buy
MID=$(bitmex market instrument --symbol XBTUSD -o json | jq '.[0].lastPrice')
BID=$(echo "scale=0; $MID * (1 - $DISCOUNT_PCT / 100) / 1" | bc)
bitmex order buy XBTUSD $DCA_QTY --order-type Limit --price $BID --yes -o json \
| jq '{orderID, price, orderQty}'
sleep $INTERVAL_SECONDS
done
MAX_QTY prevents runaway accumulation.recipe-drawdown-circuit-breaker) before each iteration.