ワンクリックで
bitmex-recipe-portfolio-snapshot-csv
Export portfolio snapshot with balances and positions to CSV.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Export portfolio snapshot with balances and positions to CSV.
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-portfolio-snapshot-csv |
| description | Export portfolio snapshot with balances and positions to CSV. |
Export a timestamped CSV of wallet balances and open positions for record-keeping, audit, or external analysis.
BITMEX_API_KEY and BITMEX_API_SECRET set.jq installed.TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
OUTDIR="$HOME/bitmex-snapshots"
mkdir -p "$OUTDIR"
WALLET_CSV="$OUTDIR/wallet_${TIMESTAMP}.csv"
POSITIONS_CSV="$OUTDIR/positions_${TIMESTAMP}.csv"
COMBINED_CSV="$OUTDIR/snapshot_${TIMESTAMP}.csv"
# wallet balance returns a single object (not array); use account margin for walletBalance/availableMargin
echo "timestamp,currency,amount,walletBalance,availableMargin,marginBalance" > "$WALLET_CSV"
MARGIN=$(bitmex account margin --currency XBt -o json 2>/dev/null)
bitmex wallet balance --currency XBt -o json 2>/dev/null \
| jq -r --arg ts "$TIMESTAMP" \
--argjson m "$MARGIN" \
'[$ts, .currency, (.amount|tostring),
($m.walletBalance|tostring),
($m.availableMargin|tostring),
($m.marginBalance|tostring)] | @csv' \
>> "$WALLET_CSV"
echo "timestamp,symbol,currentQty,avgEntryPrice,markPrice,unrealisedPnl,liquidationPrice,leverage" \
> "$POSITIONS_CSV"
bitmex position list -o json \
| jq -r --arg ts "$TIMESTAMP" \
'.[] | [$ts, .symbol, (.currentQty|tostring), (.avgEntryPrice|tostring),
(.markPrice|tostring), (.unrealisedPnl|tostring),
(.liquidationPrice|tostring), (.leverage|tostring)] | @csv' \
>> "$POSITIONS_CSV"
{
echo "=== WALLET ==="
cat "$WALLET_CSV"
echo ""
echo "=== POSITIONS ==="
cat "$POSITIONS_CSV"
} > "$COMBINED_CSV"
echo "Snapshot saved: $COMBINED_CSV"
DAILY="$OUTDIR/daily_$(date -u +%Y-%m-%d).csv"
cat "$POSITIONS_CSV" >> "$DAILY"
0 * * * * /path/to/snapshot.sh.100000000 in your spreadsheet for XBT.